netsurf-all-3.2/0000755000175000017500000000000012377713350012614 5ustar vincevincenetsurf-all-3.2/nsgenbind/0000755000175000017500000000000012377713350014563 5ustar vincevincenetsurf-all-3.2/nsgenbind/doc/0000755000175000017500000000000012377713350015330 5ustar vincevincenetsurf-all-3.2/nsgenbind/doc/example.bnd0000644000175000017500000002032012377677044017456 0ustar vincevince/* Example binding to generate Example interface * * The js_libdom (javascript to libdom) binding type is currently the * only one implemented and this principly describes that binding. * * Copyright 2012 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * Released under the terms of the MIT License, * http://www.opensource.org/licenses/mit-license */ /* directive to read WebIDL file and add its contents to the webidl AST */ webidlfile "html.idl"; /* The hdrcomment are added into the geenrated output comment header */ hdrcomment "Copyright 2012 Vincent Sanders "; hdrcomment "This file is part of NetSurf, http://www.netsurf-browser.org/"; hdrcomment "Released under the terms of the MIT License,"; hdrcomment " http://www.opensource.org/licenses/mit-license"; /* the preamble block is copied verbatum into the generated output * * This can be used for includes, comments or whatever else is desired */ preamble %{ #include #include "utils/config.h" #include "utils/log.h" #include "javascript/jsapi.h" #include "javascript/jsapi/binding.h" %} /* code block emitted immediately before the binding function bodies */ prologue %{ %} /* code block emmitted at the end of the output */ epilogue %{ %} /* additional binding fragments may be included * Note: this is not preprocessed despite the #include name, the * parser will simply switch input to the included file and carry on * cosntructing the bindings Abstract Syntax Tree (AST) */ #include "dom.bnd" /* this block describes the binding to be generated * * Depending on the type of binding being generated multiple blocks * may be allowed. * * Note: the js_libdom (javascript to libdom) binding as currently * implemented only allows for a single binding per file, this may * be improved in future. */ binding example { type js_libdom; /* the binding type */ interface Navigator; /* The WebIDL interface to generate a binding for */ /* private members: * - stored in private context structure. * - passed as parameters to constructor and stored automatically. * - are *not* considered for property getters/setters. */ private "dom_document *" node; /* internal members: * - value stored in private context structure * - not passed to constructor * - must be instantiated by constructor * - are considered for property getters/setters. */ internal "void *" fluff; /* property handler specifiers: * - (un)shared flag allows control of the properties JSAPI shared state. * The default for all unnamed properties on the interface * is shared without a type handler. * - type flag allows a set of properties whose type matches the * identifier to be handled by the same callback function. */ property shared bar; /* the default - a noop */ property shared type EventHandler; property unshared foo; property unshared type WindowProxy; } /* operation implementation code. * * The body is copied verbatum into operation binding * * several values are generated automatically: * * - The generated operations use a macro to create a JSNative JSAPI * callback. The interface allows a uniform interface despite the * evolution of the interface over differing spidermonkey versions. * * - The above implies the javascript context is in a variable called cx * * - If private or internal binding members are present they may be * accessed through a structure named "private" * * - if there are arguemnts they may be accesed via an argc/argv jsval * vector. * * - Arguments are automatically converted into c variables (named as * per the WebIDL names. * * - Return values (excepting void return types where its omitted) are * always named "retval" and are of the appropriate c type. The * initial value is set appropriately. */ operation foo %{ retval = JS_NewStringCopyN(cx, "foo", SLEN("foo")); %} /* property getter implementation code. * * The body is copied verbatum into property getter binding * * several values are generated automatically: * * - The generated operations use a macro to create a JSPropertyOp * JSAPI callback. The interface allows a uniform interface despite * the evolution of the interface over differing spidermonkey * versions. * * - The above implies the javascript context is available in a * variable called "cx". * * - If private or internal binding members are present they may be * accessed through a structure named "private" * * - Return values (void on a getter is not possible) are always named * "retval" and are of the appropriate c type. The initial value is * set appropriately. * * - If the getter is omitted altogether but an internal or private * value of the same name appears in the private structure a getter * is automatically constructed to return that value. */ getter bar %{ retval = JS_NewStringCopyN(cx, "bar", SLEN("bar")); %} /* property setter implementation code. * * The body is copied verbatum into property getter binding * * several values are generated automatically: * * - The generated operations use a macro to create a JSPropertyOp * JSAPI callback. The interface allows a uniform interface despite * the evolution of the interface over differing spidermonkey * versions. * * - The above implies the javascript context is available in a * variable called "cx". * * - If private or internal binding members are present they may be * accessed through a structure named "private" * * - Value to set is placed in a c variable named "setval" of the * appropriate type. * * - Return value, named retval" is a boolean (default true) which * indicates if the set was performed. * * - If the setter is omitted altogether but an internal or private * value of the same name appears in the private structure a setter * is automatically constructed to assign that value. */ setter baz %{ printf("%s\n", setval); %} /* implementation of the class initilisation * * This allows the default JS_InitClass to be overriden - currently * only used for the window (global) object to cause all the other class * initialisors to be called. * * function prototype is: * JSObject *jsapi_InitClass_HTMLElement(JSContext *cx, JSObject *parent) */ api init %{ %} /* implementation of the c instance creation * * This allows the overriding of the construction of an interface instance. * * The body is copied verbatum and must return the new object in the * "newobject" variable. * * The base prototype is * JSObject *jsapi_new_HTMLElement(JSContext *cx, JSObject *prototype, JSObject *parent, ...) * The varadic elements are private variables as specified in the binding * * If there are private or internal values the private struct is * constructed and instantiated. The struct is available during the * new function and is automatically attached as the private value to * the object. * * The default implemenattion simply calls JS_NewObject() * * Note this does *not* rely upon (or even call) the instances * javascript constructor allowing the c code to create objects that * cannot be instantiated from javascript. * */ api new %{ %} /* additional code in the instance finalise operation. * * The body is copied verbatim into the output * * Prototype is * void jsclass_finalize(JSContext *cx, JSObject *obj) * * private is available (if appropriate) and freed after the body */ api finalise %{ %} /* resolver code * * A resolver is only generated if this api is provided. This is a * JSResolveOp with JSCLASS_NEW_RESOLVE specified and must provide a * complete implementation. * * The body is copied verbatim into the output * * Prototype is: * JSBool jsclass_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp) * * By default returns JS_TRUE implying that *objp has been updated * * The minimal implementation would be "*objp = NULL;" but is * equivalent to simply omitting this directive and using the defaul stub. */ api resolve %{ %} /* mark the generated interface as a a global object * * The body is discarded. */ api global %{ %} netsurf-all-3.2/nsgenbind/test/0000755000175000017500000000000012377713350015542 5ustar vincevincenetsurf-all-3.2/nsgenbind/test/data/0000755000175000017500000000000012377713350016453 5ustar vincevincenetsurf-all-3.2/nsgenbind/test/data/idl/0000755000175000017500000000000012377713350017223 5ustar vincevincenetsurf-all-3.2/nsgenbind/test/data/idl/document.idl0000644000175000017500000000277312377677044021555 0ustar vincevinceinterface Document : Node { readonly attribute DOMImplementation implementation; readonly attribute DOMString URL; readonly attribute DOMString documentURI; readonly attribute DOMString compatMode; readonly attribute DOMString characterSet; readonly attribute DOMString contentType; readonly attribute DocumentType? doctype; readonly attribute Element? documentElement; HTMLCollection getElementsByTagName(DOMString localName); HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); Element? getElementById(DOMString elementId); Element createElement(DOMString localName); Element createElementNS(DOMString? namespace, DOMString qualifiedName); DocumentFragment createDocumentFragment(); Text createTextNode(DOMString data); Comment createComment(DOMString data); ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); Node importNode(Node node, optional boolean deep = true); Node adoptNode(Node node); Event createEvent(DOMString interface); Range createRange(); // NodeFilter.SHOW_ALL = 0xFFFFFFFF NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); // NEW void prepend((Node or DOMString)... nodes); void append((Node or DOMString)... nodes); }; netsurf-all-3.2/nsgenbind/test/data/idl/dom.idl0000644000175000017500000003455712377677044020523 0ustar vincevince// DOM core WebIDL // retrived from http://dom.spec.whatwg.org/ // 23rd October 2012 exception DOMException { const unsigned short INDEX_SIZE_ERR = 1; const unsigned short DOMSTRING_SIZE_ERR = 2; // historical const unsigned short HIERARCHY_REQUEST_ERR = 3; const unsigned short WRONG_DOCUMENT_ERR = 4; const unsigned short INVALID_CHARACTER_ERR = 5; const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; const unsigned short NOT_FOUND_ERR = 8; const unsigned short NOT_SUPPORTED_ERR = 9; const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical const unsigned short INVALID_STATE_ERR = 11; const unsigned short SYNTAX_ERR = 12; const unsigned short INVALID_MODIFICATION_ERR = 13; const unsigned short NAMESPACE_ERR = 14; const unsigned short INVALID_ACCESS_ERR = 15; const unsigned short VALIDATION_ERR = 16; // historical const unsigned short TYPE_MISMATCH_ERR = 17; const unsigned short SECURITY_ERR = 18; const unsigned short NETWORK_ERR = 19; const unsigned short ABORT_ERR = 20; const unsigned short URL_MISMATCH_ERR = 21; const unsigned short QUOTA_EXCEEDED_ERR = 22; const unsigned short TIMEOUT_ERR = 23; const unsigned short INVALID_NODE_TYPE_ERR = 24; const unsigned short DATA_CLONE_ERR = 25; unsigned short code; }; interface DOMError { readonly attribute DOMString name; }; [Constructor(DOMString type, optional EventInit eventInitDict)] interface Event { readonly attribute DOMString type; readonly attribute EventTarget? target; readonly attribute EventTarget? currentTarget; const unsigned short NONE = 0; const unsigned short CAPTURING_PHASE = 1; const unsigned short AT_TARGET = 2; const unsigned short BUBBLING_PHASE = 3; readonly attribute unsigned short eventPhase; void stopPropagation(); void stopImmediatePropagation(); readonly attribute boolean bubbles; readonly attribute boolean cancelable; void preventDefault(); readonly attribute boolean defaultPrevented; readonly attribute boolean isTrusted; readonly attribute DOMTimeStamp timeStamp; void initEvent(DOMString type, boolean bubbles, boolean cancelable); }; dictionary EventInit { boolean bubbles; boolean cancelable; }; [Constructor(DOMString type, optional CustomEventInit eventInitDict)] interface CustomEvent : Event { readonly attribute any detail; }; dictionary CustomEventInit : EventInit { any detail; }; interface EventTarget { void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false); void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false); boolean dispatchEvent(Event event); }; callback interface EventListener { void handleEvent(Event event); }; [Constructor(MutationCallback callback)] interface MutationObserver { void observe(Node target, MutationObserverInit options); void disconnect(); sequence takeRecords(); }; callback MutationCallback = void (sequence mutations, MutationObserver observer); dictionary MutationObserverInit { boolean childList; boolean attributes; boolean characterData; boolean subtree; boolean attributeOldValue; boolean characterDataOldValue; sequence attributeFilter; }; interface MutationRecord { readonly attribute DOMString type; readonly attribute Node target; readonly attribute NodeList addedNodes; readonly attribute NodeList removedNodes; readonly attribute Node? previousSibling; readonly attribute Node? nextSibling; readonly attribute DOMString? attributeName; readonly attribute DOMString? attributeNamespace; readonly attribute DOMString? oldValue; }; interface Node : EventTarget { const unsigned short ELEMENT_NODE = 1; const unsigned short ATTRIBUTE_NODE = 2; // historical const unsigned short TEXT_NODE = 3; const unsigned short CDATA_SECTION_NODE = 4; // historical const unsigned short ENTITY_REFERENCE_NODE = 5; // historical const unsigned short ENTITY_NODE = 6; // historical const unsigned short PROCESSING_INSTRUCTION_NODE = 7; const unsigned short COMMENT_NODE = 8; const unsigned short DOCUMENT_NODE = 9; const unsigned short DOCUMENT_TYPE_NODE = 10; const unsigned short DOCUMENT_FRAGMENT_NODE = 11; const unsigned short NOTATION_NODE = 12; // historical readonly attribute unsigned short nodeType; readonly attribute DOMString nodeName; readonly attribute DOMString? baseURI; readonly attribute Document? ownerDocument; readonly attribute Node? parentNode; readonly attribute Element? parentElement; boolean hasChildNodes(); readonly attribute NodeList childNodes; readonly attribute Node? firstChild; readonly attribute Node? lastChild; readonly attribute Node? previousSibling; readonly attribute Node? nextSibling; attribute DOMString? nodeValue; attribute DOMString? textContent; Node insertBefore(Node node, Node? child); Node appendChild(Node node); Node replaceChild(Node node, Node child); Node removeChild(Node child); void normalize(); Node cloneNode(optional boolean deep = true); boolean isEqualNode(Node? node); const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical unsigned short compareDocumentPosition(Node other); boolean contains(Node? other); DOMString? lookupPrefix(DOMString? namespace); DOMString? lookupNamespaceURI(DOMString? prefix); boolean isDefaultNamespace(DOMString? namespace); }; [Constructor] interface Document : Node { readonly attribute DOMImplementation implementation; readonly attribute DOMString URL; readonly attribute DOMString documentURI; readonly attribute DOMString compatMode; readonly attribute DOMString characterSet; readonly attribute DOMString contentType; readonly attribute DocumentType? doctype; readonly attribute Element? documentElement; HTMLCollection getElementsByTagName(DOMString localName); HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); Element? getElementById(DOMString elementId); Element createElement(DOMString localName); Element createElementNS(DOMString? namespace, DOMString qualifiedName); DocumentFragment createDocumentFragment(); Text createTextNode(DOMString data); Comment createComment(DOMString data); ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data); Node importNode(Node node, optional boolean deep = true); Node adoptNode(Node node); Event createEvent(DOMString interface); Range createRange(); // NodeFilter.SHOW_ALL = 0xFFFFFFFF NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); // NEW void prepend((Node or DOMString)... nodes); void append((Node or DOMString)... nodes); }; interface XMLDocument : Document {}; interface DOMImplementation { DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId); XMLDocument createDocument(DOMString? namespace, [TreatNullAs=EmptyString] DOMString qualifiedName, DocumentType? doctype); Document createHTMLDocument(optional DOMString title); boolean hasFeature(DOMString feature, [TreatNullAs=EmptyString] DOMString version); }; interface DocumentFragment : Node { // NEW void prepend((Node or DOMString)... nodes); void append((Node or DOMString)... nodes); }; interface DocumentType : Node { readonly attribute DOMString name; readonly attribute DOMString publicId; readonly attribute DOMString systemId; // NEW void before((Node or DOMString)... nodes); void after((Node or DOMString)... nodes); void replace((Node or DOMString)... nodes); void remove(); }; interface Element : Node { readonly attribute DOMString? namespaceURI; readonly attribute DOMString? prefix; readonly attribute DOMString localName; readonly attribute DOMString tagName; attribute DOMString id; attribute DOMString className; readonly attribute DOMTokenList classList; readonly attribute Attr[] attributes; DOMString? getAttribute(DOMString name); DOMString? getAttributeNS(DOMString? namespace, DOMString localName); void setAttribute(DOMString name, DOMString value); void setAttributeNS(DOMString? namespace, DOMString name, DOMString value); void removeAttribute(DOMString name); void removeAttributeNS(DOMString? namespace, DOMString localName); boolean hasAttribute(DOMString name); boolean hasAttributeNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByTagName(DOMString localName); HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); readonly attribute HTMLCollection children; readonly attribute Element? firstElementChild; readonly attribute Element? lastElementChild; readonly attribute Element? previousElementSibling; readonly attribute Element? nextElementSibling; readonly attribute unsigned long childElementCount; // NEW void prepend((Node or DOMString)... nodes); void append((Node or DOMString)... nodes); void before((Node or DOMString)... nodes); void after((Node or DOMString)... nodes); void replace((Node or DOMString)... nodes); void remove(); }; interface Attr { readonly attribute DOMString name; attribute DOMString value; readonly attribute DOMString? namespaceURI; readonly attribute DOMString? prefix; readonly attribute DOMString localName; }; interface CharacterData : Node { [TreatNullAs=EmptyString] attribute DOMString data; readonly attribute unsigned long length; DOMString substringData(unsigned long offset, unsigned long count); void appendData(DOMString data); void insertData(unsigned long offset, DOMString data); void deleteData(unsigned long offset, unsigned long count); void replaceData(unsigned long offset, unsigned long count, DOMString data); // NEW void before((Node or DOMString)... nodes); void after((Node or DOMString)... nodes); void replace((Node or DOMString)... nodes); void remove(); }; interface Text : CharacterData { Text splitText(unsigned long offset); readonly attribute DOMString wholeText; }; interface ProcessingInstruction : CharacterData { readonly attribute DOMString target; }; interface Comment : CharacterData { }; interface Range { readonly attribute Node startContainer; readonly attribute unsigned long startOffset; readonly attribute Node endContainer; readonly attribute unsigned long endOffset; readonly attribute boolean collapsed; readonly attribute Node commonAncestorContainer; void setStart(Node refNode, unsigned long offset); void setEnd(Node refNode, unsigned long offset); void setStartBefore(Node refNode); void setStartAfter(Node refNode); void setEndBefore(Node refNode); void setEndAfter(Node refNode); void collapse(boolean toStart); void selectNode(Node refNode); void selectNodeContents(Node refNode); const unsigned short START_TO_START = 0; const unsigned short START_TO_END = 1; const unsigned short END_TO_END = 2; const unsigned short END_TO_START = 3; short compareBoundaryPoints(unsigned short how, Range sourceRange); void deleteContents(); DocumentFragment extractContents(); DocumentFragment cloneContents(); void insertNode(Node node); void surroundContents(Node newParent); Range cloneRange(); void detach(); boolean isPointInRange(Node node, unsigned long offset); short comparePoint(Node node, unsigned long offset); boolean intersectsNode(Node node); stringifier; }; interface NodeIterator { readonly attribute Node root; readonly attribute Node? referenceNode; readonly attribute boolean pointerBeforeReferenceNode; readonly attribute unsigned long whatToShow; readonly attribute NodeFilter? filter; Node? nextNode(); Node? previousNode(); void detach(); }; interface TreeWalker { readonly attribute Node root; readonly attribute unsigned long whatToShow; readonly attribute NodeFilter? filter; attribute Node currentNode; Node? parentNode(); Node? firstChild(); Node? lastChild(); Node? previousSibling(); Node? nextSibling(); Node? previousNode(); Node? nextNode(); }; callback interface NodeFilter { // Constants for acceptNode() const unsigned short FILTER_ACCEPT = 1; const unsigned short FILTER_REJECT = 2; const unsigned short FILTER_SKIP = 3; // Constants for whatToShow const unsigned long SHOW_ALL = 0xFFFFFFFF; const unsigned long SHOW_ELEMENT = 0x1; const unsigned long SHOW_ATTRIBUTE = 0x2; // historical const unsigned long SHOW_TEXT = 0x4; const unsigned long SHOW_CDATA_SECTION = 0x8; // historical const unsigned long SHOW_ENTITY_REFERENCE = 0x10; // historical const unsigned long SHOW_ENTITY = 0x20; // historical const unsigned long SHOW_PROCESSING_INSTRUCTION = 0x40; const unsigned long SHOW_COMMENT = 0x80; const unsigned long SHOW_DOCUMENT = 0x100; const unsigned long SHOW_DOCUMENT_TYPE = 0x200; const unsigned long SHOW_DOCUMENT_FRAGMENT = 0x400; const unsigned long SHOW_NOTATION = 0x800; // historical unsigned short acceptNode(Node node); }; [ArrayClass] interface NodeList { getter Node? item(unsigned long index); readonly attribute unsigned long length; }; interface HTMLCollection { readonly attribute unsigned long length; getter Element? item(unsigned long index); getter object? namedItem(DOMString name); // only returns Element }; [NoInterfaceObject] interface DOMStringList { readonly attribute unsigned long length; getter DOMString? item(unsigned long index); boolean contains(DOMString string); }; interface DOMTokenList { readonly attribute unsigned long length; getter DOMString? item(unsigned long index); boolean contains(DOMString token); void add(DOMString... tokens); void remove(DOMString... tokens); boolean toggle(DOMString token, optional boolean force); stringifier; }; interface DOMSettableTokenList : DOMTokenList { attribute DOMString value; }; netsurf-all-3.2/nsgenbind/test/data/idl/window.idl0000644000175000017500000001166412377677044021245 0ustar vincevince#include "eventtarget.idl" [NamedPropertiesObject] interface Window : EventTarget { // the current browsing context [Unforgeable] readonly attribute WindowProxy window; [Replaceable] readonly attribute WindowProxy self; [Unforgeable] readonly attribute Document document; attribute DOMString name; [PutForwards=href, Unforgeable] readonly attribute Location location; readonly attribute History history; [Replaceable] readonly attribute BarProp locationbar; [Replaceable] readonly attribute BarProp menubar; [Replaceable] readonly attribute BarProp personalbar; [Replaceable] readonly attribute BarProp scrollbars; [Replaceable] readonly attribute BarProp statusbar; [Replaceable] readonly attribute BarProp toolbar; attribute DOMString status; void close(); void stop(); void focus(); void blur(); // other browsing contexts [Replaceable] readonly attribute WindowProxy frames; [Replaceable] readonly attribute unsigned long length; [Unforgeable] readonly attribute WindowProxy top; attribute WindowProxy? opener; readonly attribute WindowProxy parent; readonly attribute Element? frameElement; WindowProxy open(optional DOMString url, optional DOMString target, optional DOMString features, optional boolean replace); getter WindowProxy (unsigned long index); getter object (DOMString name); // the user agent readonly attribute Navigator navigator; readonly attribute External external; readonly attribute ApplicationCache applicationCache; // user prompts void alert(DOMString message); boolean confirm(DOMString message); DOMString? prompt(DOMString message, optional DOMString default); void print(); any showModalDialog(DOMString url, optional any argument); // cross-document messaging void postMessage(any message, DOMString targetOrigin, optional sequence transfer); // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onafterprint; attribute EventHandler onbeforeprint; attribute EventHandler onbeforeunload; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler onhashchange; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmessage; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onoffline; attribute EventHandler ononline; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onpagehide; attribute EventHandler onpageshow; attribute EventHandler onpopstate; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onresize; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onstorage; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onunload; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; }; netsurf-all-3.2/nsgenbind/test/data/idl/htmldocument.idl0000644000175000017500000001102112377677044022424 0ustar vincevince[OverrideBuiltins] partial interface Document { // resource metadata management [PutForwards=href] readonly attribute Location? location; attribute DOMString domain; readonly attribute DOMString referrer; attribute DOMString cookie; readonly attribute DOMString lastModified; readonly attribute DOMString readyState; // DOM tree accessors getter object (DOMString name); attribute DOMString title; attribute DOMString dir; attribute HTMLElement? body; readonly attribute HTMLHeadElement? head; readonly attribute HTMLCollection images; readonly attribute HTMLCollection embeds; readonly attribute HTMLCollection plugins; readonly attribute HTMLCollection links; readonly attribute HTMLCollection forms; readonly attribute HTMLCollection scripts; NodeList getElementsByName(DOMString elementName); NodeList getItems(optional DOMString typeNames); // microdata readonly attribute DOMElementMap cssElementMap; // dynamic markup insertion Document open(optional DOMString type, optional DOMString replace); WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace); void close(); void write(DOMString... text); void writeln(DOMString... text); // user interaction readonly attribute WindowProxy? defaultView; readonly attribute Element? activeElement; boolean hasFocus(); attribute DOMString designMode; boolean execCommand(DOMString commandId); boolean execCommand(DOMString commandId, boolean showUI); boolean execCommand(DOMString commandId, boolean showUI, DOMString value); boolean queryCommandEnabled(DOMString commandId); boolean queryCommandIndeterm(DOMString commandId); boolean queryCommandState(DOMString commandId); boolean queryCommandSupported(DOMString commandId); DOMString queryCommandValue(DOMString commandId); readonly attribute HTMLCollection commands; // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; // special event handler IDL attributes that only apply to Document objects [LenientThis] attribute EventHandler onreadystatechange; }; netsurf-all-3.2/nsgenbind/test/data/idl/blank.idl0000644000175000017500000000007012377677044021012 0ustar vincevince netsurf-all-3.2/nsgenbind/test/data/idl/empty.idl0000644000175000017500000000000012377677044021052 0ustar vincevincenetsurf-all-3.2/nsgenbind/test/data/idl/node.idl0000644000175000017500000000407612377677044020662 0ustar vincevinceinterface Node : EventTarget { const unsigned short ELEMENT_NODE = 1; const unsigned short ATTRIBUTE_NODE = 2; // historical const unsigned short TEXT_NODE = 3; const unsigned short CDATA_SECTION_NODE = 4; // historical const unsigned short ENTITY_REFERENCE_NODE = 5; // historical const unsigned short ENTITY_NODE = 6; // historical const unsigned short PROCESSING_INSTRUCTION_NODE = 7; const unsigned short COMMENT_NODE = 8; const unsigned short DOCUMENT_NODE = 9; const unsigned short DOCUMENT_TYPE_NODE = 10; const unsigned short DOCUMENT_FRAGMENT_NODE = 11; const unsigned short NOTATION_NODE = 12; // historical readonly attribute unsigned short nodeType; readonly attribute DOMString nodeName; readonly attribute DOMString? baseURI; readonly attribute Document? ownerDocument; readonly attribute Node? parentNode; readonly attribute Element? parentElement; boolean hasChildNodes(); readonly attribute NodeList childNodes; readonly attribute Node? firstChild; readonly attribute Node? lastChild; readonly attribute Node? previousSibling; readonly attribute Node? nextSibling; const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02; const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04; const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08; const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10; const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; // historical unsigned short compareDocumentPosition(Node other); boolean contains(Node? other); attribute DOMString? nodeValue; attribute DOMString? textContent; Node insertBefore(Node node, Node? child); Node appendChild(Node node); Node replaceChild(Node node, Node child); Node removeChild(Node child); void normalize(); Node cloneNode(optional boolean deep = true); boolean isEqualNode(Node? node); DOMString lookupPrefix(DOMString? namespace); DOMString lookupNamespaceURI(DOMString? prefix); boolean isDefaultNamespace(DOMString? namespace); }; netsurf-all-3.2/nsgenbind/test/data/idl/html.idl0000644000175000017500000022150612377677044020700 0ustar vincevince// HTML WebIDL // retrived from http://www.whatwg.org/specs/web-apps/current-work/ // 23rd October 2012 interface HTMLAllCollection : HTMLCollection { // inherits length and item() legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem() HTMLAllCollection tags(DOMString tagName); }; interface HTMLFormControlsCollection : HTMLCollection { // inherits length and item() legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem() }; interface RadioNodeList : NodeList { attribute DOMString value; }; interface HTMLOptionsCollection : HTMLCollection { // inherits item() attribute unsigned long length; // overrides inherited length legacycaller getter object? namedItem(DOMString name); // overrides inherited namedItem() setter creator void (unsigned long index, HTMLOptionElement? option); void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); void remove(long index); attribute long selectedIndex; }; interface HTMLPropertiesCollection : HTMLCollection { // inherits length and item() getter PropertyNodeList? namedItem(DOMString name); // overrides inherited namedItem() readonly attribute DOMString[] names; }; typedef sequence PropertyValueArray; interface PropertyNodeList : NodeList { PropertyValueArray getValues(); }; interface DOMStringMap { getter DOMString (DOMString name); setter void (DOMString name, DOMString value); creator void (DOMString name, DOMString value); deleter void (DOMString name); }; interface DOMElementMap { getter Element (DOMString name); setter void (DOMString name, Element value); creator void (DOMString name, Element value); deleter void (DOMString name); }; [NoInterfaceObject] interface Transferable { }; [OverrideBuiltins] partial interface Document { // resource metadata management [PutForwards=href] readonly attribute Location? location; attribute DOMString domain; readonly attribute DOMString referrer; attribute DOMString cookie; readonly attribute DOMString lastModified; readonly attribute DOMString readyState; // DOM tree accessors getter object (DOMString name); attribute DOMString title; attribute DOMString dir; attribute HTMLElement? body; readonly attribute HTMLHeadElement? head; readonly attribute HTMLCollection images; readonly attribute HTMLCollection embeds; readonly attribute HTMLCollection plugins; readonly attribute HTMLCollection links; readonly attribute HTMLCollection forms; readonly attribute HTMLCollection scripts; NodeList getElementsByName(DOMString elementName); NodeList getItems(optional DOMString typeNames); // microdata readonly attribute DOMElementMap cssElementMap; // dynamic markup insertion Document open(optional DOMString type, optional DOMString replace); WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace); void close(); void write(DOMString... text); void writeln(DOMString... text); // user interaction readonly attribute WindowProxy? defaultView; readonly attribute Element? activeElement; boolean hasFocus(); attribute DOMString designMode; boolean execCommand(DOMString commandId); boolean execCommand(DOMString commandId, boolean showUI); boolean execCommand(DOMString commandId, boolean showUI, DOMString value); boolean queryCommandEnabled(DOMString commandId); boolean queryCommandIndeterm(DOMString commandId); boolean queryCommandState(DOMString commandId); boolean queryCommandSupported(DOMString commandId); DOMString queryCommandValue(DOMString commandId); readonly attribute HTMLCollection commands; // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; // special event handler IDL attributes that only apply to Document objects [LenientThis] attribute EventHandler onreadystatechange; }; partial interface XMLDocument { boolean load(DOMString url); }; interface HTMLElement : Element { // metadata attributes attribute DOMString title; attribute DOMString lang; attribute boolean translate; attribute DOMString dir; readonly attribute DOMStringMap dataset; // microdata attribute boolean itemScope; [PutForwards=value] readonly attribute DOMSettableTokenList itemType; attribute DOMString itemId; [PutForwards=value] readonly attribute DOMSettableTokenList itemRef; [PutForwards=value] readonly attribute DOMSettableTokenList itemProp; readonly attribute HTMLPropertiesCollection properties; attribute any itemValue; // acts as DOMString on setting // user interaction attribute boolean hidden; void click(); attribute long tabIndex; void focus(); void blur(); attribute DOMString accessKey; readonly attribute DOMString accessKeyLabel; attribute boolean draggable; [PutForwards=value] readonly attribute DOMSettableTokenList dropzone; attribute DOMString contentEditable; readonly attribute boolean isContentEditable; attribute HTMLMenuElement? contextMenu; attribute boolean spellcheck; void forceSpellCheck(); // command API readonly attribute DOMString? commandType; readonly attribute DOMString? commandLabel; readonly attribute DOMString? commandIcon; readonly attribute boolean? commandHidden; readonly attribute boolean? commandDisabled; readonly attribute boolean? commandChecked; // styling readonly attribute CSSStyleDeclaration style; // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; }; interface HTMLUnknownElement : HTMLElement { }; interface HTMLHtmlElement : HTMLElement {}; interface HTMLHeadElement : HTMLElement {}; interface HTMLTitleElement : HTMLElement { attribute DOMString text; }; interface HTMLBaseElement : HTMLElement { attribute DOMString href; attribute DOMString target; }; interface HTMLLinkElement : HTMLElement { attribute boolean disabled; attribute DOMString href; attribute DOMString rel; readonly attribute DOMTokenList relList; attribute DOMString media; attribute DOMString hreflang; attribute DOMString type; [PutForwards=value] readonly attribute DOMSettableTokenList sizes; }; HTMLLinkElement implements LinkStyle; interface HTMLMetaElement : HTMLElement { attribute DOMString name; attribute DOMString httpEquiv; attribute DOMString content; }; interface HTMLStyleElement : HTMLElement { attribute boolean disabled; attribute DOMString media; attribute DOMString type; attribute boolean scoped; }; HTMLStyleElement implements LinkStyle; interface HTMLScriptElement : HTMLElement { attribute DOMString src; attribute boolean async; attribute boolean defer; attribute DOMString type; attribute DOMString charset; attribute DOMString text; }; interface HTMLBodyElement : HTMLElement { attribute EventHandler onafterprint; attribute EventHandler onbeforeprint; attribute EventHandler onbeforeunload; attribute EventHandler onblur; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler onhashchange; attribute EventHandler onload; attribute EventHandler onmessage; attribute EventHandler onoffline; attribute EventHandler ononline; attribute EventHandler onpopstate; attribute EventHandler onpagehide; attribute EventHandler onpageshow; attribute EventHandler onresize; attribute EventHandler onscroll; attribute EventHandler onstorage; attribute EventHandler onunload; }; interface HTMLHeadingElement : HTMLElement {}; interface HTMLParagraphElement : HTMLElement {}; interface HTMLHRElement : HTMLElement {}; interface HTMLPreElement : HTMLElement {}; interface HTMLQuoteElement : HTMLElement { attribute DOMString cite; }; interface HTMLOListElement : HTMLElement { attribute boolean reversed; attribute long start; attribute DOMString type; }; interface HTMLUListElement : HTMLElement {}; interface HTMLLIElement : HTMLElement { attribute long value; }; interface HTMLDListElement : HTMLElement {}; interface HTMLDivElement : HTMLElement {}; interface HTMLAnchorElement : HTMLElement { stringifier attribute DOMString href; attribute DOMString target; attribute DOMString download; attribute DOMString ping; attribute DOMString rel; readonly attribute DOMTokenList relList; attribute DOMString media; attribute DOMString hreflang; attribute DOMString type; attribute DOMString text; // URL decomposition IDL attributes attribute DOMString protocol; attribute DOMString host; attribute DOMString hostname; attribute DOMString port; attribute DOMString pathname; attribute DOMString search; attribute DOMString hash; }; interface HTMLDataElement : HTMLElement { attribute DOMString value; }; interface HTMLTimeElement : HTMLElement { attribute DOMString datetime; }; interface HTMLSpanElement : HTMLElement {}; interface HTMLBRElement : HTMLElement {}; interface HTMLModElement : HTMLElement { attribute DOMString cite; attribute DOMString dateTime; }; [NamedConstructor=Image(), NamedConstructor=Image(unsigned long width), NamedConstructor=Image(unsigned long width, unsigned long height)] interface HTMLImageElement : HTMLElement { attribute DOMString alt; attribute DOMString src; attribute DOMString srcset; attribute DOMString crossOrigin; attribute DOMString useMap; attribute boolean isMap; attribute unsigned long width; attribute unsigned long height; readonly attribute unsigned long naturalWidth; readonly attribute unsigned long naturalHeight; readonly attribute boolean complete; }; interface HTMLIFrameElement : HTMLElement { attribute DOMString src; attribute DOMString srcdoc; attribute DOMString name; [PutForwards=value] readonly attribute DOMSettableTokenList sandbox; attribute boolean seamless; attribute DOMString width; attribute DOMString height; readonly attribute Document? contentDocument; readonly attribute WindowProxy? contentWindow; }; interface HTMLEmbedElement : HTMLElement { attribute DOMString src; attribute DOMString type; attribute DOMString width; attribute DOMString height; legacycaller any (any... arguments); }; interface HTMLObjectElement : HTMLElement { attribute DOMString data; attribute DOMString type; attribute boolean typeMustMatch; attribute DOMString name; attribute DOMString useMap; readonly attribute HTMLFormElement? form; attribute DOMString width; attribute DOMString height; readonly attribute Document? contentDocument; readonly attribute WindowProxy? contentWindow; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); legacycaller any (any... arguments); }; interface HTMLParamElement : HTMLElement { attribute DOMString name; attribute DOMString value; }; interface HTMLVideoElement : HTMLMediaElement { attribute unsigned long width; attribute unsigned long height; readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; attribute DOMString poster; }; [NamedConstructor=Audio(), NamedConstructor=Audio(DOMString src)] interface HTMLAudioElement : HTMLMediaElement {}; interface HTMLSourceElement : HTMLElement { attribute DOMString src; attribute DOMString type; attribute DOMString media; }; interface HTMLTrackElement : HTMLElement { attribute DOMString kind; attribute DOMString src; attribute DOMString srclang; attribute DOMString label; attribute boolean default; const unsigned short NONE = 0; const unsigned short LOADING = 1; const unsigned short LOADED = 2; const unsigned short ERROR = 3; readonly attribute unsigned short readyState; readonly attribute TextTrack track; }; interface HTMLMediaElement : HTMLElement { // error state readonly attribute MediaError? error; // network state attribute DOMString src; readonly attribute DOMString currentSrc; attribute DOMString crossOrigin; const unsigned short NETWORK_EMPTY = 0; const unsigned short NETWORK_IDLE = 1; const unsigned short NETWORK_LOADING = 2; const unsigned short NETWORK_NO_SOURCE = 3; readonly attribute unsigned short networkState; attribute DOMString preload; readonly attribute TimeRanges buffered; void load(); DOMString canPlayType(DOMString type); // ready state const unsigned short HAVE_NOTHING = 0; const unsigned short HAVE_METADATA = 1; const unsigned short HAVE_CURRENT_DATA = 2; const unsigned short HAVE_FUTURE_DATA = 3; const unsigned short HAVE_ENOUGH_DATA = 4; readonly attribute unsigned short readyState; readonly attribute boolean seeking; // playback state attribute double currentTime; void fastSeek(double time); readonly attribute unrestricted double duration; readonly attribute Date startDate; readonly attribute boolean paused; attribute double defaultPlaybackRate; attribute double playbackRate; readonly attribute TimeRanges played; readonly attribute TimeRanges seekable; readonly attribute boolean ended; attribute boolean autoplay; attribute boolean loop; void play(); void pause(); // media controller attribute DOMString mediaGroup; attribute MediaController? controller; // controls attribute boolean controls; attribute double volume; attribute boolean muted; attribute boolean defaultMuted; // tracks readonly attribute AudioTrackList audioTracks; readonly attribute VideoTrackList videoTracks; readonly attribute TextTrackList textTracks; TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language); }; interface MediaError { const unsigned short MEDIA_ERR_ABORTED = 1; const unsigned short MEDIA_ERR_NETWORK = 2; const unsigned short MEDIA_ERR_DECODE = 3; const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4; readonly attribute unsigned short code; }; interface AudioTrackList : EventTarget { readonly attribute unsigned long length; getter AudioTrack (unsigned long index); AudioTrack? getTrackById(DOMString id); attribute EventHandler onchange; attribute EventHandler onaddtrack; attribute EventHandler onremovetrack; }; interface AudioTrack { readonly attribute DOMString id; readonly attribute DOMString kind; readonly attribute DOMString label; readonly attribute DOMString language; attribute boolean enabled; }; interface VideoTrackList : EventTarget { readonly attribute unsigned long length; getter VideoTrack (unsigned long index); VideoTrack? getTrackById(DOMString id); readonly attribute long selectedIndex; attribute EventHandler onchange; attribute EventHandler onaddtrack; attribute EventHandler onremovetrack; }; interface VideoTrack { readonly attribute DOMString id; readonly attribute DOMString kind; readonly attribute DOMString label; readonly attribute DOMString language; attribute boolean selected; }; enum MediaControllerPlaybackState { "waiting", "playing", "ended" }; [Constructor] interface MediaController : EventTarget { readonly attribute unsigned short readyState; // uses HTMLMediaElement.readyState's values readonly attribute TimeRanges buffered; readonly attribute TimeRanges seekable; readonly attribute unrestricted double duration; attribute double currentTime; readonly attribute boolean paused; readonly attribute MediaControllerPlaybackState playbackState; readonly attribute TimeRanges played; void pause(); void unpause(); void play(); // calls play() on all media elements as well attribute double defaultPlaybackRate; attribute double playbackRate; attribute double volume; attribute boolean muted; attribute EventHandler onemptied; attribute EventHandler onloadedmetadata; attribute EventHandler onloadeddata; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onplaying; attribute EventHandler onended; attribute EventHandler onwaiting; attribute EventHandler ondurationchange; attribute EventHandler ontimeupdate; attribute EventHandler onplay; attribute EventHandler onpause; attribute EventHandler onratechange; attribute EventHandler onvolumechange; }; interface TextTrackList : EventTarget { readonly attribute unsigned long length; getter TextTrack (unsigned long index); attribute EventHandler onaddtrack; attribute EventHandler onremovetrack; }; enum TextTrackMode { "disabled", "hidden", "showing" }; interface TextTrack : EventTarget { readonly attribute DOMString kind; readonly attribute DOMString label; readonly attribute DOMString language; readonly attribute DOMString inBandMetadataTrackDispatchType; attribute TextTrackMode mode; readonly attribute TextTrackCueList? cues; readonly attribute TextTrackCueList? activeCues; void addCue(TextTrackCue cue); void removeCue(TextTrackCue cue); attribute EventHandler oncuechange; }; interface TextTrackCueList { readonly attribute unsigned long length; getter TextTrackCue (unsigned long index); TextTrackCue? getCueById(DOMString id); }; enum AutoKeyword { "auto" }; [Constructor(double startTime, double endTime, DOMString text)] interface TextTrackCue : EventTarget { readonly attribute TextTrack? track; attribute DOMString id; attribute double startTime; attribute double endTime; attribute boolean pauseOnExit; attribute DOMString vertical; attribute boolean snapToLines; attribute (long or AutoKeyword) line; attribute long position; attribute long size; attribute DOMString align; attribute DOMString text; DocumentFragment getCueAsHTML(); attribute EventHandler onenter; attribute EventHandler onexit; }; interface TimeRanges { readonly attribute unsigned long length; double start(unsigned long index); double end(unsigned long index); }; [Constructor(DOMString type, optional TrackEventInit eventInitDict)] interface TrackEvent : Event { readonly attribute object? track; }; dictionary TrackEventInit : EventInit { object? track; }; interface HTMLCanvasElement : HTMLElement { attribute unsigned long width; attribute unsigned long height; DOMString toDataURL(optional DOMString type, any... arguments); DOMString toDataURLHD(optional DOMString type, any... arguments); void toBlob(FileCallback? _callback, optional DOMString type, any... arguments); void toBlobHD(FileCallback? _callback, optional DOMString type, any... arguments); object? getContext(DOMString contextId, any... arguments); boolean supportsContext(DOMString contextId, any... arguments); }; interface CanvasRenderingContext2D { // back-reference to the canvas readonly attribute HTMLCanvasElement canvas; // state void save(); // push state on state stack void restore(); // pop state stack and restore state // transformations (default transform is the identity matrix) attribute SVGMatrix currentTransform; void scale(unrestricted double x, unrestricted double y); void rotate(unrestricted double angle); void translate(unrestricted double x, unrestricted double y); void transform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); void setTransform(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f); void resetTransform(); // compositing attribute unrestricted double globalAlpha; // (default 1.0) attribute DOMString globalCompositeOperation; // (default source-over) // image smoothing attribute boolean imageSmoothingEnabled; // (default true) // colors and styles (see also the CanvasDrawingStyles interface) attribute (DOMString or CanvasGradient or CanvasPattern) strokeStyle; // (default black) attribute (DOMString or CanvasGradient or CanvasPattern) fillStyle; // (default black) CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1); CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1); CanvasPattern createPattern((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, DOMString repetition); // shadows attribute unrestricted double shadowOffsetX; // (default 0) attribute unrestricted double shadowOffsetY; // (default 0) attribute unrestricted double shadowBlur; // (default 0) attribute DOMString shadowColor; // (default transparent black) // rects void clearRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void fillRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void strokeRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); // path API (see also CanvasPathMethods) void beginPath(); void fill(); void fill(Path path); void stroke(); void stroke(Path path); void drawSystemFocusRing(Element element); void drawSystemFocusRing(Path path, Element element); boolean drawCustomFocusRing(Element element); boolean drawCustomFocusRing(Path path, Element element); void scrollPathIntoView(); void scrollPathIntoView(Path path); void clip(); void clip(Path path); void resetClip(); boolean isPointInPath(unrestricted double x, unrestricted double y); boolean isPointInPath(Path path, unrestricted double x, unrestricted double y); // text (see also the CanvasDrawingStyles interface) void fillText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); void strokeText(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); TextMetrics measureText(DOMString text); // drawing images void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double dx, unrestricted double dy); void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh); void drawImage((HTMLImageElement or HTMLCanvasElement or HTMLVideoElement) image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh); // hit regions void addHitRegion(HitRegionOptions options); void removeHitRegion(HitRegionOptions options); // pixel manipulation ImageData createImageData(double sw, double sh); ImageData createImageData(ImageData imagedata); ImageData createImageDataHD(double sw, double sh); ImageData getImageData(double sx, double sy, double sw, double sh); ImageData getImageDataHD(double sx, double sy, double sw, double sh); void putImageData(ImageData imagedata, double dx, double dy); void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); void putImageDataHD(ImageData imagedata, double dx, double dy); void putImageDataHD(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); }; CanvasRenderingContext2D implements CanvasDrawingStyles; CanvasRenderingContext2D implements CanvasPathMethods; [NoInterfaceObject] interface CanvasDrawingStyles { // line caps/joins attribute unrestricted double lineWidth; // (default 1) attribute DOMString lineCap; // "butt", "round", "square" (default "butt") attribute DOMString lineJoin; // "round", "bevel", "miter" (default "miter") attribute unrestricted double miterLimit; // (default 10) // dashed lines void setLineDash(sequence segments); // default empty sequence getLineDash(); attribute unrestricted double lineDashOffset; // text attribute DOMString font; // (default 10px sans-serif) attribute DOMString textAlign; // "start", "end", "left", "right", "center" (default: "start") attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") }; [NoInterfaceObject] interface CanvasPathMethods { // shared path API methods void closePath(); void moveTo(unrestricted double x, unrestricted double y); void lineTo(unrestricted double x, unrestricted double y); void quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y); void bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y); void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius); void arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation); void rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h); void arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false); void ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, boolean anticlockwise); }; interface CanvasGradient { // opaque object void addColorStop(double offset, DOMString color); }; interface CanvasPattern { // opaque object void setTransform(SVGMatrix transform); }; interface TextMetrics { // x-direction readonly attribute double width; // advance width readonly attribute double actualBoundingBoxLeft; readonly attribute double actualBoundingBoxRight; // y-direction readonly attribute double fontBoundingBoxAscent; readonly attribute double fontBoundingBoxDescent; readonly attribute double actualBoundingBoxAscent; readonly attribute double actualBoundingBoxDescent; readonly attribute double emHeightAscent; readonly attribute double emHeightDescent; readonly attribute double hangingBaseline; readonly attribute double alphabeticBaseline; readonly attribute double ideographicBaseline; }; dictionary HitRegionOptions { Path? path = null; DOMString id = ""; DOMString? parentID = null; DOMString cursor = "inherit"; // for control-backed regions: Element? control = null; // for unbacked regions: DOMString? label = null; DOMString? role = null; }; interface ImageData { readonly attribute unsigned long width; readonly attribute unsigned long height; readonly attribute Uint8ClampedArray data; }; [Constructor(optional Element scope)] interface DrawingStyle { }; DrawingStyle implements CanvasDrawingStyles; [Constructor, Constructor(Path path), Constructor(DOMString d)] interface Path { void addPath(Path path, SVGMatrix? transformation); void addPathByStrokingPath(Path path, CanvasDrawingStyles styles, SVGMatrix? transformation); void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth); void addText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional unrestricted double maxWidth); void addPathByStrokingText(DOMString text, CanvasDrawingStyles styles, SVGMatrix? transformation, Path path, optional unrestricted double maxWidth); }; Path implements CanvasPathMethods; partial interface Screen { readonly attribute double canvasResolution; }; partial interface MouseEvent { readonly attribute DOMString? region; }; partial dictionary MouseEventInit { DOMString? region; }; interface HTMLMapElement : HTMLElement { attribute DOMString name; readonly attribute HTMLCollection areas; readonly attribute HTMLCollection images; }; interface HTMLAreaElement : HTMLElement { attribute DOMString alt; attribute DOMString coords; attribute DOMString shape; stringifier attribute DOMString href; attribute DOMString target; attribute DOMString download; attribute DOMString ping; attribute DOMString rel; readonly attribute DOMTokenList relList; attribute DOMString media; attribute DOMString hreflang; attribute DOMString type; // URL decomposition IDL attributes attribute DOMString protocol; attribute DOMString host; attribute DOMString hostname; attribute DOMString port; attribute DOMString pathname; attribute DOMString search; attribute DOMString hash; }; interface HTMLTableElement : HTMLElement { attribute HTMLTableCaptionElement? caption; HTMLElement createCaption(); void deleteCaption(); attribute HTMLTableSectionElement? tHead; HTMLElement createTHead(); void deleteTHead(); attribute HTMLTableSectionElement? tFoot; HTMLElement createTFoot(); void deleteTFoot(); readonly attribute HTMLCollection tBodies; HTMLElement createTBody(); readonly attribute HTMLCollection rows; HTMLElement insertRow(optional long index); void deleteRow(long index); }; interface HTMLTableCaptionElement : HTMLElement {}; interface HTMLTableColElement : HTMLElement { attribute unsigned long span; }; interface HTMLTableSectionElement : HTMLElement { readonly attribute HTMLCollection rows; HTMLElement insertRow(optional long index); void deleteRow(long index); }; interface HTMLTableRowElement : HTMLElement { readonly attribute long rowIndex; readonly attribute long sectionRowIndex; readonly attribute HTMLCollection cells; HTMLElement insertCell(optional long index); void deleteCell(long index); }; interface HTMLTableDataCellElement : HTMLTableCellElement {}; interface HTMLTableHeaderCellElement : HTMLTableCellElement { attribute DOMString scope; attribute DOMString abbr; }; interface HTMLTableCellElement : HTMLElement { attribute unsigned long colSpan; attribute unsigned long rowSpan; [PutForwards=value] readonly attribute DOMSettableTokenList headers; readonly attribute long cellIndex; }; [OverrideBuiltins] interface HTMLFormElement : HTMLElement { attribute DOMString acceptCharset; attribute DOMString action; attribute DOMString autocomplete; attribute DOMString enctype; attribute DOMString encoding; attribute DOMString method; attribute DOMString name; attribute boolean noValidate; attribute DOMString target; readonly attribute HTMLFormControlsCollection elements; readonly attribute long length; getter Element (unsigned long index); getter object (DOMString name); void submit(); void reset(); boolean checkValidity(); }; interface HTMLFieldSetElement : HTMLElement { attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute DOMString name; readonly attribute DOMString type; readonly attribute HTMLFormControlsCollection elements; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); }; interface HTMLLegendElement : HTMLElement { readonly attribute HTMLFormElement? form; }; interface HTMLLabelElement : HTMLElement { readonly attribute HTMLFormElement? form; attribute DOMString htmlFor; readonly attribute HTMLElement? control; }; interface HTMLInputElement : HTMLElement { attribute DOMString accept; attribute DOMString alt; attribute DOMString autocomplete; attribute boolean autofocus; attribute boolean defaultChecked; attribute boolean checked; attribute DOMString dirName; attribute boolean disabled; readonly attribute HTMLFormElement? form; readonly attribute FileList? files; attribute DOMString formAction; attribute DOMString formEnctype; attribute DOMString formMethod; attribute boolean formNoValidate; attribute DOMString formTarget; attribute unsigned long height; attribute boolean indeterminate; attribute DOMString inputMode; readonly attribute HTMLElement? list; attribute DOMString max; attribute long maxLength; attribute DOMString min; attribute boolean multiple; attribute DOMString name; attribute DOMString pattern; attribute DOMString placeholder; attribute boolean readOnly; attribute boolean required; attribute unsigned long size; attribute DOMString src; attribute DOMString step; attribute DOMString type; attribute DOMString defaultValue; [TreatNullAs=EmptyString] attribute DOMString value; attribute Date? valueAsDate; attribute unrestricted double valueAsNumber; attribute unsigned long width; void stepUp(optional long n); void stepDown(optional long n); readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; void select(); attribute unsigned long selectionStart; attribute unsigned long selectionEnd; attribute DOMString selectionDirection; void setRangeText(DOMString replacement); void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); }; interface HTMLButtonElement : HTMLElement { attribute boolean autofocus; attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute DOMString formAction; attribute DOMString formEnctype; attribute DOMString formMethod; attribute boolean formNoValidate; attribute DOMString formTarget; attribute DOMString name; attribute DOMString type; attribute DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; }; interface HTMLSelectElement : HTMLElement { attribute boolean autofocus; attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute boolean multiple; attribute DOMString name; attribute boolean required; attribute unsigned long size; readonly attribute DOMString type; readonly attribute HTMLOptionsCollection options; attribute unsigned long length; getter Element item(unsigned long index); object namedItem(DOMString name); void add((HTMLOptionElement or HTMLOptGroupElement) element, optional (HTMLElement or long)? before = null); void remove(long index); setter creator void (unsigned long index, HTMLOptionElement? option); readonly attribute HTMLCollection selectedOptions; attribute long selectedIndex; attribute DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; }; interface HTMLDataListElement : HTMLElement { readonly attribute HTMLCollection options; }; interface HTMLOptGroupElement : HTMLElement { attribute boolean disabled; attribute DOMString label; }; [NamedConstructor=Option(), NamedConstructor=Option(DOMString text), NamedConstructor=Option(DOMString text, DOMString value), NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected), NamedConstructor=Option(DOMString text, DOMString value, boolean defaultSelected, boolean selected)] interface HTMLOptionElement : HTMLElement { attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute DOMString label; attribute boolean defaultSelected; attribute boolean selected; attribute DOMString value; attribute DOMString text; readonly attribute long index; }; interface HTMLTextAreaElement : HTMLElement { attribute DOMString autocomplete; attribute boolean autofocus; attribute unsigned long cols; attribute DOMString dirName; attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute DOMString inputMode; attribute long maxLength; attribute DOMString name; attribute DOMString placeholder; attribute boolean readOnly; attribute boolean required; attribute unsigned long rows; attribute DOMString wrap; readonly attribute DOMString type; attribute DOMString defaultValue; [TreatNullAs=EmptyString] attribute DOMString value; readonly attribute unsigned long textLength; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; void select(); attribute unsigned long selectionStart; attribute unsigned long selectionEnd; attribute DOMString selectionDirection; void setRangeText(DOMString replacement); void setRangeText(DOMString replacement, unsigned long start, unsigned long end, optional SelectionMode selectionMode); void setSelectionRange(unsigned long start, unsigned long end, optional DOMString direction); }; interface HTMLKeygenElement : HTMLElement { attribute boolean autofocus; attribute DOMString challenge; attribute boolean disabled; readonly attribute HTMLFormElement? form; attribute DOMString keytype; attribute DOMString name; readonly attribute DOMString type; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; }; interface HTMLOutputElement : HTMLElement { [PutForwards=value] readonly attribute DOMSettableTokenList htmlFor; readonly attribute HTMLFormElement? form; attribute DOMString name; readonly attribute DOMString type; attribute DOMString defaultValue; attribute DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); void setCustomValidity(DOMString error); readonly attribute NodeList labels; }; interface HTMLProgressElement : HTMLElement { attribute double value; attribute double max; readonly attribute double position; readonly attribute NodeList labels; }; interface HTMLMeterElement : HTMLElement { attribute double value; attribute double min; attribute double max; attribute double low; attribute double high; attribute double optimum; readonly attribute NodeList labels; }; interface ValidityState { readonly attribute boolean valueMissing; readonly attribute boolean typeMismatch; readonly attribute boolean patternMismatch; readonly attribute boolean tooLong; readonly attribute boolean rangeUnderflow; readonly attribute boolean rangeOverflow; readonly attribute boolean stepMismatch; readonly attribute boolean customError; readonly attribute boolean valid; }; interface HTMLDetailsElement : HTMLElement { attribute boolean open; }; interface HTMLCommandElement : HTMLElement { attribute DOMString type; attribute DOMString label; attribute DOMString icon; attribute boolean disabled; attribute boolean checked; attribute DOMString radiogroup; readonly attribute HTMLElement? command; }; interface HTMLMenuElement : HTMLElement { attribute DOMString type; attribute DOMString label; }; interface HTMLDialogElement : HTMLElement { attribute boolean open; attribute DOMString returnValue; void show(optional (MouseEvent or Element) anchor); void showModal(optional (MouseEvent or Element) anchor); void close(optional DOMString returnValue); }; [NamedPropertiesObject] interface Window : EventTarget { // the current browsing context [Unforgeable] readonly attribute WindowProxy window; [Replaceable] readonly attribute WindowProxy self; [Unforgeable] readonly attribute Document document; attribute DOMString name; [PutForwards=href, Unforgeable] readonly attribute Location location; readonly attribute History history; [Replaceable] readonly attribute BarProp locationbar; [Replaceable] readonly attribute BarProp menubar; [Replaceable] readonly attribute BarProp personalbar; [Replaceable] readonly attribute BarProp scrollbars; [Replaceable] readonly attribute BarProp statusbar; [Replaceable] readonly attribute BarProp toolbar; attribute DOMString status; void close(); void stop(); void focus(); void blur(); // other browsing contexts [Replaceable] readonly attribute WindowProxy frames; [Replaceable] readonly attribute unsigned long length; [Unforgeable] readonly attribute WindowProxy top; attribute WindowProxy? opener; readonly attribute WindowProxy parent; readonly attribute Element? frameElement; WindowProxy open(optional DOMString url, optional DOMString target, optional DOMString features, optional boolean replace); getter WindowProxy (unsigned long index); getter object (DOMString name); // the user agent readonly attribute Navigator navigator; readonly attribute External external; readonly attribute ApplicationCache applicationCache; // user prompts void alert(DOMString message); boolean confirm(DOMString message); DOMString? prompt(DOMString message, optional DOMString default); void print(); any showModalDialog(DOMString url, optional any argument); // cross-document messaging void postMessage(any message, DOMString targetOrigin, optional sequence transfer); // event handler IDL attributes attribute EventHandler onabort; attribute EventHandler onafterprint; attribute EventHandler onbeforeprint; attribute EventHandler onbeforeunload; attribute EventHandler onblur; attribute EventHandler oncancel; attribute EventHandler oncanplay; attribute EventHandler oncanplaythrough; attribute EventHandler onchange; attribute EventHandler onclick; attribute EventHandler onclose; attribute EventHandler oncontextmenu; attribute EventHandler oncuechange; attribute EventHandler ondblclick; attribute EventHandler ondrag; attribute EventHandler ondragend; attribute EventHandler ondragenter; attribute EventHandler ondragleave; attribute EventHandler ondragover; attribute EventHandler ondragstart; attribute EventHandler ondrop; attribute EventHandler ondurationchange; attribute EventHandler onemptied; attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; attribute EventHandler onhashchange; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; attribute EventHandler onkeypress; attribute EventHandler onkeyup; attribute EventHandler onload; attribute EventHandler onloadeddata; attribute EventHandler onloadedmetadata; attribute EventHandler onloadstart; attribute EventHandler onmessage; attribute EventHandler onmousedown; attribute EventHandler onmousemove; attribute EventHandler onmouseout; attribute EventHandler onmouseover; attribute EventHandler onmouseup; attribute EventHandler onmousewheel; attribute EventHandler onoffline; attribute EventHandler ononline; attribute EventHandler onpause; attribute EventHandler onplay; attribute EventHandler onplaying; attribute EventHandler onpagehide; attribute EventHandler onpageshow; attribute EventHandler onpopstate; attribute EventHandler onprogress; attribute EventHandler onratechange; attribute EventHandler onreset; attribute EventHandler onresize; attribute EventHandler onscroll; attribute EventHandler onseeked; attribute EventHandler onseeking; attribute EventHandler onselect; attribute EventHandler onshow; attribute EventHandler onstalled; attribute EventHandler onstorage; attribute EventHandler onsubmit; attribute EventHandler onsuspend; attribute EventHandler ontimeupdate; attribute EventHandler onunload; attribute EventHandler onvolumechange; attribute EventHandler onwaiting; }; interface BarProp { attribute boolean visible; }; interface History { readonly attribute long length; readonly attribute any state; void go(optional long delta); void back(); void forward(); void pushState(any data, DOMString title, optional DOMString url); void replaceState(any data, DOMString title, optional DOMString url); }; interface Location { stringifier attribute DOMString href; void assign(DOMString url); void replace(DOMString url); void reload(); // URL decomposition IDL attributes attribute DOMString protocol; attribute DOMString host; attribute DOMString hostname; attribute DOMString port; attribute DOMString pathname; attribute DOMString search; attribute DOMString hash; }; [Constructor(DOMString type, optional PopStateEventInit eventInitDict)] interface PopStateEvent : Event { readonly attribute any state; }; dictionary PopStateEventInit : EventInit { any state; }; [Constructor(DOMString type, optional HashChangeEventInit eventInitDict)] interface HashChangeEvent : Event { readonly attribute DOMString oldURL; readonly attribute DOMString newURL; }; dictionary HashChangeEventInit : EventInit { DOMString oldURL; DOMString newURL; }; [Constructor(DOMString type, optional PageTransitionEventInit eventInitDict)] interface PageTransitionEvent : Event { readonly attribute boolean persisted; }; dictionary PageTransitionEventInit : EventInit { boolean persisted; }; interface BeforeUnloadEvent : Event { attribute DOMString returnValue; }; interface ApplicationCache : EventTarget { // update status const unsigned short UNCACHED = 0; const unsigned short IDLE = 1; const unsigned short CHECKING = 2; const unsigned short DOWNLOADING = 3; const unsigned short UPDATEREADY = 4; const unsigned short OBSOLETE = 5; readonly attribute unsigned short status; // updates void update(); void abort(); void swapCache(); // events attribute EventHandler onchecking; attribute EventHandler onerror; attribute EventHandler onnoupdate; attribute EventHandler ondownloading; attribute EventHandler onprogress; attribute EventHandler onupdateready; attribute EventHandler oncached; attribute EventHandler onobsolete; }; [NoInterfaceObject] interface NavigatorOnLine { readonly attribute boolean onLine; }; [TreatNonCallableAsNull] callback EventHandlerNonNull = any (Event event); typedef EventHandlerNonNull? EventHandler; [TreatNonCallableAsNull] callback OnErrorEventHandlerNonNull = any ((Event or DOMString) event, DOMString source, unsigned long lineno, unsigned long column); typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; [NoInterfaceObject] interface WindowBase64 { DOMString btoa(DOMString btoa); DOMString atob(DOMString atob); }; Window implements WindowBase64; [NoInterfaceObject] interface WindowTimers { long setTimeout(Function handler, optional long timeout, any... arguments); long setTimeout(DOMString handler, optional long timeout, any... arguments); void clearTimeout(long handle); long setInterval(Function handler, optional long timeout, any... arguments); long setInterval(DOMString handler, optional long timeout, any... arguments); void clearInterval(long handle); }; Window implements WindowTimers; [NoInterfaceObject] interface WindowModal { readonly attribute any dialogArguments; attribute DOMString returnValue; }; interface Navigator { // objects implementing this interface also implement the interfaces given below }; Navigator implements NavigatorID; Navigator implements NavigatorOnLine; Navigator implements NavigatorContentUtils; Navigator implements NavigatorStorageUtils; [NoInterfaceObject] interface NavigatorID { readonly attribute DOMString appName; readonly attribute DOMString appVersion; readonly attribute DOMString platform; readonly attribute DOMString userAgent; }; [NoInterfaceObject] interface NavigatorContentUtils { // content handler registration void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title); void registerContentHandler(DOMString mimeType, DOMString url, DOMString title); DOMString isProtocolHandlerRegistered(DOMString scheme, DOMString url); DOMString isContentHandlerRegistered(DOMString mimeType, DOMString url); void unregisterProtocolHandler(DOMString scheme, DOMString url); void unregisterContentHandler(DOMString mimeType, DOMString url); }; [NoInterfaceObject] interface NavigatorStorageUtils { void yieldForStorageUpdates(); }; interface External { void AddSearchProvider(DOMString engineURL); unsigned long IsSearchProviderInstalled(DOMString engineURL); }; interface DataTransfer { attribute DOMString dropEffect; attribute DOMString effectAllowed; readonly attribute DataTransferItemList items; void setDragImage(Element image, long x, long y); /* old interface */ readonly attribute DOMString[] types; DOMString getData(DOMString format); void setData(DOMString format, DOMString data); void clearData(optional DOMString format); readonly attribute FileList files; }; interface DataTransferItemList { readonly attribute unsigned long length; getter DataTransferItem (unsigned long index); deleter void (unsigned long index); void clear(); DataTransferItem? add(DOMString data, DOMString type); DataTransferItem? add(File data); }; interface DataTransferItem { readonly attribute DOMString kind; readonly attribute DOMString type; void getAsString(FunctionStringCallback? _callback); File? getAsFile(); }; [Callback, NoInterfaceObject] interface FunctionStringCallback { void handleEvent(DOMString data); }; [Constructor(DOMString type, optional DragEventInit eventInitDict)] interface DragEvent : MouseEvent { readonly attribute DataTransfer? dataTransfer; }; dictionary DragEventInit : MouseEventInit { DataTransfer? dataTransfer; }; interface WorkerGlobalScope : EventTarget { readonly attribute WorkerGlobalScope self; readonly attribute WorkerLocation location; void close(); attribute EventHandler onerror; attribute EventHandler onoffline; attribute EventHandler ononline; }; WorkerGlobalScope implements WorkerUtils; interface DedicatedWorkerGlobalScope : WorkerGlobalScope { void postMessage(any message, optional sequence transfer); attribute EventHandler onmessage; }; interface SharedWorkerGlobalScope : WorkerGlobalScope { readonly attribute DOMString name; readonly attribute ApplicationCache applicationCache; attribute EventHandler onconnect; }; [Constructor(DOMString type, optional ErrorEventInit eventInitDict)] interface ErrorEvent : Event { readonly attribute DOMString message; readonly attribute DOMString filename; readonly attribute unsigned long lineno; readonly attribute unsigned long column; }; dictionary ErrorEventInit : EventInit { DOMString message; DOMString filename; unsigned long lineno; unsigned long column; }; [NoInterfaceObject] interface AbstractWorker { attribute EventHandler onerror; }; [Constructor(DOMString scriptURL)] interface Worker : EventTarget { void terminate(); void postMessage(any message, optional sequence transfer); attribute EventHandler onmessage; }; Worker implements AbstractWorker; [Constructor(DOMString scriptURL, optional DOMString name)] interface SharedWorker : EventTarget { readonly attribute MessagePort port; }; SharedWorker implements AbstractWorker; [NoInterfaceObject] interface WorkerUtils { void importScripts(DOMString... urls); readonly attribute WorkerNavigator navigator; }; WorkerUtils implements WindowTimers; WorkerUtils implements WindowBase64; interface WorkerNavigator {}; WorkerNavigator implements NavigatorID; WorkerNavigator implements NavigatorOnLine; interface WorkerLocation { // URL decomposition IDL attributes stringifier readonly attribute DOMString href; readonly attribute DOMString protocol; readonly attribute DOMString host; readonly attribute DOMString hostname; readonly attribute DOMString port; readonly attribute DOMString pathname; readonly attribute DOMString search; readonly attribute DOMString hash; }; [Constructor(DOMString type, optional MessageEventInit eventInitDict)] interface MessageEvent : Event { readonly attribute any data; readonly attribute DOMString origin; readonly attribute DOMString lastEventId; readonly attribute (WindowProxy or MessagePort)? source; readonly attribute MessagePort[]? ports; }; dictionary MessageEventInit : EventInit { any data; DOMString origin; DOMString lastEventId; WindowProxy? source; MessagePort[]? ports; }; [Constructor(DOMString url, optional EventSourceInit eventSourceInitDict)] interface EventSource : EventTarget { readonly attribute DOMString url; readonly attribute boolean withCredentials; // ready state const unsigned short CONNECTING = 0; const unsigned short OPEN = 1; const unsigned short CLOSED = 2; readonly attribute unsigned short readyState; // networking attribute EventHandler onopen; attribute EventHandler onmessage; attribute EventHandler onerror; void close(); }; dictionary EventSourceInit { boolean withCredentials = false; }; enum BinaryType { "blob", "arraybuffer" }; [Constructor(DOMString url, optional (DOMString or DOMString[]) protocols)] interface WebSocket : EventTarget { readonly attribute DOMString url; // ready state const unsigned short CONNECTING = 0; const unsigned short OPEN = 1; const unsigned short CLOSING = 2; const unsigned short CLOSED = 3; readonly attribute unsigned short readyState; readonly attribute unsigned long bufferedAmount; // networking attribute EventHandler onopen; attribute EventHandler onerror; attribute EventHandler onclose; readonly attribute DOMString extensions; readonly attribute DOMString protocol; void close([Clamp] optional unsigned short code, optional DOMString reason); // messaging attribute EventHandler onmessage; attribute BinaryType binaryType; void send(DOMString data); void send(Blob data); void send(ArrayBuffer data); void send(ArrayBufferView data); }; [Constructor(DOMString type, optional CloseEventInit eventInitDict)] interface CloseEvent : Event { readonly attribute boolean wasClean; readonly attribute unsigned short code; readonly attribute DOMString reason; }; dictionary CloseEventInit : EventInit { boolean wasClean; unsigned short code; DOMString reason; }; [Constructor] interface MessageChannel { readonly attribute MessagePort port1; readonly attribute MessagePort port2; }; interface MessagePort : EventTarget { void postMessage(any message, optional sequence transfer); void start(); void close(); // event handlers attribute EventHandler onmessage; }; MessagePort implements Transferable; interface Storage { readonly attribute unsigned long length; DOMString? key(unsigned long index); getter DOMString getItem(DOMString key); setter creator void setItem(DOMString key, DOMString value); deleter void removeItem(DOMString key); void clear(); }; [NoInterfaceObject] interface WindowSessionStorage { readonly attribute Storage sessionStorage; }; Window implements WindowSessionStorage; [NoInterfaceObject] interface WindowLocalStorage { readonly attribute Storage localStorage; }; Window implements WindowLocalStorage; [Constructor(DOMString type, optional StorageEventInit eventInitDict)] interface StorageEvent : Event { readonly attribute DOMString? key; readonly attribute DOMString? oldValue; readonly attribute DOMString? newValue; readonly attribute DOMString url; readonly attribute Storage? storageArea; }; dictionary StorageEventInit : EventInit { DOMString? key; DOMString? oldValue; DOMString? newValue; DOMString url; Storage? storageArea; }; interface HTMLAppletElement : HTMLElement { attribute DOMString align; attribute DOMString alt; attribute DOMString archive; attribute DOMString code; attribute DOMString codeBase; attribute DOMString height; attribute unsigned long hspace; attribute DOMString name; attribute DOMString _object; // the underscore is not part of the identifier attribute unsigned long vspace; attribute DOMString width; }; interface HTMLMarqueeElement : HTMLElement { attribute DOMString behavior; attribute DOMString bgColor; attribute DOMString direction; attribute DOMString height; attribute unsigned long hspace; attribute long loop; attribute unsigned long scrollAmount; attribute unsigned long scrollDelay; attribute boolean trueSpeed; attribute unsigned long vspace; attribute DOMString width; attribute EventHandler onbounce; attribute EventHandler onfinish; attribute EventHandler onstart; void start(); void stop(); }; interface HTMLFrameSetElement : HTMLElement { attribute DOMString cols; attribute DOMString rows; attribute EventHandler onafterprint; attribute EventHandler onbeforeprint; attribute EventHandler onbeforeunload; attribute EventHandler onblur; attribute EventHandler onerror; attribute EventHandler onfocus; attribute EventHandler onhashchange; attribute EventHandler onload; attribute EventHandler onmessage; attribute EventHandler onoffline; attribute EventHandler ononline; attribute EventHandler onpagehide; attribute EventHandler onpageshow; attribute EventHandler onpopstate; attribute EventHandler onresize; attribute EventHandler onscroll; attribute EventHandler onstorage; attribute EventHandler onunload; }; interface HTMLFrameElement : HTMLElement { attribute DOMString name; attribute DOMString scrolling; attribute DOMString src; attribute DOMString frameBorder; attribute DOMString longDesc; attribute boolean noResize; readonly attribute Document? contentDocument; readonly attribute WindowProxy? contentWindow; [TreatNullAs=EmptyString] attribute DOMString marginHeight; [TreatNullAs=EmptyString] attribute DOMString marginWidth; }; partial interface HTMLAnchorElement { attribute DOMString coords; attribute DOMString charset; attribute DOMString name; attribute DOMString rev; attribute DOMString shape; }; partial interface HTMLAreaElement { attribute boolean noHref; }; interface HTMLBaseFontElement : HTMLElement { attribute DOMString color; attribute DOMString face; attribute long size; }; partial interface HTMLBodyElement { [TreatNullAs=EmptyString] attribute DOMString text; [TreatNullAs=EmptyString] attribute DOMString link; [TreatNullAs=EmptyString] attribute DOMString vLink; [TreatNullAs=EmptyString] attribute DOMString aLink; [TreatNullAs=EmptyString] attribute DOMString bgColor; attribute DOMString background; }; partial interface HTMLBRElement { attribute DOMString clear; }; partial interface HTMLTableCaptionElement { attribute DOMString align; }; partial interface HTMLTableColElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; attribute DOMString width; }; interface HTMLDirectoryElement : HTMLElement { attribute boolean compact; }; partial interface HTMLDivElement { attribute DOMString align; }; partial interface HTMLDListElement { attribute boolean compact; }; partial interface HTMLEmbedElement { attribute DOMString align; attribute DOMString name; }; interface HTMLFontElement : HTMLElement { [TreatNullAs=EmptyString] attribute DOMString color; attribute DOMString face; attribute DOMString size; }; partial interface HTMLHeadingElement { attribute DOMString align; }; partial interface HTMLHRElement { attribute DOMString align; attribute DOMString color; attribute boolean noShade; attribute DOMString size; attribute DOMString width; }; partial interface HTMLHtmlElement { attribute DOMString version; }; partial interface HTMLIFrameElement { attribute DOMString align; attribute DOMString scrolling; attribute DOMString frameBorder; attribute DOMString longDesc; [TreatNullAs=EmptyString] attribute DOMString marginHeight; [TreatNullAs=EmptyString] attribute DOMString marginWidth; }; partial interface HTMLImageElement { attribute DOMString name; attribute DOMString align; attribute unsigned long hspace; attribute unsigned long vspace; attribute DOMString longDesc; [TreatNullAs=EmptyString] attribute DOMString border; }; partial interface HTMLInputElement { attribute DOMString align; attribute DOMString useMap; }; partial interface HTMLLegendElement { attribute DOMString align; }; partial interface HTMLLIElement { attribute DOMString type; }; partial interface HTMLLinkElement { attribute DOMString charset; attribute DOMString rev; attribute DOMString target; }; partial interface HTMLMenuElement { attribute boolean compact; }; partial interface HTMLMetaElement { attribute DOMString scheme; }; partial interface HTMLObjectElement { attribute DOMString align; attribute DOMString archive; attribute DOMString code; attribute boolean declare; attribute unsigned long hspace; attribute DOMString standby; attribute unsigned long vspace; attribute DOMString codeBase; attribute DOMString codeType; [TreatNullAs=EmptyString] attribute DOMString border; }; partial interface HTMLOListElement { attribute boolean compact; }; partial interface HTMLParagraphElement { attribute DOMString align; }; partial interface HTMLParamElement { attribute DOMString type; attribute DOMString valueType; }; partial interface HTMLPreElement { attribute long width; }; partial interface HTMLScriptElement { attribute DOMString event; attribute DOMString htmlFor; }; partial interface HTMLTableElement { attribute DOMString align; attribute DOMString border; attribute DOMString frame; attribute DOMString rules; attribute DOMString summary; attribute DOMString width; [TreatNullAs=EmptyString] attribute DOMString bgColor; [TreatNullAs=EmptyString] attribute DOMString cellPadding; [TreatNullAs=EmptyString] attribute DOMString cellSpacing; }; partial interface HTMLTableSectionElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; }; partial interface HTMLTableCellElement { attribute DOMString abbr; attribute DOMString align; attribute DOMString axis; attribute DOMString height; attribute DOMString width; attribute DOMString ch; attribute DOMString chOff; attribute boolean noWrap; attribute DOMString vAlign; [TreatNullAs=EmptyString] attribute DOMString bgColor; }; partial interface HTMLTableRowElement { attribute DOMString align; attribute DOMString ch; attribute DOMString chOff; attribute DOMString vAlign; [TreatNullAs=EmptyString] attribute DOMString bgColor; }; partial interface HTMLUListElement { attribute boolean compact; attribute DOMString type; }; partial interface Document { [TreatNullAs=EmptyString] attribute DOMString fgColor; [TreatNullAs=EmptyString] attribute DOMString linkColor; [TreatNullAs=EmptyString] attribute DOMString vlinkColor; [TreatNullAs=EmptyString] attribute DOMString alinkColor; [TreatNullAs=EmptyString] attribute DOMString bgColor; readonly attribute HTMLCollection anchors; readonly attribute HTMLCollection applets; void clear(); readonly attribute HTMLAllCollection all; }; netsurf-all-3.2/nsgenbind/test/data/idl/eventtarget.idl0000644000175000017500000000041412377677044022255 0ustar vincevinceinterface EventTarget { void addEventListener(DOMString type, EventListener? callback, optional boolean capture = false); void removeEventListener(DOMString type, EventListener? callback, optional boolean capture = false); boolean dispatchEvent(Event event); }; netsurf-all-3.2/nsgenbind/test/data/bindings/0000755000175000017500000000000012377713350020250 5ustar vincevincenetsurf-all-3.2/nsgenbind/test/data/bindings/window.bnd0000644000175000017500000001057112377677044022261 0ustar vincevince/* binding to generate window */ webidlfile "html.idl"; hdrcomment "Part of NetSurf Project"; preamble %{ #include #include "utils/config.h" #include "utils/log.h" #include "javascript/jsapi.h" #include "javascript/jsapi/binding.h" %} prologue %{ /* prologue comment */ %} epilogue %{ /* epilogue comment */ %} #include "dom.bnd" binding window { type js_libdom; /* the binding type */ interface Window; /* Web IDL interface to generate */ private "struct browser_window *" bw; private "struct html_content *" htmlc; internal "JSObject *" document; internal "JSObject *" navigator; internal "JSObject *" console; internal "JSObject *" location; property unshared type WindowProxy; property unshared foo; property shared type EventHandler; property shared baz; } api mark %{ if (private != NULL) { if (private->document != NULL) { JSAPI_GCMARK(private->document); } if (private->navigator != NULL) { JSAPI_GCMARK(private->navigator); } if (private->console != NULL) { JSAPI_GCMARK(private->console); } if (private->location != NULL) { JSAPI_GCMARK(private->location); } } %} api global %{ %} api init %{ JSObject *user_proto; prototype = JS_NewCompartmentAndGlobalObject(cx, &JSClass_Window, NULL); if (prototype == NULL) { return NULL; } /** @todo reconsider global object handling. future * editions of spidermonkey appear to be removing the * idea of a global so we probably need to handle * global object references internally */ /* set the contexts global */ JS_SetGlobalObject(cx, prototype); /* Populate the global object with the standard globals, like * Object and Array. */ if (!JS_InitStandardClasses(cx, prototype)) { return NULL; } /* add functions to prototype */ if (!JS_DefineFunctions(cx, prototype, jsclass_functions)) { return NULL; } /* add properties to prototype */ if (!JS_DefineProperties(cx, prototype, jsclass_properties)) return NULL; /* Initialises all the user javascript classes to make their * prototypes available. */ /** @todo should we be managing these prototype objects ourselves */ user_proto = jsapi_InitClass_Document(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_Navigator(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_Location(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_Console(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_HTMLElement(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_HTMLCollection(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_NodeList(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_Text(cx, prototype); if (user_proto == NULL) { return NULL; } user_proto = jsapi_InitClass_Node(cx, prototype); if (user_proto == NULL) { return NULL; } %} api new %{ /* @todo sort out windows that are not globals */ assert(parent == NULL); /* the window object is the global so its prototype *is* the instance */ newobject = prototype; /* instantiate the subclasses off the window global */ private->document = jsapi_new_Document(cx, NULL, newobject, (dom_document *)dom_node_ref(htmlc->document), htmlc); if (private->document == NULL) { free(private); return NULL; } private->navigator = jsapi_new_Navigator(cx, NULL, newobject); if (private->navigator == NULL) { free(private); return NULL; } private->location = jsapi_new_Location(cx, NULL, newobject, bw); if (private->location == NULL) { free(private); return NULL; } private->console = jsapi_new_Console(cx, NULL, newobject); if (private->console == NULL) { free(private); return NULL; } /** @todo forms, history */ LOG(("Created new window object %p", newobject)); %} operation confirm %{ warn_user(message, NULL); %} operation alert %{ warn_user(message, NULL); %} operation prompt %{ warn_user(message, NULL); %} getter window %{ jsret = obj; %} getter self %{ jsret = obj; %} getter EventHandler %{ /* example shared property type handler */ %} netsurf-all-3.2/nsgenbind/test/data/bindings/htmldocument.bnd0000644000175000017500000000167612377677044023463 0ustar vincevince/* test binding to generate htmldocument */ #include "document.bnd" webidlfile "htmldocument.idl"; hdrcomment "Part of NetSurf Project"; hdrcomment "multi" "line" "comment"; hdrcomment "IDL http://www.whatwg.org/specs/web-apps/current-work/#the-document-object"; preamble %{ #include #include "utils/config.h" #include "utils/log.h" #include "javascript/jsapi.h" %} operation write %{ LOG(("content %p parser %p writing %s", private->htmlc, private->htmlc->parser, text)); if (private->htmlc->parser != NULL) { dom_hubbub_parser_insert_chunk(private->htmlc->parser, (uint8_t *)text, text_len); } %} binding document { type js_libdom; /* the binding type */ /* parameters to constructor value stored in private * context structure. */ private "dom_document *" node; private "struct html_content *" htmlc; interface Document; /* Web IDL interface to generate */ } netsurf-all-3.2/nsgenbind/test/data/bindings/document.bnd0000644000175000017500000000072612377677044022571 0ustar vincevince/* test binding for document - must be included */ webidlfile "eventtarget.idl"; webidlfile "node.idl"; webidlfile "document.idl"; operation getElementById %{ dom_string *elementId_dom; dom_element *element; dom_string_create((unsigned char*)elementId, elementId_len, &elementId_dom); dom_document_get_element_by_id(private->node, elementId_dom, &element); jsretval = OBJECT_TO_JSVAL(jsapi_new_element(cx, JS_GetGlobalObject(cx), private->htmlc, element)); %} netsurf-all-3.2/nsgenbind/test/data/bindings/htmldocument2.bnd0000644000175000017500000000143212377677044023533 0ustar vincevince/* test binding to generate htmldocument */ #include "dom.bnd" webidlfile "html.idl"; hdrcomment "Part of NetSurf Project"; preamble %{ #include #include "utils/config.h" #include "utils/log.h" #include "javascript/jsapi.h" %} operation write %{ LOG(("content %p parser %p writing %s", private->htmlc, private->htmlc->parser, text)); if (private->htmlc->parser != NULL) { dom_hubbub_parser_insert_chunk(private->htmlc->parser, (uint8_t *)text, text_len); } %} binding document { type js_libdom; /* the binding type */ /* parameters to constructor value stored in private * context structure. */ private "dom_document *" node; private "struct html_content *" htmlc; interface Document; /* Web IDL interface to generate */ } netsurf-all-3.2/nsgenbind/test/data/bindings/blankidl.bnd0000644000175000017500000000003012377677044022517 0ustar vincevincewebidlfile "blank.idl"; netsurf-all-3.2/nsgenbind/test/data/bindings/dom.bnd0000644000175000017500000000063412377677044021530 0ustar vincevince/* test binding for document - must be included */ webidlfile "dom.idl"; operation getElementById %{ dom_string *elementId_dom; dom_element *element; dom_string_create((unsigned char*)elementId, elementId_len, &elementId_dom); dom_document_get_element_by_id(private->node, elementId_dom, &element); jsretval = OBJECT_TO_JSVAL(jsapi_new_element(cx, JS_GetGlobalObject(cx), private->htmlc, element)); %} netsurf-all-3.2/nsgenbind/test/data/bindings/emptyidl.bnd0000644000175000017500000000003012377677044022566 0ustar vincevincewebidlfile "empty.idl"; netsurf-all-3.2/nsgenbind/test/testrunner.sh0000755000175000017500000000150112377677044020320 0ustar vincevince#!/bin/sh outline() { echo >>${LOGFILE} echo "-----------------------------------------------------------" >>${LOGFILE} echo >>${LOGFILE} } BUILDDIR=$1 TESTDIR=$2 # locations LOGFILE=${BUILDDIR}/testlog GENJSBIND=${BUILDDIR}/nsgenbind BINDINGDIR=${TESTDIR}/data/bindings BINDINGTESTS=$(ls ${BINDINGDIR}/*.bnd) IDLDIR=${TESTDIR}/data/idl echo "$*" >${LOGFILE} for TEST in ${BINDINGTESTS};do TESTNAME=$(basename ${TEST} .bnd) echo -n " TEST: ${TESTNAME}......" outline echo ${GENJSBIND} -D -v -I ${IDLDIR} -o ${BUILDDIR}/test_${TESTNAME}.c -h ${BUILDDIR}/test_${TESTNAME}.h ${TEST} >>${LOGFILE} 2>&1 ${GENJSBIND} -D -v -I ${IDLDIR} -o ${BUILDDIR}/test_${TESTNAME}.c -h ${BUILDDIR}/test_${TESTNAME}.h ${TEST} >>${LOGFILE} 2>&1 if [ $? -eq 0 ]; then echo "PASS" else echo "FAIL" fi done netsurf-all-3.2/nsgenbind/test/Makefile0000644000175000017500000000024312377677044017212 0ustar vincevince TEST_TARGETS := $(TEST_TARGETS) test_bindings test_bindings: $(Q)$(SHAREDLDPATH) $(TESTRUNNER) $(BUILDDIR) $(CURDIR)/test include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/nsgenbind/README0000644000175000017500000000031112377677044015447 0ustar vincevincegenjsbind ========= This is a tool to generate javascript to dom bindings from w3c webidl files and a binding configuration file. building -------- The tool requires bison and flex as pre-requisitesnetsurf-all-3.2/nsgenbind/COPYING0000644000175000017500000000210412377677044015624 0ustar vincevinceCopyright 2012 Vincent Sanders Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. netsurf-all-3.2/nsgenbind/src/0000755000175000017500000000000012377713350015352 5ustar vincevincenetsurf-all-3.2/nsgenbind/src/options.h0000644000175000017500000000212312377677044017225 0ustar vincevince/* binding generator options * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #ifndef nsgenbind_options_h #define nsgenbind_options_h /** global options */ struct options { char *infilename; /**< binding source */ char *outfilename; /**< output source file */ char *hdrfilename; /**< output header file */ char *depfilename; /**< dependancy output*/ FILE *depfilehandle; /**< dependancy file handle */ char *idlpath; /**< path to IDL files */ bool verbose; /**< verbose processing */ bool debug; /**< debug enabled */ bool dbglog; /**< embed debug logging in output */ unsigned int warnings; /**< warning flags */ }; extern struct options *options; enum opt_warnings { WARNING_UNIMPLEMENTED = 1, }; #define WARNING_ALL (WARNING_UNIMPLEMENTED) #define WARN(flags, msg, args...) do { \ if ((options->warnings & flags) != 0) { \ fprintf(stderr, "%s: warning:"msg"\n", __func__, ## args); \ } \ } while(0) #endif netsurf-all-3.2/nsgenbind/src/nsgenbind-ast.c0000644000175000017500000002306212377677044020266 0ustar vincevince/* binding generator AST implementation for parser * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ /** @todo this currently stuffs everything in one global tree, not very nice */ #include #include #include #include #include #include "nsgenbind-ast.h" #include "options.h" /* parser and lexer interface */ extern int nsgenbind_debug; extern int nsgenbind__flex_debug; extern void nsgenbind_restart(FILE*); extern int nsgenbind_parse(struct genbind_node **genbind_ast); /* terminal nodes have a value only */ struct genbind_node { enum genbind_node_type type; struct genbind_node *l; union { void *value; struct genbind_node *node; char *text; int number; /* node data is an integer */ } r; }; char *genbind_strapp(char *a, char *b) { char *fullstr; int fulllen; fulllen = strlen(a) + strlen(b) + 1; fullstr = malloc(fulllen); snprintf(fullstr, fulllen, "%s%s", a, b); free(a); free(b); return fullstr; } struct genbind_node *genbind_node_link(struct genbind_node *tgt, struct genbind_node *src) { tgt->l = src; return tgt; } struct genbind_node * genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r) { struct genbind_node *nn; nn = calloc(1, sizeof(struct genbind_node)); nn->type = type; nn->l = l; nn->r.value = r; return nn; } int genbind_node_for_each_type(struct genbind_node *node, enum genbind_node_type type, genbind_callback_t *cb, void *ctx) { int ret; if (node == NULL) { return -1; } if (node->l != NULL) { ret = genbind_node_for_each_type(node->l, type, cb, ctx); if (ret != 0) { return ret; } } if (node->type == type) { return cb(node, ctx); } return 0; } /* exported interface defined in nsgenbind-ast.h */ struct genbind_node * genbind_node_find(struct genbind_node *node, struct genbind_node *prev, genbind_callback_t *cb, void *ctx) { struct genbind_node *ret; if ((node == NULL) || (node == prev)) { return NULL; } if (node->l != prev) { ret = genbind_node_find(node->l, prev, cb, ctx); if (ret != NULL) { return ret; } } if (cb(node, ctx) != 0) { return node; } return NULL; } /* exported interface documented in nsgenbind-ast.h */ struct genbind_node * genbind_node_find_type(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type type) { return genbind_node_find(node, prev, genbind_cmp_node_type, (void *)type); } /* exported interface documented in nsgenbind-ast.h */ struct genbind_node * genbind_node_find_type_ident(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type type, const char *ident) { struct genbind_node *found_node; struct genbind_node *ident_node; if (ident == NULL) { return NULL; } found_node = genbind_node_find_type(node, prev, type); while (found_node != NULL) { /* look for an ident node */ ident_node = genbind_node_find_type(genbind_node_getnode(found_node), NULL, GENBIND_NODE_TYPE_IDENT); if (ident_node != NULL) { if (strcmp(ident_node->r.text, ident) == 0) break; } /* look for next matching node */ found_node = genbind_node_find_type(node, found_node, type); } return found_node; } /* exported interface documented in nsgenbind-ast.h */ struct genbind_node * genbind_node_find_type_type(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type type, const char *ident) { struct genbind_node *found_node; struct genbind_node *ident_node; found_node = genbind_node_find_type(node, prev, type); while (found_node != NULL) { /* look for a type node */ ident_node = genbind_node_find_type(genbind_node_getnode(found_node), NULL, GENBIND_NODE_TYPE_TYPE); if (ident_node != NULL) { if (strcmp(ident_node->r.text, ident) == 0) break; } /* look for next matching node */ found_node = genbind_node_find_type(node, found_node, type); } return found_node; } int genbind_cmp_node_type(struct genbind_node *node, void *ctx) { if (node->type == (enum genbind_node_type)ctx) return 1; return 0; } char *genbind_node_gettext(struct genbind_node *node) { if (node != NULL) { switch(node->type) { case GENBIND_NODE_TYPE_WEBIDLFILE: case GENBIND_NODE_TYPE_STRING: case GENBIND_NODE_TYPE_PREAMBLE: case GENBIND_NODE_TYPE_PROLOGUE: case GENBIND_NODE_TYPE_EPILOGUE: case GENBIND_NODE_TYPE_IDENT: case GENBIND_NODE_TYPE_TYPE: case GENBIND_NODE_TYPE_BINDING_INTERFACE: case GENBIND_NODE_TYPE_CBLOCK: return node->r.text; default: break; } } return NULL; } struct genbind_node *genbind_node_getnode(struct genbind_node *node) { if (node != NULL) { switch(node->type) { case GENBIND_NODE_TYPE_HDRCOMMENT: case GENBIND_NODE_TYPE_BINDING: case GENBIND_NODE_TYPE_BINDING_PRIVATE: case GENBIND_NODE_TYPE_BINDING_INTERNAL: case GENBIND_NODE_TYPE_BINDING_PROPERTY: case GENBIND_NODE_TYPE_OPERATION: case GENBIND_NODE_TYPE_API: case GENBIND_NODE_TYPE_GETTER: case GENBIND_NODE_TYPE_SETTER: return node->r.node; default: break; } } return NULL; } int genbind_node_getint(struct genbind_node *node) { if (node != NULL) { switch(node->type) { case GENBIND_NODE_TYPE_MODIFIER: return node->r.number; default: break; } } return -1; } static const char *genbind_node_type_to_str(enum genbind_node_type type) { switch(type) { case GENBIND_NODE_TYPE_IDENT: return "Ident"; case GENBIND_NODE_TYPE_ROOT: return "Root"; case GENBIND_NODE_TYPE_WEBIDLFILE: return "webidlfile"; case GENBIND_NODE_TYPE_HDRCOMMENT: return "HdrComment"; case GENBIND_NODE_TYPE_STRING: return "String"; case GENBIND_NODE_TYPE_PREAMBLE: return "Preamble"; case GENBIND_NODE_TYPE_BINDING: return "Binding"; case GENBIND_NODE_TYPE_TYPE: return "Type"; case GENBIND_NODE_TYPE_BINDING_PRIVATE: return "Private"; case GENBIND_NODE_TYPE_BINDING_INTERNAL: return "Internal"; case GENBIND_NODE_TYPE_BINDING_INTERFACE: return "Interface"; case GENBIND_NODE_TYPE_BINDING_PROPERTY: return "Property"; case GENBIND_NODE_TYPE_OPERATION: return "Operation"; case GENBIND_NODE_TYPE_API: return "API"; case GENBIND_NODE_TYPE_GETTER: return "Getter"; case GENBIND_NODE_TYPE_SETTER: return "Setter"; case GENBIND_NODE_TYPE_CBLOCK: return "CBlock"; default: return "Unknown"; } } int genbind_ast_dump(struct genbind_node *node, int indent) { const char *SPACES=" "; char *txt; while (node != NULL) { printf("%.*s%s", indent, SPACES, genbind_node_type_to_str(node->type)); txt = genbind_node_gettext(node); if (txt == NULL) { printf("\n"); genbind_ast_dump(genbind_node_getnode(node), indent + 2); } else { printf(": \"%.*s\"\n", 75 - indent, txt); } node = node->l; } return 0; } FILE *genbindopen(const char *filename) { FILE *genfile; char *fullname; int fulllen; static char *prevfilepath = NULL; /* try filename raw */ genfile = fopen(filename, "r"); if (genfile != NULL) { if (options->verbose) { printf("Opened Genbind file %s\n", filename); } if (prevfilepath == NULL) { fullname = strrchr(filename, '/'); if (fullname == NULL) { fulllen = strlen(filename); } else { fulllen = fullname - filename; } prevfilepath = strndup(filename,fulllen); } if (options->depfilehandle != NULL) { fprintf(options->depfilehandle, " \\\n\t%s", filename); } return genfile; } /* try based on previous filename */ if (prevfilepath != NULL) { fulllen = strlen(prevfilepath) + strlen(filename) + 2; fullname = malloc(fulllen); snprintf(fullname, fulllen, "%s/%s", prevfilepath, filename); if (options->debug) { printf("Attempting to open Genbind file %s\n", fullname); } genfile = fopen(fullname, "r"); if (genfile != NULL) { if (options->verbose) { printf("Opened Genbind file %s\n", fullname); } if (options->depfilehandle != NULL) { fprintf(options->depfilehandle, " \\\n\t%s", fullname); } free(fullname); return genfile; } free(fullname); } /* try on idl path */ if (options->idlpath != NULL) { fulllen = strlen(options->idlpath) + strlen(filename) + 2; fullname = malloc(fulllen); snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename); genfile = fopen(fullname, "r"); if ((genfile != NULL) && options->verbose) { printf("Opend Genbind file %s\n", fullname); if (options->depfilehandle != NULL) { fprintf(options->depfilehandle, " \\\n\t%s", fullname); } } free(fullname); } return genfile; } int genbind_parsefile(char *infilename, struct genbind_node **ast) { FILE *infile; /* open input file */ if ((infilename[0] == '-') && (infilename[1] == 0)) { if (options->verbose) { printf("Using stdin for input\n"); } infile = stdin; } else { infile = genbindopen(infilename); } if (!infile) { fprintf(stderr, "Error opening %s: %s\n", infilename, strerror(errno)); return 3; } if (options->debug) { nsgenbind_debug = 1; nsgenbind__flex_debug = 1; } /* set flex to read from file */ nsgenbind_restart(infile); /* process binding */ return nsgenbind_parse(ast); } #ifdef NEED_STRNDUP char *strndup(const char *s, size_t n) { size_t len; char *s2; for (len = 0; len != n && s[len]; len++) continue; s2 = malloc(len + 1); if (!s2) return 0; memcpy(s2, s, len); s2[len] = 0; return s2; } #endif netsurf-all-3.2/nsgenbind/src/webidl-ast.h0000644000175000017500000000641412377677044017574 0ustar vincevince/* Web IDL AST interface * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #ifndef nsgenbind_webidl_ast_h #define nsgenbind_webidl_ast_h enum webidl_node_type { /* generic node types which define structure or attributes */ WEBIDL_NODE_TYPE_ROOT = 0, WEBIDL_NODE_TYPE_IDENT, /** access modifier e.g. for attributes or types */ WEBIDL_NODE_TYPE_MODIFIER, /** a list of nodes (interface members, arguments) */ WEBIDL_NODE_TYPE_LIST, /* non structural node types */ WEBIDL_NODE_TYPE_INTERFACE, WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, WEBIDL_NODE_TYPE_ATTRIBUTE, WEBIDL_NODE_TYPE_OPERATION, WEBIDL_NODE_TYPE_CONST, WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT, WEBIDL_NODE_TYPE_ARGUMENT, WEBIDL_NODE_TYPE_ELLIPSIS, WEBIDL_NODE_TYPE_TYPE, WEBIDL_NODE_TYPE_TYPE_BASE, WEBIDL_NODE_TYPE_TYPE_NULLABLE, WEBIDL_NODE_TYPE_TYPE_ARRAY, WEBIDL_NODE_TYPE_LITERAL_NULL, WEBIDL_NODE_TYPE_LITERAL_INT, WEBIDL_NODE_TYPE_LITERAL_BOOL, WEBIDL_NODE_TYPE_LITERAL_FLOAT, WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, }; enum webidl_type { WEBIDL_TYPE_USER, WEBIDL_TYPE_BOOL, WEBIDL_TYPE_BYTE, WEBIDL_TYPE_OCTET, WEBIDL_TYPE_FLOAT, WEBIDL_TYPE_DOUBLE, WEBIDL_TYPE_SHORT, WEBIDL_TYPE_LONG, WEBIDL_TYPE_LONGLONG, WEBIDL_TYPE_STRING, WEBIDL_TYPE_SEQUENCE, WEBIDL_TYPE_OBJECT, WEBIDL_TYPE_DATE, WEBIDL_TYPE_VOID, }; enum webidl_type_modifier { WEBIDL_TYPE_MODIFIER_UNSIGNED, WEBIDL_TYPE_MODIFIER_UNRESTRICTED, WEBIDL_TYPE_READONLY, }; struct webidl_node; /** callback for search and iteration routines */ typedef int (webidl_callback_t)(struct webidl_node *node, void *ctx); int webidl_cmp_node_type(struct webidl_node *node, void *ctx); struct webidl_node *webidl_node_new(enum webidl_node_type, struct webidl_node *l, void *r); void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void *r); struct webidl_node *webidl_node_prepend(struct webidl_node *list, struct webidl_node *node); struct webidl_node *webidl_node_append(struct webidl_node *list, struct webidl_node *node); struct webidl_node *webidl_node_add(struct webidl_node *node, struct webidl_node *list); /* node contents acessors */ char *webidl_node_gettext(struct webidl_node *node); struct webidl_node *webidl_node_getnode(struct webidl_node *node); int webidl_node_getint(struct webidl_node *node); enum webidl_node_type webidl_node_gettype(struct webidl_node *node); /* node searches */ int webidl_node_for_each_type(struct webidl_node *node, enum webidl_node_type type, webidl_callback_t *cb, void *ctx); struct webidl_node * webidl_node_find(struct webidl_node *node, struct webidl_node *prev, webidl_callback_t *cb, void *ctx); struct webidl_node * webidl_node_find_type(struct webidl_node *node, struct webidl_node *prev, enum webidl_node_type type); struct webidl_node * webidl_node_find_type_ident(struct webidl_node *root_node, enum webidl_node_type type, const char *ident); /* debug dump */ int webidl_ast_dump(struct webidl_node *node, int indent); /** parse web idl file */ int webidl_parsefile(char *filename, struct webidl_node **webidl_ast); #endif netsurf-all-3.2/nsgenbind/src/nsgenbind.c0000644000175000017500000000646412377677044017510 0ustar vincevince/* binding generator main and command line parsing * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include #include #include "nsgenbind-ast.h" #include "jsapi-libdom.h" #include "options.h" struct options *options; static struct options* process_cmdline(int argc, char **argv) { int opt; options = calloc(1,sizeof(struct options)); if (options == NULL) { fprintf(stderr, "Allocation error\n"); return NULL; } while ((opt = getopt(argc, argv, "vgDW::d:I:o:h:")) != -1) { switch (opt) { case 'I': options->idlpath = strdup(optarg); break; case 'o': options->outfilename = strdup(optarg); break; case 'h': options->hdrfilename = strdup(optarg); break; case 'd': options->depfilename = strdup(optarg); break; case 'v': options->verbose = true; break; case 'D': options->debug = true; break; case 'g': options->dbglog = true; break; case 'W': options->warnings = 1; /* warning flags */ break; default: /* '?' */ fprintf(stderr, "Usage: %s [-v] [-g] [-D] [-W] [-d depfilename] [-I idlpath] [-o filename] [-h headerfile] inputfile\n", argv[0]); free(options); return NULL; } } if (optind >= argc) { fprintf(stderr, "Error: expected input filename\n"); free(options); return NULL; } options->infilename = strdup(argv[optind]); return options; } int main(int argc, char **argv) { int res; struct genbind_node *genbind_root; options = process_cmdline(argc, argv); if (options == NULL) { return 1; /* bad commandline */ } if (options->verbose && (options->outfilename == NULL)) { fprintf(stderr, "Error: output to stdout with verbose logging would fail\n"); return 2; } if (options->depfilename != NULL && options->outfilename == NULL) { fprintf(stderr, "Error: output to stdout with dep generation would fail\n"); return 3; } if (options->depfilename != NULL && options->infilename == NULL) { fprintf(stderr, "Error: input from stdin with dep generation would fail\n"); return 3; } if (options->depfilename != NULL) { options->depfilehandle = fopen(options->depfilename, "w"); if (options->depfilehandle == NULL) { fprintf(stderr, "Error: unable to open dep file\n"); return 4; } fprintf(options->depfilehandle, "%s %s :", options->depfilename, options->outfilename); } res = genbind_parsefile(options->infilename, &genbind_root); if (res != 0) { fprintf(stderr, "Error: parse failed with code %d\n", res); return res; } if (options->verbose) { genbind_ast_dump(genbind_root, 0); } res = jsapi_libdom_output(options->outfilename, options->hdrfilename, genbind_root); if (res != 0) { fprintf(stderr, "Error: output failed with code %d\n", res); if (options->outfilename != NULL) { unlink(options->outfilename); } if (options->hdrfilename != NULL) { unlink(options->hdrfilename); } return res; } if (options->depfilehandle != NULL) { fputc('\n', options->depfilehandle); fclose(options->depfilehandle); } return 0; } netsurf-all-3.2/nsgenbind/src/webidl-ast.c0000644000175000017500000002077512377677044017575 0ustar vincevince/* AST generator for the WEB IDL parser * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include "webidl-ast.h" #include "options.h" extern int webidl_debug; extern int webidl__flex_debug; extern void webidl_restart(FILE*); extern int webidl_parse(struct webidl_node **webidl_ast); struct webidl_node { enum webidl_node_type type; struct webidl_node *l; union { void *value; struct webidl_node *node; /* node has a list of nodes */ char *text; /* node data is text */ int number; /* node data is an integer */ } r; }; /* insert node(s) at beginning of a list */ struct webidl_node * webidl_node_prepend(struct webidl_node *list, struct webidl_node *inst) { struct webidl_node *end = inst; if (inst == NULL) { return list; /* no node to prepend - return existing list */ } /* find end of inserted node list */ while (end->l != NULL) { end = end->l; } end->l = list; return inst; } /* append node at end of a list */ struct webidl_node * webidl_node_append(struct webidl_node *list, struct webidl_node *node) { struct webidl_node *cur = list; if (cur == NULL) { return node; /* no existing list so just return node */ } while (cur->l != NULL) { cur = cur->l; } cur->l = node; return list; } /* prepend list to a nodes list * * inserts a list into the beginning of a nodes r list * * CAUTION: if the \a node element is not a node type the node will not be added */ struct webidl_node * webidl_node_add(struct webidl_node *node, struct webidl_node *list) { if (node == NULL) { return list; } /* this does not use webidl_node_getnode() as it cannot * determine between an empty node and a node which is not a * list type */ switch (node->type) { case WEBIDL_NODE_TYPE_ROOT: case WEBIDL_NODE_TYPE_INTERFACE: case WEBIDL_NODE_TYPE_LIST: case WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE: case WEBIDL_NODE_TYPE_ATTRIBUTE: case WEBIDL_NODE_TYPE_OPERATION: case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT: case WEBIDL_NODE_TYPE_ARGUMENT: case WEBIDL_NODE_TYPE_TYPE: case WEBIDL_NODE_TYPE_CONST: break; default: /* not a node type node */ return list; } node->r.node = webidl_node_prepend(node->r.node, list); return node; } struct webidl_node * webidl_node_new(enum webidl_node_type type, struct webidl_node *l, void *r) { struct webidl_node *nn; nn = calloc(1, sizeof(struct webidl_node)); nn->type = type; nn->l = l; nn->r.text = r; return nn; } void webidl_node_set(struct webidl_node *node, enum webidl_node_type type, void *r) { node->type = type; node->r.value = r; } int webidl_node_for_each_type(struct webidl_node *node, enum webidl_node_type type, webidl_callback_t *cb, void *ctx) { int ret; if (node == NULL) { return -1; } if (node->l != NULL) { ret = webidl_node_for_each_type(node->l, type, cb, ctx); if (ret != 0) { return ret; } } if (node->type == type) { return cb(node, ctx); } return 0; } /* exported interface defined in webidl-ast.h */ int webidl_cmp_node_type(struct webidl_node *node, void *ctx) { if (node->type == (enum webidl_node_type)ctx) return 1; return 0; } /* exported interface defined in webidl-ast.h */ struct webidl_node * webidl_node_find(struct webidl_node *node, struct webidl_node *prev, webidl_callback_t *cb, void *ctx) { struct webidl_node *ret; if ((node == NULL) || (node == prev)) { return NULL; } if (node->l != prev) { ret = webidl_node_find(node->l, prev, cb, ctx); if (ret != NULL) { return ret; } } if (cb(node, ctx) != 0) { return node; } return NULL; } /* exported interface defined in webidl-ast.h */ struct webidl_node * webidl_node_find_type(struct webidl_node *node, struct webidl_node *prev, enum webidl_node_type type) { return webidl_node_find(node, prev, webidl_cmp_node_type, (void *)type); } struct webidl_node * webidl_node_find_type_ident(struct webidl_node *root_node, enum webidl_node_type type, const char *ident) { struct webidl_node *node; struct webidl_node *ident_node; node = webidl_node_find_type(root_node, NULL, type); while (node != NULL) { ident_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_IDENT); if (ident_node != NULL) { if (strcmp(ident_node->r.text, ident) == 0) break; } node = webidl_node_find_type(root_node, node, type); } return node; } char *webidl_node_gettext(struct webidl_node *node) { if (node != NULL) { switch(node->type) { case WEBIDL_NODE_TYPE_IDENT: case WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE: case WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS: return node->r.text; default: break; } } return NULL; } int webidl_node_getint(struct webidl_node *node) { if (node != NULL) { switch(node->type) { case WEBIDL_NODE_TYPE_MODIFIER: case WEBIDL_NODE_TYPE_TYPE_BASE: case WEBIDL_NODE_TYPE_LITERAL_INT: return node->r.number; default: break; } } return -1; } enum webidl_node_type webidl_node_gettype(struct webidl_node *node) { return node->type; } struct webidl_node *webidl_node_getnode(struct webidl_node *node) { if (node != NULL) { switch (node->type) { case WEBIDL_NODE_TYPE_ROOT: case WEBIDL_NODE_TYPE_INTERFACE: case WEBIDL_NODE_TYPE_LIST: case WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE: case WEBIDL_NODE_TYPE_ATTRIBUTE: case WEBIDL_NODE_TYPE_OPERATION: case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT: case WEBIDL_NODE_TYPE_ARGUMENT: case WEBIDL_NODE_TYPE_TYPE: case WEBIDL_NODE_TYPE_CONST: return node->r.node; default: break; } } return NULL; } static const char *webidl_node_type_to_str(enum webidl_node_type type) { switch(type) { case WEBIDL_NODE_TYPE_ROOT: return "root"; case WEBIDL_NODE_TYPE_IDENT: return "Ident"; case WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE: return "Inherit"; case WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS: return "Implements"; case WEBIDL_NODE_TYPE_INTERFACE: return "Interface"; case WEBIDL_NODE_TYPE_LIST: return "List"; case WEBIDL_NODE_TYPE_ATTRIBUTE: return "Attribute"; case WEBIDL_NODE_TYPE_OPERATION: return "Operation"; case WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT: return "Argument(opt)"; case WEBIDL_NODE_TYPE_ARGUMENT: return "Argument"; case WEBIDL_NODE_TYPE_ELLIPSIS: return "Ellipsis"; case WEBIDL_NODE_TYPE_TYPE: return "Type"; case WEBIDL_NODE_TYPE_TYPE_BASE: return "Base"; case WEBIDL_NODE_TYPE_TYPE_NULLABLE: return "Nullable"; case WEBIDL_NODE_TYPE_TYPE_ARRAY: return "Array"; case WEBIDL_NODE_TYPE_MODIFIER: return "Modifier"; case WEBIDL_NODE_TYPE_CONST: return "Const"; case WEBIDL_NODE_TYPE_LITERAL_INT: return "Literal (int)"; case WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE: return "Extended Attribute"; default: return "Unknown"; } } int webidl_ast_dump(struct webidl_node *node, int indent) { const char *SPACES=" "; char *txt; while (node != NULL) { printf("%.*s%s", indent, SPACES, webidl_node_type_to_str(node->type)); txt = webidl_node_gettext(node); if (txt == NULL) { struct webidl_node *next; next = webidl_node_getnode(node); if (next != NULL) { printf("\n"); webidl_ast_dump(next, indent + 2); } else { /* not txt or node has to be an int */ printf(": %d\n", webidl_node_getint(node)); } } else { printf(": \"%s\"\n", txt); } node = node->l; } return 0; } static FILE *idlopen(const char *filename) { FILE *idlfile; char *fullname; int fulllen; if (options->idlpath == NULL) { if (options->verbose) { printf("Opening IDL file %s\n", filename); } return fopen(filename, "r"); } fulllen = strlen(options->idlpath) + strlen(filename) + 2; fullname = malloc(fulllen); snprintf(fullname, fulllen, "%s/%s", options->idlpath, filename); if (options->verbose) { printf("Opening IDL file %s\n", fullname); } idlfile = fopen(fullname, "r"); free(fullname); return idlfile; } int webidl_parsefile(char *filename, struct webidl_node **webidl_ast) { FILE *idlfile; idlfile = idlopen(filename); if (!idlfile) { fprintf(stderr, "Error opening %s: %s\n", filename, strerror(errno)); return 2; } if (options->debug) { webidl_debug = 1; webidl__flex_debug = 1; } /* set flex to read from file */ webidl_restart(idlfile); /* parse the file */ return webidl_parse(webidl_ast); } netsurf-all-3.2/nsgenbind/src/webidl-lexer.l0000644000175000017500000002014112377677044020121 0ustar vincevince%{ /* This is a unicode tolerant lexer for web IDL * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders * * Derived from: * * W3C WEB IDL - http://www.w3.org/TR/WebIDL/ (especially the grammar * in apendix A) * * The ECMA script spec - * http://ecma-international.org/ecma-262/5.1/#sec-7.2 (expecially * section 7.2 for unicode value handling) */ #include #include #include #include "webidl-parser.h" #define YY_USER_ACTION yylloc->first_line = yylloc->last_line; \ yylloc->first_column = yylloc->last_column + 1; \ yylloc->last_column += yyleng; /* Ensure compatability with bison 2.6 and later */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED && defined WEBIDL_STYPE_IS_DECLARED #define YYSTYPE WEBIDL_STYPE #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED && defined WEBIDL_LTYPE_IS_DECLARED #define YYLTYPE WEBIDL_LTYPE #endif %} /* lexer options */ %option never-interactive %option yylineno %option bison-bridge %option bison-locations %option warn %option prefix="webidl_" %option nounput %option noyywrap /* regular definitions */ /* ecmascript section 7.2 defines whitespace http://ecma-international.org/ecma-262/5.1/#sec-7.2 * Web IDL appendix A has the IDL grammar http://www.w3.org/TR/WebIDL/#idl-grammar */ /* we do not define space, line feed, carriage return, tab, vertical * tab or form feed here as they are the standard C escapes */ /* other Unicode space separator */ USP (\xe1\x9a\x80)|(\xe1\xa0\x8e)|(\xe2\x80[\x80-\x8a])|(\xe2\x80\xaf)|(\xe2\x81\x9f)|(\xe3\x80\x80) /* Line separator \u2028 */ LS (\xe2\x80\xa8) /* paragraph separator \u2029 */ PS (\xe2\x80\xa9) /* non breaking space \u00A0 */ NBSP (\xc2\xa0) /* web idl grammar for whitespace matches single and multiline * comments too. Here there are separate definitions for both single * and multiline comments. */ whitespace ([ \t\v\f]|{NBSP}|{USP}) multicomment \/\*(([^*])|(\*[^/]))*\*\/ singlecomment \/\/ lineend ([\n\r]|{LS}|{PS}) /* integer numbers in hexidecimal, decimal and octal, slight extension * to spec which only allows for decimal values */ hexdigit [0-9A-Fa-f] hexint 0(x|X){hexdigit}+ decimalint 0|([1-9][0-9]*) octalint (0[0-8]+) /* decimal floating point number */ decimalexponent (e|E)[\+\-]?[0-9]+ decimalfloat ({decimalint}\.[0-9]*{decimalexponent}?)|(\.[0-9]+{decimalexponent}?)|({decimalint}{decimalexponent}?) /* quoted string. spec simply has "[^"]*" but here escapes are allowed for */ hexescseq x{hexdigit}{2} unicodeescseq u{hexdigit}{4} characterescseq ['\"\\bfnrtv]|[^'\"\\bfnrtv\n\r] escseq {characterescseq}|0|{hexescseq}|{unicodeescseq} quotedstring ([^\"\\\n\r]|\\{escseq}) /* web idl identifier direct from spec */ identifier [A-Z_a-z][0-9A-Z_a-z]* /* web idl other direct from spec */ other [^\t\n\r 0-9A-Z_a-z] /* used for #include directive - not part of web idl spec */ poundsign ^{whitespace}*# %x incl %% {whitespace} ++yylloc->last_column; /* skip whitespace */ {lineend} if (yytext[0] != '\r') { /* update position counts */ ++yylloc->last_line; yylloc->last_column = 0; } /* Simple text terminals */ boolean return TOK_BOOLEAN; byte return TOK_BYTE; octet return TOK_OCTET; attribute return TOK_ATTRIBUTE; callback return TOK_CALLBACK; const return TOK_CONST; creator return TOK_CREATOR; deleter return TOK_DELETER; dictionary return TOK_DICTIONARY; enum return TOK_ENUM; exception return TOK_EXCEPTION; getter return TOK_GETTER; implements return TOK_IMPLEMENTS; inherit return TOK_INHERIT; interface return TOK_INTERFACE; legacycaller return TOK_LEGACYCALLER; partial return TOK_PARTIAL; setter return TOK_SETTER; static return TOK_STATIC; stringifier return TOK_STRINGIFIER; typedef return TOK_TYPEDEF; unrestricted return TOK_UNRESTRICTED; "..." return TOK_ELLIPSIS; Date return TOK_DATE; DOMString return TOK_STRING; /* dom strings are just strings */ Infinity return TOK_INFINITY; NaN return TOK_NAN; any return TOK_ANY; double return TOK_DOUBLE; false return TOK_FALSE; float return TOK_FLOAT; long return TOK_LONG; null return TOK_NULL_LITERAL; object yylval->text = strdup(yytext); return TOK_IDENTIFIER; or return TOK_OR; optional return TOK_OPTIONAL; sequence return TOK_SEQUENCE; short return TOK_SHORT; true return TOK_TRUE; unsigned return TOK_UNSIGNED; void return TOK_VOID; readonly return TOK_READONLY; {identifier} { /* A leading "_" is used to escape an identifier from * looking like a reserved word terminal. */ yylval->text = (yytext[0] == '_') ? strdup(yytext + 1) : strdup(yytext); return TOK_IDENTIFIER; } {decimalint} yylval->value = strtol(yytext, NULL, 10); return TOK_INT_LITERAL; {octalint} yylval->value = strtol(yytext, NULL, 8); return TOK_INT_LITERAL; {hexint} yylval->value = strtol(yytext, NULL, 16); return TOK_INT_LITERAL; {decimalfloat} yylval->text = strdup(yytext); return TOK_FLOAT_LITERAL; \"{quotedstring}*\" yylval->text = strdup(yytext); return TOK_STRING_LITERAL; {multicomment} { /* multicomment */ char* s = yytext; for (; *s; ++s) { if (*s == '\n') { ++yylloc->last_line; yylloc->last_column = 0; } else { ++yylloc->last_column; } } if (strncmp(yytext, "/**", 3) == 0) { /* Javadoc style comment */ yylval->text = strdup(yytext); return TOK_JAVADOC; } } {singlecomment} { /* singlecomment */ int c; do { c = input(); } while (c != '\n' && c != '\r' && c != EOF); ++yylloc->last_line; yylloc->last_column = 0; } {poundsign}include BEGIN(incl); {other} return (int) yytext[0]; [ \t]*\" /* eat the whitespace and open quotes */ [^\t\n\"]+ { /* got the include file name */ yyin = fopen( yytext, "r" ); if ( ! yyin ) { fprintf(stderr, "Unable to open include %s\n", yytext); exit(3); } yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE )); BEGIN(INITIAL); } \n BEGIN(INITIAL); <> { yypop_buffer_state(); if ( !YY_CURRENT_BUFFER ) { yyterminate(); } else { BEGIN(incl); } } %% netsurf-all-3.2/nsgenbind/src/jsapi-libdom-const.c0000644000175000017500000001147112377677044021231 0ustar vincevince/* const property generation * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include "options.h" #include "nsgenbind-ast.h" #include "webidl-ast.h" #include "jsapi-libdom.h" static int output_cast_literal(struct binding *binding, struct webidl_node *node) { struct webidl_node *type_node = NULL; struct webidl_node *literal_node = NULL; struct webidl_node *type_base = NULL; enum webidl_type webidl_arg_type; type_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_TYPE); type_base = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_BOOL: /* JSBool */ literal_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_LITERAL_BOOL); fprintf(binding->outfile, "BOOLEAN_TO_JSVAL(JS_FALSE)"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ literal_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_LITERAL_FLOAT); fprintf(binding->outfile, "DOUBLE_TO_JSVAL(0.0)"); break; case WEBIDL_TYPE_LONG: /* int32_t */ literal_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_LITERAL_INT); fprintf(binding->outfile, "INT_TO_JSVAL(%d)", webidl_node_getint(literal_node)); break; case WEBIDL_TYPE_SHORT: /* int16_t */ literal_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_LITERAL_INT); fprintf(binding->outfile, "INT_TO_JSVAL(%d)", webidl_node_getint(literal_node)); break; case WEBIDL_TYPE_STRING: case WEBIDL_TYPE_BYTE: case WEBIDL_TYPE_OCTET: case WEBIDL_TYPE_LONGLONG: case WEBIDL_TYPE_SEQUENCE: case WEBIDL_TYPE_OBJECT: case WEBIDL_TYPE_DATE: case WEBIDL_TYPE_VOID: case WEBIDL_TYPE_USER: default: WARN(WARNING_UNIMPLEMENTED, "types not allowed as literal"); break; /* @todo these types are not allowed here */ } return 0; } static int webidl_const_define_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *ident_node; ident_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* Broken AST - must have ident */ return 1; } fprintf(binding->outfile, "\tJS_DefineProperty(cx,\n" "\t\tprototype,\n" "\t\t\"%s\",\n" "\t\t", webidl_node_gettext(ident_node)); output_cast_literal(binding, node); fprintf(binding->outfile, ",\n" "\t\tJS_PropertyStub,\n" "\t\tJS_StrictPropertyStub,\n" "\t\tJSPROP_READONLY | JSPROP_ENUMERATE | JSPROP_PERMANENT);\n\n"); return 0; } /* callback to emit implements property spec */ static int webidl_const_spec_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return output_const_defines(binding, webidl_node_gettext(node)); } int output_const_defines(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } /* generate property entries for each list (partial interfaces) */ members_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"\t/**** %s ****/\n", interface); /* for each const emit a property define */ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_CONST, webidl_const_define_cb, binding); members_node = webidl_node_find_type(webidl_node_getnode(interface_node), members_node, WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = output_const_defines(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_const_spec_implements_cb, binding); } return res; } netsurf-all-3.2/nsgenbind/src/nsgenbind-ast.h0000644000175000017500000001104512377677044020271 0ustar vincevince/* binding file AST interface * * This file is part of nsnsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #ifndef nsgenbind_nsgenbind_ast_h #define nsgenbind_nsgenbind_ast_h enum genbind_node_type { GENBIND_NODE_TYPE_ROOT = 0, GENBIND_NODE_TYPE_IDENT, /**< generic identifier string */ GENBIND_NODE_TYPE_TYPE, /**< generic type string */ GENBIND_NODE_TYPE_MODIFIER, /**< node modifier */ GENBIND_NODE_TYPE_CBLOCK, GENBIND_NODE_TYPE_WEBIDLFILE, GENBIND_NODE_TYPE_HDRCOMMENT, GENBIND_NODE_TYPE_STRING, GENBIND_NODE_TYPE_PREAMBLE, GENBIND_NODE_TYPE_PROLOGUE, GENBIND_NODE_TYPE_EPILOGUE, GENBIND_NODE_TYPE_BINDING, GENBIND_NODE_TYPE_BINDING_PRIVATE, GENBIND_NODE_TYPE_BINDING_INTERNAL, GENBIND_NODE_TYPE_BINDING_INTERFACE, GENBIND_NODE_TYPE_BINDING_PROPERTY, GENBIND_NODE_TYPE_API, GENBIND_NODE_TYPE_OPERATION, GENBIND_NODE_TYPE_GETTER, GENBIND_NODE_TYPE_SETTER, }; /* modifier flags */ enum genbind_type_modifier { GENBIND_TYPE_NONE = 0, GENBIND_TYPE_TYPE = 1, /**< identifies a type handler */ GENBIND_TYPE_UNSHARED = 2, /**< unshared item */ GENBIND_TYPE_TYPE_UNSHARED = 3, /**< identifies a unshared type handler */ }; struct genbind_node; /** callback for search and iteration routines */ typedef int (genbind_callback_t)(struct genbind_node *node, void *ctx); int genbind_cmp_node_type(struct genbind_node *node, void *ctx); FILE *genbindopen(const char *filename); int genbind_parsefile(char *infilename, struct genbind_node **ast); char *genbind_strapp(char *a, char *b); struct genbind_node *genbind_new_node(enum genbind_node_type type, struct genbind_node *l, void *r); struct genbind_node *genbind_node_link(struct genbind_node *tgt, struct genbind_node *src); int genbind_ast_dump(struct genbind_node *ast, int indent); /** Depth first left hand search using user provided comparison * * @param node The node to start the search from * @param prev The node at which to stop the search, either NULL to * search the full tree depth (initial search) or the result * of a previous search to continue. * @param cb Comparison callback * @param ctx Context for callback */ struct genbind_node * genbind_node_find(struct genbind_node *node, struct genbind_node *prev, genbind_callback_t *cb, void *ctx); /** Depth first left hand search returning nodes of the specified type * * @param node The node to start the search from * @param prev The node at which to stop the search, either NULL to * search the full tree depth (initial search) or the result * of a previous search to continue. * @param nodetype The type of node to seach for */ struct genbind_node * genbind_node_find_type(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type nodetype); /** Depth first left hand search returning nodes of the specified type * and a ident child node with matching text * * @param node The node to start the search from * @param prev The node at which to stop the search, either NULL to * search the full tree depth (initial search) or the result * of a previous search to continue. * @param nodetype The type of node to seach for * @param ident The text to match the ident child node to */ struct genbind_node * genbind_node_find_type_ident(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type nodetype, const char *ident); /** Depth first left hand search returning nodes of the specified type * and a type child node with matching text * * @param node The node to start the search from * @param prev The node at which to stop the search, either NULL to * search the full tree depth (initial search) or the result * of a previous search to continue. * @param nodetype The type of node to seach for * @param type The text to match the type child node to */ struct genbind_node * genbind_node_find_type_type(struct genbind_node *node, struct genbind_node *prev, enum genbind_node_type nodetype, const char *type); int genbind_node_for_each_type(struct genbind_node *node, enum genbind_node_type type, genbind_callback_t *cb, void *ctx); char *genbind_node_gettext(struct genbind_node *node); struct genbind_node *genbind_node_getnode(struct genbind_node *node); int genbind_node_getint(struct genbind_node *node); #ifdef _WIN32 #define NEED_STRNDUP 1 char *strndup(const char *s, size_t n); #endif #endif netsurf-all-3.2/nsgenbind/src/nsgenbind-lexer.l0000644000175000017500000001110612377677044020623 0ustar vincevince%{ /* lexer for the binding generation config file * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include "nsgenbind-parser.h" #include "nsgenbind-ast.h" #define YY_USER_ACTION yylloc->first_line = yylloc->last_line; \ yylloc->first_column = yylloc->last_column + 1; \ yylloc->last_column += yyleng; /* Ensure compatability with bison 2.6 and later */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED && defined NSGENBIND_STYPE_IS_DECLARED #define YYSTYPE NSGENBIND_STYPE #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED && defined NSGENBIND_LTYPE_IS_DECLARED #define YYLTYPE NSGENBIND_LTYPE #endif %} /* lexer options */ %option never-interactive %option yylineno %option bison-bridge %option bison-locations %option nodefault %option warn %option prefix="nsgenbind_" %option nounput %option noinput %option noyywrap /* other Unicode space separator */ USP (\xe1\x9a\x80)|(\xe1\xa0\x8e)|(\xe2\x80[\x80-\x8a])|(\xe2\x80\xaf)|(\xe2\x81\x9f)|(\xe3\x80\x80) /* non breaking space \u00A0 */ NBSP (\xc2\xa0) /* Line separator \u2028 */ LS (\xe2\x80\xa8) /* paragraph separator \u2029 */ PS (\xe2\x80\xa9) whitespace ([ \t\v\f]|{NBSP}|{USP}) lineend ([\n\r]|{LS}|{PS}) multicomment \/\*(([^*])|(\*[^/]))*\*\/ quotedstring [^\"\\\n\r] identifier [A-Z_a-z][0-9A-Z_a-z]* other [^\t\n\r 0-9A-Z_a-z] cblockopen \%\{ cblockclose \%\} /* used for #include directive */ poundsign ^{whitespace}*# %x cblock %x incl %% {whitespace} ++yylloc->last_column;/* nothing */ {lineend} if (yytext[0] != '\r') { /* update position counts */ ++yylloc->last_line; yylloc->last_column = 0; } /* terminals */ webidlfile return TOK_IDLFILE; hdrcomment return TOK_HDR_COMMENT; preamble return TOK_PREAMBLE; prologue return TOK_PROLOGUE; epilogue return TOK_EPILOGUE; binding return TOK_BINDING; interface return TOK_INTERFACE; type return TOK_TYPE; private return TOK_PRIVATE; internal return TOK_INTERNAL; unshared return TOK_UNSHARED; shared return TOK_SHARED; property return TOK_PROPERTY; operation return TOK_OPERATION; api return TOK_API; getter return TOK_GETTER; setter return TOK_SETTER; {cblockopen} BEGIN(cblock); {identifier} { /* A leading "_" is used to escape an identifier from * looking like a reserved word terminal. */ yylval->text = (yytext[0] == '_') ? strdup(yytext + 1) : strdup(yytext); return TOK_IDENTIFIER; } \"{quotedstring}*\" yylval->text = strndup(yytext + 1, yyleng - 2 ); return TOK_STRING_LITERAL; {multicomment} /* nothing */ {poundsign}include BEGIN(incl); {other} return (int) yytext[0]; . /* nothing */ [^\%]* yylval->text = strdup(yytext); return TOK_CCODE_LITERAL; {cblockclose} BEGIN(INITIAL); \% yylval->text = strdup(yytext); return TOK_CCODE_LITERAL; [ \t]*\" /* eat the whitespace and open quotes */ [^\t\n\"]+ { /* got the include file name */ yyin = genbindopen(yytext); if (! yyin) { fprintf(stderr, "Unable to open include %s\n", yytext); exit(3); } yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE )); BEGIN(INITIAL); } \n BEGIN(INITIAL); . /* nothing */ <> { yypop_buffer_state(); if ( !YY_CURRENT_BUFFER ) { yyterminate(); } else { BEGIN(incl); } } %% netsurf-all-3.2/nsgenbind/src/webidl-parser.y0000644000175000017500000010073412377677044020322 0ustar vincevince%{ /* This is a bison parser for Web IDL * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders * * Derived from the the grammar in apendix A of W3C WEB IDL * http://www.w3.org/TR/WebIDL/ */ #include #include #include #include #include #include "webidl-ast.h" #include "webidl-parser.h" #include "webidl-lexer.h" char *errtxt; static void webidl_error(YYLTYPE *locp, struct webidl_node **winbind_ast, const char *str) { locp = locp; winbind_ast = winbind_ast; errtxt = strdup(str); } %} %locations /* bison prior to 2.4 cannot cope with %define api.pure so we use the * deprecated directive */ %pure-parser %error-verbose %parse-param { struct webidl_node **webidl_ast } %union { int attr; long value; bool isit; char* text; struct webidl_node *node; } %token TOK_ANY %token TOK_ATTRIBUTE %token TOK_BOOLEAN %token TOK_BYTE %token TOK_CALLBACK %token TOK_LEGACYCALLER %token TOK_CONST %token TOK_CREATOR %token TOK_DATE %token TOK_DELETER %token TOK_DICTIONARY %token TOK_DOUBLE %token TOK_ELLIPSIS %token TOK_ENUM %token TOK_EOL %token TOK_EXCEPTION %token TOK_FALSE %token TOK_FLOAT %token TOK_GETRAISES %token TOK_GETTER %token TOK_IMPLEMENTS %token TOK_IN %token TOK_INFINITY %token TOK_INHERIT %token TOK_INTERFACE %token TOK_LONG %token TOK_MODULE %token TOK_NAN %token TOK_NATIVE %token TOK_NULL_LITERAL %token TOK_OBJECT %token TOK_OCTET %token TOK_OMITTABLE %token TOK_OPTIONAL %token TOK_OR %token TOK_PARTIAL %token TOK_RAISES %token TOK_READONLY %token TOK_SETRAISES %token TOK_SETTER %token TOK_SEQUENCE %token TOK_SHORT %token TOK_STATIC %token TOK_STRING %token TOK_STRINGIFIER %token TOK_TRUE %token TOK_TYPEDEF %token TOK_UNRESTRICTED %token TOK_UNSIGNED %token TOK_VOID %token TOK_POUND_SIGN %token TOK_IDENTIFIER %token TOK_INT_LITERAL %token TOK_FLOAT_LITERAL %token TOK_STRING_LITERAL %token TOK_OTHER_LITERAL %token TOK_JAVADOC %type Inheritance %type Definitions %type Definition %type Partial %type PartialDefinition %type Dictionary %type PartialDictionary %type Exception %type Enum %type Typedef %type ImplementsStatement %type Interface %type InterfaceMembers %type InterfaceMember %type PartialInterface %type CallbackOrInterface %type CallbackRest %type CallbackRestOrInterface %type Attribute %type AttributeOrOperation %type StringifierAttributeOrOperation %type Const %type Operation %type OperationRest %type OptionalIdentifier %type ArgumentList %type Arguments %type Argument %type OptionalOrRequiredArgument %type ArgumentName %type ArgumentNameKeyword %type Ellipsis %type Type %type ReturnType %type SingleType %type UnionType %type NonAnyType %type ConstType %type PrimitiveType %type UnrestrictedFloatType %type FloatType %type UnsignedIntegerType %type IntegerType %type TypeSuffix %type TypeSuffixStartingWithArray %type FloatLiteral %type BooleanLiteral %type ConstValue %type ReadOnly %type OptionalLong %type Inherit %type ExtendedAttributeList %type ExtendedAttributes %type ExtendedAttributeRest %type ExtendedAttributeInner %type ExtendedAttribute %type Other %type OtherOrComma %% /* [1] default rule to add built AST to passed in one, altered from * original grammar to be left recusive, */ Definitions: /* empty */ { $$ = NULL; } | Definitions ExtendedAttributeList Definition { webidl_node_add($3, $2); $$ = *webidl_ast = webidl_node_prepend(*webidl_ast, $3); } | error { fprintf(stderr, "%d: %s\n", yylloc.first_line, errtxt); free(errtxt); YYABORT ; } ; /* [2] */ Definition: CallbackOrInterface | Partial | Dictionary | Exception | Enum | Typedef | ImplementsStatement ; /* [3] */ CallbackOrInterface : TOK_CALLBACK CallbackRestOrInterface { $$ = $2; } | Interface ; /* [4] */ CallbackRestOrInterface: CallbackRest | Interface ; /* [5] */ Interface: TOK_INTERFACE TOK_IDENTIFIER Inheritance '{' InterfaceMembers '}' ';' { /* extend interface with additional members */ struct webidl_node *interface_node; struct webidl_node *members = NULL; if ($3 != NULL) { members = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE, members, $3); } members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, members, $5); interface_node = webidl_node_find_type_ident(*webidl_ast, WEBIDL_NODE_TYPE_INTERFACE, $2); if (interface_node == NULL) { /* no existing interface - create one with ident */ members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2); $$ = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, members); } else { /* update the existing interface */ /* link member node into interfaces_node */ webidl_node_add(interface_node, members); $$ = NULL; /* updating so no need to add a new node */ } } ; /* [6] */ Partial: TOK_PARTIAL PartialDefinition { $$ = $2; } ; /* [7] */ PartialDefinition: PartialInterface | PartialDictionary ; /* [8] */ PartialInterface: TOK_INTERFACE TOK_IDENTIFIER '{' InterfaceMembers '}' ';' { /* extend interface with additional members */ struct webidl_node *members; struct webidl_node *interface_node; interface_node = webidl_node_find_type_ident(*webidl_ast, WEBIDL_NODE_TYPE_INTERFACE, $2); members = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, $4); if (interface_node == NULL) { /* doesnt already exist so create it */ members = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, members, $2); $$ = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, members); } else { /* update the existing interface */ /* link member node into interfaces_node */ webidl_node_add(interface_node, members); $$ = NULL; /* updating so no need to add a new node */ } } ; /* [9] slightly altered from original grammar to be left recursive */ InterfaceMembers: /* empty */ { $$ = NULL; } | InterfaceMembers ExtendedAttributeList InterfaceMember /* This needs to deal with members with the same identifier which * indicate polymorphism. this is handled in the AST by adding the * argument lists for each polymorphism to the same * WEBIDL_NODE_TYPE_OPERATION * * @todo need to consider qualifer/stringifier compatibility */ { struct webidl_node *member_node; struct webidl_node *ident_node; struct webidl_node *list_node; ident_node = webidl_node_find_type(webidl_node_getnode($3), NULL, WEBIDL_NODE_TYPE_IDENT); list_node = webidl_node_find_type(webidl_node_getnode($3), NULL, WEBIDL_NODE_TYPE_LIST); if (ident_node == NULL) { /* something with no ident - possibly constructors? */ /* @todo understand this abtter */ $$ = webidl_node_prepend($1, $3); } else if (list_node == NULL) { /* member with no argument list, usually an attribute, cannot * be polymorphic */ /* add extended attributes to parameter list */ webidl_node_add($3, $2); $$ = webidl_node_prepend($1, $3); } else { /* add extended attributes to parameter list */ webidl_node_add(list_node, $2); /* has an arguemnt list so can be polymorphic */ member_node = webidl_node_find_type_ident($1, webidl_node_gettype($3), webidl_node_gettext(ident_node)); if (member_node == NULL) { /* not a member with that ident already present */ $$ = webidl_node_prepend($1, $3); } else { webidl_node_add(member_node, list_node); $$ = $1; /* updated existing node do not add new one */ } } } ; /* [10] */ InterfaceMember: Const | AttributeOrOperation ; /* [11] */ Dictionary: TOK_DICTIONARY TOK_IDENTIFIER Inheritance '{' DictionaryMembers '}' ';' { $$ = NULL; } ; /* [12] */ DictionaryMembers: /* empty */ | ExtendedAttributeList DictionaryMember DictionaryMembers ; /* [13] */ DictionaryMember: Type TOK_IDENTIFIER Default ';' ; /* [14] */ PartialDictionary: TOK_DICTIONARY TOK_IDENTIFIER '{' DictionaryMembers '}' ';' { $$ = NULL; } /* [15] */ Default: /* empty */ | '=' DefaultValue ; /* [16] */ DefaultValue: ConstValue | TOK_STRING_LITERAL ; /* [17] */ Exception: TOK_EXCEPTION TOK_IDENTIFIER Inheritance '{' ExceptionMembers '}' ';' { $$ = NULL; } ; /* [18] */ ExceptionMembers: /* empty */ | ExtendedAttributeList ExceptionMember ExceptionMembers ; /* [19] returns a string */ Inheritance: /* empty */ { $$ = NULL; } | ':' TOK_IDENTIFIER { $$ = $2; } ; /* [20] */ Enum: TOK_ENUM TOK_IDENTIFIER '{' EnumValueList '}' ';' { $$ = NULL; } ; /* [21] */ EnumValueList: TOK_STRING_LITERAL EnumValues ; /* [22] */ EnumValues: /* empty */ | ',' TOK_STRING_LITERAL EnumValues ; /* [23] - bug in w3c grammar? it doesnt list the equals as a terminal */ CallbackRest: TOK_IDENTIFIER '=' ReturnType '(' ArgumentList ')' ';' { $$ = NULL; } ; /* [24] */ Typedef: TOK_TYPEDEF ExtendedAttributeList Type TOK_IDENTIFIER ';' { $$ = NULL; } ; /* [25] */ ImplementsStatement: TOK_IDENTIFIER TOK_IMPLEMENTS TOK_IDENTIFIER ';' { /* extend interface with implements members */ struct webidl_node *implements; struct webidl_node *interface_node; interface_node = webidl_node_find_type_ident(*webidl_ast, WEBIDL_NODE_TYPE_INTERFACE, $1); implements = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, NULL, $3); if (interface_node == NULL) { /* interface doesnt already exist so create it */ implements = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, implements, $1); $$ = webidl_node_new(WEBIDL_NODE_TYPE_INTERFACE, NULL, implements); } else { /* update the existing interface */ /* link implements node into interfaces_node */ webidl_node_add(interface_node, implements); $$ = NULL; /* updating so no need to add a new node */ } } ; /* [26] */ Const: TOK_CONST ConstType TOK_IDENTIFIER '=' ConstValue ';' { struct webidl_node *constant; constant = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3); /* add constant type */ constant = webidl_node_prepend(constant, $2); /* add constant value */ constant = webidl_node_prepend(constant, $5); $$ = webidl_node_new(WEBIDL_NODE_TYPE_CONST, NULL, constant); } ; /* [27] */ ConstValue: BooleanLiteral | FloatLiteral | TOK_INT_LITERAL { $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_INT, NULL, (void *)$1); } | TOK_NULL_LITERAL { $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_NULL, NULL, NULL); } ; /* [28] */ BooleanLiteral: TOK_TRUE { $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL, NULL, (void *)true); } | TOK_FALSE { $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_BOOL, NULL, (void *)false); } ; /* [29] */ FloatLiteral: TOK_FLOAT_LITERAL { float *value; value = malloc(sizeof(float)); *value = strtof($1, NULL); $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, NULL, value); } | '-' TOK_INFINITY { float *value; value = malloc(sizeof(float)); *value = -INFINITY; $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, NULL, value); } | TOK_INFINITY { float *value; value = malloc(sizeof(float)); *value = INFINITY; $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, NULL, value); } | TOK_NAN { float *value; value = malloc(sizeof(float)); *value = NAN; $$ = webidl_node_new(WEBIDL_NODE_TYPE_LITERAL_FLOAT, NULL, value); } ; /* [30] */ AttributeOrOperation: TOK_STRINGIFIER StringifierAttributeOrOperation { $$ = $2; } | Attribute | Operation ; /* [31] */ StringifierAttributeOrOperation: Attribute | OperationRest { /* @todo deal with stringifier */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, $1); } | ';' { $$=NULL; } ; /* [32] */ Attribute: Inherit ReadOnly TOK_ATTRIBUTE Type TOK_IDENTIFIER ';' { struct webidl_node *attribute; attribute = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $5); /* add attributes type */ attribute = webidl_node_prepend(attribute, $4); /* deal with readonly modifier */ if ($2) { attribute = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, attribute, (void *)WEBIDL_TYPE_READONLY); } $$ = webidl_node_new(WEBIDL_NODE_TYPE_ATTRIBUTE, NULL, attribute); } ; /* [33] */ Inherit: /* empty */ { $$ = false; } | TOK_INHERIT { $$ = true; } ; /* [34] */ ReadOnly: /* empty */ { $$ = false; } | TOK_READONLY { $$ = true; } ; /* [35] */ Operation: Qualifiers OperationRest { /* @todo fix qualifiers */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPERATION, NULL, $2); } ; /* [36] */ Qualifiers: TOK_STATIC | Specials ; /* [37] */ Specials: /* empty */ | Special Specials ; /* [38] */ Special: TOK_GETTER | TOK_SETTER | TOK_CREATOR | TOK_DELETER | TOK_LEGACYCALLER ; /* [39] */ OperationRest: ReturnType OptionalIdentifier '(' ArgumentList ')' ';' { struct webidl_node *arglist; /* put return type in argument list */ arglist = webidl_node_prepend($4, $1); /* argument list */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_LIST, NULL, arglist); $$ = webidl_node_prepend($$, $2); /* identifier */ } ; /* [40] */ OptionalIdentifier: /* empty */ { $$ = NULL; } | TOK_IDENTIFIER { $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $1); } ; /* [41] an empty list or a list of non empty comma separated arguments, note * this is right associative so the tree build is ass backwards */ ArgumentList: /* empty */ { $$ = NULL; } | Argument Arguments { $$ = webidl_node_append($2, $1); } ; /* [42] */ Arguments: /* empty */ { $$ = NULL; } | ',' Argument Arguments { $$ = webidl_node_append($3, $2); } ; /* [43] */ Argument: ExtendedAttributeList OptionalOrRequiredArgument { $$ = $2; } ; /* [44] */ OptionalOrRequiredArgument: TOK_OPTIONAL Type ArgumentName Default { struct webidl_node *argument; argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3); argument = webidl_node_prepend(argument, $2); /* add type node */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_OPTIONAL_ARGUMENT, NULL, argument); } | Type Ellipsis ArgumentName { struct webidl_node *argument; argument = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $3); argument = webidl_node_prepend(argument, $2); /* ellipsis node */ argument = webidl_node_prepend(argument, $1); /* add type node */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_ARGUMENT, NULL, argument); } ; /* [45] */ ArgumentName: ArgumentNameKeyword | TOK_IDENTIFIER ; /* [46] */ Ellipsis: /* empty */ { $$ = NULL; } | TOK_ELLIPSIS { $$ = webidl_node_new(WEBIDL_NODE_TYPE_ELLIPSIS, NULL, NULL); } ; /* [47] */ ExceptionMember: Const | ExceptionField ; /* [48] */ ExceptionField: Type TOK_IDENTIFIER ';' ; /* [49] extended attribute list inside square brackets */ ExtendedAttributeList: /* empty */ { $$ = NULL; } | '[' ExtendedAttribute ExtendedAttributes ']' { $$ = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, $3, $2); } ; /* [50] extended attributes are separated with a comma */ ExtendedAttributes: /* empty */ { $$ = NULL; } | ',' ExtendedAttribute ExtendedAttributes { $$ = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, $3, $2); } ; /* [51] extended attributes internal nesting with normal, square and curly * braces */ ExtendedAttribute: '(' ExtendedAttributeInner ')' ExtendedAttributeRest { $$ = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, $4, $2); } | '[' ExtendedAttributeInner ']' ExtendedAttributeRest { /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_SQUARE */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, $4, $2); } | '{' ExtendedAttributeInner '}' ExtendedAttributeRest { /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_CURLY */ $$ = webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, $4, $2); } | Other ExtendedAttributeRest { $$ = webidl_node_append($2, webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $1)); } ; /* [52] extended attributes can be space separated too */ ExtendedAttributeRest: /* empty */ { $$ = NULL; } | ExtendedAttribute { $$ = $1; } ; /* [53] extended attributes are nested with normal, square and curly braces */ ExtendedAttributeInner: /* empty */ { $$ = NULL; } | '(' ExtendedAttributeInner ')' ExtendedAttributeInner { $$ = webidl_node_prepend( webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, NULL, $2), $4); } | '[' ExtendedAttributeInner ']' ExtendedAttributeInner { /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_SQUARE */ $$ = webidl_node_prepend( webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, NULL, $2), $4); } | '{' ExtendedAttributeInner '}' ExtendedAttributeInner { /* @todo should be a WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE_CURLY */ $$ = webidl_node_prepend( webidl_node_new(WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, NULL, $2), $4); } | OtherOrComma ExtendedAttributeInner { $$ = webidl_node_append($2, webidl_node_new(WEBIDL_NODE_TYPE_IDENT, NULL, $1)); } ; /* [54] */ Other: TOK_INT_LITERAL { /* @todo loosing base info here might break the attribute */ $$ = calloc(1, 32); snprintf($$, 32, "%ld", $1); } | TOK_FLOAT_LITERAL { $$ = $1; } | TOK_IDENTIFIER { $$ = $1; } | TOK_STRING_LITERAL { $$ = $1; } | TOK_OTHER_LITERAL { $$ = $1; } | '-' { $$ = strdup("-"); } | '.' { $$ = strdup("."); } | TOK_ELLIPSIS { $$ = strdup("..."); } | ':' { $$ = strdup(":"); } | ';' { $$ = strdup(";"); } | '<' { $$ = strdup("<"); } | '=' { $$ = strdup("="); } | '>' { $$ = strdup(">"); } | '?' { $$ = strdup("?"); } | TOK_DATE { $$ = strdup("Date"); } | TOK_STRING { $$ = strdup("DOMString"); } | TOK_INFINITY { $$ = strdup("Infinity"); } | TOK_NAN { $$ = strdup("NaN"); } | TOK_ANY { $$ = strdup("any"); } | TOK_BOOLEAN { $$ = strdup("boolean"); } | TOK_BYTE { $$ = strdup("byte"); } | TOK_DOUBLE { $$ = strdup("double"); } | TOK_FALSE { $$ = strdup("false"); } | TOK_FLOAT { $$ = strdup("float"); } | TOK_LONG { $$ = strdup("long"); } | TOK_NULL_LITERAL { $$ = strdup("null"); } | TOK_OBJECT { $$ = strdup("object"); } | TOK_OCTET { $$ = strdup("octet"); } | TOK_OR { $$ = strdup("or"); } | TOK_OPTIONAL { $$ = strdup("optional"); } | TOK_SEQUENCE { $$ = strdup("sequence"); } | TOK_SHORT { $$ = strdup("short"); } | TOK_TRUE { $$ = strdup("true"); } | TOK_UNSIGNED { $$ = strdup("unsigned"); } | TOK_VOID { $$ = strdup("void"); } | ArgumentNameKeyword { $$ = $1; } ; /* [55] */ ArgumentNameKeyword: TOK_ATTRIBUTE { $$ = strdup("attribute"); } | TOK_CALLBACK { $$ = strdup("callback"); } | TOK_CONST { $$ = strdup("const"); } | TOK_CREATOR { $$ = strdup("creator"); } | TOK_DELETER { $$ = strdup("deleter"); } | TOK_DICTIONARY { $$ = strdup("dictionary"); } | TOK_ENUM { $$ = strdup("enum"); } | TOK_EXCEPTION { $$ = strdup("exception"); } | TOK_GETTER { $$ = strdup("getter"); } | TOK_IMPLEMENTS { $$ = strdup("implements"); } | TOK_INHERIT { $$ = strdup("inherit"); } | TOK_INTERFACE { $$ = strdup("interface"); } | TOK_LEGACYCALLER { $$ = strdup("legacycaller"); } | TOK_PARTIAL { $$ = strdup("partial"); } | TOK_SETTER { $$ = strdup("setter"); } | TOK_STATIC { $$ = strdup("static"); } | TOK_STRINGIFIER { $$ = strdup("stringifier"); } | TOK_TYPEDEF { $$ = strdup("typedef"); } | TOK_UNRESTRICTED { $$ = strdup("unrestricted"); } ; /* [56] as it says an other element or a comma */ OtherOrComma: Other { $$ = $1; } | ',' { $$ = strdup(","); } ; /* [57] */ Type: SingleType { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1); } | UnionType TypeSuffix { /* todo handle suffix */ $$ = $1; } ; /* [58] */ SingleType: NonAnyType | TOK_ANY TypeSuffixStartingWithArray { $$ = NULL; /* todo implement */ } ; /* [59] */ UnionType: '(' UnionMemberType TOK_OR UnionMemberType UnionMemberTypes ')' { $$ = NULL; } ; /* [60] */ UnionMemberType: NonAnyType | UnionType TypeSuffix | TOK_ANY '[' ']' TypeSuffix ; /* [61] */ UnionMemberTypes: /* empty */ | TOK_OR UnionMemberType UnionMemberTypes ; /* [62] */ NonAnyType: PrimitiveType TypeSuffix { $$ = webidl_node_prepend($1, $2); } | TOK_STRING TypeSuffix { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_STRING); } | TOK_IDENTIFIER TypeSuffix { struct webidl_node *type; type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_USER); $$ = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1); } | TOK_SEQUENCE '<' Type '>' Null { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $3, (void *)WEBIDL_TYPE_SEQUENCE); } | TOK_OBJECT TypeSuffix { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_OBJECT); } | TOK_DATE TypeSuffix { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, $2, (void *)WEBIDL_TYPE_DATE); } ; /* [63] */ ConstType: PrimitiveType Null { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, $1); } | TOK_IDENTIFIER Null { struct webidl_node *type; type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_USER); type = webidl_node_new(WEBIDL_NODE_TYPE_IDENT, type, $1); $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type); } ; /* [64] */ PrimitiveType: UnsignedIntegerType | UnrestrictedFloatType | TOK_BOOLEAN { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BOOL); } | TOK_BYTE { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_BYTE); } | TOK_OCTET { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_OCTET); } ; /* [65] */ UnrestrictedFloatType: TOK_UNRESTRICTED FloatType { $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, $2, (void *)WEBIDL_TYPE_MODIFIER_UNRESTRICTED); } | FloatType ; /* [66] */ FloatType: TOK_FLOAT { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_FLOAT); } | TOK_DOUBLE { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_DOUBLE); } ; /* [67] */ UnsignedIntegerType: TOK_UNSIGNED IntegerType { $$ = webidl_node_new(WEBIDL_NODE_TYPE_MODIFIER, $2, (void *)WEBIDL_TYPE_MODIFIER_UNSIGNED); } | IntegerType ; /* [68] */ IntegerType: TOK_SHORT { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_SHORT); } | TOK_LONG OptionalLong { if ($2) { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONGLONG); } else { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_LONG); } } ; /* [69] */ OptionalLong: /* empty */ { $$ = false; } | TOK_LONG { $$ = true; } ; /* [70] */ TypeSuffix: /* empty */ { $$ = NULL; } | '[' ']' TypeSuffix { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_ARRAY, $3, NULL); } | '?' TypeSuffixStartingWithArray { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_NULLABLE, $2, NULL); } ; /* [71] */ TypeSuffixStartingWithArray: /* empty */ { $$ = NULL; } | '[' ']' TypeSuffix { $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_ARRAY, $3, NULL); } ; /* [72] */ Null: /* empty */ | '?' ; /* [73] */ ReturnType: Type | TOK_VOID { struct webidl_node *type; type = webidl_node_new(WEBIDL_NODE_TYPE_TYPE_BASE, NULL, (void *)WEBIDL_TYPE_VOID); $$ = webidl_node_new(WEBIDL_NODE_TYPE_TYPE, NULL, type); } ; %% netsurf-all-3.2/nsgenbind/src/nsgenbind-parser.y0000644000175000017500000001771012377677044021024 0ustar vincevince%{ /* parser for the binding generation config file * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include "nsgenbind-parser.h" #include "nsgenbind-lexer.h" #include "webidl-ast.h" #include "nsgenbind-ast.h" char *errtxt; static void nsgenbind_error(YYLTYPE *locp, struct genbind_node **genbind_ast, const char *str) { locp = locp; genbind_ast = genbind_ast; errtxt = strdup(str); } %} %locations /* bison prior to 2.4 cannot cope with %define api.pure so we use the * deprecated directive */ %pure-parser %error-verbose %parse-param { struct genbind_node **genbind_ast } %union { char* text; struct genbind_node *node; long value; } %token TOK_IDLFILE %token TOK_HDR_COMMENT %token TOK_PREAMBLE %token TOK_PROLOGUE; %token TOK_EPILOGUE; %token TOK_API %token TOK_BINDING %token TOK_OPERATION %token TOK_GETTER %token TOK_SETTER %token TOK_INTERFACE %token TOK_TYPE %token TOK_PRIVATE %token TOK_INTERNAL %token TOK_UNSHARED %token TOK_SHARED %token TOK_PROPERTY %token TOK_IDENTIFIER %token TOK_STRING_LITERAL %token TOK_CCODE_LITERAL %type CBlock %type Modifiers %type Modifier %type Statement %type Statements %type IdlFile %type Preamble %type Prologue %type Epilogue %type HdrComment %type Strings %type Binding %type BindingArgs %type BindingArg %type Type %type Private %type Internal %type Interface %type Property %type Operation %type Api %type Getter %type Setter %% Input : Statements { *genbind_ast = $1; } ; Statements : Statement | Statements Statement { $$ = genbind_node_link($2, $1); } | error ';' { fprintf(stderr, "%d: %s\n", yylloc.first_line, errtxt); free(errtxt); YYABORT ; } ; Statement : IdlFile | HdrComment | Preamble | Prologue | Epilogue | Binding | Operation | Api | Getter | Setter ; /* [3] load a web IDL file */ IdlFile : TOK_IDLFILE TOK_STRING_LITERAL ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_WEBIDLFILE, NULL, $2); } ; HdrComment : TOK_HDR_COMMENT Strings ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_HDRCOMMENT, NULL, $2); } ; Strings : TOK_STRING_LITERAL { $$ = genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $1); } | Strings TOK_STRING_LITERAL { $$ = genbind_new_node(GENBIND_NODE_TYPE_STRING, $1, $2); } ; Preamble : TOK_PREAMBLE CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_PREAMBLE, NULL, $2); } ; Prologue : TOK_PROLOGUE CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_PROLOGUE, NULL, $2); } ; Epilogue : TOK_EPILOGUE CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_EPILOGUE, NULL, $2); } ; CBlock : TOK_CCODE_LITERAL | CBlock TOK_CCODE_LITERAL { $$ = genbind_strapp($1, $2); } ; Operation : TOK_OPERATION TOK_IDENTIFIER CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_OPERATION, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_CBLOCK, NULL, $3), $2)); } Api : TOK_API TOK_IDENTIFIER CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_API, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_CBLOCK, NULL, $3), $2)); } Getter : TOK_GETTER TOK_IDENTIFIER CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_GETTER, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_CBLOCK, NULL, $3), $2)); } Setter : TOK_SETTER TOK_IDENTIFIER CBlock { $$ = genbind_new_node(GENBIND_NODE_TYPE_SETTER, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_CBLOCK, NULL, $3), $2)); } Binding : TOK_BINDING TOK_IDENTIFIER '{' BindingArgs '}' { $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, $4, $2)); } ; BindingArgs : BindingArg | BindingArgs BindingArg { $$ = genbind_node_link($2, $1); } ; BindingArg : Type | Private | Internal | Interface | Property ; Type : TOK_TYPE TOK_IDENTIFIER ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_TYPE, NULL, $2); } ; Private : TOK_PRIVATE TOK_STRING_LITERAL TOK_IDENTIFIER ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PRIVATE, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $2), $3)); } ; Internal : TOK_INTERNAL TOK_STRING_LITERAL TOK_IDENTIFIER ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERNAL, NULL, genbind_new_node(GENBIND_NODE_TYPE_IDENT, genbind_new_node(GENBIND_NODE_TYPE_STRING, NULL, $2), $3)); } ; Interface : TOK_INTERFACE TOK_IDENTIFIER ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_INTERFACE, NULL, $2); } ; Property : TOK_PROPERTY Modifiers TOK_IDENTIFIER ';' { $$ = genbind_new_node(GENBIND_NODE_TYPE_BINDING_PROPERTY, NULL, genbind_new_node(GENBIND_NODE_TYPE_MODIFIER, genbind_new_node(GENBIND_NODE_TYPE_IDENT, NULL, $3), (void *)$2)); } ; Modifiers : /* empty */ { $$ = GENBIND_TYPE_NONE; } | Modifiers Modifier { $$ |= $2; } ; Modifier : TOK_TYPE { $$ = GENBIND_TYPE_TYPE; } | TOK_UNSHARED { $$ = GENBIND_TYPE_UNSHARED; } | TOK_SHARED { $$ = GENBIND_TYPE_NONE; } ; %% netsurf-all-3.2/nsgenbind/src/Makefile0000644000175000017500000000261612377677044017030 0ustar vincevinceCFLAGS := $(CFLAGS) -I$(BUILDDIR) -Isrc/ -g -DYYENABLE_NLS=0 # Sources in this directory DIR_SOURCES := nsgenbind.c webidl-ast.c nsgenbind-ast.c jsapi-libdom.c jsapi-libdom-operator.c jsapi-libdom-property.c jsapi-libdom-const.c SOURCES := $(SOURCES) $(BUILDDIR)/nsgenbind-parser.c $(BUILDDIR)/nsgenbind-lexer.c $(BUILDDIR)/webidl-parser.c $(BUILDDIR)/webidl-lexer.c $(BUILDDIR)/%-lexer.c $(BUILDDIR)/%-lexer.h: src/%-lexer.l $(VQ)$(ECHO) " FLEX: $<" $(Q)$(FLEX) --outfile=$(BUILDDIR)/$(*F)-lexer.c --header-file=$(BUILDDIR)/$(*F)-lexer.h $< $(BUILDDIR)/%-lexer.c: $(BUILDDIR)/%-parser.h # Bison 2.6 and later require api.prefix, but this breaks Bison 2.5 and earlier. bisonvsn := $(word 4,$(shell $(BISON) --version)) bisonmaj := $(word 1,$(subst ., ,$(bisonvsn))) bisonmin := $(word 2,$(subst ., ,$(bisonvsn))) ifeq ($(bisonmaj),1) BISON_DEFINES = --name-prefix=$(*F)_ else ifeq ($(bisonmaj),2) ifneq ($(findstring $(bisonmin),"0 1 2 3 4 5"),) BISON_DEFINES = --name-prefix=$(*F)_ else BISON_DEFINES = --define=api.prefix=$(*F)_ endif else BISON_DEFINES = --define=api.prefix=$(*F)_ endif endif $(BUILDDIR)/%-parser.c $(BUILDDIR)/%-parser.h: src/%-parser.y $(VQ)$(ECHO) " BISON: $<" $(Q)$(BISON) -d -t $(BISON_DEFINES) --report=all --output=$(BUILDDIR)/$(*F)-parser.c --defines=$(BUILDDIR)/$(*F)-parser.h $< # Grab the core makefile include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/nsgenbind/src/jsapi-libdom.c0000644000175000017500000007145212377677044020112 0ustar vincevince/* binding output generator for jsapi(spidermonkey) to libdom * * This file is part of nsgenbind. * Published under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include #include "options.h" #include "nsgenbind-ast.h" #include "webidl-ast.h" #include "jsapi-libdom.h" #define HDR_COMMENT_SEP "\n * \n * " #define HDR_COMMENT_PREAMBLE "/* Generated by nsgenbind from %s\n" \ " *\n" \ " * nsgenbind is published under the MIT Licence.\n" \ " * nsgenbind is similar to a compiler is a purely transformative tool which\n" \ " * explicitly makes no copyright claim on this generated output" #define HDROUTF(bndg, fmt, args...) do { \ if (bndg->hdrfile != NULL) { \ fprintf(bndg->hdrfile, fmt, ##args); \ } \ } while(0) static int webidl_file_cb(struct genbind_node *node, void *ctx) { struct webidl_node **webidl_ast = ctx; char *filename; filename = genbind_node_gettext(node); return webidl_parsefile(filename, webidl_ast); } static int read_webidl(struct genbind_node *genbind_ast, struct webidl_node **webidl_ast) { int res; res = genbind_node_for_each_type(genbind_ast, GENBIND_NODE_TYPE_WEBIDLFILE, webidl_file_cb, webidl_ast); /* debug dump of web idl AST */ if (options->verbose) { webidl_ast_dump(*webidl_ast, 0); } return res; } static int webidl_preamble_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; fprintf(binding->outfile, "%s", genbind_node_gettext(node)); return 0; } static int webidl_prologue_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; fprintf(binding->outfile, "%s", genbind_node_gettext(node)); return 0; } static int webidl_epilogue_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; fprintf(binding->outfile, "%s", genbind_node_gettext(node)); return 0; } static int webidl_hdrcomments_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; fprintf(binding->outfile, HDR_COMMENT_SEP"%s", genbind_node_gettext(node)); return 0; } static int webidl_hdrcomment_cb(struct genbind_node *node, void *ctx) { genbind_node_for_each_type(genbind_node_getnode(node), GENBIND_NODE_TYPE_STRING, webidl_hdrcomments_cb, ctx); return 0; } static int webidl_private_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; struct genbind_node *ident_node; struct genbind_node *type_node; ident_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_IDENT); if (ident_node == NULL) return -1; /* bad AST */ type_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_STRING); if (type_node == NULL) return -1; /* bad AST */ fprintf(binding->outfile, " %s%s;\n", genbind_node_gettext(type_node), genbind_node_gettext(ident_node)); return 0; } static int webidl_private_param_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; struct genbind_node *ident_node; struct genbind_node *type_node; ident_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_IDENT); if (ident_node == NULL) return -1; /* bad AST */ type_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_STRING); if (type_node == NULL) return -1; /* bad AST */ fprintf(binding->outfile, ",\n\t\t%s%s", genbind_node_gettext(type_node), genbind_node_gettext(ident_node)); return 0; } static int webidl_private_assign_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; struct genbind_node *ident_node; const char *ident; ident_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_IDENT); if (ident_node == NULL) return -1; /* bad AST */ ident = genbind_node_gettext(ident_node); fprintf(binding->outfile, "\tprivate->%s = %s;\n", ident, ident); return 0; } /* section output generators */ /** Output the epilogue right at the end of the generated program */ static int output_epilogue(struct binding *binding) { genbind_node_for_each_type(binding->gb_ast, GENBIND_NODE_TYPE_EPILOGUE, webidl_epilogue_cb, binding); fprintf(binding->outfile,"\n\n"); if (binding->hdrfile) { binding->outfile = binding->hdrfile; fprintf(binding->outfile, "\n\n#endif /* _%s_ */\n", binding->hdrguard); binding->outfile = binding->srcfile; } return 0; } /** Output the prologue right before the generated function bodies */ static int output_prologue(struct binding *binding) { genbind_node_for_each_type(binding->gb_ast, GENBIND_NODE_TYPE_PROLOGUE, webidl_prologue_cb, binding); fprintf(binding->outfile,"\n\n"); return 0; } static int output_api_operations(struct binding *binding) { int res = 0; /* finalise */ if (binding->has_private) { /* finalizer with private to free */ fprintf(binding->outfile, "static void jsclass_finalize(JSContext *cx, JSObject *obj)\n" "{\n" "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } if (binding->finalise != NULL) { output_code_block(binding, genbind_node_getnode(binding->finalise)); } fprintf(binding->outfile, "\tif (private != NULL) {\n" "\t\tfree(private);\n" "\t}\n" "}\n\n"); } else if (binding->finalise != NULL) { /* finaliser without private data */ fprintf(binding->outfile, "static void jsclass_finalize(JSContext *cx, JSObject *obj)\n" "{\n"); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } output_code_block(binding, genbind_node_getnode(binding->finalise)); fprintf(binding->outfile, "}\n\n"); } /* generate class default property add implementation */ if (binding->addproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(add, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->addproperty)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate class default property delete implementation */ if (binding->delproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(del, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->delproperty)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate class default property get implementation */ if (binding->getproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(get, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->getproperty)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate class default property set implementation */ if (binding->setproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_STRICTPROP(set, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->setproperty)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate class enumerate implementation */ if (binding->enumerate != NULL) { fprintf(binding->outfile, "static JSBool jsclass_enumerate(JSContext *cx, JSObject *obj)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->enumerate)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate class resolver implementation */ if (binding->resolve != NULL) { fprintf(binding->outfile, "static JSBool jsclass_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->resolve)); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } /* generate trace/mark entry */ if (binding->mark != NULL) { fprintf(binding->outfile, "static JSAPI_MARKOP(jsclass_mark)\n" "{\n"); if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = JS_GetInstancePrivate(JSAPI_MARKCX, obj, &JSClass_%s, NULL);\n", binding->interface); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", JSAPI_MARKCX, obj, private);\n"); } } else { if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", JSAPI_MARKCX, obj);\n"); } } output_code_block(binding, genbind_node_getnode(binding->mark)); fprintf(binding->outfile, "\tJSAPI_MARKOP_RETURN(JS_TRUE);\n" "}\n\n"); } return res; } void output_code_block(struct binding *binding, struct genbind_node *codelist) { struct genbind_node *code_node; code_node = genbind_node_find_type(codelist, NULL, GENBIND_NODE_TYPE_CBLOCK); if (code_node != NULL) { fprintf(binding->outfile, "%s\n", genbind_node_gettext(code_node)); } } /** generate class initialiser which create the javascript class prototype */ static int output_class_init(struct binding *binding) { int res = 0; struct genbind_node *api_node; /* class Initialisor declaration */ if (binding->hdrfile) { binding->outfile = binding->hdrfile; fprintf(binding->outfile, "JSObject *jsapi_InitClass_%s(JSContext *cx, JSObject *parent);\n", binding->interface); binding->outfile = binding->srcfile; } /* class Initialisor definition */ fprintf(binding->outfile, "JSObject *jsapi_InitClass_%s(JSContext *cx, JSObject *parent)\n" "{\n" "\tJSObject *prototype;\n", binding->interface); api_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_API, "init"); if (api_node != NULL) { output_code_block(binding, genbind_node_getnode(api_node)); } else { fprintf(binding->outfile, "\n" "\tprototype = JS_InitClass(cx,\n" "\t\tparent,\n" "\t\tNULL,\n" "\t\t&JSClass_%s,\n" "\t\tNULL,\n" "\t\t0,\n" "\t\tNULL,\n" "\t\tNULL, \n" "\t\tNULL, \n" "\t\tNULL);\n", binding->interface); } output_const_defines(binding, binding->interface); fprintf(binding->outfile, "\treturn prototype;\n" "}\n\n"); return res; } static int output_class_new(struct binding *binding) { int res = 0; struct genbind_node *api_node; /* constructor declaration */ if (binding->hdrfile) { binding->outfile = binding->hdrfile; fprintf(binding->outfile, "JSObject *jsapi_new_%s(JSContext *cx,\n" "\t\tJSObject *prototype,\n" "\t\tJSObject *parent", binding->interface); genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_PRIVATE, webidl_private_param_cb, binding); fprintf(binding->outfile, ");"); binding->outfile = binding->srcfile; } /* constructor definition */ fprintf(binding->outfile, "JSObject *jsapi_new_%s(JSContext *cx,\n" "\t\tJSObject *prototype,\n" "\t\tJSObject *parent", binding->interface); genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_PRIVATE, webidl_private_param_cb, binding); fprintf(binding->outfile, ")\n" "{\n" "\tJSObject *newobject;\n"); /* create private data */ if (binding->has_private) { fprintf(binding->outfile, "\tstruct jsclass_private *private;\n" "\n" "\tprivate = malloc(sizeof(struct jsclass_private));\n" "\tif (private == NULL) {\n" "\t\treturn NULL;\n" "\t}\n"); genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_PRIVATE, webidl_private_assign_cb, binding); } api_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_API, "new"); if (api_node != NULL) { output_code_block(binding, genbind_node_getnode(api_node)); } else { fprintf(binding->outfile, "\n" "\tnewobject = JS_NewObject(cx, &JSClass_%s, prototype, parent);\n", binding->interface); } if (binding->has_private) { fprintf(binding->outfile, "\tif (newobject == NULL) {\n" "\t\tfree(private);\n" "\t\treturn NULL;\n" "\t}\n\n"); /* root object to stop it being garbage collected */ fprintf(binding->outfile, "\tif (JSAPI_ADD_OBJECT_ROOT(cx, &newobject) != JS_TRUE) {\n" "\t\tfree(private);\n" "\t\treturn NULL;\n" "\t}\n\n"); fprintf(binding->outfile, "\n" "\t/* attach private pointer */\n" "\tif (JS_SetPrivate(cx, newobject, private) != JS_TRUE) {\n" "\t\tfree(private);\n" "\t\treturn NULL;\n" "\t}\n\n"); /* attach operations and attributes (functions and properties) */ fprintf(binding->outfile, "\tif (JS_DefineFunctions(cx, newobject, jsclass_functions) != JS_TRUE) {\n" "\t\tfree(private);\n" "\t\treturn NULL;\n" "\t}\n\n"); fprintf(binding->outfile, "\tif (JS_DefineProperties(cx, newobject, jsclass_properties) != JS_TRUE) {\n" "\t\tfree(private);\n" "\t\treturn NULL;\n" "\t}\n\n"); } else { fprintf(binding->outfile, "\tif (newobject == NULL) {\n" "\t\treturn NULL;\n" "\t}\n"); /* root object to stop it being garbage collected */ fprintf(binding->outfile, "\tif (JSAPI_ADD_OBJECT_ROOT(cx, &newobject) != JS_TRUE) {\n" "\t\treturn NULL;\n" "\t}\n\n"); /* attach operations and attributes (functions and properties) */ fprintf(binding->outfile, "\tif (JS_DefineFunctions(cx, newobject, jsclass_functions) != JS_TRUE) {\n" "\t\treturn NULL;\n" "\t}\n\n"); fprintf(binding->outfile, "\tif (JS_DefineProperties(cx, newobject, jsclass_properties) != JS_TRUE) {\n" "\t\treturn NULL;\n" "\t}\n\n"); } /* unroot object and return it */ fprintf(binding->outfile, "\tJSAPI_REMOVE_OBJECT_ROOT(cx, &newobject);\n" "\n" "\treturn newobject;\n" "}\n"); return res; } static int output_jsclass(struct binding *binding) { /* forward declare add property */ if (binding->addproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(add, JSContext *cx, JSObject *obj, jsval *vp);\n\n"); } /* forward declare del property */ if (binding->delproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(del, JSContext *cx, JSObject *obj, jsval *vp);\n\n"); } /* forward declare get property */ if (binding->getproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_PROP(get, JSContext *cx, JSObject *obj, jsval *vp);\n\n"); } /* forward declare set property */ if (binding->setproperty != NULL) { fprintf(binding->outfile, "static JSBool JSAPI_STRICTPROP(set, JSContext *cx, JSObject *obj, jsval *vp);\n\n"); } /* forward declare the enumerate */ if (binding->enumerate != NULL) { fprintf(binding->outfile, "static JSBool jsclass_enumerate(JSContext *cx, JSObject *obj);\n\n"); } /* forward declare the resolver */ if (binding->resolve != NULL) { fprintf(binding->outfile, "static JSBool jsclass_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags, JSObject **objp);\n\n"); } /* forward declare the GC mark operation */ if (binding->mark != NULL) { fprintf(binding->outfile, "static JSAPI_MARKOP(jsclass_mark);\n\n"); } /* forward declare the finalizer */ if (binding->has_private || (binding->finalise != NULL)) { fprintf(binding->outfile, "static void jsclass_finalize(JSContext *cx, JSObject *obj);\n\n"); } /* forward declare property list */ fprintf(binding->outfile, "static JSPropertySpec jsclass_properties[];\n\n"); /* output the class declaration */ HDROUTF(binding, "JSClass JSClass_%s;\n", binding->interface); /* output the class definition */ fprintf(binding->outfile, "JSClass JSClass_%s = {\n" "\t\"%s\",\n", binding->interface, binding->interface); /* generate class flags */ if (binding->has_global) { fprintf(binding->outfile, "\tJSCLASS_GLOBAL_FLAGS"); } else { fprintf(binding->outfile, "\t0"); } if (binding->resolve != NULL) { fprintf(binding->outfile, " | JSCLASS_NEW_RESOLVE"); } if (binding->mark != NULL) { fprintf(binding->outfile, " | JSAPI_JSCLASS_MARK_IS_TRACE"); } if (binding->has_private) { fprintf(binding->outfile, " | JSCLASS_HAS_PRIVATE"); } fprintf(binding->outfile, ",\n"); /* add property */ if (binding->addproperty != NULL) { fprintf(binding->outfile, "\tjsapi_property_add,\t/* addProperty */\n"); } else { fprintf(binding->outfile, "\tJS_PropertyStub,\t/* addProperty */\n"); } /* del property */ if (binding->delproperty != NULL) { fprintf(binding->outfile, "\tjsapi_property_del,\t/* delProperty */\n"); } else { fprintf(binding->outfile, "\tJS_PropertyStub,\t/* delProperty */\n"); } /* get property */ if (binding->getproperty != NULL) { fprintf(binding->outfile, "\tjsapi_property_get,\t/* getProperty */\n"); } else { fprintf(binding->outfile, "\tJS_PropertyStub,\t/* getProperty */\n"); } /* set property */ if (binding->setproperty != NULL) { fprintf(binding->outfile, "\tjsapi_property_set,\t/* setProperty */\n"); } else { fprintf(binding->outfile, "\tJS_StrictPropertyStub,\t/* setProperty */\n"); } /* enumerate */ if (binding->enumerate != NULL) { fprintf(binding->outfile, "\tjsclass_enumerate,\t/* enumerate */\n"); } else { fprintf(binding->outfile, "\tJS_EnumerateStub,\t/* enumerate */\n"); } /* resolver */ if (binding->resolve != NULL) { fprintf(binding->outfile, "\t(JSResolveOp)jsclass_resolve,\n"); } else { fprintf(binding->outfile, "\tJS_ResolveStub,\n"); } fprintf(binding->outfile, "\tJS_ConvertStub,\t/* convert */\n"); if (binding->has_private || (binding->finalise != NULL)) { fprintf(binding->outfile, "\tjsclass_finalize,\n"); } else { fprintf(binding->outfile, "\tJS_FinalizeStub,\n"); } fprintf(binding->outfile, "\t0,\t/* reserved */\n" "\tNULL,\t/* checkAccess */\n" "\tNULL,\t/* call */\n" "\tNULL,\t/* construct */\n" "\tNULL,\t/* xdr Object */\n" "\tNULL,\t/* hasInstance */\n"); /* trace/mark */ if (binding->mark != NULL) { fprintf(binding->outfile, "\tJSAPI_JSCLASS_MARKOP(jsclass_mark),\n"); } else { fprintf(binding->outfile, "\tNULL, /* trace/mark */\n"); } fprintf(binding->outfile, "\tJSAPI_CLASS_NO_INTERNAL_MEMBERS\n" "};\n\n"); return 0; } static int output_private_declaration(struct binding *binding) { struct genbind_node *type_node; if (!binding->has_private) { return 0; } type_node = genbind_node_find(binding->binding_list, NULL, genbind_cmp_node_type, (void *)GENBIND_NODE_TYPE_TYPE); if (type_node == NULL) { return -1; } fprintf(binding->outfile, "struct jsclass_private {\n"); genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_PRIVATE, webidl_private_cb, binding); genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_INTERNAL, webidl_private_cb, binding); fprintf(binding->outfile, "};\n\n"); return 0; } static int output_preamble(struct binding *binding) { genbind_node_for_each_type(binding->gb_ast, GENBIND_NODE_TYPE_PREAMBLE, webidl_preamble_cb, binding); fprintf(binding->outfile,"\n\n"); if (binding->hdrfile) { binding->outfile = binding->hdrfile; fprintf(binding->outfile, "#ifndef _%s_\n" "#define _%s_\n\n", binding->hdrguard, binding->hdrguard); binding->outfile = binding->srcfile; } return 0; } static int output_header_comments(struct binding *binding) { const char *preamble = HDR_COMMENT_PREAMBLE; fprintf(binding->outfile, preamble, options->infilename); genbind_node_for_each_type(binding->gb_ast, GENBIND_NODE_TYPE_HDRCOMMENT, webidl_hdrcomment_cb, binding); fprintf(binding->outfile,"\n */\n\n"); if (binding->hdrfile != NULL) { binding->outfile = binding->hdrfile; fprintf(binding->outfile, preamble, options->infilename); genbind_node_for_each_type(binding->gb_ast, GENBIND_NODE_TYPE_HDRCOMMENT, webidl_hdrcomment_cb, binding); fprintf(binding->outfile,"\n */\n\n"); binding->outfile = binding->srcfile; } return 0; } static bool binding_has_private(struct genbind_node *binding_list) { struct genbind_node *node; node = genbind_node_find_type(binding_list, NULL, GENBIND_NODE_TYPE_BINDING_PRIVATE); if (node != NULL) { return true; } node = genbind_node_find_type(binding_list, NULL, GENBIND_NODE_TYPE_BINDING_INTERNAL); if (node != NULL) { return true; } return false; } static bool binding_has_global(struct binding *binding) { struct genbind_node *api_node; api_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_API, "global"); if (api_node != NULL) { return true; } return false; } static struct binding * binding_new(char *outfilename, char *hdrfilename, struct genbind_node *genbind_ast) { struct binding *nb; struct genbind_node *binding_node; struct genbind_node *binding_list; struct genbind_node *ident_node; struct genbind_node *interface_node; FILE *outfile = NULL; /* output source file */ FILE *hdrfile = NULL; /* output header file */ char *hdrguard = NULL; struct webidl_node *webidl_ast = NULL; int res; binding_node = genbind_node_find_type(genbind_ast, NULL, GENBIND_NODE_TYPE_BINDING); if (binding_node == NULL) { return NULL; } binding_list = genbind_node_getnode(binding_node); if (binding_list == NULL) { return NULL; } ident_node = genbind_node_find_type(binding_list, NULL, GENBIND_NODE_TYPE_IDENT); if (ident_node == NULL) { return NULL; } interface_node = genbind_node_find_type(binding_list, NULL, GENBIND_NODE_TYPE_BINDING_INTERFACE); if (interface_node == NULL) { return NULL; } /* walk ast and load any web IDL files required */ res = read_webidl(genbind_ast, &webidl_ast); if (res != 0) { fprintf(stderr, "Error reading Web IDL files\n"); return NULL; } /* open output file */ if (outfilename == NULL) { outfile = stdout; } else { outfile = fopen(outfilename, "w"); } if (outfile == NULL) { fprintf(stderr, "Error opening source output %s: %s\n", outfilename, strerror(errno)); return NULL; } /* output header file if required */ if (hdrfilename != NULL) { int guardlen; int pos; hdrfile = fopen(hdrfilename, "w"); if (hdrfile == NULL) { fprintf(stderr, "Error opening header output %s: %s\n", hdrfilename, strerror(errno)); fclose(outfile); return NULL; } guardlen = strlen(hdrfilename); hdrguard = calloc(1, guardlen + 1); for (pos = 0; pos < guardlen; pos++) { if (isalpha(hdrfilename[pos])) { hdrguard[pos] = toupper(hdrfilename[pos]); } else { hdrguard[pos] = '_'; } } } nb = calloc(1, sizeof(struct binding)); nb->gb_ast = genbind_ast; nb->wi_ast = webidl_ast; nb->name = genbind_node_gettext(ident_node); nb->interface = genbind_node_gettext(interface_node); nb->outfile = outfile; nb->srcfile = outfile; nb->hdrfile = hdrfile; nb->hdrguard = hdrguard; nb->has_private = binding_has_private(binding_list); nb->has_global = binding_has_global(nb); nb->binding_list = binding_list; /* class API */ nb->addproperty = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "addproperty"); nb->delproperty = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "delproperty"); nb->getproperty = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "getproperty"); nb->setproperty = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "setproperty"); nb->enumerate = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "enumerate"); nb->resolve = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "resolve"); nb->finalise = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "finalise"); nb->mark = genbind_node_find_type_ident(genbind_ast, NULL, GENBIND_NODE_TYPE_API, "mark"); return nb; } int jsapi_libdom_output(char *outfilename, char *hdrfilename, struct genbind_node *genbind_ast) { int res; struct binding *binding; /* get general binding information used in output */ binding = binding_new(outfilename, hdrfilename, genbind_ast); if (binding == NULL) { return 40; } /* start with comment block */ res = output_header_comments(binding); if (res) { return 50; } res = output_preamble(binding); if (res) { return 60; } res = output_private_declaration(binding); if (res) { return 70; } res = output_jsclass(binding); if (res) { return 80; } res = output_property_tinyid(binding); if (res) { return 85; } /* user code outout just before function bodies emitted */ res = output_prologue(binding); if (res) { return 89; } /* operator and atrtribute body generation */ res = output_operator_body(binding, binding->interface); if (res) { return 90; } res = output_property_body(binding); if (res) { return 100; } /* operator and atrtribute specifier generation */ res = output_function_spec(binding); if (res) { return 110; } res = output_property_spec(binding); if (res) { return 120; } /* binding specific operations (destructors etc.) */ res = output_api_operations(binding); if (res) { return 130; } res = output_class_init(binding); if (res) { return 140; } res = output_class_new(binding); if (res) { return 150; } res = output_epilogue(binding); if (res) { return 160; } fclose(binding->outfile); return 0; } netsurf-all-3.2/nsgenbind/src/jsapi-libdom-property.c0000644000175000017500000007011712377677044021771 0ustar vincevince/* property generation * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include "options.h" #include "nsgenbind-ast.h" #include "webidl-ast.h" #include "jsapi-libdom.h" static int generate_property_tinyid(struct binding *binding, const char *interface); static int generate_property_spec(struct binding *binding, const char *interface); static int generate_property_body(struct binding *binding, const char *interface); /* generate context data fetcher if the binding has private data */ static inline int output_private_get(struct binding *binding, const char *argname) { int ret = 0; if (binding->has_private) { ret = fprintf(binding->outfile, "\tstruct jsclass_private *%s;\n" "\n" "\t%s = JS_GetInstancePrivate(cx, obj, &JSClass_%s, NULL);\n" "\tif (%s == NULL) {\n" "\t\treturn JS_FALSE;\n" "\t}\n\n", argname, argname, binding->interface, argname); if (options->dbglog) { ret += fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, obj, %s);\n", argname); } } else { if (options->dbglog) { ret += fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, obj);\n"); } } return ret; } /* generate vars for property name getter */ static inline int output_property_name_get_vars(struct binding *binding, const char *argname) { /* get property name */ return fprintf(binding->outfile, "\tjsval %s_jsval;\n" "\tJSString *%s_jsstr = NULL;\n" "\tint %s_len = 0;\n" "\tchar *%s = NULL;\n", argname, argname, argname, argname); } /* generate vars for property tinyid getter */ static inline int output_property_tinyid_get_vars(struct binding *binding, const char *argname) { /* get property name */ return fprintf(binding->outfile, "\tjsval %s_jsval;\n" "\tint8_t %s = JSAPI_PROP_TINYID_END;\n", argname, argname); } /* generate property name getter */ static inline int output_property_name_get(struct binding *binding, const char *argname) { /* get property name */ return fprintf(binding->outfile, "\t /* obtain property name */\n" "\tJSAPI_PROP_IDVAL(cx, &%s_jsval);\n" "\t%s_jsstr = JS_ValueToString(cx, %s_jsval);\n" "\tif (%s_jsstr != NULL) {\n" "\t\tJSString_to_char(%s_jsstr, %s, %s_len);\n" "\t}\n\n", argname,argname,argname,argname,argname,argname,argname); } /* generate property name getter */ static inline int output_property_tinyid_get(struct binding *binding, const char *argname) { /* get property name */ return fprintf(binding->outfile, "\t /* obtain property tinyid */\n" "\tJSAPI_PROP_IDVAL(cx, &%s_jsval);\n" "\t%s = JSVAL_TO_INT(%s_jsval);\n\n", argname, argname, argname); } /******************************** tinyid ********************************/ static int webidl_property_tinyid_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *ident_node; const char *ident; ident_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_IDENT); ident = webidl_node_gettext(ident_node); if (ident == NULL) { /* properties must have an operator * http://www.w3.org/TR/WebIDL/#idl-attributes */ return -1; } fprintf(binding->outfile, "\tJSAPI_PROP_TINYID_%s,\n", ident); return 0; } /* callback to emit implements property spec */ static int webidl_property_tinyid_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return generate_property_tinyid(binding, webidl_node_gettext(node)); } static int generate_property_tinyid(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } /* generate property entries for each list (partial interfaces) */ members_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"\t/**** %s ****/\n", interface); /* for each property emit a JSAPI_PS() */ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_ATTRIBUTE, webidl_property_tinyid_cb, binding); members_node = webidl_node_find_type(webidl_node_getnode(interface_node), members_node, WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = generate_property_tinyid(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_property_tinyid_implements_cb, binding); } return res; } /* exported interface documented in jsapi-libdom.h */ int output_property_tinyid(struct binding *binding) { int res; fprintf(binding->outfile, "enum property_tinyid {\n"); res = generate_property_tinyid(binding, binding->interface); fprintf(binding->outfile, "\tJSAPI_PROP_TINYID_END,\n" "};\n\n"); return res; } /******************************** specifier ********************************/ /* search binding for property sharing modifier */ static enum genbind_type_modifier get_binding_shared_modifier(struct binding *binding, const char *type, const char *ident) { struct genbind_node *shared_node; struct genbind_node *shared_mod_node; /* look for node matching the ident first */ shared_node = genbind_node_find_type_ident(binding->binding_list, NULL, GENBIND_NODE_TYPE_BINDING_PROPERTY, ident); /* look for a node matching the type */ if (shared_node == NULL) { shared_node = genbind_node_find_type_ident(binding->binding_list, NULL, GENBIND_NODE_TYPE_BINDING_PROPERTY, type); } if (shared_node != NULL) { /* no explicit shared status */ shared_mod_node = genbind_node_find_type(genbind_node_getnode(shared_node), NULL, GENBIND_NODE_TYPE_MODIFIER); if (shared_mod_node != NULL) { return genbind_node_getint(shared_mod_node); } } return GENBIND_TYPE_NONE; } /* obtain the value for a key/value type extended attribute */ static char * get_keyval_extended_attribute(struct webidl_node *node, const char *attribute) { struct webidl_node *ext_node; struct webidl_node *ident_node; char *value; ext_node = webidl_node_find_type_ident(webidl_node_getnode(node), WEBIDL_NODE_TYPE_EXTENDED_ATTRIBUTE, attribute); if (ext_node == NULL) { return NULL; /* no matching extended attribute at all */ } /* should be extended atrribute name node */ ident_node = webidl_node_find_type(webidl_node_getnode(ext_node), NULL, WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* not the attribute name already matched - bail * somethings broken */ return NULL; } value = webidl_node_gettext(ident_node); if (strcmp(attribute, value) != 0) { /* not the attribute name already matched - bail * somethings broken */ return NULL; } /* should be an = sign for key/value pair */ ident_node = webidl_node_find_type(webidl_node_getnode(ext_node), ident_node, WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* no additional attribute - not key/value then */ return NULL; } value = webidl_node_gettext(ident_node); if (strcmp("=", value) != 0) { /* not a key/value pair then */ return NULL; } /* value */ ident_node = webidl_node_find_type(webidl_node_getnode(ext_node), ident_node, WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* no value */ return NULL; } value = webidl_node_gettext(ident_node); return value; } static bool property_is_ro(struct webidl_node *node) { struct webidl_node *modifier_node; modifier_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_MODIFIER); if (webidl_node_getint(modifier_node) == WEBIDL_TYPE_READONLY) { return true; } return false; } static int webidl_property_spec_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *type_node; const char *type = NULL; struct webidl_node *ident_node; const char *ident; ident_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_IDENT); ident = webidl_node_gettext(ident_node); if (ident == NULL) { /* properties must have an operator * http://www.w3.org/TR/WebIDL/#idl-attributes */ return -1; } /* get type name */ type_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_TYPE); ident_node = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_IDENT); type = webidl_node_gettext(ident_node); /* generate JSAPI_PS macro entry */ /* if there is a putforwards the property requires a setter */ if ((property_is_ro(node)) && (get_keyval_extended_attribute(node, "PutForwards") == NULL)) { fprintf(binding->outfile, "\tJSAPI_PS_RO(\"%s\",\n", ident); } else { fprintf(binding->outfile, "\tJSAPI_PS(\"%s\",\n", ident); } /* generate property shared status */ switch (get_binding_shared_modifier(binding, type, ident)) { default: case GENBIND_TYPE_NONE: /* shared property without type handler * * js doesnt provide storage and setter/getter must * perform all GC management. */ fprintf(binding->outfile, "\t\t%s,\n" "\t\tJSAPI_PROP_TINYID_%s,\n" "\t\tJSPROP_SHARED | ", ident, ident); break; case GENBIND_TYPE_TYPE: /* shared property with a type handler */ fprintf(binding->outfile, "\t\t%s,\n" "\t\tJSAPI_PROP_TINYID_%s,\n" "\t\tJSPROP_SHARED | ", type, ident); break; case GENBIND_TYPE_UNSHARED: /* unshared property without type handler */ fprintf(binding->outfile, "\t\t%s,\n" "\t\tJSAPI_PROP_TINYID_%s,\n" "\t\t", ident, ident); break; case GENBIND_TYPE_TYPE_UNSHARED: /* unshared property with a type handler */ fprintf(binding->outfile, "\t\t%s,\n" "\t\tJSAPI_PROP_TINYID_%s,\n" "\t\t", type, ident); break; } fprintf(binding->outfile, "JSPROP_ENUMERATE),\n"); return 0; } /* callback to emit implements property spec */ static int webidl_property_spec_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return generate_property_spec(binding, webidl_node_gettext(node)); } static int generate_property_spec(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } /* generate property entries for each list (partial interfaces) */ members_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"\t/**** %s ****/\n", interface); /* for each property emit a JSAPI_PS() */ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_ATTRIBUTE, webidl_property_spec_cb, binding); members_node = webidl_node_find_type(webidl_node_getnode(interface_node), members_node, WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = generate_property_spec(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_property_spec_implements_cb, binding); } return res; } /* exported interface documented in jsapi-libdom.h */ int output_property_spec(struct binding *binding) { int res; fprintf(binding->outfile, "static JSPropertySpec jsclass_properties[] = {\n"); res = generate_property_spec(binding, binding->interface); fprintf(binding->outfile, "\tJSAPI_PS_END\n};\n\n"); return res; } /******************************** body ********************************/ static int output_return(struct binding *binding, const char *ident, struct webidl_node *node) { struct webidl_node *type_node = NULL; struct webidl_node *type_base = NULL; struct webidl_node *type_nullable = NULL; enum webidl_type webidl_arg_type; type_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_TYPE); type_base = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(type_base); type_nullable = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_NULLABLE); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: /* User type are represented with jsobject */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_BYTE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_BYTE"); break; case WEBIDL_TYPE_OCTET: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_OCTET"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_SHORT: /* int16_t */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_LONGLONG: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_LONGLONG"); break; case WEBIDL_TYPE_LONG: /* int32_t */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_STRING: /* JSString * */ if (type_nullable == NULL) { /* entry is not nullable ensure it is set to a string */ fprintf(binding->outfile, "\tif (%s == NULL) {\n" "\t\t%s = JS_NewStringCopyN(cx, NULL, 0);\n" "\t}\n", ident, ident); } fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_SEQUENCE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SEQUENCE"); break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSAPI_PROP_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_DATE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_DATE"); break; case WEBIDL_TYPE_VOID: /* specifically requires no value */ break; default: break; } return 0; } /* generate variable declaration of the correct type with appropriate default */ static int output_return_declaration(struct binding *binding, const char *ident, struct webidl_node *node) { struct webidl_node *type_node = NULL; struct webidl_node *type_base = NULL; struct webidl_node *type_name = NULL; struct webidl_node *type_mod = NULL; enum webidl_type webidl_arg_type; type_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_TYPE); type_base = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: /* User type are represented with jsobject */ type_name = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_IDENT); fprintf(binding->outfile, "\tJSObject *%s = NULL; /* %s */\n", ident, webidl_node_gettext(type_name)); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tJSBool %s = JS_FALSE;\n",ident); break; case WEBIDL_TYPE_BYTE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_BYTE"); break; case WEBIDL_TYPE_OCTET: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_OCTET"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tdouble %s = 0;\n", ident); break; case WEBIDL_TYPE_SHORT: /* int16_t */ type_mod = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_MODIFIER); if ((type_mod != NULL) && (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { fprintf(binding->outfile, "\tuint16_t %s = 0;\n", ident); } else { fprintf(binding->outfile, "\tint16_t %s = 0;\n", ident); } break; case WEBIDL_TYPE_LONGLONG: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_LONGLONG"); break; case WEBIDL_TYPE_LONG: /* int32_t */ type_mod = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_MODIFIER); if ((type_mod != NULL) && (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { fprintf(binding->outfile, "\tuint32_t %s = 0;\n", ident); } else { fprintf(binding->outfile, "\tint32_t %s = 0;\n", ident); } break; case WEBIDL_TYPE_STRING: /* JSString * */ fprintf(binding->outfile, "\tJSString *%s = NULL;\n", ident); break; case WEBIDL_TYPE_SEQUENCE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SEQUENCE"); break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSObject *%s = NULL;\n", ident); break; case WEBIDL_TYPE_DATE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_DATE"); break; case WEBIDL_TYPE_VOID: /* specifically requires no value */ break; default: break; } return 0; } static int output_property_placeholder(struct binding *binding, struct webidl_node* oplist, const char *ident) { oplist=oplist; WARN(WARNING_UNIMPLEMENTED, "property %s.%s has no implementation\n", binding->interface, ident); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"property %s.%s has no implementation\");\n", binding->interface, ident); } return 0; } static int output_property_getter(struct binding *binding, struct webidl_node *node, const char *ident) { struct genbind_node *property_node; fprintf(binding->outfile, "static JSBool JSAPI_PROP(%s_get, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n", ident); /* return value declaration */ output_return_declaration(binding, "jsret", node); output_private_get(binding, "private"); property_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_GETTER, ident); if (property_node != NULL) { /* binding source block */ output_code_block(binding, genbind_node_getnode(property_node)); } else { /* examine internal variables and see if they are gettable */ struct genbind_node *binding_node; struct genbind_node *internal_node = NULL; binding_node = genbind_node_find_type(binding->gb_ast, NULL, GENBIND_NODE_TYPE_BINDING); if (binding_node != NULL) { internal_node = genbind_node_find_type_ident(genbind_node_getnode(binding_node), NULL, GENBIND_NODE_TYPE_BINDING_INTERNAL, ident); } if (internal_node != NULL) { /** @todo fetching from internal entries ought to be type sensitive */ fprintf(binding->outfile, "\tjsret = private->%s;\n", ident); } else { output_property_placeholder(binding, node, ident); } } output_return(binding, "jsret", node); fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); return 0; } static int output_property_setter(struct binding *binding, struct webidl_node *node, const char *ident) { struct genbind_node *property_node; char *putforwards; putforwards = get_keyval_extended_attribute(node, "PutForwards"); if (putforwards != NULL) { /* generate a putforwards setter */ fprintf(binding->outfile, "/* PutForwards setter */\n" "static JSBool JSAPI_STRICTPROP(%s_set, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n", ident); fprintf(binding->outfile, "\tjsval propval;\n" "\tif (JS_GetProperty(cx, obj, \"%s\", &propval) == JS_TRUE) {\n" "\t\tJS_SetProperty(cx, JSVAL_TO_OBJECT(propval), \"%s\", vp);\n" "\t}\n", ident, putforwards); fprintf(binding->outfile, "\treturn JS_FALSE; /* disallow the asignment */\n" "}\n\n"); return 0; } if (property_is_ro(node)) { /* readonly so a set function is not required */ return 0; } property_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_SETTER, ident); fprintf(binding->outfile, "static JSBool JSAPI_STRICTPROP(%s_set, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n", ident); output_private_get(binding, "private"); if (property_node != NULL) { /* binding source block */ output_code_block(binding, genbind_node_getnode(property_node)); } else { output_property_placeholder(binding, node, ident); } fprintf(binding->outfile, " return JS_FALSE; /* disallow the asignment by default */\n" "}\n\n"); return 0; } static int webidl_property_body_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *ident_node; const char *ident; struct webidl_node *type_node; const char *type = NULL; int ret; enum genbind_type_modifier shared_mod; ident_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_IDENT); ident = webidl_node_gettext(ident_node); if (ident == NULL) { /* properties must have an operator * http://www.w3.org/TR/WebIDL/#idl-attributes */ return -1; } /* get type name */ type_node = webidl_node_find_type(webidl_node_getnode(node), NULL, WEBIDL_NODE_TYPE_TYPE); ident_node = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_IDENT); type = webidl_node_gettext(ident_node); /* find shared modifiers */ shared_mod = get_binding_shared_modifier(binding, type, ident); /* only generate individual getters/setters if there is not a * type handler */ if ((shared_mod & GENBIND_TYPE_TYPE) == 0) { ret = output_property_setter(binding, node, ident); if (ret == 0) { /* property getter */ ret = output_property_getter(binding, node, ident); } } return ret; } /* callback to emit implements property bodys */ static int webidl_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return generate_property_body(binding, webidl_node_gettext(node)); } static int generate_property_body(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } /* generate property bodies */ members_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"/**** %s ****/\n", interface); /* emit property body */ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_ATTRIBUTE, webidl_property_body_cb, binding); members_node = webidl_node_find_type(webidl_node_getnode(interface_node), members_node, WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = generate_property_body(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_implements_cb, binding); } return res; } /* setter for type handler */ static int output_property_type_setter(struct binding *binding, struct genbind_node *node, const char *type) { struct genbind_node *property_node; node = node;/* currently unused */ fprintf(binding->outfile, "static JSBool\n" "JSAPI_STRICTPROP(%s_set, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n", type); /* property name vars */ output_property_tinyid_get_vars(binding, "tinyid"); /* context data */ output_private_get(binding, "private"); /* property name */ output_property_tinyid_get(binding, "tinyid"); /* output binding code block */ property_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_SETTER, type); if (property_node != NULL) { /* binding source block */ output_code_block(binding, genbind_node_getnode(property_node)); } fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); return 0; } /* getter for type handlers */ static int output_property_type_getter(struct binding *binding, struct genbind_node *node, const char *type) { struct genbind_node *property_node; node = node;/* currently unused */ fprintf(binding->outfile, "static JSBool JSAPI_PROP(%s_get, JSContext *cx, JSObject *obj, jsval *vp)\n" "{\n", type); /* property tinyid vars */ output_property_tinyid_get_vars(binding, "tinyid"); /* context data */ output_private_get(binding, "private"); /* property tinyid */ output_property_tinyid_get(binding, "tinyid"); /* output binding code block */ property_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_GETTER, type); if (property_node != NULL) { /* binding source block */ output_code_block(binding, genbind_node_getnode(property_node)); } fprintf(binding->outfile, " return JS_TRUE;\n" "}\n\n"); return 0; } /* callback to emit property handlers for whole types */ static int typehandler_property_cb(struct genbind_node *node, void *ctx) { struct binding *binding = ctx; struct genbind_node *ident_node; const char *type; struct genbind_node *mod_node; enum genbind_type_modifier share_mod; int ret = 0; mod_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_MODIFIER); share_mod = genbind_node_getint(mod_node); if ((share_mod & GENBIND_TYPE_TYPE) == GENBIND_TYPE_TYPE) { /* type handler */ ident_node = genbind_node_find_type(genbind_node_getnode(node), NULL, GENBIND_NODE_TYPE_IDENT); type = genbind_node_gettext(ident_node); if (type != NULL) { ret = output_property_type_setter(binding, node, type); if (ret == 0) { /* property getter */ ret = output_property_type_getter(binding, node, type); } } } return ret; } /* exported interface documented in jsapi-libdom.h */ int output_property_body(struct binding *binding) { int res; res = generate_property_body(binding, binding->interface); if (res == 0) { res = genbind_node_for_each_type(binding->binding_list, GENBIND_NODE_TYPE_BINDING_PROPERTY, typehandler_property_cb, binding); } return res; } netsurf-all-3.2/nsgenbind/src/jsapi-libdom-operator.c0000644000175000017500000005303612377677044021741 0ustar vincevince/* function/operator generation * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #include #include #include #include #include #include "options.h" #include "nsgenbind-ast.h" #include "webidl-ast.h" #include "jsapi-libdom.h" static int webidl_func_spec_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *ident_node; ident_node = webidl_node_find(webidl_node_getnode(node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* operation without identifier - must have special keyword * http://www.w3.org/TR/WebIDL/#idl-operations */ } else { fprintf(binding->outfile, "\tJSAPI_FS(%s, 0, JSPROP_ENUMERATE ),\n", webidl_node_gettext(ident_node)); /* @todo number of args to that FN_FS() call should be correct */ } return 0; } static int generate_function_spec(struct binding *binding, const char *interface); /* callback to emit implements operator spec */ static int webidl_function_spec_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return generate_function_spec(binding, webidl_node_gettext(node)); } static int generate_function_spec(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } members_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"\t/**** %s ****/\n", interface); /* for each function emit a JSAPI_FS()*/ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_OPERATION, webidl_func_spec_cb, binding); members_node = webidl_node_find(webidl_node_getnode(interface_node), members_node, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = generate_function_spec(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_function_spec_implements_cb, binding); } return res; } int output_function_spec(struct binding *binding) { int res; fprintf(binding->outfile, "static JSFunctionSpec jsclass_functions[] = {\n"); res = generate_function_spec(binding, binding->interface); fprintf(binding->outfile, "\tJSAPI_FS_END\n};\n\n"); return res; } static int output_return(struct binding *binding, const char *ident, struct webidl_node *node) { struct webidl_node *arglist_node = NULL; struct webidl_node *type_node = NULL; struct webidl_node *type_base = NULL; enum webidl_type webidl_arg_type; arglist_node = webidl_node_find_type(node, NULL, WEBIDL_NODE_TYPE_LIST); if (arglist_node == NULL) { return -1; /* @todo check if this is broken AST */ } type_node = webidl_node_find_type(webidl_node_getnode(arglist_node), NULL, WEBIDL_NODE_TYPE_TYPE); type_base = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: /* User type are represented with jsobject */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_BYTE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_BYTE"); break; case WEBIDL_TYPE_OCTET: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_OCTET"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_SHORT: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SHORT"); break; case WEBIDL_TYPE_LONGLONG: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_LONGLONG"); break; case WEBIDL_TYPE_LONG: /* int32_t */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, INT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_STRING: /* JSString * */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, JSAPI_STRING_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_SEQUENCE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SEQUENCE"); break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSAPI_FUNC_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(%s));\n", ident); break; case WEBIDL_TYPE_DATE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_DATE"); break; case WEBIDL_TYPE_VOID: /* specifically requires no value */ break; default: break; } return 0; } /* generate variable declaration of the correct type with appropriate default */ static int output_return_declaration(struct binding *binding, const char *ident, struct webidl_node *node) { struct webidl_node *arglist_node = NULL; struct webidl_node *type_node = NULL; struct webidl_node *type_name = NULL; struct webidl_node *type_base = NULL; enum webidl_type webidl_arg_type; struct webidl_node *type_mod = NULL; arglist_node = webidl_node_find_type(node, NULL, WEBIDL_NODE_TYPE_LIST); if (arglist_node == NULL) { return -1; /* @todo check if this is broken AST */ } type_node = webidl_node_find_type(webidl_node_getnode(arglist_node), NULL, WEBIDL_NODE_TYPE_TYPE); type_base = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: /* User type are represented with jsobject */ type_name = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_IDENT); fprintf(binding->outfile, "\tJSObject *%s = NULL; /* %s */\n", ident, webidl_node_gettext(type_name)); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tJSBool %s = JS_FALSE;\n",ident); break; case WEBIDL_TYPE_BYTE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_BYTE"); break; case WEBIDL_TYPE_OCTET: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_OCTET"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tdouble %s = 0;\n", ident); break; case WEBIDL_TYPE_SHORT: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SHORT"); break; case WEBIDL_TYPE_LONGLONG: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_LONGLONG"); break; case WEBIDL_TYPE_LONG: /* int32_t */ type_mod = webidl_node_find_type(webidl_node_getnode(type_node), NULL, WEBIDL_NODE_TYPE_MODIFIER); if ((type_mod != NULL) && (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { fprintf(binding->outfile, "\tuint32_t %s = 0;\n", ident); } else { fprintf(binding->outfile, "\tint32_t %s = 0;\n", ident); } break; case WEBIDL_TYPE_STRING: /* JSString * */ fprintf(binding->outfile, "\tJSString *%s = NULL;\n", ident); break; case WEBIDL_TYPE_SEQUENCE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_SEQUENCE"); break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSObject *%s = NULL;\n", ident); break; case WEBIDL_TYPE_DATE: WARN(WARNING_UNIMPLEMENTED, "Unhandled type WEBIDL_TYPE_DATE"); break; case WEBIDL_TYPE_VOID: /* specifically requires no value */ break; default: break; } return 0; } /** creates all the variable definitions * * generate functions variables (including return value) with default * values as appropriate */ static void output_variable_definitions(struct binding *binding, struct webidl_node *operation_list) { struct webidl_node *operation_ident; struct webidl_node *arglist_node; struct webidl_node *arglist; /* argument list */ struct webidl_node *arg_node = NULL; struct webidl_node *arg_ident = NULL; struct webidl_node *arg_type = NULL; struct webidl_node *arg_type_base = NULL; struct webidl_node *arg_type_ident = NULL; enum webidl_type webidl_arg_type; struct webidl_node *type_mod = NULL; /* input variables */ arglist_node = webidl_node_find_type(operation_list, NULL, WEBIDL_NODE_TYPE_LIST); if (arglist_node == NULL) { return; /* @todo check if this is broken AST */ } arglist = webidl_node_getnode(arglist_node); arg_node = webidl_node_find_type(arglist, arg_node, WEBIDL_NODE_TYPE_ARGUMENT); /* at least one argument or private need to generate argv variable */ if ((arg_node != NULL) || binding->has_private) { fprintf(binding->outfile, "\tjsval *argv = JSAPI_FUNC_ARGV(cx, vp);\n"); } while (arg_node != NULL) { /* generate variable to hold the argument */ arg_ident = webidl_node_find_type(webidl_node_getnode(arg_node), NULL, WEBIDL_NODE_TYPE_IDENT); arg_type = webidl_node_find_type(webidl_node_getnode(arg_node), NULL, WEBIDL_NODE_TYPE_TYPE); arg_type_base = webidl_node_find_type(webidl_node_getnode(arg_type), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(arg_type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: if (options->verbose) { operation_ident = webidl_node_find_type(operation_list, NULL, WEBIDL_NODE_TYPE_IDENT); arg_type_ident = webidl_node_find_type(webidl_node_getnode(arg_type), NULL, WEBIDL_NODE_TYPE_IDENT); fprintf(stderr, "User type: %s:%s %s\n", webidl_node_gettext(operation_ident), webidl_node_gettext(arg_type_ident), webidl_node_gettext(arg_ident)); } /* User type - jsobject then */ fprintf(binding->outfile, "\tJSObject *%s = NULL;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tJSBool %s = JS_FALSE;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_BYTE: fprintf(stderr, "Unsupported: WEBIDL_TYPE_BYTE\n"); break; case WEBIDL_TYPE_OCTET: fprintf(stderr, "Unsupported: WEBIDL_TYPE_OCTET\n"); break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tdouble %s = 0;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_SHORT: fprintf(stderr, "Unsupported: WEBIDL_TYPE_SHORT\n"); break; case WEBIDL_TYPE_LONGLONG: fprintf(stderr, "Unsupported: WEBIDL_TYPE_LONGLONG\n"); break; case WEBIDL_TYPE_LONG: /* int32_t */ type_mod = webidl_node_find_type(webidl_node_getnode(arg_type), NULL, WEBIDL_NODE_TYPE_MODIFIER); if ((type_mod != NULL) && (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { fprintf(binding->outfile, "\tuint32_t %s = 0;\n", webidl_node_gettext(arg_ident)); } else { fprintf(binding->outfile, "\tint32_t %s = 0;\n", webidl_node_gettext(arg_ident)); } break; case WEBIDL_TYPE_STRING: /* JSString * */ fprintf(binding->outfile, "\tJSString *%s_jsstr = NULL;\n" "\tint %s_len = 0;\n" "\tchar *%s = NULL;\n", webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_SEQUENCE: fprintf(stderr, "Unsupported: WEBIDL_TYPE_SEQUENCE\n"); break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSObject *%s = NULL;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_DATE: fprintf(stderr, "Unsupported: WEBIDL_TYPE_DATE\n"); break; case WEBIDL_TYPE_VOID: fprintf(stderr, "Unsupported: WEBIDL_TYPE_VOID\n"); break; default: break; } /* next argument */ arg_node = webidl_node_find_type(arglist, arg_node, WEBIDL_NODE_TYPE_ARGUMENT); } } /** generate code to process operation input from javascript */ static void output_operation_input(struct binding *binding, struct webidl_node *operation_list) { struct webidl_node *arglist_node; struct webidl_node *arglist; /* argument list */ struct webidl_node *arg_node = NULL; struct webidl_node *arg_ident = NULL; struct webidl_node *arg_type = NULL; struct webidl_node *arg_type_base = NULL; struct webidl_node *type_mod = NULL; enum webidl_type webidl_arg_type; int arg_cur = 0; /* current position in the input argument vector */ /* input variables */ arglist_node = webidl_node_find_type(operation_list, NULL, WEBIDL_NODE_TYPE_LIST); if (arglist_node == NULL) { return; /* @todo check if this is broken AST */ } arglist = webidl_node_getnode(arglist_node); arg_node = webidl_node_find_type(arglist, arg_node, WEBIDL_NODE_TYPE_ARGUMENT); while (arg_node != NULL) { /* generate variable to hold the argument */ arg_ident = webidl_node_find_type(webidl_node_getnode(arg_node), NULL, WEBIDL_NODE_TYPE_IDENT); arg_type = webidl_node_find_type(webidl_node_getnode(arg_node), NULL, WEBIDL_NODE_TYPE_TYPE); arg_type_base = webidl_node_find_type(webidl_node_getnode(arg_type), NULL, WEBIDL_NODE_TYPE_TYPE_BASE); webidl_arg_type = webidl_node_getint(arg_type_base); switch (webidl_arg_type) { case WEBIDL_TYPE_USER: fprintf(binding->outfile, "\tif (!JSAPI_JSVAL_IS_OBJECT(argv[%d])) {\n" "\t\tJSType argtype;\n" "\t\targtype = JS_TypeOfValue(cx, argv[%d]);\n" "\t\tJSLOG(\"User argument is type %%s not an object\", JS_GetTypeName(cx, argtype));\n" "\t\treturn JS_FALSE;\n" "\t}\n" "\t%s = JSVAL_TO_OBJECT(argv[%d]);\n", arg_cur, arg_cur, webidl_node_gettext(arg_ident), arg_cur); break; case WEBIDL_TYPE_BOOL: /* JSBool */ fprintf(binding->outfile, "\tif (!JS_ValueToBoolean(cx, argv[%d], &%s)) {\n" "\t\treturn JS_FALSE;\n" "\t}\n", arg_cur, webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_BYTE: case WEBIDL_TYPE_OCTET: break; case WEBIDL_TYPE_FLOAT: case WEBIDL_TYPE_DOUBLE: /* double */ fprintf(binding->outfile, "\tdouble %s = 0;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_SHORT: case WEBIDL_TYPE_LONGLONG: break; case WEBIDL_TYPE_LONG: /* int32_t */ type_mod = webidl_node_find_type(webidl_node_getnode(arg_type), NULL, WEBIDL_NODE_TYPE_MODIFIER); if ((type_mod != NULL) && (webidl_node_getint(type_mod) == WEBIDL_TYPE_MODIFIER_UNSIGNED)) { fprintf(binding->outfile, "\tJS_ValueToECMAUint32(cx, argv[%d], &%s);\n", arg_cur, webidl_node_gettext(arg_ident)); } else { fprintf(binding->outfile, "\tJS_ValueToECMAInt32(cx, argv[%d], &%s);\n", arg_cur, webidl_node_gettext(arg_ident)); } break; case WEBIDL_TYPE_STRING: /* JSString * */ fprintf(binding->outfile, "\tif (argc > %d) {\n" "\t\t%s_jsstr = JS_ValueToString(cx, argv[%d]);\n" "\t} else {\n" "\t\t%s_jsstr = JS_ValueToString(cx, JSVAL_VOID);\n" "\t}\n" "\tif (%s_jsstr != NULL) {\n" "\t\tJSString_to_char(%s_jsstr, %s, %s_len);\n" "\t}\n\n", arg_cur, webidl_node_gettext(arg_ident), arg_cur, webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident), webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_SEQUENCE: break; case WEBIDL_TYPE_OBJECT: /* JSObject * */ fprintf(binding->outfile, "\tJSObject *%s = NULL;\n", webidl_node_gettext(arg_ident)); break; case WEBIDL_TYPE_DATE: case WEBIDL_TYPE_VOID: break; default: break; } /* next argument */ arg_node = webidl_node_find_type(arglist, arg_node, WEBIDL_NODE_TYPE_ARGUMENT); arg_cur++; } } static int output_operator_placeholder(struct binding *binding, struct webidl_node *oplist, struct webidl_node *ident_node) { oplist = oplist; WARN(WARNING_UNIMPLEMENTED, "operation %s.%s has no implementation\n", binding->interface, webidl_node_gettext(ident_node)); if (options->dbglog) { fprintf(binding->outfile, "\tJSLOG(\"operation %s.%s has no implementation\");\n", binding->interface, webidl_node_gettext(ident_node)); } return 0; } /* generate context data fetcher if the binding has private data */ static inline int output_private_get(struct binding *binding, const char *argname) { int ret = 0; if (binding->has_private) { ret = fprintf(binding->outfile, "\tstruct jsclass_private *%s;\n" "\n" "\t%s = JS_GetInstancePrivate(cx,\n" "\t\t\tJSAPI_THIS_OBJECT(cx,vp),\n" "\t\t\t&JSClass_%s,\n" "\t\t\targv);\n" "\tif (%s == NULL) {\n" "\t\treturn JS_FALSE;\n" "\t}\n\n", argname, argname, binding->interface, argname); if (options->dbglog) { ret += fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p private:%%p\", cx, JSAPI_THIS_OBJECT(cx,vp), %s);\n", argname); } } else { if (options->dbglog) { ret += fprintf(binding->outfile, "\tJSLOG(\"jscontext:%%p jsobject:%%p\", cx, JSAPI_THIS_OBJECT(cx,vp));\n"); } } return ret; } static int webidl_operator_body_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; struct webidl_node *ident_node; struct genbind_node *operation_node; ident_node = webidl_node_find(webidl_node_getnode(node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_IDENT); if (ident_node == NULL) { /* operation without identifier - must have special keyword * http://www.w3.org/TR/WebIDL/#idl-operations */ WARN(WARNING_UNIMPLEMENTED, "Unhandled operation with no name on %s\n", binding->interface); } else { /* normal operation with identifier */ fprintf(binding->outfile, "static JSBool JSAPI_FUNC(%s, JSContext *cx, uintN argc, jsval *vp)\n", webidl_node_gettext(ident_node)); fprintf(binding->outfile, "{\n"); /* return value declaration */ output_return_declaration(binding, "jsret", webidl_node_getnode(node)); output_variable_definitions(binding, webidl_node_getnode(node)); output_private_get(binding, "private"); output_operation_input(binding, webidl_node_getnode(node)); operation_node = genbind_node_find_type_ident(binding->gb_ast, NULL, GENBIND_NODE_TYPE_OPERATION, webidl_node_gettext(ident_node)); if (operation_node != NULL) { output_code_block(binding, genbind_node_getnode(operation_node)); } else { output_operator_placeholder(binding, webidl_node_getnode(node), ident_node); } output_return(binding, "jsret", webidl_node_getnode(node)); /* set return value an return true */ fprintf(binding->outfile, "\treturn JS_TRUE;\n" "}\n\n"); } return 0; } /* callback to emit implements operator bodys */ static int webidl_implements_cb(struct webidl_node *node, void *ctx) { struct binding *binding = ctx; return output_operator_body(binding, webidl_node_gettext(node)); } /* exported interface documented in jsapi-libdom.h */ int output_operator_body(struct binding *binding, const char *interface) { struct webidl_node *interface_node; struct webidl_node *members_node; struct webidl_node *inherit_node; int res = 0; /* find interface in webidl with correct ident attached */ interface_node = webidl_node_find_type_ident(binding->wi_ast, WEBIDL_NODE_TYPE_INTERFACE, interface); if (interface_node == NULL) { fprintf(stderr, "Unable to find interface %s in loaded WebIDL\n", interface); return -1; } members_node = webidl_node_find(webidl_node_getnode(interface_node), NULL, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_LIST); while (members_node != NULL) { fprintf(binding->outfile,"/**** %s ****/\n", interface); /* for each function emit a JSAPI_FS()*/ webidl_node_for_each_type(webidl_node_getnode(members_node), WEBIDL_NODE_TYPE_OPERATION, webidl_operator_body_cb, binding); members_node = webidl_node_find(webidl_node_getnode(interface_node), members_node, webidl_cmp_node_type, (void *)WEBIDL_NODE_TYPE_LIST); } /* check for inherited nodes and insert them too */ inherit_node = webidl_node_find_type(webidl_node_getnode(interface_node), NULL, WEBIDL_NODE_TYPE_INTERFACE_INHERITANCE); if (inherit_node != NULL) { res = output_operator_body(binding, webidl_node_gettext(inherit_node)); } if (res == 0) { res = webidl_node_for_each_type(webidl_node_getnode(interface_node), WEBIDL_NODE_TYPE_INTERFACE_IMPLEMENTS, webidl_implements_cb, binding); } return res; } netsurf-all-3.2/nsgenbind/src/jsapi-libdom.h0000644000175000017500000000570012377677044020110 0ustar vincevince/* binding generator output * * This file is part of nsgenbind. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Vincent Sanders */ #ifndef nsgenbind_jsapi_libdom_h #define nsgenbind_jsapi_libdom_h struct binding { struct genbind_node *gb_ast; /* root node of binding AST */ struct webidl_node *wi_ast; /* root node of webidl AST */ const char *name; /* name of the binding */ const char *interface; /* webidl interface binding is for */ bool has_private; /* true if the binding requires a private structure */ bool has_global; /* true if the binding is for a global */ struct genbind_node *binding_list; /* node list of the binding */ struct genbind_node *addproperty; /* binding api add property node or NULL */ struct genbind_node *delproperty; /* binding api delete property node or NULL */ struct genbind_node *getproperty; /* binding api get property node or NULL */ struct genbind_node *setproperty; /* binding api set property node or NULL */ struct genbind_node *enumerate; /* binding api enumerate node or NULL */ struct genbind_node *resolve; /* binding api resolve node or NULL */ struct genbind_node *finalise; /* binding api finalise node or NULL */ struct genbind_node *mark; /* binding api mark node or NULL */ const char *hdrguard; /* header file guard name */ FILE *outfile ; /* file handle output should be written to, * allows reuse of callback routines to output * to headers and source files */ FILE *srcfile ; /* output source file */ FILE *hdrfile ; /* output header file */ }; /** Generate binding between jsapi and netsurf libdom */ int jsapi_libdom_output(char *outfile, char *hdrfile, struct genbind_node *genbind_root); /** output code block from a node */ void output_code_block(struct binding *binding, struct genbind_node *codelist); /* Generate jsapi native function specifiers */ int output_function_spec(struct binding *binding); /* Generate jsapi native function bodys * * web IDL describes methods as operators * http://www.w3.org/TR/WebIDL/#idl-operations * * This walks the web IDL AST to find all operator interface members * and construct appropriate jsapi native function body to implement * them. * * Function body contents can be overriden with an operator code * block in the binding definition. * * @param binding The binding information * @param interface The interface to generate operator bodys for */ int output_operator_body(struct binding *binding, const char *interface); /** generate property tinyid enum */ int output_property_tinyid(struct binding *binding); /** generate property specifier structure */ int output_property_spec(struct binding *binding); /** generate property function bodies */ int output_property_body(struct binding *binding); /** generate property definitions for constants */ int output_const_defines(struct binding *binding, const char *interface); #endif netsurf-all-3.2/nsgenbind/Makefile0000644000175000017500000000203612377677044016235 0ustar vincevince# Define the component name COMPONENT := nsgenbind # And the component type COMPONENT_TYPE := binary # Component version COMPONENT_VERSION := 0.1.1 # Tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER := test/testrunner.sh # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs # BeOS/Haiku/AmigaOS have standard library errors that issue warnings. ifneq ($(TARGET),beos) ifneq ($(TARGET),amiga) # WARNFLAGS := $(WARNFLAGS) -Werror endif endif CFLAGS := -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -I$(CURDIR)/include/ \ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif # Grab the core makefile include $(NSBUILD)/Makefile.top # Add extra install rules for binary INSTALL_ITEMS := $(INSTALL_ITEMS) /bin:$(OUTPUT) netsurf-all-3.2/libpencil/0000755000175000017500000000000012377713350014555 5ustar vincevincenetsurf-all-3.2/libpencil/include/0000755000175000017500000000000012377713350016200 5ustar vincevincenetsurf-all-3.2/libpencil/include/pencil.h0000644000175000017500000000421312377676762017642 0ustar vincevince/* * This file is part of Pencil * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa */ #ifndef PENCIL_H #define PENCIL_H #include #include #include "rufl.h" struct pencil_diagram; typedef enum { pencil_OK, pencil_OUT_OF_MEMORY = rufl_OUT_OF_MEMORY, pencil_FONT_MANAGER_ERROR = rufl_FONT_MANAGER_ERROR, pencil_FONT_NOT_FOUND = rufl_FONT_NOT_FOUND, pencil_IO_ERROR = rufl_IO_ERROR, pencil_IO_EOF = rufl_IO_EOF, } pencil_code; /** A colour as 0xBBGGRR00. */ typedef uint32_t pencil_colour; #define pencil_TRANSPARENT 0xffffffff typedef enum { pencil_JOIN_MITRED, pencil_JOIN_ROUND, pencil_JOIN_BEVELLED, } pencil_join; typedef enum { pencil_CAP_BUTT, pencil_CAP_ROUND, pencil_CAP_SQUARE, pencil_CAP_TRIANGLE, } pencil_cap; typedef enum { pencil_SOLID, pencil_DOTTED, pencil_DASHED, } pencil_pattern; struct pencil_diagram *pencil_create(void); pencil_code pencil_text(struct pencil_diagram *diagram, int x, int y, const char *font_family, rufl_style font_style, unsigned int font_size, const char *string, size_t length, pencil_colour colour); pencil_code pencil_path(struct pencil_diagram *diagram, const int *path, unsigned int n, pencil_colour fill_colour, pencil_colour outline_colour, int thickness, pencil_join join, pencil_cap start_cap, pencil_cap end_cap, int cap_width, int cap_length, bool even_odd, pencil_pattern pattern); pencil_code pencil_sprite(struct pencil_diagram *diagram, int x, int y, int width, int height, const char *sprite); pencil_code pencil_group_start(struct pencil_diagram *diagram, const char *name); pencil_code pencil_group_end(struct pencil_diagram *diagram); pencil_code pencil_clip_start(struct pencil_diagram *diagram, int x0, int y0, int x1, int y1); pencil_code pencil_clip_end(struct pencil_diagram *diagram); pencil_code pencil_save_drawfile(struct pencil_diagram *diagram, const char *source, char **drawfile_buffer, size_t *drawfile_size); void pencil_free(struct pencil_diagram *diagram); void pencil_dump(struct pencil_diagram *diagram); #endif netsurf-all-3.2/libpencil/test/0000755000175000017500000000000012377713350015534 5ustar vincevincenetsurf-all-3.2/libpencil/test/pencil_test.c0000644000175000017500000000605612377676762020237 0ustar vincevince/* * This file is part of Pencil * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa */ #include #include #include #include #include #include "pencil.h" #define SPRITE "Resources:$.Resources.Desktop.Sprites" static void test_pencil(void); int main(int argc, char *argv[]) { rufl_code code; (void) argc; (void) argv; code = rufl_init(); if (code != rufl_OK) { printf("rufl_init failed: %i\n", code); return 1; } test_pencil(); rufl_quit(); return 0; } void test_pencil(void) { struct pencil_diagram *diagram; pencil_code code; int path[] = {2, 100, 40, 8, 100, 400, 8, 300, 300, 0}; char utf8_test[] = "Hello, world! 畚留了凌僚 " "Uhersk辿 Hradi邸t. "; char *drawfile_buffer; size_t drawfile_size; os_error *error; fileswitch_object_type obj_type; int size; osspriteop_area *area; diagram = pencil_create(); if (!diagram) { printf("pencil_create failed\n"); return; } code = pencil_text(diagram, 100, 40, "Homerton", rufl_WEIGHT_400, 320, "Hello, world!", 13, 0x000000); if (code != pencil_OK) { printf("pencil_text failed: %i\n", code); return; } code = pencil_path(diagram, path, sizeof path / sizeof path[0], 0x00ff00, 0x0000ff, 5, pencil_JOIN_ROUND, pencil_CAP_BUTT, pencil_CAP_TRIANGLE, 15, 20, false, pencil_SOLID); if (code != pencil_OK) { printf("pencil_path failed: %i\n", code); return; } code = pencil_text(diagram, 100, 400, "NewHall", rufl_WEIGHT_400, 320, utf8_test, sizeof utf8_test, 0xff0000); if (code != pencil_OK) { printf("pencil_text failed: %i\n", code); return; } error = xosfile_read_no_path(SPRITE, &obj_type, 0, 0, &size, 0); if (error) { printf("xosfile_read_no_path failed: 0x%x: %s\n", error->errnum, error->errmess); return; } if (obj_type != fileswitch_IS_FILE) { printf("File " SPRITE " does not exist\n"); return; } area = malloc(size + 4); if (!area) { printf("Out of memory\n"); return; } area->size = size + 4; area->sprite_count = 0; area->first = 0; area->used = 16; error = xosspriteop_load_sprite_file(osspriteop_USER_AREA, area, SPRITE); if (error) { printf("xosspriteop_load_sprite_file failed: 0x%x: %s\n", error->errnum, error->errmess); return; } code = pencil_sprite(diagram, 400, 200, 200, 100, ((char *) area) + area->first); if (code != pencil_OK) { printf("pencil_sprite failed: %i\n", code); return; } pencil_dump(diagram); code = pencil_save_drawfile(diagram, "Pencil-Test", &drawfile_buffer, &drawfile_size); if (code != pencil_OK) { printf("pencil_save_drawfile failed: %i\n", code); return; } assert(drawfile_buffer); error = xosfile_save_stamped("DrawFile", osfile_TYPE_DRAW, (byte *) drawfile_buffer, (byte *) drawfile_buffer + drawfile_size); if (error) { printf("xosfile_save_stamped failed: 0x%x: %s\n", error->errnum, error->errmess); return; } pencil_free(diagram); } netsurf-all-3.2/libpencil/test/Makefile0000644000175000017500000000013112377676762017206 0ustar vincevince# Tests DIR_TEST_ITEMS := pencil_test:pencil_test.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libpencil/libpencil.pc.in0000644000175000017500000000034412377676762017467 0ustar vincevinceprefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/LIBDIR includedir=${prefix}/include Name: libpencil Description: Pencil: a drawfile creation library Version: VERSION Libs: -L${libdir} -lpencil Cflags: -I${includedir} netsurf-all-3.2/libpencil/src/0000755000175000017500000000000012377713350015344 5ustar vincevincenetsurf-all-3.2/libpencil/src/pencil_build.c0000644000175000017500000001340512377676762020163 0ustar vincevince/* * This file is part of Pencil * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa */ #define _GNU_SOURCE /* for strndup */ #include #include #include #include #include "pencil_internal.h" static struct pencil_item *pencil_new_item(pencil_item_type type); static void pencil_append_child(struct pencil_item *group, struct pencil_item *child); static void pencil_free_item(struct pencil_item *item); static void pencil_dump_item(struct pencil_item *item, unsigned int depth); struct pencil_diagram *pencil_create(void) { struct pencil_diagram *diagram; struct pencil_item *root_group; diagram = malloc(sizeof *diagram); root_group = pencil_new_item(pencil_GROUP); if (!diagram || !root_group) { free(root_group); free(diagram); return 0; } root_group->group_name = strdup("root group"); if (!root_group->group_name) { free(root_group); free(diagram); return 0; } diagram->root = root_group; diagram->current_group = root_group; return diagram; } pencil_code pencil_text(struct pencil_diagram *diagram, int x, int y, const char *font_family, rufl_style font_style, unsigned int font_size, const char *string, size_t length, pencil_colour colour) { struct pencil_item *item; item = pencil_new_item(pencil_TEXT); if (!item) return pencil_OUT_OF_MEMORY; item->x = x; item->y = y; item->fill_colour = colour; item->font_family = font_family; item->font_style = font_style; item->font_size = font_size; item->text = strndup(string, length); if (!item->text) { free(item); return pencil_OUT_OF_MEMORY; } pencil_append_child(diagram->current_group, item); return pencil_OK; } pencil_code pencil_path(struct pencil_diagram *diagram, const int *path, unsigned int n, pencil_colour fill_colour, pencil_colour outline_colour, int thickness, pencil_join join, pencil_cap start_cap, pencil_cap end_cap, int cap_width, int cap_length, bool even_odd, pencil_pattern pattern) { struct pencil_item *item; item = pencil_new_item(pencil_PATH); if (!item) return pencil_OUT_OF_MEMORY; item->fill_colour = fill_colour; item->outline_colour = outline_colour; item->path = malloc(sizeof path[0] * n); if (!item->path) { free(item); return pencil_OUT_OF_MEMORY; } memcpy(item->path, path, sizeof path[0] * n); item->path_size = n; item->thickness = thickness; item->join = join; item->start_cap = start_cap; item->end_cap = end_cap; item->cap_width = cap_width; item->cap_length = cap_length; item->even_odd = even_odd; item->pattern = pattern; pencil_append_child(diagram->current_group, item); return pencil_OK; } pencil_code pencil_sprite(struct pencil_diagram *diagram, int x, int y, int width, int height, const char *sprite) { struct pencil_item *item; item = pencil_new_item(pencil_SPRITE); if (!item) return pencil_OUT_OF_MEMORY; item->x = x; item->y = y; item->width = width; item->height = height; item->sprite = sprite; pencil_append_child(diagram->current_group, item); return pencil_OK; } pencil_code pencil_group_start(struct pencil_diagram *diagram, const char *name) { struct pencil_item *item; item = pencil_new_item(pencil_GROUP); if (!item) return pencil_OUT_OF_MEMORY; item->group_name = strdup(name); if (!item->group_name) { free(item); return pencil_OUT_OF_MEMORY; } pencil_append_child(diagram->current_group, item); diagram->current_group = item; return pencil_OK; } pencil_code pencil_group_end(struct pencil_diagram *diagram) { diagram->current_group = diagram->current_group->parent; return pencil_OK; } struct pencil_item *pencil_new_item(pencil_item_type type) { struct pencil_item *item; item = malloc(sizeof *item); if (!item) return 0; item->type = type; item->group_name = 0; item->text = 0; item->path = 0; item->parent = item->next = item->children = item->last = 0; return item; } void pencil_append_child(struct pencil_item *group, struct pencil_item *child) { child->parent = group; if (group->children) { assert(group->last); group->last->next = child; } else { group->children = child; } group->last = child; } void pencil_free(struct pencil_diagram *diagram) { pencil_free_item(diagram->root); free(diagram); } void pencil_free_item(struct pencil_item *item) { for (struct pencil_item *child = item->children; child; child = child->next) pencil_free_item(child); free(item->group_name); free(item->text); free(item->path); free(item); } void pencil_dump(struct pencil_diagram *diagram) { printf("diagram %p: current group %p\n", (void *) diagram, (void *) diagram->current_group); pencil_dump_item(diagram->root, 0); } void pencil_dump_item(struct pencil_item *item, unsigned int depth) { for (unsigned int i = 0; i != depth; i++) printf(" "); printf("%p ", (void *) item); switch (item->type) { case pencil_GROUP: printf("GROUP"); break; case pencil_TEXT: printf("TEXT (%i %i) font %s %i %i, text \"%s\"", item->x, item->y, item->font_family, item->font_style, item->font_size, item->text); break; case pencil_PATH: printf("PATH ("); for (unsigned int i = 0; i != item->path_size; i++) printf("%i ", item->path[i]); printf(") thickness %i, join %i, caps %i %i %i %i, ", item->thickness, item->join, item->start_cap, item->end_cap, item->cap_width, item->cap_length); if (item->even_odd) printf("even-odd, "); printf("pattern %i", item->pattern); break; case pencil_SPRITE: printf("SPRITE (%i %i) (%i x %i)\n", item->x, item->y, item->width, item->height); break; default: printf("UNKNOWN"); } printf("\n"); for (struct pencil_item *child = item->children; child; child = child->next) pencil_dump_item(child, depth + 1); } netsurf-all-3.2/libpencil/src/pencil_internal.h0000644000175000017500000000216612377676762020707 0ustar vincevince/* * This file is part of Pencil * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa */ #ifndef PENCIL_INTERNAL_H #define PENCIL_INTERNAL_H #include #include "pencil.h" struct pencil_item; struct pencil_diagram { struct pencil_item *root; struct pencil_item *current_group; }; typedef enum { pencil_GROUP, pencil_TEXT, pencil_PATH, pencil_SPRITE, } pencil_item_type; struct pencil_item { pencil_item_type type; pencil_colour fill_colour; pencil_colour outline_colour; char *group_name; int x, y; const char *font_family; rufl_style font_style; unsigned int font_size; char *text; int *path; unsigned int path_size; int thickness; pencil_join join; pencil_cap start_cap; pencil_cap end_cap; int cap_width; int cap_length; bool even_odd; pencil_pattern pattern; int width, height; const void *sprite; struct { int x0; int y0; int x1; int y1; } bbox; struct pencil_item *parent; struct pencil_item *next; struct pencil_item *children; struct pencil_item *last; }; #endif netsurf-all-3.2/libpencil/src/Makefile0000644000175000017500000000013212377676762017017 0ustar vincevince# Sources DIR_SOURCES := pencil_build.c pencil_save.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libpencil/src/pencil_save.c0000644000175000017500000003422312377676762020023 0ustar vincevince/* * This file is part of Pencil * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa */ /** \file * Saving as a DrawFile (implementation). * * Two passes over the diagram tree are made. The first pass computes the size * that will be required and enumerates the fonts. The second pass creates the * DrawFile in a buffer. */ #define _GNU_SOURCE /* for strndup */ #include #include #include #include #include #include #include #include #include #include "pencil_internal.h" /* Maximum grouping depth (too deep crashes Draw). */ #define MAX_DEPTH 10 struct pencil_save_context { pencil_code code; struct pencil_diagram *diagram; size_t size; char **font_list; unsigned int font_count; struct pencil_item *item; void *buffer; void *b; os_box bbox; }; static void pencil_save_pass1(struct pencil_save_context *context, struct pencil_item *item, unsigned int depth); static void pencil_save_pass1_text_callback(void *c, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, int x, int y); static void pencil_save_pass2(struct pencil_save_context *context, struct pencil_item *item, unsigned int depth); static void pencil_save_pass2_text_callback(void *c, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, int x, int y); pencil_code pencil_save_drawfile(struct pencil_diagram *diagram, const char *source, char **drawfile_buffer, size_t *drawfile_size) { struct pencil_save_context context = { pencil_OK, diagram, 0, 0, 0, 0, 0, 0, { INT_MAX, INT_MAX, INT_MIN, INT_MIN } }; unsigned int i; size_t size, font_table_size; void *buffer, *b; drawfile_diagram *header; drawfile_object *font_table; char *f; *drawfile_buffer = 0; *drawfile_size = 0; /* pass 1 */ pencil_save_pass1(&context, diagram->root, 0); if (context.code != pencil_OK) { for (i = 0; i != context.font_count; i++) free(context.font_list[i]); free(context.font_list); return context.code; } /* find font table size */ font_table_size = 8; for (i = 0; i != context.font_count; i++) font_table_size += 1 + strlen(context.font_list[i]) + 1; font_table_size = (font_table_size + 3) & ~3; size = 40 + font_table_size + context.size; /* use calloc to prevent information leakage */ buffer = calloc(size, 1); if (!buffer) { for (i = 0; i != context.font_count; i++) free(context.font_list[i]); free(context.font_list); return pencil_OUT_OF_MEMORY; } /* file headers */ header = (drawfile_diagram *) buffer; header->tag[0] = 'D'; header->tag[1] = 'r'; header->tag[2] = 'a'; header->tag[3] = 'w'; header->major_version = 201; header->minor_version = 0; strncpy(header->source, source, 12); for (i = strlen(source); i < 12; i++) header->source[i] = ' '; header->bbox = context.bbox; b = (char *) buffer + sizeof(drawfile_diagram_base); /* font table */ font_table = (drawfile_object *) b; font_table->type = drawfile_TYPE_FONT_TABLE; font_table->size = font_table_size; f = (char *) b + 8; for (i = 0; i != context.font_count; i++) { *f++ = i + 1; strcpy(f, context.font_list[i]); f += strlen(context.font_list[i]) + 1; } b = (char *) b + font_table_size; /* pass 2 */ context.buffer = buffer; context.b = b; pencil_save_pass2(&context, diagram->root, 0); /* free font list */ for (i = 0; i != context.font_count; i++) free(context.font_list[i]); free(context.font_list); if (context.code != pencil_OK) { free(buffer); return context.code; } assert(context.b == buffer + size); *drawfile_buffer = buffer; *drawfile_size = size; return pencil_OK; } void pencil_save_pass1(struct pencil_save_context *context, struct pencil_item *item, unsigned int depth) { rufl_code code; struct pencil_item *child; assert(item); /* Initialise item bounding box */ item->bbox.x0 = INT_MAX; item->bbox.y0 = INT_MAX; item->bbox.x1 = INT_MIN; item->bbox.y1 = INT_MIN; for (child = item->children; child; child = child->next) { pencil_save_pass1(context, child, depth + 1); if (context->code != pencil_OK) return; /* Update item bounding box to include child */ if (child->bbox.x0 < item->bbox.x0) item->bbox.x0 = child->bbox.x0; if (child->bbox.y0 < item->bbox.y0) item->bbox.y0 = child->bbox.y0; if (child->bbox.x1 > item->bbox.x1) item->bbox.x1 = child->bbox.x1; if (child->bbox.y1 > item->bbox.y1) item->bbox.y1 = child->bbox.y1; } switch (item->type) { case pencil_GROUP: if (!item->children || MAX_DEPTH <= depth || (item->bbox.x0 == INT_MAX && item->bbox.y0 == INT_MAX && item->bbox.x1 == INT_MIN && item->bbox.y1 == INT_MIN)) break; context->size += 36; break; case pencil_TEXT: { int bbox[4]; int width; code = rufl_paint_callback(item->font_family, item->font_style, item->font_size, item->text, strlen(item->text), item->x, item->y, pencil_save_pass1_text_callback, context); if (code != rufl_OK) context->code = code; if (context->code != pencil_OK) return; code = rufl_font_bbox(item->font_family, item->font_style, item->font_size, bbox); if (code != rufl_OK) context->code = code; if (context->code != pencil_OK) return; code = rufl_width(item->font_family, item->font_style, item->font_size, item->text, strlen(item->text), &width); if (code != rufl_OK) context->code = code; if (context->code != pencil_OK) return; item->bbox.x0 = item->x * 256; item->bbox.y0 = item->y * 256; item->bbox.x1 = (item->x + width) * 256; item->bbox.y1 = (item->y + (bbox[3] - bbox[1])) * 256; } break; case pencil_PATH: context->size += 24 + 16 + item->path_size * 4; if (item->pattern != pencil_SOLID) context->size += 12; /* Calculate bounding box */ for (unsigned int i = 0; i != item->path_size; ) { switch (item->path[i]) { case 0: case 5: i++; break; case 2: case 6: case 8: { int points = item->path[i++] == 6 ? 3 : 1; for (; points > 0; points--) { int x = item->path[i++] * 256; int y = item->path[i++] * 256; if (x < item->bbox.x0) item->bbox.x0 = x; if (y < item->bbox.y0) item->bbox.y0 = y; if (x > item->bbox.x1) item->bbox.x1 = x; if (y > item->bbox.y1) item->bbox.y1 = y; } } break; default: assert(0); } } break; case pencil_SPRITE: context->size += 24 + ((const osspriteop_header *) item->sprite)->size; item->bbox.x0 = item->x * 256; item->bbox.y0 = item->y * 256; item->bbox.x1 = (item->x + item->width) * 256; item->bbox.y1 = (item->y + item->height) * 256; break; default: assert(0); } /* Update global bounding box */ if (item->bbox.x0 < context->bbox.x0) context->bbox.x0 = item->bbox.x0; if (item->bbox.y0 < context->bbox.y0) context->bbox.y0 = item->bbox.y0; if (item->bbox.x1 > context->bbox.x1) context->bbox.x1 = item->bbox.x1; if (item->bbox.y1 > context->bbox.y1) context->bbox.y1 = item->bbox.y1; } void pencil_save_pass1_text_callback(void *c, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, int x, int y) { struct pencil_save_context *context = c; unsigned int i; char **font_list; (void) font_size; /* unused */ (void) x; /* unused */ (void) y; /* unused */ assert(s8 || s16); /* check if the font name is new */ for (i = 0; i != context->font_count && strcmp(context->font_list[i], font_name) != 0; i++) ; if (i == context->font_count) { /* add to list of fonts */ font_list = realloc(context->font_list, sizeof context->font_list[0] * (context->font_count + 1)); if (!font_list) { context->code = pencil_OUT_OF_MEMORY; return; } font_list[context->font_count] = strdup(font_name); if (!font_list[context->font_count]) { context->code = pencil_OUT_OF_MEMORY; return; } context->font_list = font_list; context->font_count++; } /* compute size of transformed text object */ if (s8) { context->size += 24 + 56 + ((n + 4) & ~3); } else { unsigned int utf8_length = 0; for (i = 0; i != n; i++) { if (s16[i] < 0x80) utf8_length += 1; else if (s16[i] < 0x800) utf8_length += 2; else utf8_length += 3; } context->size += 24 + 56 + ((utf8_length + 4) & ~3); } } void pencil_save_pass2(struct pencil_save_context *context, struct pencil_item *item, unsigned int depth) { drawfile_object *object = (drawfile_object *) context->b; bool group = false; rufl_code code; int *path; unsigned int i; struct pencil_item *child; assert(item); switch (item->type) { case pencil_GROUP: if (!item->children || MAX_DEPTH <= depth || (item->bbox.x0 == INT_MAX && item->bbox.y0 == INT_MAX && item->bbox.x1 == INT_MIN && item->bbox.y1 == INT_MIN)) break; group = true; object->type = drawfile_TYPE_GROUP; object->size = 36; strncpy(object->data.group.name, item->group_name, 12); for (i = strlen(item->group_name); i < 12; i++) object->data.group.name[i] = ' '; object->data.group.bbox.x0 = item->bbox.x0; object->data.group.bbox.y0 = item->bbox.y0; object->data.group.bbox.x1 = item->bbox.x1; object->data.group.bbox.y1 = item->bbox.y1; context->b = (char *) context->b + object->size; break; case pencil_TEXT: context->item = item; code = rufl_paint_callback(item->font_family, item->font_style, item->font_size, item->text, strlen(item->text), item->x, item->y, pencil_save_pass2_text_callback, context); if (code != rufl_OK) context->code = code; if (context->code != pencil_OK) return; break; case pencil_PATH: object->type = drawfile_TYPE_PATH; object->size = 24 + 16 + item->path_size * 4; object->data.path.bbox.x0 = item->bbox.x0; object->data.path.bbox.y0 = item->bbox.y0; object->data.path.bbox.x1 = item->bbox.x1; object->data.path.bbox.y1 = item->bbox.y1; object->data.path.fill = item->fill_colour; object->data.path.outline = item->outline_colour; object->data.path.width = item->thickness * 256; object->data.path.style.flags = 0; object->data.path.style.cap_width = item->cap_width; object->data.path.style.cap_length = item->cap_length; if (item->pattern != pencil_SOLID) { object->size += 12; object->data.path_with_pattern.pattern.start = 0; object->data.path_with_pattern.pattern. element_count = 1; if (item->pattern != pencil_DOTTED) object->data.path_with_pattern.pattern. elements[0] = 512 * item->thickness; else if (item->pattern != pencil_DASHED) object->data.path_with_pattern.pattern. elements[0] = 1536 * item->thickness; } path = (int *) (void *) ((char *) context->b + object->size - item->path_size * 4); for (i = 0; i != item->path_size; ) { switch (item->path[i]) { case 0: case 5: path[i] = item->path[i]; i++; break; case 2: case 8: path[i] = item->path[i]; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; break; case 6: path[i] = item->path[i]; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; path[i] = item->path[i] * 256; i++; break; default: assert(0); } } context->b = (char *) context->b + object->size; break; case pencil_SPRITE: object->type = drawfile_TYPE_SPRITE; object->size = 24 + ((const osspriteop_header *) item->sprite)->size; object->data.sprite.bbox.x0 = item->bbox.x0; object->data.sprite.bbox.y0 = item->bbox.y0; object->data.sprite.bbox.x1 = item->bbox.x1; object->data.sprite.bbox.y1 = item->bbox.y1; memcpy(&object->data.sprite.header, item->sprite, object->size - 24); context->b = (char *) context->b + object->size; break; default: assert(0); } for (child = item->children; child; child = child->next) { pencil_save_pass2(context, child, depth + 1); if (context->code != pencil_OK) return; } if (group) object->size = (char *) context->b - (char *) object; } void pencil_save_pass2_text_callback(void *c, const char *font_name, unsigned int font_size, const char *s8, unsigned short *s16, unsigned int n, int x, int y) { struct pencil_save_context *context = c; drawfile_object *object = (drawfile_object *) context->b; unsigned int i; assert(s8 || s16); /* find font index */ for (i = 0; i != context->font_count && strcmp(context->font_list[i], font_name) != 0; i++) ; assert(i != context->font_count); object->type = drawfile_TYPE_TRFM_TEXT; object->data.trfm_text.bbox.x0 = context->item->bbox.x0; object->data.trfm_text.bbox.y0 = context->item->bbox.y0; object->data.trfm_text.bbox.x1 = context->item->bbox.x1; object->data.trfm_text.bbox.y1 = context->item->bbox.y1; object->data.trfm_text.trfm.entries[0][0] = 0x10000; object->data.trfm_text.trfm.entries[0][1] = 0; object->data.trfm_text.trfm.entries[1][0] = 0; object->data.trfm_text.trfm.entries[1][1] = 0x10000; object->data.trfm_text.trfm.entries[2][0] = 0; object->data.trfm_text.trfm.entries[2][1] = 0; object->data.trfm_text.flags = drawfile_TEXT_KERN; object->data.trfm_text.fill = context->item->fill_colour; object->data.trfm_text.bg_hint = os_COLOUR_WHITE; object->data.trfm_text.style.font_index = i + 1; object->data.trfm_text.xsize = font_size * 40; object->data.trfm_text.ysize = font_size * 40; object->data.trfm_text.base.x = x * 256; object->data.trfm_text.base.y = y * 256; if (s8) { strncpy(object->data.trfm_text.text, s8, n); object->size = 24 + 56 + ((n + 4) & ~3); } else { char *z = object->data.trfm_text.text; unsigned int utf8_length = 0; for (i = 0; i != n; i++) { if (s16[i] < 0x80) { *z++ = s16[i]; utf8_length += 1; } else if (s16[i] < 0x800) { *z++ = 0xc0 | ((s16[i] >> 6) & 0x1f); *z++ = 0x80 | (s16[i] & 0x3f); utf8_length += 2; } else { *z++ = 0xe0 | (s16[i] >> 12); *z++ = 0x80 | ((s16[i] >> 6) & 0x3f); *z++ = 0x80 | (s16[i] & 0x3f); utf8_length += 3; } } object->size = 24 + 56 + ((utf8_length + 4) & ~3); } context->b = (char *) context->b + object->size; } netsurf-all-3.2/libpencil/Makefile0000644000175000017500000000307312377676762016237 0ustar vincevince# Component settings COMPONENT := pencil COMPONENT_VERSION := 0.0.3 # Default to a static library COMPONENT_TYPE ?= lib-static # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER := $(ECHO) # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -pedantic # BeOS/Haiku/AmigaOS4 standard library headers create warnings ifneq ($(TARGET),beos) ifneq ($(TARGET),AmigaOS) WARNFLAGS := $(WARNFLAGS) -Werror endif endif CFLAGS := -I$(CURDIR)/include/ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif # OSLib ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) ifeq ($(TARGET),riscos) CFLAGS := $(CFLAGS) -I$(PREFIX)/include LDFLAGS := $(LDFLAGS) -lOSLib32 endif endif # RUfl ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) ifneq ($(PKGCONFIG),) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) librufl --cflags) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) librufl --libs) else CFLAGS := $(CFLAGS) -I$(PREFIX)/include LDFLAGS := $(LDFLAGS) -lrufl endif endif include $(NSBUILD)/Makefile.top # Extra installation rules I := /include INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/pencil.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) netsurf-all-3.2/libcss/0000755000175000017500000000000012377713347014101 5ustar vincevincenetsurf-all-3.2/libcss/docs/0000755000175000017500000000000012377713347015031 5ustar vincevincenetsurf-all-3.2/libcss/docs/Bytecode0000644000175000017500000006722612377676736016541 0ustar vincevinceCSS style declaration bytecode ============================== Format ------ [] is 32 bits wide: bits 18-31: value bits 10-17 : flags bits 0-9 : opcode The 8 bits of flag data are defined as follows: bits 2-7: Must Be Zero (MBZ) bit 1 : value is inherit bit 0 : value is important The 14 bits of value are opcode-specific. Parameters are opcode-specific. Each parameter must begin on a 4 byte boundary. Datatype storage ---------------- All numeric values are stored in a 32bit wide field. This field contains a fixed point value with 22 bits assigned to the integer part and 10 bits assigned to the fractional part. Strings are stored as a 32bit index into a table of interned string pointers. The table is found in the stylesheet object. CSS dimensions are stored as two 32bit values: . Length is a 32bit numeric value (as described above) and unit is as follows: bit 8 clear => length unit bits 9-31: MBZ bits 0-7 : 00000000 => px 00000001 => ex 00000010 => em 00000011 => in 00000100 => cm 00000101 => mm 00000110 => pt 00000111 => pc bit 8 set => percentage unit bits 9-31: MBZ bits 0-7 : MBZ bit 9 set => angle unit bits 10-31: MBZ bit 8 : MBZ bits 0-7 : 00000000 => deg 00000001 => grad 00000010 => rad bit 10 set => time unit bits 11-31: MBZ bits 8-9 : MBZ bits 0-7 : 00000000 => ms 00000001 => s bit 11 set => frequency unit bits 12-31: MBZ bits 8-10 : MBZ bits 0-7 : 00000000 => Hz 00000001 => kHz CSS colours are stored as one 32bit value. See "Colour" for their format. Shorthand properties -------------------- The CSS shorthand properties are handled by decomposing them to their component parts, and then creating bytecode for these. For example, "background: red none no-repeat scroll left top !important;" would be decomposed to: background-color: red !important; background-image: none !important; background-repeat: no-repeat !important; background-attachment: scroll !important; background-position: left top !important; and bytecode generated for each of these properties. The full list of CSS 2.1 shorthand properties is: background border-color border-style border-{top,right,bottom,left} border-width border cue font list-style margin outline padding pause Opcodes ------- 00 - azimuth (14bits) : bits 8-13: MBZ bit 7 set => angle follows. bits 0-6: MBZ bit 6 set => relative movement: bit 7 : MBZ bits 1-5: MBZ bit 0 : set => rightwards, clear => leftwards bits 6 & 7 clear => keyword position: bit 5 : set => behind, clear => in front bits 0-4: 00000 => left-side 00001 => far-left 00010 => left 00011 => center-left 00100 => center 00101 => center-right 00110 => right 00111 => far-right 01000 => right-side other => Reserved for future expansion. 01 - background-attachment (14bits) : 0 => fixed 1 => scroll other => Reserved for future expansion. 02 - background-color (14bits) : bit 8-13: MBZ bit 7 set => colour follows. bits 0-6: MBZ bit 7 clear => keyword colour: bits 0-6: 0000000 => transparent, 0000001 => currentColor, other => rffe. 03 - background-image (14bits) : bits 8-13: MBZ bit 7 set => uri string follows. bits 0-6: MBZ bit 7 clear => keyword: bits 1-6: MBZ bit 0 : clear => none, set => rffe. 04 - background-position (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => percentage or length unit follows bits 4-6: MBZ clear => keywords: bits 4-6: 000 => center 001 => right 010 => left other => rffe bit 3: set => percentage or length unit follows bits 0-2: MBZ clear => keywords: bits 0-2: 000 => center 001 => bottom 010 => top other => rffe 05 - background-repeat (14bits) : 0 => no-repeat 1 => repeat-x 2 => repeat-y 3 => repeat other => Reserved for future expansion. 06 - border-collapse (14bits) : 0 => separate 1 => collapse other => Reserved for future expansion. 07 - border-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => two lengths follow bits 0-6: MBZ clear => Reserved for future expansion. bits 0-6: MBZ 08 - border-top-color 09 - border-right-color 0a - border-bottom-color 0b - border-left-color (14bits) : bits 8-13: MBZ bit 7 set => colour follows. bits 0-6: MBZ bit 7 clear => keyword colour: bits 0-6: 0000000 => transparent, 0000001 => currentColor, other => rffe. 0c - border-top-style 0d - border-right-style 0e - border-bottom-style 0f - border-left-style (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => hidden, 00000010 => dotted, 00000011 => dashed, 00000100 => solid, 00000101 => double, 00000110 => groove, 00000111 => ridge, 00001000 => inset, 00001001 => outset, other => Reserved for future expansion. 10 - border-top-width 11 - border-right-width 12 - border-bottom-width 13 - border-left-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => thin, 0000001 => medium, 0000010 => thick, other => rffe. 14 - bottom (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => length/percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 15 - caption-side (14bits) : 0 => top 1 => bottom other => Reserved for future expansion. 16 - clear (14bits) : 0 => none 1 => left 2 => right 3 => both other => Reserved for future expansion. 17 - clip (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => shape follows bits 0-2: 000 => rect, bit 3 => top auto bit 4 => right auto bit 5 => bottom auto bit 6 => left auto other => rffe. bits 3-6: MBZ. bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. If the value is rect(top, right, bottom, left), then bits 3-6 encode which of , , , is set to auto. The subsequent parameter list is then 4 - entries long. Each entry is a dimension. Entries are always ordered top, right, bottom, left. For example, clip: rect(10px, auto, auto, 10px) would produce the following bytecode: <02c00017> <00002800> <00000000> <00002800> <00000000> 18 - color (14bits) : bits 8-13: MBZ bits 0-7: bit 7: set => colour follows. bits 0-6: MBZ. clear => keywords: bits 0-6: 0000000 => transparent, 0000001 => currentColor, other => rffe. 19 - content (14bits) : bits 8-13: MBZ (except counter & counters, see below) bits 0-7 : bit 7 set => string follows bits 0-6: 0000000 => string, 0000001 => uri, 0000010 => counter, bits 12-13: MBZ bits 8-11 : list-style-type 0000011 => counters, bits 12-13: MBZ bits 8-11 : list-style-type 0000100 => attr, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => normal, 0000001 => none, 0000010 => open-quote, 0000011 => close-quote, 0000100 => no-open-quote, 0000101 => no-close-quote, other => rffe. If the value is not "normal", "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "normal"). For example, content: open-quote url('http://example.com/') " : " attr(name) " " counter(x) "." counters(y, ".") close-quote;" would result in the following bytecode: <00080019> <00000081> <00000080> <00000084> <00000080> <00000382> <00000080> <00000383> <00000003> <00000000> 1a - counter-increment (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => pair follows bits 0-6: 0000000 => pair other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value is not "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "none"). 1b - counter-reset (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => pair follows bits 0-6: 0000000 => pair, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value is not "none", or "inherit", then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits set to zero (the encoding for "none"). 1c - cue-after (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 1d - cue-before (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 1e - cursor (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => uri follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, 0000001 => crosshair, 0000010 => default, 0000011 => pointer, 0000100 => move, 0000101 => e-resize, 0000110 => ne-resize, 0000111 => nw-resize, 0001000 => n-resize, 0001001 => se-resize, 0001010 => sw-resize, 0001011 => s-resize, 0001100 => w-resize, 0001101 => text, 0001110 => wait, 0001111 => help, 0010000 => progress, other => rffe. If the value indicates that a uri is present, then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with bit 7 clear. 1f - direction (14bits) : 0 => ltr, 1 => rtl, other => Reserved for future expansion. 20 - display (14bits) : 0 => inline, 1 => block, 2 => list-item, 3 => run-in, 4 => inline-block, 5 => table, 6 => inline-table, 7 => table-row-group, 8 => table-header-group, 9 => table-footer-group, a => table-row, b => table-column-group, c => table-column, d => table-cell, e => table-caption, f => none, other => Reserved for future expansion. 21 - elevation (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => angle follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => below, 0000001 => level, 0000010 => above, 0000011 => higher, 0000100 => lower, other => rffe. 22 - empty-cells (14bits) : 0 => show, 1 => hide, other => Reserved for future expansion. 23 - float (14bits) : 0 => left, 1 => right, 2 => none, other => Reserved for future expansion. 24 - font-family (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => data follows bits 1-6: MBZ bit 0 : clear => string, set => ident list (as string) bit 7 clear => keywords: bits 0-6: 0000000 => Reserved. 0000001 => serif, 0000010 => sans-serif, 0000011 => cursive, 0000100 => fantasy, 0000101 => monospace, other => rffe. In all cases, there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear. 25 - font-size (14bits) : bits 8-13: MBZ bits 0-7: bit 7 set => dimension follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => xx-small, 0000001 => x-small, 0000010 => small, 0000011 => medium, 0000100 => large, 0000101 => x-large, 0000110 => xx-large, 0000111 => larger, 0001000 => smaller, other => rffe. 26 - font-style (14bits) : 0 => normal, 1 => italic, 2 => oblique, other => Reserved for future expansion. 27 - font-variant (14bits) : 0 => normal, 1 => small-caps, other => Reserved for future expansion. 28 - font-weight (14bits) : 0 => normal, 1 => bold, 2 => bolder, 3 => lighter, 4 => 100, 5 => 200, 6 => 300, 7 => 400, 8 => 500, 9 => 600, a => 700, b => 800, c => 900, other => Reserved for future expansion. 29 - height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 2a - left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 2b - letter-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 2c - line-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length/number/percentage follows bits 0-6: 0000000 => number, 0000001 => dimension, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 2d - list-style-image (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => string follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 2e - list-style-position (14bits) : 0 => inside, 1 => outside, other => Reserved for future expansion. 2f - list-style-type (14bits) : 0 => disc, 1 => circle, 2 => square, 3 => decimal, 4 => decimal-leading-zero, 5 => lower-roman, 6 => upper-roman, 7 => lower-greek, 8 => lower-latin, 9 => upper-latin, a => armenian, b => georgian, c => lower-alpha, d => upper-alpha, e => none, other => Reserved for future expansion. 30 - margin-top 31 - margin-right 32 - margin-bottom 33 - margin-left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 34 - max-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 35 - max-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. 36 - min-height (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 37 - min-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 38 - orphans (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => integer follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 39 - outline-color (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => colour follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => transparent, 0000001 => currentColor, 0000010 => invert, other => rffe. 3a - outline-style (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => hidden, 00000010 => dotted, 00000011 => dashed, 00000100 => solid, 00000101 => double, 00000110 => groove, 00000111 => ridge, 00001000 => inset, 00001001 => outset, other => Reserved for future expansion. 3b - outline-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => thin, 0000001 => medium, 0000010 => thick, other => rffe. 3c - overflow-x (14bits) : 0 => visible, 1 => hidden, 2 => scroll, 3 => auto, other => Reserved for future expansion. 3d - padding-top 3e - padding-right 3f - padding-bottom 40 - padding-left (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 41 - page-break-after (14bits) : 0 => auto, 1 => always, 2 => avoid, 3 => left, 4 => right, other => Reserved for future expansion. 42 - page-break-before (14bits) : 0 => auto, 1 => always, 2 => avoid, 3 => left, 4 => right, other => Reserved for future expansion. 43 - page-break-inside (14bits) : 0 => auto, 1 => avoid, other => Reserved for future expansion. 44 - pause-after (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => time or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 45 - pause-before (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => time or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 46 - pitch-range (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 47 - pitch (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => frequency follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => x-low, 0000001 => low, 0000010 => medium, 0000011 => high, 0000100 => x-high, other => rffe. 48 - play-during (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => string follows bit 6: set => mix, clear => don't mix bit 5: set => repeat, clear => no repeat bits 0-4: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, 0000001 => none, other => rffe. 49 - position (14bits) : 0 => static, 1 => relative, 2 => absolute, 3 => fixed, other => Reserved for future expansion. 4a - quotes (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => two strings follow bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => none, other => rffe. If the value indicates that strings are present, then there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear (the encoding for "none"). 4b - richness (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 4c - right (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 4d - speak-header (14bits) : 0 => once, 1 => always, other => Reserved for future expansion. 4e - speak-numeral (14bits) : 0 => digits, 1 => continuous, other => Reserved for future expansion. 4f - speak-punctuation (14bits) : 0 => code, 1 => none, other => Reserved for future expansion. 50 - speak (14bits) : 0 => normal, 1 => none, 2 => spell-out, other => Reserved for future expansion. 51 - speech-rate (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => number follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => x-slow, 0000001 => slow, 0000010 => medium, 0000011 => fast, 0000100 => x-fast, 0000101 => faster, 0000110 => slower, other => rffe. 52 - stress (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => number follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 53 - table-layout (14bits) : 0 => auto, 1 => fixed, other => Reserved for future expansion. 54 - text-align (14bits) : 0 => left, 1 => right, 2 => center, 3 => justify, 4 => -libcss-left, 5 => -libcss-center, 6 => -libcss-right, other => Reserved for future expansion. 55 - text-decoration (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none otherwise: bits 4-7: MBZ bit 3: set => blink, clear => no blink bit 2: set => line-through, clear => no line-through bit 1: set => overline, clear => no overline bit 0: set => underline, clear => no underline 56 - text-indent (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => length or percentage follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 57 - text-transform (14bits) : 0 => capitalize, 1 => uppercase, 2 => lowercase, 3 => none, other => Reserved for future expansion. 58 - top (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 59 - unicode-bidi (14bits) : 0 => normal, 1 => embed, 2 => bidi-override, other => Reserved for future expansion. 5a - vertical-align (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => baseline, 0000001 => sub, 0000010 => super, 0000011 => top, 0000100 => text-top, 0000101 => middle, 0000110 => bottom, 0000111 => text-bottom, other => rffe. 5b - visibility (14bits) : 0 => visible, 1 => hidden, 2 => collapse, other => Reserved for future expansion. 5c - voice-family (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => data follows bits 1-6: MBZ bit 0 : clear => string, set => ident list (as string) bit 7 clear => keywords: bits 0-6: 0000000 => Reserved. 0000001 => male, 0000010 => female, 0000011 => child, other => rffe. In all cases, there is a parameter list. Each item is preceded by a word which declares the type of the next item. The list is terminated by a word with all bits clear. 5d - volume (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => number/percentage follows bits 0-6: 0000000 => number, 0000001 => dimension, other => rffe. bit 7 clear => keywords: bits 0-6: 0000000 => silent, 0000001 => x-soft, 0000010 => soft, 0000011 => medium, 0000100 => loud, 0000101 => x-loud, other => rffe. 5e - white-space (14bits) : 0 => normal, 1 => pre, 2 => nowrap, 3 => pre-wrap, 4 => pre-line, other => Reserved for future expansion. 5f - widows (14bits) : bits 8-13: MBZ bits 0-7 : bit 7: set => integer follows bits 0-6: MBZ clear => Reserved for future expansion bits 0-6: MBZ 60 - width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length or percentage follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 61 - word-spacing (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 62 - z-index (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => integer follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 63 - opacity (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => number follows bits 0-6: MBZ bit 7 clear => Reserved for future expansion bits 0-6: MBZ 64 - break-after (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => auto, 00000001 => always, 00000010 => avoid, 00000011 => left, 00000100 => right, 00000101 => page, 00000110 => column, 00000111 => avoid-page, 00001000 => avoid-column, other => Reserved for future expansion. 65 - break-before (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => auto, 00000001 => always, 00000010 => avoid, 00000011 => left, 00000100 => right, 00000101 => page, 00000110 => column, 00000111 => avoid-page, 00001000 => avoid-column, other => Reserved for future expansion. 66 - break-inside (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => auto, 00000001 => avoid, 00000010 => avoid-page, 00000011 => avoid-column, other => Reserved for future expansion. 67 - column-count (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => integer follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 68 - column-fill (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => balance, 00000001 => auto, other => Reserved for future expansion. 69 - column-gap (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => normal, other => rffe. 6a - column-rule-color (14bits) : bits 8-13: MBZ bit 7 set => colour follows. bits 0-6: MBZ bit 7 clear => Reserved for future expansion bits 0-6: MBZ 6b - column-rule-style (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => hidden, 00000010 => dotted, 00000011 => dashed, 00000100 => solid, 00000101 => double, 00000110 => groove, 00000111 => ridge, 00001000 => inset, 00001001 => outset, other => Reserved for future expansion. 6c - column-rule-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => thin, 0000001 => medium, 0000010 => thick, other => rffe. 6d - column-span (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => none, 00000001 => all, other => Reserved for future expansion. 6e - column-width (14bits) : bits 8-13: MBZ bits 0-7 : bit 7 set => length follows bits 0-6: MBZ bit 7 clear => keywords: bits 0-6: 0000000 => auto, other => rffe. 6f - writing-mode (14bits) : bits 8-13: MBZ bits 0-7 : 00000000 => horizontal-tb, 00000001 => vertical-rl, 00000010 => vertical-lr, other => Reserved for future expansion. 70 - overflow-y (14bits) : 0 => visible, 1 => hidden, 2 => scroll, 3 => auto, other => Reserved for future expansion. 71-3ff - Reserved for future expansion. netsurf-all-3.2/libcss/docs/Lexer0000644000175000017500000000113212377676736016042 0ustar vincevinceLexical analyser ================ This document contains various snippets of information about the lexer implementation. First sets ---------- IDENT [a-zA-Z] | '-' | '_' | [^#x0-#x7F] | '\' ATKEYWORD '@' STRING '"' | "'" INVALID_STRING '"' | "'" HASH '#' NUMBER [0-9] | '.' | '-' | '+' PERCENTAGE [0-9] | '.' | '-' | '+' DIMENSION [0-9] | '.' URI [Uu] UNICODE-RANGE [Uu] CDO '<' CDC '-' S #x9 | #xA | #xC | #xD | #x20 COMMENT '/' FUNCTION [a-zA-Z] | '-' | '_' | [^#x0-#x7F] | '\' INCLUDES '~' DASHMATCH '|' PREFIXMATCH '^' SUFFIXMATCH '$' SUBSTRINGMATCH '*' CHAR anything except " or ' netsurf-all-3.2/libcss/docs/Tokens0000644000175000017500000000473012377676736016235 0ustar vincevinceProduction rules for lexical tokens =================================== This file provides a complete set of production rules for the tokens generated by the lexer. In case of ambiguity, the longest match wins. Components ---------- ident ::= '-'? nmstart nmchar* name ::= nmchar+ nmstart ::= [a-zA-Z] | '_' | nonascii | escape nonascii ::= [#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF] unicode ::= '\' [0-9a-fA-F]{1,6} wc? escape ::= unicode | '\' [^\n\r\f0-9a-fA-F] nmchar ::= [a-zA-Z0-9] | '-' | '_' | nonascii | escape num ::= [-+]? ([0-9]+ | [0-9]* '.' [0-9]+) string ::= '"' (stringchar | "'")* '"' | "'" (stringchar | '"')* "'" stringchar ::= urlchar | #x20 | #x29 | '\' nl urlchar ::= [#x9#x21#x23-#x26#x28#x2A-#x7E] | nonascii | escape nl ::= #xA | #xD #xA | #xD | #xC w ::= wc* wc ::= #x9 | #xA | #xC | #xD | #x20 Tokens ------ IDENT ::= ident ATKEYWORD ::= '@' ident STRING ::= string INVALID_STRING ::= '"' (stringchar | "'")* [^"] | "'" (stringchar | '"')* [^'] HASH ::= '#' name NUMBER ::= num PERCENTAGE ::= num '%' DIMENSION ::= num ident URI ::= "url(" w (string | urlchar*) w ')' UNICODE-RANGE ::= [Uu] '+' [0-9a-fA-F?]{1,6} ('-' [0-9a-fA-F]{1,6})? CDO ::= "" S ::= wc+ COMMENT ::= "/*" [^*]* '*'+ ([^/] [^*]* '*'+) '/' FUNCTION ::= ident '(' INCLUDES ::= "~=" DASHMATCH ::= "|=" PREFIXMATCH ::= "^=" SUFFIXMATCH ::= "$=" SUBSTRINGMATCH ::= "*=" CHAR ::= any other character, except " or ' Differences from the CSS3 Syntax module specification ----------------------------------------------------- 1) UNICODE-RANGE is case insensitive (it's uppercase only in the spec) 2) escape follows CSS2.1. CSS3 defines it as: escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF] 3) urlchar omits ' and ): a) If ' is permitted verbatim then, as stringchar inherits from urlchar, single quoted strings may contain verbatim single quotes. This is clearly nonsense. b) If ) is permitted verbatim then it becomes impossible to determine the true end of URI. Thus, for sanity's sake, it's omitted here. 4) stringchar explicitly includes ). See 3(b) for why it won't inherit it from urlchar as the spec implies. 5) BOM ::= #xFEFF is omitted. It is assumed that any leading BOM will be stripped from the document before lexing occurs. netsurf-all-3.2/libcss/docs/Representation0000644000175000017500000000454212377676736017775 0ustar vincevinceLibCSS internal stylesheet representation ========================================= Selector: struct selector { selector_type type; /**< Type of selector */ struct { const uint8_t *name; size_t name_len; const uint8_t *value; size_t value_len; } data; /**< Selector data */ struct selector *specifics; /**< Selector specifics */ combinator combinator_type; /**< Type of combinator */ struct selector *combinator; /**< Combining selector */ struct rule *rule; /**< Owning rule */ struct style *style; /**< Applicable style */ struct selector *next; /**< Next selector in list */ struct selector *prev; /**< Previous selector */ }; Rule: struct rule { rule_type type; /**< Type of rule */ union { struct { uint32_t selector_count; struct selector **selectors; } selector; struct { uint32_t media; uint32_t rule_count; struct rule **rules; } media; struct { struct style *style; } font_face; struct { uint32_t selector_count; struct selector **selectors; struct style *style; } page; struct { struct stylesheet *sheet; } import; struct { char *encoding; } charset; } data; /**< Rule data */ uint32_t index; /**< Index of rule in sheet */ struct stylesheet *owner; /**< Owning sheet */ struct rule *parent; /**< Parent rule */ struct rule *first_child; /**< First in child list */ struct rule *last_child; /**< Last in child list */ struct rule *next; /**< Next rule */ struct rule *prev; /**< Previous rule */ }; Stylesheet: struct stylesheet { #define HASH_SIZE (37) struct selector *selectors[HASH_SIZE]; /**< Hashtable of selectors */ uint32_t rule_count; /**< Number of rules in sheet */ struct rule *rule_list; /**< List of rules in sheet */ bool disabled; /**< Whether this sheet is * disabled */ char *url; /**< URL of this sheet */ char *title; /**< Title of this sheet */ uint32_t media; /**< Bitfield of media types */ void *ownerNode; /**< Owning node in document */ struct rule *ownerRule; /**< Owning rule in parent */ struct stylesheet *parent; /**< Parent sheet */ struct stylesheet *first_child; /**< First in child list */ struct stylesheet *last_child; /**< Last in child list */ struct stylesheet *next; /**< Next in sibling list */ struct stylesheet *prev; /**< Previous in sibling list */ }; netsurf-all-3.2/libcss/docs/API0000644000175000017500000002116712377676736015406 0ustar vincevinceUsing the LibCSS API ==================== This document explains how to use LibCSS. In addition to this document, please see the examples and the headers (found in /usr/local/include/libcss or a similar location). Experience with C is assumed. Using the library consists of the following general steps: 1. Initialize the library. 2. Load one or more CSS files. 3. Use the Selection API to determine styles. 4. Use the computed styles. 5. Shut down the library. Please see example1.c for a demonstration of these steps. Load one or more CSS files -------------------------- A stylesheet is represented by the opaque type css_stylesheet. To create one, use css_stylesheet_create(), for example: css_stylesheet *sheet; css_stylesheet_params params; /* Set params */ ... code = css_stylesheet_create(¶ms, &sheet); if (code != CSS_OK) ... The arguments are as follows: + css_stylesheet_params params | + uint32_t params_version | | Version of the params struct. | | | + css_language_level level | | Which version of CSS the stylesheet should be treated as. It currently has | | no effect and is reserved for future use. The recommended value is | | CSS_LEVEL_DEFAULT. | | | + const char *charset | | The encoding of the stylesheet data, or NULL if LibCSS should attempt to | | detect it. If the encoding is known, for example from the Content-Type | | header or a file attribute, then it should be supplied here. | | | + const char *url | | The URL that the stylesheet was retrieved from. LibCSS uses this along | | with the resolve function (see below) to convert relative URLs in the | | stylesheet (e.g. imports, background images) to absolute URLs. If the | | stylesheet has no URL, use "". | | | + const char *title | | This is intended for the stylesheet title (for example from the | | tag). The title is not used by LibCSS but may be retrieved using | | css_stylesheet_get_title(). May be NULL if there is no title. | | | + bool allow_quirks | | | + bool inline_style | | | + css_url_resolution_fn resolve | | Function for resolving releative URLs into absolute URLs. | | | + void *resolve_pw | | Client data passed back to resolve function. | | | + css_import_notification_fn import | | Import notification function. | | | + void *import_pw | | Client data passed back to import function. | | | + css_color_resolution_fn color | | Colour resolution function. | | | + void *color_pw | | Client data passed back to color function. | | | + css_font_resolution_fn font | | Font resolution function. | | | + void *font_pw | Client data passed back to import function. | + css_stylesheet **stylesheet Updated with the newly created stylesheet object. Once the stylesheet has been created, CSS source data can be added to it. LibCSS parses the data into internal structures. Only data in memory is supported; you must handle reading from files or the network if required. Data is added using css_stylesheet_append_data(), for example: code = css_stylesheet_append_data(sheet, data, length); if (code != CSS_OK && code != CSS_NEEDDATA) ... The second argument is a pointer to a buffer containing some CSS to be parsed, with length in bytes given in the 3rd argument. This function may be called repeatedly with more data from the same stylesheet, for example as data arrives over the network. The return value may be CSS_NEEDDATA instead of CSS_OK. This indicates that more data may be expected. The two states can be treated identically. When all the data has been supplied, css_stylesheet_data_done() completes the processing: code = css_stylesheet_data_done(sheet); if (code != CSS_OK) ... The stylesheet is now in memory and ready for further use. Use the Selection API to determine styles ----------------------------------------- The Selection API is currently the only way to get information about styles from stylesheets that have been loaded. It takes a document node as input and returns the computed style that applies to that node. For example, it can be used to answer the question "What style should this

element have?" CSS selectors can be complex and apply to certain arrangments of elements within a document tree. Therefore LibCSS has to be able to navigate your document tree and read attributes of it to determine if a style applies. It does this through a series of functions that you supply. In this way LibCSS is independent of the representation of the document. For example, with the style rule: table h2 { color: red; } when requesting the style for an h2 element node, LibCSS will search its ancestors for a table element to determine if this style applies. The first step in using the Selection API is creating a selection context. This is a list of the stylesheets to be used. A context is created using css_select_ctx_create(): css_select_ctx *select_ctx; code = css_select_ctx_create(&select_ctx); if (code != CSS_OK) ... Stylesheets are added to the context using css_select_ctx_append_sheet(): code = css_select_ctx_append_sheet(select_ctx, sheet, CSS_ORIGIN_AUTHOR, CSS_MEDIA_ALL); if (code != CSS_OK) ... When adding a stylesheet, the origin and media can be specified. These are used in the computation of styles as defined in the CSS specification. Alternatively stylesheets may be added using css_select_ctx_insert_sheet(). After the context has been prepared, an empty computed style is created: css_computed_style *style; code = css_computed_style_create(&style); if (code != CSS_OK) ... The style is then determined for a document node using css_select_style(): code = css_select_style(select_ctx, element_node, 0, CSS_MEDIA_SCREEN, NULL, style, &select_handler, 0); if (code != CSS_OK) ... The arguments are as follows: + css_select_ctx *ctx | The selection context, as described above. | + void *node | A pointer to the document node for which the style is required. This is a | void pointer and may therefore be of any desired type. LibCSS can not use it | directly; instead it gets information about it through the functions given | in the handler argument, described below. Usually this will be a node in a | document tree. | + uint64_t media | The media that the style should apply to. The computed style will only | consider stylesheets or @media blocks that include this media. See the CSS | specification for more details. | + const css_stylesheet *inline_style | + css_select_handler *handler | This is a table of functions that are used to get information from and to | navigate the document tree, in order to determine if a CSS selector matches | the document node. Further details are below. | + void *pw | A private data pointer that is passed to each of the handler functions. | + css_computed_style **result Updated to the computed styles for the node. Array indexed by css_pseudo_element. The types of the handler functions that need to be supplied and the definition of css_select_handler are given in libcss/select.h. The functions all have the following in common: * the first argument is the private data pointer that was the last argument to css_select_style() * the second argument is the document node that is being queried is some way * the last one or two arguments are pointers that must be updated with the required information * the return value is a css_error and should be CSS_OK if everything worked and an error code otherwise For example, the node_name function, which determines the element name of a node, could be this: css_error node_name(void *pw, void *n, lwc_string **name) { my_document_node *node = n; *name = lwc_string_ref(node->name); return CSS_OK; } where my_document_node is your document tree node type (e.g. a struct of some sort). Use the computed styles ----------------------- After the style has been computed by css_select_style() the CSS properties can finally be retrieved. This is done using the property accessor functions declared in libcss/computed.h. Note that although struct css_computed_style is declared in computed.h, its members must not be used directly. The accessors carry out various additional work to read the properties correctly. For example, the css_computed_color() accessor retrieves the color property: uint8_t color_type; css_color color_shade; color_type = css_computed_color(style, &color_shade); In this case color_type can be CSS_COLOR_INHERIT or CSS_COLOR_COLOR. In the latter case, color_shade contains the actual color in RRGGBBAA format. Together these two variables encode the possible values for the property given by the CSS specification. netsurf-all-3.2/libcss/docs/Colour0000644000175000017500000000073712377676736016240 0ustar vincevinceThe exported representation of colours is an unsigned 32bit value in host order The value is divided into four 8bit channels. These are: Bits Name Desciption 0-7 Blue The blue intensity of the colour 0 is off 0xff is fully on 8-15 Green The green intensity of the colour 0 is off 0xff is fully on 16-23 Red The red intensity of the colour 0 is off 0xff is fully on 24-31 Alpha The Alpha component represents the opacity of the colour 0 is fully transparent and 0xff is opaque netsurf-all-3.2/libcss/docs/Grammar0000644000175000017500000001647612377676736016372 0ustar vincevinceExpanded grammar rules ====================== This file provides a fully-expanded version of (a slightly modified) forward-compatible CSS grammar. See CSS3 Syntax $4.3.2 for the compact version. start -> ws stylesheet EOF stylesheet -> CDO ws stylesheet stylesheet -> CDC ws stylesheet stylesheet -> statement stylesheet stylesheet -> statement -> ruleset statement -> at-rule ruleset -> selector '{' ws ruleset-end ruleset -> '{' ws ruleset-end ruleset-end -> declaration decl-list '}' ws ruleset-end -> decl-list '}' ws at-rule -> ATKEYWORD ws any0 at-rule-end at-rule-end -> block at-rule-end -> ';' ws block -> '{' ws block-content '}' ws block-content -> any block-content block-content -> block block-content block-content -> ATKEYWORD ws block-content block-content -> ';' ws block-content block-content -> selector -> any1 declaration -> property ':' ws value1 decl-list -> ';' ws decl-list-end decl-list -> decl-list-end -> declaration decl-list decl-list-end -> decl-list property -> IDENT ws value0 -> value value0 value0 -> value1 -> value value0 value -> any value -> block value -> ATKEYWORD ws any0 -> any any0 any0 -> any1 -> any any0 any -> IDENT ws any -> NUMBER ws any -> PERCENTAGE ws any -> DIMENSION ws any -> STRING ws any -> CHAR ws any -> URI ws any -> HASH ws any -> UNICODE-RANGE ws any -> INCLUDES ws any -> DASHMATCH ws any -> PREFIXMATCH ws any -> SUFFIXMATCH ws any -> SUBSTRINGMATCH ws any -> FUNCTION ws any0 ')' ws any -> '(' ws any0 ')' ws any -> '[' ws any0 ']' ws ws -> S ws ws -> Differences from the specification ---------------------------------- 1) The start non-terminal has been introduced. It eats any leading whitespace and handles EOF. 2) The "stylesheet -> S stylesheet" production has been removed. 3) The "stylesheet -> CDO stylesheet" production has been changed to "stylesheet -> CDO ws stylesheet". 4) The "stylesheet -> CDC stylesheet" production has been changed to "stylesheet -> CDC ws stylesheet". Essentially, the above changes remove the expectation of leading whitespace from the stylesheet non-terminal. This is handled by either the start non-terminal, or by the changes made to the production rules for the stylesheet non-terminal. Note that the "stylesheet -> statement stylesheet" production does not require modification as the statement production rule already consumes any whitespace following the statement. If '{', '}', '[', ']', '(', ')', and ';' are omitted from any, then the above grammar is LL(1). Nullable productions -------------------- stylesheet, block-content, decl-list, decl-list-end, value0, any0, ws FIRST sets ---------- start CDO, CDC, S, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF stylesheet CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD statement IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD ruleset IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{' ruleset-end IDENT, ';' at-rule ATKEYWORD at-rule-end '{', ';' block '{' block-content IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, ';' selector IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[' declaration IDENT decl-list ';', '}' decl-list-end IDENT, ';', '}' property IDENT value0 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD value1 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD value IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD any0 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[' any1 IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[' any IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[' ws S FOLLOW sets ----------- start stylesheet EOF statement CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF ruleset CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF ruleset-end CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF at-rule CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF at-rule-end CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF block CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF, ';', '}' block-content '}' selector '{' declaration ';', '}' decl-list '}' decl-list-end '}' property ':' value0 ';', '}' value1 ';', '}' value IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, ';', '}' any0 '{', ';', ')', ']' any1 '{' any IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ';', ATKEYWORD, '}' ws CDO, CDC, IDENT, NUMBER, PERCENTAGE, DIMENSION, STRING, CHAR, URI, HASH, UNICODE-RANGE, INCLUDES, DASHMATCH, PREFIXMATCH, SUFFIXMATCH, SUBSTRINGMATCH, FUNCTION, '(', '[', '{', ATKEYWORD, EOF, ';', '}', ':' netsurf-all-3.2/libcss/docs/API-ABI-Changes0000644000175000017500000000363512377676736017345 0ustar vincevinceLibCSS API & ABI Changes ======================== This document explains how to upgrade clients to use new versions of LibCSS. LibCSS 0.2.0 --> LibCSS 0.3.0 ----------------------------- Both the API and ABI are changed. LibCSS nolonger lets clients provide a memory allocator function. This change affects the following functions: From include/libcss/computed.h -- css_computed_style_create() From include/libcss/select.h -- css_select_ctx_create() From incluce/libcss/stylesheet.h -- css_stylesheet_create() There are changes to selection handler callback table: node_classes LibCSS nolonger frees the any array of classes passed to the node_classes callback. It does still unref the individual strings. This means clients need not allocate a new array each call, but can keep the array cached on the node. set_libcss_node_data New selection handler function used to store a private cache belonging to libcss on document element nodes. When the node is deleted or modified, clients should call css_libcss_node_data_handler(). get_libcss_node_data New selection handler function used to retrieve private cache belonging to libcss from document element nodes. LibCSS 0.3.0 --> LibCSS 0.4.0 ----------------------------- The API is changed. Due to the change from CSS2 overflow to CSS3 overflow properties, the computed style access functions for overflow properties have changed. The overflow property is removed. Added are overflow-x and overflow-y properties. (The overflow shorthand property now sets overflow-x and overflow-y.) This change affects the following functions: Removed from include/libcss/computed.h -- css_computed_overflow() Added to include/libcss/computed.h -- css_computed_overflow_x() Added to include/libcss/computed.h -- css_computed_overflow_y() netsurf-all-3.2/libcss/include/0000755000175000017500000000000012377713347015524 5ustar vincevincenetsurf-all-3.2/libcss/include/libcss/0000755000175000017500000000000012377713347017003 5ustar vincevincenetsurf-all-3.2/libcss/include/libcss/select.h0000644000175000017500000001773412377676736020461 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef libcss_select_h_ #define libcss_select_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include typedef enum css_pseudo_element { CSS_PSEUDO_ELEMENT_NONE = 0, CSS_PSEUDO_ELEMENT_FIRST_LINE = 1, CSS_PSEUDO_ELEMENT_FIRST_LETTER = 2, CSS_PSEUDO_ELEMENT_BEFORE = 3, CSS_PSEUDO_ELEMENT_AFTER = 4, CSS_PSEUDO_ELEMENT_COUNT = 5 /**< Number of pseudo elements */ } css_pseudo_element; /** * Style selection result set */ typedef struct css_select_results { /** * Array of pointers to computed styles, * indexed by css_pseudo_element. If there * was no styling for a given pseudo element, * then no computed style will be created and * the corresponding pointer will be set to NULL */ css_computed_style *styles[CSS_PSEUDO_ELEMENT_COUNT]; } css_select_results; typedef enum css_select_handler_version { CSS_SELECT_HANDLER_VERSION_1 = 1 } css_select_handler_version; typedef struct css_select_handler { /** ABI version of this structure */ uint32_t handler_version; css_error (*node_name)(void *pw, void *node, css_qname *qname); css_error (*node_classes)(void *pw, void *node, lwc_string ***classes, uint32_t *n_classes); css_error (*node_id)(void *pw, void *node, lwc_string **id); css_error (*named_ancestor_node)(void *pw, void *node, const css_qname *qname, void **ancestor); css_error (*named_parent_node)(void *pw, void *node, const css_qname *qname, void **parent); css_error (*named_sibling_node)(void *pw, void *node, const css_qname *qname, void **sibling); css_error (*named_generic_sibling_node)(void *pw, void *node, const css_qname *qname, void **sibling); css_error (*parent_node)(void *pw, void *node, void **parent); css_error (*sibling_node)(void *pw, void *node, void **sibling); css_error (*node_has_name)(void *pw, void *node, const css_qname *qname, bool *match); css_error (*node_has_class)(void *pw, void *node, lwc_string *name, bool *match); css_error (*node_has_id)(void *pw, void *node, lwc_string *name, bool *match); css_error (*node_has_attribute)(void *pw, void *node, const css_qname *qname, bool *match); css_error (*node_has_attribute_equal)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_has_attribute_dashmatch)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_has_attribute_includes)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_has_attribute_prefix)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_has_attribute_suffix)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_has_attribute_substring)(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); css_error (*node_is_root)(void *pw, void *node, bool *match); css_error (*node_count_siblings)(void *pw, void *node, bool same_name, bool after, int32_t *count); css_error (*node_is_empty)(void *pw, void *node, bool *match); css_error (*node_is_link)(void *pw, void *node, bool *match); css_error (*node_is_visited)(void *pw, void *node, bool *match); css_error (*node_is_hover)(void *pw, void *node, bool *match); css_error (*node_is_active)(void *pw, void *node, bool *match); css_error (*node_is_focus)(void *pw, void *node, bool *match); css_error (*node_is_enabled)(void *pw, void *node, bool *match); css_error (*node_is_disabled)(void *pw, void *node, bool *match); css_error (*node_is_checked)(void *pw, void *node, bool *match); css_error (*node_is_target)(void *pw, void *node, bool *match); css_error (*node_is_lang)(void *pw, void *node, lwc_string *lang, bool *match); css_error (*node_presentational_hint)(void *pw, void *node, uint32_t property, css_hint *hint); css_error (*ua_default_for_property)(void *pw, uint32_t property, css_hint *hint); css_error (*compute_font_size)(void *pw, const css_hint *parent, css_hint *size); /** * Set libcss_node_data on a DOM node. * * Replaces any existing libcss_node_data. If node is deleted, cloned, * or its ancestors are modified, call css_libcss_node_data_handler for * any non-NULL libcss_node_data. * * \param pw Client data * \param node DOM node to set data for * \param libcss_node_data Data to set on node, or NULL * \return CSS_OK on success, or appropriate error otherwise */ css_error (*set_libcss_node_data)(void *pw, void *node, void *libcss_node_data); /** * Get libcss_node_data from a DOM node. * * \param pw Client data * \param node DOM node to get data from * \param libcss_node_data Updated to node data, else set to NULL. * \return CSS_OK on success, or appropriate error otherwise */ css_error (*get_libcss_node_data)(void *pw, void *node, void **libcss_node_data); } css_select_handler; /** * Font face selection result set */ typedef struct css_select_font_faces_results { /** * Array of pointers to computed font faces. */ css_font_face **font_faces; uint32_t n_font_faces; } css_select_font_faces_results; typedef enum { CSS_NODE_DELETED, CSS_NODE_MODIFIED, CSS_NODE_ANCESTORS_MODIFIED, CSS_NODE_CLONED } css_node_data_action; /** * Handle libcss_node_data on DOM changes/deletion. * * When a DOM node is deleted, if it has libcss_node_data, call with * action CSS_NODE_DELETED, to ensure the libcss_node_data is not leaked. * Does not call handler->set_libcss_node_data. * * When a DOM node is modified, if the node has libcss_node_data, * call with CSS_NODE_MODIFIED. This will result in a call to * handler->set_libcss_node_data for the node. * * When a DOM node's ancestors are modified, if the node has libcss_node_data, * call with CSS_NODE_ANCESTORS_MODIFIED. This will result in a call to * handler->set_libcss_node_data for the node. * * When a DOM node with libcss_node_data is cloned, and its ancestors are * also clones, call with CSS_NODE_CLONED. This will result in a call to * handler->set_libcss_node_data for the clone node. * * \param handler Selection handler vtable * \param action Type of node action. * \param pw Client data * \param node DOM node to get data from * \param clone_node Clone node, or NULL * \param libcss_node_data Node data (non-NULL) * \return CSS_OK on success, or appropriate error otherwise */ css_error css_libcss_node_data_handler(css_select_handler *handler, css_node_data_action action, void *pw, void *node, void *clone_node, void *libcss_node_data); css_error css_select_ctx_create(css_select_ctx **result); css_error css_select_ctx_destroy(css_select_ctx *ctx); css_error css_select_ctx_append_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_origin origin, uint64_t media); css_error css_select_ctx_insert_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, uint32_t index, css_origin origin, uint64_t media); css_error css_select_ctx_remove_sheet(css_select_ctx *ctx, const css_stylesheet *sheet); css_error css_select_ctx_count_sheets(css_select_ctx *ctx, uint32_t *count); css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, const css_stylesheet **sheet); css_error css_select_style(css_select_ctx *ctx, void *node, uint64_t media, const css_stylesheet *inline_style, css_select_handler *handler, void *pw, css_select_results **result); css_error css_select_results_destroy(css_select_results *results); css_error css_select_font_faces(css_select_ctx *ctx, uint64_t media, lwc_string *font_family, css_select_font_faces_results **result); css_error css_select_font_faces_results_destroy( css_select_font_faces_results *results); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/fpmath.h0000644000175000017500000000672612377676736020460 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef libcss_fpmath_h_ #define libcss_fpmath_h_ #ifdef __cplusplus extern "C" { #endif #include #include /* 22:10 fixed point math */ #define CSS_RADIX_POINT 10 /* type for fixed point numbers */ typedef int32_t css_fixed; static inline css_fixed css_add_fixed(const css_fixed x, const css_fixed y) { int32_t ux = x; int32_t uy = y; int32_t res = ux + uy; /* Calculate overflowed result. (Don't change the sign bit of ux) */ ux = (ux >> 31) + INT_MAX; /* Force compiler to use cmovns instruction */ if ((int32_t) ((ux ^ uy) | ~(uy ^ res)) >= 0) { res = ux; } return res; } static inline css_fixed css_subtract_fixed(const css_fixed x, const css_fixed y) { int32_t ux = x; int32_t uy = y; int32_t res = ux - uy; ux = (ux >> 31) + INT_MAX; /* Force compiler to use cmovns instruction */ if ((int32_t)((ux ^ uy) & (ux ^ res)) < 0) { res = ux; } return res; } static inline css_fixed css_divide_fixed(const css_fixed x, const css_fixed y) { int64_t xx = ((int64_t)x << CSS_RADIX_POINT) / y; if (xx < INT_MIN) xx = INT_MIN; if (xx > INT_MAX) xx = INT_MAX; return xx; } static inline css_fixed css_multiply_fixed(const css_fixed x, const css_fixed y) { int64_t xx = ((int64_t)x * (int64_t)y) >> CSS_RADIX_POINT; if (xx < INT_MIN) xx = INT_MIN; if (xx > INT_MAX) xx = INT_MAX; return xx; } static inline css_fixed css_int_to_fixed(const int a) { int64_t xx = ((int64_t) a) << CSS_RADIX_POINT; if (xx < INT_MIN) xx = INT_MIN; if (xx > INT_MAX) xx = INT_MAX; return xx; } static inline css_fixed css_float_to_fixed(const float a) { float xx = a * (float) (1 << CSS_RADIX_POINT); if (xx < INT_MIN) xx = INT_MIN; if (xx > INT_MAX) xx = INT_MAX; return (css_fixed) xx; } /* Add two fixed point values */ #define FADD(a, b) (css_add_fixed((a), (b))) /* Subtract two fixed point values */ #define FSUB(a, b) (css_subtract_fixed((a), (b))) /* Multiply two fixed point values */ #define FMUL(a, b) (css_multiply_fixed((a), (b))) /* Divide two fixed point values */ #define FDIV(a, b) (css_divide_fixed((a), (b))) /* Convert a floating point value to fixed point */ #define FLTTOFIX(a) ((css_fixed) ((a) * (float) (1 << CSS_RADIX_POINT))) /* Convert a fixed point value to floating point */ #define FIXTOFLT(a) ((float) (a) / (float) (1 << CSS_RADIX_POINT)) /* Convert an integer to a fixed point value */ #define INTTOFIX(a) (css_int_to_fixed(a)) /* Convert a fixed point value to an integer */ #define FIXTOINT(a) ((a) >> CSS_RADIX_POINT) /* truncate a fixed point value */ #define TRUNCATEFIX(a) (a & ~((1 << CSS_RADIX_POINT)- 1 )) /* Useful values */ #define F_PI_2 0x00000648 /* 1.5708 (PI/2) */ #define F_PI 0x00000c91 /* 3.1415 (PI) */ #define F_3PI_2 0x000012d9 /* 4.7124 (3PI/2) */ #define F_2PI 0x00001922 /* 6.2831 (2 PI) */ #define F_90 0x00016800 /* 90 */ #define F_180 0x0002d000 /* 180 */ #define F_270 0x00043800 /* 270 */ #define F_360 0x0005a000 /* 360 */ #define F_0_5 0x00000200 /* 0.5 */ #define F_1 0x00000400 /* 1 */ #define F_10 0x00002800 /* 10 */ #define F_72 0x00012000 /* 72 */ #define F_100 0x00019000 /* 100 */ #define F_200 0x00032000 /* 200 */ #define F_255 0x0003FC00 /* 255 */ #define F_300 0x0004b000 /* 300 */ #define F_400 0x00064000 /* 400 */ #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/stylesheet.h0000644000175000017500000001200612377676736021356 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef libcss_stylesheet_h_ #define libcss_stylesheet_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include /** * Callback to resolve an URL * * \param pw Client data * \param dict String internment context * \param base Base URI (absolute) * \param rel URL to resolve, either absolute or relative to base * \param abs Pointer to location to receive result * \return CSS_OK on success, appropriate error otherwise. */ typedef css_error (*css_url_resolution_fn)(void *pw, const char *base, lwc_string *rel, lwc_string **abs); /** * Callback to be notified of the need for an imported stylesheet * * \param pw Client data * \param parent Stylesheet requesting the import * \param url URL of the imported sheet * \param media Applicable media for the imported sheet * \return CSS_OK on success, appropriate error otherwise * * \note This function will be invoked for notification purposes * only. The client may use this to trigger a parallel fetch * of the imported stylesheet. The imported sheet must be * registered with its parent using the post-parse import * registration API. */ typedef css_error (*css_import_notification_fn)(void *pw, css_stylesheet *parent, lwc_string *url, uint64_t media); /** * Callback use to resolve system colour names to RGB values * * \param pw Client data * \param name System colour name * \param color Pointer to location to receive color value * \return CSS_OK on success, * CSS_INVALID if the name is unknown. */ typedef css_error (*css_color_resolution_fn)(void *pw, lwc_string *name, css_color *color); /** System font callback result data. */ typedef struct css_system_font { enum css_font_style_e style; enum css_font_variant_e variant; enum css_font_weight_e weight; struct { css_fixed size; css_unit unit; } size; struct { css_fixed size; css_unit unit; } line_height; /* Note: must be a single family name only */ lwc_string *family; } css_system_font; /** * Callback use to resolve system font names to font values * * \param pw Client data * \param name System font identifier * \param system_font Pointer to system font descriptor to be filled * \return CSS_OK on success, * CSS_INVALID if the name is unknown. */ typedef css_error (*css_font_resolution_fn)(void *pw, lwc_string *name, css_system_font *system_font); typedef enum css_stylesheet_params_version { CSS_STYLESHEET_PARAMS_VERSION_1 = 1 } css_stylesheet_params_version; /** * Parameter block for css_stylesheet_create() */ typedef struct css_stylesheet_params { /** ABI version of this structure */ uint32_t params_version; /** The language level of the stylesheet */ css_language_level level; /** The charset of the stylesheet data, or NULL to detect */ const char *charset; /** URL of stylesheet */ const char *url; /** Title of stylesheet */ const char *title; /** Permit quirky parsing of stylesheet */ bool allow_quirks; /** This stylesheet is an inline style */ bool inline_style; /** URL resolution function */ css_url_resolution_fn resolve; /** Client private data for resolve */ void *resolve_pw; /** Import notification function */ css_import_notification_fn import; /** Client private data for import */ void *import_pw; /** Colour resolution function */ css_color_resolution_fn color; /** Client private data for color */ void *color_pw; /** Font resolution function */ css_font_resolution_fn font; /** Client private data for font */ void *font_pw; } css_stylesheet_params; css_error css_stylesheet_create(const css_stylesheet_params *params, css_stylesheet **stylesheet); css_error css_stylesheet_destroy(css_stylesheet *sheet); css_error css_stylesheet_append_data(css_stylesheet *sheet, const uint8_t *data, size_t len); css_error css_stylesheet_data_done(css_stylesheet *sheet); css_error css_stylesheet_next_pending_import(css_stylesheet *parent, lwc_string **url, uint64_t *media); css_error css_stylesheet_register_import(css_stylesheet *parent, css_stylesheet *child); css_error css_stylesheet_get_language_level(css_stylesheet *sheet, css_language_level *level); css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url); css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title); css_error css_stylesheet_quirks_allowed(css_stylesheet *sheet, bool *allowed); css_error css_stylesheet_used_quirks(css_stylesheet *sheet, bool *quirks); css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled); css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled); css_error css_stylesheet_size(css_stylesheet *sheet, size_t *size); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/computed.h0000644000175000017500000002426612377676736021020 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef libcss_computed_h_ #define libcss_computed_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include struct css_hint; struct css_select_handler; typedef struct css_computed_counter { lwc_string *name; css_fixed value; } css_computed_counter; typedef struct css_computed_clip_rect { css_fixed top; css_fixed right; css_fixed bottom; css_fixed left; css_unit tunit; css_unit runit; css_unit bunit; css_unit lunit; bool top_auto; bool right_auto; bool bottom_auto; bool left_auto; } css_computed_clip_rect; enum css_computed_content_type { CSS_COMPUTED_CONTENT_NONE = 0, CSS_COMPUTED_CONTENT_STRING = 1, CSS_COMPUTED_CONTENT_URI = 2, CSS_COMPUTED_CONTENT_COUNTER = 3, CSS_COMPUTED_CONTENT_COUNTERS = 4, CSS_COMPUTED_CONTENT_ATTR = 5, CSS_COMPUTED_CONTENT_OPEN_QUOTE = 6, CSS_COMPUTED_CONTENT_CLOSE_QUOTE = 7, CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE = 8, CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE = 9 }; typedef struct css_computed_content_item { uint8_t type; union { lwc_string *string; lwc_string *uri; lwc_string *attr; struct { lwc_string *name; uint8_t style; } counter; struct { lwc_string *name; lwc_string *sep; uint8_t style; } counters; } data; } css_computed_content_item; css_error css_computed_style_create(css_computed_style **result); css_error css_computed_style_destroy(css_computed_style *style); css_error css_computed_style_initialise(css_computed_style *style, struct css_select_handler *handler, void *pw); css_error css_computed_style_compose(const css_computed_style *parent, const css_computed_style *child, css_error (*compute_font_size)(void *pw, const struct css_hint *parent, struct css_hint *size), void *pw, css_computed_style *result); /****************************************************************************** * Property accessors below here * ******************************************************************************/ uint8_t css_computed_letter_spacing( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_outline_color( const css_computed_style *style, css_color *color); uint8_t css_computed_outline_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_spacing( const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit); uint8_t css_computed_word_spacing( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_counter_increment( const css_computed_style *style, const css_computed_counter **counters); uint8_t css_computed_counter_reset( const css_computed_style *style, const css_computed_counter **counters); uint8_t css_computed_cursor( const css_computed_style *style, lwc_string ***urls); uint8_t css_computed_clip( const css_computed_style *style, css_computed_clip_rect *rect); uint8_t css_computed_content( const css_computed_style *style, const css_computed_content_item **content); uint8_t css_computed_vertical_align( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_font_size( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_top_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_right_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_bottom_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_left_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_background_image( const css_computed_style *style, lwc_string **url); uint8_t css_computed_color( const css_computed_style *style, css_color *color); uint8_t css_computed_list_style_image( const css_computed_style *style, lwc_string **url); uint8_t css_computed_quotes( const css_computed_style *style, lwc_string ***quotes); uint8_t css_computed_top( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_right( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_left( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_border_top_color( const css_computed_style *style, css_color *color); uint8_t css_computed_border_right_color( const css_computed_style *style, css_color *color); uint8_t css_computed_border_bottom_color( const css_computed_style *style, css_color *color); uint8_t css_computed_border_left_color( const css_computed_style *style, css_color *color); uint8_t css_computed_height( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_line_height( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_background_color( const css_computed_style *style, css_color *color); uint8_t css_computed_z_index( const css_computed_style *style, int32_t *z_index); uint8_t css_computed_margin_top( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_margin_right( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_margin_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_margin_left( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_background_attachment( const css_computed_style *style); uint8_t css_computed_border_collapse( const css_computed_style *style); uint8_t css_computed_caption_side( const css_computed_style *style); uint8_t css_computed_direction( const css_computed_style *style); uint8_t css_computed_max_height( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_max_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_empty_cells( const css_computed_style *style); uint8_t css_computed_float( const css_computed_style *style); uint8_t css_computed_writing_mode( const css_computed_style *style); uint8_t css_computed_font_style( const css_computed_style *style); uint8_t css_computed_min_height( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_min_width( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_background_repeat( const css_computed_style *style); uint8_t css_computed_clear( const css_computed_style *style); uint8_t css_computed_padding_top( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_padding_right( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_padding_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_padding_left( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_overflow_x( const css_computed_style *style); uint8_t css_computed_overflow_y( const css_computed_style *style); uint8_t css_computed_position( const css_computed_style *style); uint8_t css_computed_opacity( const css_computed_style *style, css_fixed *opacity); uint8_t css_computed_text_transform( const css_computed_style *style); uint8_t css_computed_text_indent( const css_computed_style *style, css_fixed *length, css_unit *unit); uint8_t css_computed_white_space( const css_computed_style *style); uint8_t css_computed_background_position( const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit); uint8_t css_computed_display( const css_computed_style *style, bool root); uint8_t css_computed_display_static( const css_computed_style *style); uint8_t css_computed_font_variant( const css_computed_style *style); uint8_t css_computed_text_decoration( const css_computed_style *style); uint8_t css_computed_font_family( const css_computed_style *style, lwc_string ***names); uint8_t css_computed_border_top_style( const css_computed_style *style); uint8_t css_computed_border_right_style( const css_computed_style *style); uint8_t css_computed_border_bottom_style( const css_computed_style *style); uint8_t css_computed_border_left_style( const css_computed_style *style); uint8_t css_computed_font_weight( const css_computed_style *style); uint8_t css_computed_list_style_type( const css_computed_style *style); uint8_t css_computed_outline_style( const css_computed_style *style); uint8_t css_computed_table_layout( const css_computed_style *style); uint8_t css_computed_unicode_bidi( const css_computed_style *style); uint8_t css_computed_visibility( const css_computed_style *style); uint8_t css_computed_list_style_position( const css_computed_style *style); uint8_t css_computed_text_align( const css_computed_style *style); uint8_t css_computed_page_break_after( const css_computed_style *style); uint8_t css_computed_page_break_before( const css_computed_style *style); uint8_t css_computed_page_break_inside( const css_computed_style *style); uint8_t css_computed_orphans( const css_computed_style *style, int32_t *orphans); uint8_t css_computed_widows( const css_computed_style *style, int32_t *widows); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/errors.h0000644000175000017500000000136712377676736020511 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef libcss_errors_h_ #define libcss_errors_h_ #ifdef __cplusplus extern "C" { #endif #include typedef enum css_error { CSS_OK = 0, CSS_NOMEM = 1, CSS_BADPARM = 2, CSS_INVALID = 3, CSS_FILENOTFOUND = 4, CSS_NEEDDATA = 5, CSS_BADCHARSET = 6, CSS_EOF = 7, CSS_IMPORTS_PENDING = 8, CSS_PROPERTY_NOT_SET = 9 } css_error; /* Convert a libcss error value to a string */ const char *css_error_to_string(css_error error); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/font_face.h0000644000175000017500000000451212377676736021114 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 Things Made Out Of Other Things Ltd. * Written by James Montgomerie */ #ifndef libcss_font_face_h_ #define libcss_font_face_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include typedef enum css_font_face_format { CSS_FONT_FACE_FORMAT_UNSPECIFIED = 0x00, CSS_FONT_FACE_FORMAT_WOFF = 0x01, /* WOFF (Web Open Font Format); .woff */ CSS_FONT_FACE_FORMAT_OPENTYPE = 0x02, /* TrueType or OpenType; .ttf, .otf */ CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE = 0x04, /* Embedded OpenType; .eot */ CSS_FONT_FACE_FORMAT_SVG = 0x08, /* SVG Font; .svg, .svgz */ CSS_FONT_FACE_FORMAT_UNKNOWN = 0x10, /* Format specified, but not recognised */ /* We don't define CSS_FONT_FACE_SRC_FORMAT_TRUETYPE as might be * expected, because the CSS3 specification * (http://www.w3.org/TR/css3-fonts/, 則4.3) says: * "Given the overlap in common usage between TrueType and * OpenType, the format hints "truetype" and "opentype" must be * considered as synonymous" * so we compute a hint of 'truetype' to css_font_face_format_opentype. */ } css_font_face_format; typedef enum css_font_face_location_type { CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED = 0, CSS_FONT_FACE_LOCATION_TYPE_LOCAL = 1, CSS_FONT_FACE_LOCATION_TYPE_URI = 2, } css_font_face_location_type; css_error css_font_face_get_font_family( const css_font_face *font_face, lwc_string **font_family); css_error css_font_face_count_srcs(const css_font_face *font_face, uint32_t *count); css_error css_font_face_get_src(const css_font_face *font_face, uint32_t index, const css_font_face_src **src); css_error css_font_face_src_get_location(const css_font_face_src *src, lwc_string **location); css_font_face_location_type css_font_face_src_location_type( const css_font_face_src *src); css_font_face_format css_font_face_src_format(const css_font_face_src *src); uint8_t css_font_face_font_style(const css_font_face *font_face); uint8_t css_font_face_font_weight(const css_font_face *font_face); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/types.h0000644000175000017500000000732112377676736020335 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef libcss_types_h_ #define libcss_types_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include /** * Source of charset information, in order of importance. * A client-dictated charset will override all others. * A document-specified charset will override autodetection or the default. */ typedef enum css_charset_source { CSS_CHARSET_DEFAULT = 0, /**< Default setting */ CSS_CHARSET_REFERRED = 1, /**< From referring document */ CSS_CHARSET_METADATA = 2, /**< From linking metadata */ CSS_CHARSET_DOCUMENT = 3, /**< Defined in document */ CSS_CHARSET_DICTATED = 4 /**< Dictated by client */ } css_charset_source; /** * Stylesheet language level -- defines parsing rules and supported properties */ typedef enum css_language_level { CSS_LEVEL_1 = 0, /**< CSS 1 */ CSS_LEVEL_2 = 1, /**< CSS 2 */ CSS_LEVEL_21 = 2, /**< CSS 2.1 */ CSS_LEVEL_3 = 3, /**< CSS 3 */ CSS_LEVEL_DEFAULT = CSS_LEVEL_21 /**< Default level */ } css_language_level; /** * Stylesheet media types */ typedef enum css_media_type { CSS_MEDIA_AURAL = (1 << 0), CSS_MEDIA_BRAILLE = (1 << 1), CSS_MEDIA_EMBOSSED = (1 << 2), CSS_MEDIA_HANDHELD = (1 << 3), CSS_MEDIA_PRINT = (1 << 4), CSS_MEDIA_PROJECTION = (1 << 5), CSS_MEDIA_SCREEN = (1 << 6), CSS_MEDIA_SPEECH = (1 << 7), CSS_MEDIA_TTY = (1 << 8), CSS_MEDIA_TV = (1 << 9), CSS_MEDIA_ALL = CSS_MEDIA_AURAL | CSS_MEDIA_BRAILLE | CSS_MEDIA_EMBOSSED | CSS_MEDIA_HANDHELD | CSS_MEDIA_PRINT | CSS_MEDIA_PROJECTION | CSS_MEDIA_SCREEN | CSS_MEDIA_SPEECH | CSS_MEDIA_TTY | CSS_MEDIA_TV } css_media_type; /** * Stylesheet origin */ typedef enum css_origin { CSS_ORIGIN_UA = 0, /**< User agent stylesheet */ CSS_ORIGIN_USER = 1, /**< User stylesheet */ CSS_ORIGIN_AUTHOR = 2 /**< Author stylesheet */ } css_origin; /** CSS colour -- AARRGGBB */ typedef uint32_t css_color; /* CSS unit */ typedef enum css_unit { CSS_UNIT_PX = 0x0, CSS_UNIT_EX = 0x1, CSS_UNIT_EM = 0x2, CSS_UNIT_IN = 0x3, CSS_UNIT_CM = 0x4, CSS_UNIT_MM = 0x5, CSS_UNIT_PT = 0x6, CSS_UNIT_PC = 0x7, CSS_UNIT_PCT = 0x8, /* Percentage */ CSS_UNIT_DEG = 0x9, CSS_UNIT_GRAD = 0xa, CSS_UNIT_RAD = 0xb, CSS_UNIT_MS = 0xc, CSS_UNIT_S = 0xd, CSS_UNIT_HZ = 0xe, CSS_UNIT_KHZ = 0xf } css_unit; /** * Type of a qualified name */ typedef struct css_qname { /** * Namespace URI: * * NULL for no namespace * '*' for any namespace (including none) * URI for a specific namespace */ lwc_string *ns; /** * Local part of qualified name */ lwc_string *name; } css_qname; typedef struct css_stylesheet css_stylesheet; typedef struct css_select_ctx css_select_ctx; typedef struct css_computed_style css_computed_style; typedef struct css_font_face css_font_face; typedef struct css_font_face_src css_font_face_src; #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/libcss.h0000644000175000017500000000111512377676736020443 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef libcss_h_ #define libcss_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include #include #include #include #include #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/functypes.h0000644000175000017500000000065412377676736021213 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007-8 John-Mark Bell */ #ifndef libcss_functypes_h_ #define libcss_functypes_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/properties.h0000644000175000017500000005047212377676736021372 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef libcss_properties_h_ #define libcss_properties_h_ #ifdef __cplusplus extern "C" { #endif enum css_properties_e { CSS_PROP_AZIMUTH = 0x000, CSS_PROP_BACKGROUND_ATTACHMENT = 0x001, CSS_PROP_BACKGROUND_COLOR = 0x002, CSS_PROP_BACKGROUND_IMAGE = 0x003, CSS_PROP_BACKGROUND_POSITION = 0x004, CSS_PROP_BACKGROUND_REPEAT = 0x005, CSS_PROP_BORDER_COLLAPSE = 0x006, CSS_PROP_BORDER_SPACING = 0x007, CSS_PROP_BORDER_TOP_COLOR = 0x008, CSS_PROP_BORDER_RIGHT_COLOR = 0x009, CSS_PROP_BORDER_BOTTOM_COLOR = 0x00a, CSS_PROP_BORDER_LEFT_COLOR = 0x00b, CSS_PROP_BORDER_TOP_STYLE = 0x00c, CSS_PROP_BORDER_RIGHT_STYLE = 0x00d, CSS_PROP_BORDER_BOTTOM_STYLE = 0x00e, CSS_PROP_BORDER_LEFT_STYLE = 0x00f, CSS_PROP_BORDER_TOP_WIDTH = 0x010, CSS_PROP_BORDER_RIGHT_WIDTH = 0x011, CSS_PROP_BORDER_BOTTOM_WIDTH = 0x012, CSS_PROP_BORDER_LEFT_WIDTH = 0x013, CSS_PROP_BOTTOM = 0x014, CSS_PROP_CAPTION_SIDE = 0x015, CSS_PROP_CLEAR = 0x016, CSS_PROP_CLIP = 0x017, CSS_PROP_COLOR = 0x018, CSS_PROP_CONTENT = 0x019, CSS_PROP_COUNTER_INCREMENT = 0x01a, CSS_PROP_COUNTER_RESET = 0x01b, CSS_PROP_CUE_AFTER = 0x01c, CSS_PROP_CUE_BEFORE = 0x01d, CSS_PROP_CURSOR = 0x01e, CSS_PROP_DIRECTION = 0x01f, CSS_PROP_DISPLAY = 0x020, CSS_PROP_ELEVATION = 0x021, CSS_PROP_EMPTY_CELLS = 0x022, CSS_PROP_FLOAT = 0x023, CSS_PROP_FONT_FAMILY = 0x024, CSS_PROP_FONT_SIZE = 0x025, CSS_PROP_FONT_STYLE = 0x026, CSS_PROP_FONT_VARIANT = 0x027, CSS_PROP_FONT_WEIGHT = 0x028, CSS_PROP_HEIGHT = 0x029, CSS_PROP_LEFT = 0x02a, CSS_PROP_LETTER_SPACING = 0x02b, CSS_PROP_LINE_HEIGHT = 0x02c, CSS_PROP_LIST_STYLE_IMAGE = 0x02d, CSS_PROP_LIST_STYLE_POSITION = 0x02e, CSS_PROP_LIST_STYLE_TYPE = 0x02f, CSS_PROP_MARGIN_TOP = 0x030, CSS_PROP_MARGIN_RIGHT = 0x031, CSS_PROP_MARGIN_BOTTOM = 0x032, CSS_PROP_MARGIN_LEFT = 0x033, CSS_PROP_MAX_HEIGHT = 0x034, CSS_PROP_MAX_WIDTH = 0x035, CSS_PROP_MIN_HEIGHT = 0x036, CSS_PROP_MIN_WIDTH = 0x037, CSS_PROP_ORPHANS = 0x038, CSS_PROP_OUTLINE_COLOR = 0x039, CSS_PROP_OUTLINE_STYLE = 0x03a, CSS_PROP_OUTLINE_WIDTH = 0x03b, CSS_PROP_OVERFLOW_X = 0x03c, CSS_PROP_PADDING_TOP = 0x03d, CSS_PROP_PADDING_RIGHT = 0x03e, CSS_PROP_PADDING_BOTTOM = 0x03f, CSS_PROP_PADDING_LEFT = 0x040, CSS_PROP_PAGE_BREAK_AFTER = 0x041, CSS_PROP_PAGE_BREAK_BEFORE = 0x042, CSS_PROP_PAGE_BREAK_INSIDE = 0x043, CSS_PROP_PAUSE_AFTER = 0x044, CSS_PROP_PAUSE_BEFORE = 0x045, CSS_PROP_PITCH_RANGE = 0x046, CSS_PROP_PITCH = 0x047, CSS_PROP_PLAY_DURING = 0x048, CSS_PROP_POSITION = 0x049, CSS_PROP_QUOTES = 0x04a, CSS_PROP_RICHNESS = 0x04b, CSS_PROP_RIGHT = 0x04c, CSS_PROP_SPEAK_HEADER = 0x04d, CSS_PROP_SPEAK_NUMERAL = 0x04e, CSS_PROP_SPEAK_PUNCTUATION = 0x04f, CSS_PROP_SPEAK = 0x050, CSS_PROP_SPEECH_RATE = 0x051, CSS_PROP_STRESS = 0x052, CSS_PROP_TABLE_LAYOUT = 0x053, CSS_PROP_TEXT_ALIGN = 0x054, CSS_PROP_TEXT_DECORATION = 0x055, CSS_PROP_TEXT_INDENT = 0x056, CSS_PROP_TEXT_TRANSFORM = 0x057, CSS_PROP_TOP = 0x058, CSS_PROP_UNICODE_BIDI = 0x059, CSS_PROP_VERTICAL_ALIGN = 0x05a, CSS_PROP_VISIBILITY = 0x05b, CSS_PROP_VOICE_FAMILY = 0x05c, CSS_PROP_VOLUME = 0x05d, CSS_PROP_WHITE_SPACE = 0x05e, CSS_PROP_WIDOWS = 0x05f, CSS_PROP_WIDTH = 0x060, CSS_PROP_WORD_SPACING = 0x061, CSS_PROP_Z_INDEX = 0x062, CSS_PROP_OPACITY = 0x063, CSS_PROP_BREAK_AFTER = 0x064, CSS_PROP_BREAK_BEFORE = 0x065, CSS_PROP_BREAK_INSIDE = 0x066, CSS_PROP_COLUMN_COUNT = 0x067, CSS_PROP_COLUMN_FILL = 0x068, CSS_PROP_COLUMN_GAP = 0x069, CSS_PROP_COLUMN_RULE_COLOR = 0x06a, CSS_PROP_COLUMN_RULE_STYLE = 0x06b, CSS_PROP_COLUMN_RULE_WIDTH = 0x06c, CSS_PROP_COLUMN_SPAN = 0x06d, CSS_PROP_COLUMN_WIDTH = 0x06e, CSS_PROP_WRITING_MODE = 0x06f, CSS_PROP_OVERFLOW_Y = 0x070, CSS_N_PROPERTIES }; enum css_background_attachment_e { CSS_BACKGROUND_ATTACHMENT_INHERIT = 0x0, CSS_BACKGROUND_ATTACHMENT_FIXED = 0x1, CSS_BACKGROUND_ATTACHMENT_SCROLL = 0x2 }; enum css_background_color_e { CSS_BACKGROUND_COLOR_INHERIT = 0x0, CSS_BACKGROUND_COLOR_COLOR = 0x1, CSS_BACKGROUND_COLOR_CURRENT_COLOR = 0x2 }; enum css_background_image_e { CSS_BACKGROUND_IMAGE_INHERIT = 0x0, /* Consult pointer in struct to determine which */ CSS_BACKGROUND_IMAGE_NONE = 0x1, CSS_BACKGROUND_IMAGE_IMAGE = 0x1 }; enum css_background_position_e { CSS_BACKGROUND_POSITION_INHERIT = 0x0, CSS_BACKGROUND_POSITION_SET = 0x1 }; enum css_background_repeat_e { CSS_BACKGROUND_REPEAT_INHERIT = 0x0, CSS_BACKGROUND_REPEAT_REPEAT_X = 0x1, CSS_BACKGROUND_REPEAT_REPEAT_Y = 0x2, CSS_BACKGROUND_REPEAT_REPEAT = 0x3, CSS_BACKGROUND_REPEAT_NO_REPEAT = 0x4 }; enum css_border_collapse_e { CSS_BORDER_COLLAPSE_INHERIT = 0x0, CSS_BORDER_COLLAPSE_SEPARATE = 0x1, CSS_BORDER_COLLAPSE_COLLAPSE = 0x2 }; enum css_border_spacing_e { CSS_BORDER_SPACING_INHERIT = 0x0, CSS_BORDER_SPACING_SET = 0x1 }; enum css_border_color_e { CSS_BORDER_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, CSS_BORDER_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, CSS_BORDER_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR }; enum css_border_style_e { CSS_BORDER_STYLE_INHERIT = 0x0, CSS_BORDER_STYLE_NONE = 0x1, CSS_BORDER_STYLE_HIDDEN = 0x2, CSS_BORDER_STYLE_DOTTED = 0x3, CSS_BORDER_STYLE_DASHED = 0x4, CSS_BORDER_STYLE_SOLID = 0x5, CSS_BORDER_STYLE_DOUBLE = 0x6, CSS_BORDER_STYLE_GROOVE = 0x7, CSS_BORDER_STYLE_RIDGE = 0x8, CSS_BORDER_STYLE_INSET = 0x9, CSS_BORDER_STYLE_OUTSET = 0xa }; enum css_border_width_e { CSS_BORDER_WIDTH_INHERIT = 0x0, CSS_BORDER_WIDTH_THIN = 0x1, CSS_BORDER_WIDTH_MEDIUM = 0x2, CSS_BORDER_WIDTH_THICK = 0x3, CSS_BORDER_WIDTH_WIDTH = 0x4 }; enum css_bottom_e { CSS_BOTTOM_INHERIT = 0x0, CSS_BOTTOM_SET = 0x1, CSS_BOTTOM_AUTO = 0x2 }; enum css_break_after_e { CSS_BREAK_AFTER_INHERIT = 0x0, CSS_BREAK_AFTER_AUTO = 0x1, CSS_BREAK_AFTER_AVOID = 0x2, CSS_BREAK_AFTER_ALWAYS = 0x3, CSS_BREAK_AFTER_LEFT = 0x4, CSS_BREAK_AFTER_RIGHT = 0x5, CSS_BREAK_AFTER_PAGE = 0x6, CSS_BREAK_AFTER_COLUMN = 0x7, CSS_BREAK_AFTER_AVOID_PAGE = 0x8, CSS_BREAK_AFTER_AVOID_COLUMN = 0x9 }; enum css_break_before_e { CSS_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, CSS_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, CSS_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, CSS_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, CSS_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, CSS_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT, CSS_BREAK_BEFORE_PAGE = CSS_BREAK_AFTER_PAGE, CSS_BREAK_BEFORE_COLUMN = CSS_BREAK_AFTER_COLUMN, CSS_BREAK_BEFORE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, CSS_BREAK_BEFORE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN }; enum css_break_inside_e { CSS_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, CSS_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, CSS_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID, CSS_BREAK_INSIDE_AVOID_PAGE = CSS_BREAK_AFTER_AVOID_PAGE, CSS_BREAK_INSIDE_AVOID_COLUMN = CSS_BREAK_AFTER_AVOID_COLUMN }; enum css_caption_side_e { CSS_CAPTION_SIDE_INHERIT = 0x0, CSS_CAPTION_SIDE_TOP = 0x1, CSS_CAPTION_SIDE_BOTTOM = 0x2 }; enum css_clear_e { CSS_CLEAR_INHERIT = 0x0, CSS_CLEAR_NONE = 0x1, CSS_CLEAR_LEFT = 0x2, CSS_CLEAR_RIGHT = 0x3, CSS_CLEAR_BOTH = 0x4 }; enum css_clip_e { CSS_CLIP_INHERIT = 0x0, CSS_CLIP_AUTO = 0x1, CSS_CLIP_RECT = 0x2 }; enum css_color_e { CSS_COLOR_INHERIT = 0x0, CSS_COLOR_COLOR = 0x1 }; enum css_column_count_e { CSS_COLUMN_COUNT_INHERIT = 0x0, CSS_COLUMN_COUNT_AUTO = 0x1, CSS_COLUMN_COUNT_SET = 0x2 }; enum css_column_fill_e { CSS_COLUMN_FILL_INHERIT = 0x0, CSS_COLUMN_FILL_BALANCE = 0x1, CSS_COLUMN_FILL_AUTO = 0x2 }; enum css_column_gap_e { CSS_COLUMN_GAP_INHERIT = 0x0, CSS_COLUMN_GAP_NORMAL = 0x1, CSS_COLUMN_GAP_SET = 0x2 }; enum css_column_rule_color_e { CSS_COLUMN_RULE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, CSS_COLUMN_RULE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, CSS_COLUMN_RULE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR }; enum css_column_rule_style_e { CSS_COLUMN_RULE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT, CSS_COLUMN_RULE_STYLE_NONE = CSS_BORDER_STYLE_NONE, CSS_COLUMN_RULE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED, CSS_COLUMN_RULE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED, CSS_COLUMN_RULE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID, CSS_COLUMN_RULE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE, CSS_COLUMN_RULE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE, CSS_COLUMN_RULE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE, CSS_COLUMN_RULE_STYLE_INSET = CSS_BORDER_STYLE_INSET, CSS_COLUMN_RULE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET }; enum css_column_rule_width_e { CSS_COLUMN_RULE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT, CSS_COLUMN_RULE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN, CSS_COLUMN_RULE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM, CSS_COLUMN_RULE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK, CSS_COLUMN_RULE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH }; enum css_column_span_e { CSS_COLUMN_SPAN_INHERIT = 0x0, CSS_COLUMN_SPAN_NONE = 0x1, CSS_COLUMN_SPAN_ALL = 0x2 }; enum css_column_width_e { CSS_COLUMN_WIDTH_INHERIT = 0x0, CSS_COLUMN_WIDTH_AUTO = 0x1, CSS_COLUMN_WIDTH_SET = 0x2 }; enum css_content_e { CSS_CONTENT_INHERIT = 0x0, CSS_CONTENT_NONE = 0x1, CSS_CONTENT_NORMAL = 0x2, CSS_CONTENT_SET = 0x3 }; enum css_counter_increment_e { CSS_COUNTER_INCREMENT_INHERIT = 0x0, /* Consult pointer in struct to determine which */ CSS_COUNTER_INCREMENT_NAMED = 0x1, CSS_COUNTER_INCREMENT_NONE = 0x1 }; enum css_counter_reset_e { CSS_COUNTER_RESET_INHERIT = 0x0, /* Consult pointer in struct to determine which */ CSS_COUNTER_RESET_NAMED = 0x1, CSS_COUNTER_RESET_NONE = 0x1 }; enum css_cursor_e { CSS_CURSOR_INHERIT = 0x00, /* URLs exist if pointer is non-NULL */ CSS_CURSOR_AUTO = 0x01, CSS_CURSOR_CROSSHAIR = 0x02, CSS_CURSOR_DEFAULT = 0x03, CSS_CURSOR_POINTER = 0x04, CSS_CURSOR_MOVE = 0x05, CSS_CURSOR_E_RESIZE = 0x06, CSS_CURSOR_NE_RESIZE = 0x07, CSS_CURSOR_NW_RESIZE = 0x08, CSS_CURSOR_N_RESIZE = 0x09, CSS_CURSOR_SE_RESIZE = 0x0a, CSS_CURSOR_SW_RESIZE = 0x0b, CSS_CURSOR_S_RESIZE = 0x0c, CSS_CURSOR_W_RESIZE = 0x0d, CSS_CURSOR_TEXT = 0x0e, CSS_CURSOR_WAIT = 0x0f, CSS_CURSOR_HELP = 0x10, CSS_CURSOR_PROGRESS = 0x11 }; enum css_direction_e { CSS_DIRECTION_INHERIT = 0x0, CSS_DIRECTION_LTR = 0x1, CSS_DIRECTION_RTL = 0x2 }; enum css_display_e { CSS_DISPLAY_INHERIT = 0x00, CSS_DISPLAY_INLINE = 0x01, CSS_DISPLAY_BLOCK = 0x02, CSS_DISPLAY_LIST_ITEM = 0x03, CSS_DISPLAY_RUN_IN = 0x04, CSS_DISPLAY_INLINE_BLOCK = 0x05, CSS_DISPLAY_TABLE = 0x06, CSS_DISPLAY_INLINE_TABLE = 0x07, CSS_DISPLAY_TABLE_ROW_GROUP = 0x08, CSS_DISPLAY_TABLE_HEADER_GROUP = 0x09, CSS_DISPLAY_TABLE_FOOTER_GROUP = 0x0a, CSS_DISPLAY_TABLE_ROW = 0x0b, CSS_DISPLAY_TABLE_COLUMN_GROUP = 0x0c, CSS_DISPLAY_TABLE_COLUMN = 0x0d, CSS_DISPLAY_TABLE_CELL = 0x0e, CSS_DISPLAY_TABLE_CAPTION = 0x0f, CSS_DISPLAY_NONE = 0x10 }; enum css_empty_cells_e { CSS_EMPTY_CELLS_INHERIT = 0x0, CSS_EMPTY_CELLS_SHOW = 0x1, CSS_EMPTY_CELLS_HIDE = 0x2 }; enum css_float_e { CSS_FLOAT_INHERIT = 0x0, CSS_FLOAT_LEFT = 0x1, CSS_FLOAT_RIGHT = 0x2, CSS_FLOAT_NONE = 0x3 }; enum css_font_family_e { CSS_FONT_FAMILY_INHERIT = 0x0, /* Named fonts exist if pointer is non-NULL */ CSS_FONT_FAMILY_SERIF = 0x1, CSS_FONT_FAMILY_SANS_SERIF = 0x2, CSS_FONT_FAMILY_CURSIVE = 0x3, CSS_FONT_FAMILY_FANTASY = 0x4, CSS_FONT_FAMILY_MONOSPACE = 0x5 }; enum css_font_size_e { CSS_FONT_SIZE_INHERIT = 0x0, CSS_FONT_SIZE_XX_SMALL = 0x1, CSS_FONT_SIZE_X_SMALL = 0x2, CSS_FONT_SIZE_SMALL = 0x3, CSS_FONT_SIZE_MEDIUM = 0x4, CSS_FONT_SIZE_LARGE = 0x5, CSS_FONT_SIZE_X_LARGE = 0x6, CSS_FONT_SIZE_XX_LARGE = 0x7, CSS_FONT_SIZE_LARGER = 0x8, CSS_FONT_SIZE_SMALLER = 0x9, CSS_FONT_SIZE_DIMENSION = 0xa }; enum css_font_style_e { CSS_FONT_STYLE_INHERIT = 0x0, CSS_FONT_STYLE_NORMAL = 0x1, CSS_FONT_STYLE_ITALIC = 0x2, CSS_FONT_STYLE_OBLIQUE = 0x3 }; enum css_font_variant_e { CSS_FONT_VARIANT_INHERIT = 0x0, CSS_FONT_VARIANT_NORMAL = 0x1, CSS_FONT_VARIANT_SMALL_CAPS = 0x2 }; enum css_font_weight_e { CSS_FONT_WEIGHT_INHERIT = 0x0, CSS_FONT_WEIGHT_NORMAL = 0x1, CSS_FONT_WEIGHT_BOLD = 0x2, CSS_FONT_WEIGHT_BOLDER = 0x3, CSS_FONT_WEIGHT_LIGHTER = 0x4, CSS_FONT_WEIGHT_100 = 0x5, CSS_FONT_WEIGHT_200 = 0x6, CSS_FONT_WEIGHT_300 = 0x7, CSS_FONT_WEIGHT_400 = 0x8, CSS_FONT_WEIGHT_500 = 0x9, CSS_FONT_WEIGHT_600 = 0xa, CSS_FONT_WEIGHT_700 = 0xb, CSS_FONT_WEIGHT_800 = 0xc, CSS_FONT_WEIGHT_900 = 0xd }; enum css_height_e { CSS_HEIGHT_INHERIT = 0x0, CSS_HEIGHT_SET = 0x1, CSS_HEIGHT_AUTO = 0x2 }; enum css_left_e { CSS_LEFT_INHERIT = 0x0, CSS_LEFT_SET = 0x1, CSS_LEFT_AUTO = 0x2 }; enum css_letter_spacing_e { CSS_LETTER_SPACING_INHERIT = 0x0, CSS_LETTER_SPACING_SET = 0x1, CSS_LETTER_SPACING_NORMAL = 0x2 }; enum css_line_height_e { CSS_LINE_HEIGHT_INHERIT = 0x0, CSS_LINE_HEIGHT_NUMBER = 0x1, CSS_LINE_HEIGHT_DIMENSION = 0x2, CSS_LINE_HEIGHT_NORMAL = 0x3 }; enum css_list_style_image_e { CSS_LIST_STYLE_IMAGE_INHERIT = 0x0, /* Consult pointer in struct to determine which */ CSS_LIST_STYLE_IMAGE_URI = 0x1, CSS_LIST_STYLE_IMAGE_NONE = 0x1 }; enum css_list_style_position_e { CSS_LIST_STYLE_POSITION_INHERIT = 0x0, CSS_LIST_STYLE_POSITION_INSIDE = 0x1, CSS_LIST_STYLE_POSITION_OUTSIDE = 0x2 }; enum css_list_style_type_e { CSS_LIST_STYLE_TYPE_INHERIT = 0x0, CSS_LIST_STYLE_TYPE_DISC = 0x1, CSS_LIST_STYLE_TYPE_CIRCLE = 0x2, CSS_LIST_STYLE_TYPE_SQUARE = 0x3, CSS_LIST_STYLE_TYPE_DECIMAL = 0x4, CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO= 0x5, CSS_LIST_STYLE_TYPE_LOWER_ROMAN = 0x6, CSS_LIST_STYLE_TYPE_UPPER_ROMAN = 0x7, CSS_LIST_STYLE_TYPE_LOWER_GREEK = 0x8, CSS_LIST_STYLE_TYPE_LOWER_LATIN = 0x9, CSS_LIST_STYLE_TYPE_UPPER_LATIN = 0xa, CSS_LIST_STYLE_TYPE_ARMENIAN = 0xb, CSS_LIST_STYLE_TYPE_GEORGIAN = 0xc, CSS_LIST_STYLE_TYPE_LOWER_ALPHA = 0xd, CSS_LIST_STYLE_TYPE_UPPER_ALPHA = 0xe, CSS_LIST_STYLE_TYPE_NONE = 0xf }; enum css_margin_e { CSS_MARGIN_INHERIT = 0x0, CSS_MARGIN_SET = 0x1, CSS_MARGIN_AUTO = 0x2 }; enum css_max_height_e { CSS_MAX_HEIGHT_INHERIT = 0x0, CSS_MAX_HEIGHT_SET = 0x1, CSS_MAX_HEIGHT_NONE = 0x2 }; enum css_max_width_e { CSS_MAX_WIDTH_INHERIT = 0x0, CSS_MAX_WIDTH_SET = 0x1, CSS_MAX_WIDTH_NONE = 0x2 }; enum css_min_height_e { CSS_MIN_HEIGHT_INHERIT = 0x0, CSS_MIN_HEIGHT_SET = 0x1 }; enum css_min_width_e { CSS_MIN_WIDTH_INHERIT = 0x0, CSS_MIN_WIDTH_SET = 0x1 }; enum css_opacity_e { CSS_OPACITY_INHERIT = 0x0, CSS_OPACITY_SET = 0x1 }; enum css_outline_color_e { CSS_OUTLINE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT, CSS_OUTLINE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR, CSS_OUTLINE_COLOR_CURRENT_COLOR = CSS_BACKGROUND_COLOR_CURRENT_COLOR, CSS_OUTLINE_COLOR_INVERT = 0x3 }; enum css_outline_style_e { CSS_OUTLINE_STYLE_INHERIT = CSS_BORDER_STYLE_INHERIT, CSS_OUTLINE_STYLE_NONE = CSS_BORDER_STYLE_NONE, CSS_OUTLINE_STYLE_DOTTED = CSS_BORDER_STYLE_DOTTED, CSS_OUTLINE_STYLE_DASHED = CSS_BORDER_STYLE_DASHED, CSS_OUTLINE_STYLE_SOLID = CSS_BORDER_STYLE_SOLID, CSS_OUTLINE_STYLE_DOUBLE = CSS_BORDER_STYLE_DOUBLE, CSS_OUTLINE_STYLE_GROOVE = CSS_BORDER_STYLE_GROOVE, CSS_OUTLINE_STYLE_RIDGE = CSS_BORDER_STYLE_RIDGE, CSS_OUTLINE_STYLE_INSET = CSS_BORDER_STYLE_INSET, CSS_OUTLINE_STYLE_OUTSET = CSS_BORDER_STYLE_OUTSET }; enum css_outline_width_e { CSS_OUTLINE_WIDTH_INHERIT = CSS_BORDER_WIDTH_INHERIT, CSS_OUTLINE_WIDTH_THIN = CSS_BORDER_WIDTH_THIN, CSS_OUTLINE_WIDTH_MEDIUM = CSS_BORDER_WIDTH_MEDIUM, CSS_OUTLINE_WIDTH_THICK = CSS_BORDER_WIDTH_THICK, CSS_OUTLINE_WIDTH_WIDTH = CSS_BORDER_WIDTH_WIDTH }; enum css_overflow_e { CSS_OVERFLOW_INHERIT = 0x0, CSS_OVERFLOW_VISIBLE = 0x1, CSS_OVERFLOW_HIDDEN = 0x2, CSS_OVERFLOW_SCROLL = 0x3, CSS_OVERFLOW_AUTO = 0x4 }; enum css_orphans_e { CSS_ORPHANS_INHERIT = 0x0, CSS_ORPHANS_SET = 0x1 }; enum css_padding_e { CSS_PADDING_INHERIT = 0x0, CSS_PADDING_SET = 0x1 }; enum css_page_break_after_e { CSS_PAGE_BREAK_AFTER_INHERIT = CSS_BREAK_AFTER_INHERIT, CSS_PAGE_BREAK_AFTER_AUTO = CSS_BREAK_AFTER_AUTO, CSS_PAGE_BREAK_AFTER_AVOID = CSS_BREAK_AFTER_AVOID, CSS_PAGE_BREAK_AFTER_ALWAYS = CSS_BREAK_AFTER_ALWAYS, CSS_PAGE_BREAK_AFTER_LEFT = CSS_BREAK_AFTER_LEFT, CSS_PAGE_BREAK_AFTER_RIGHT = CSS_BREAK_AFTER_RIGHT }; enum css_page_break_before_e { CSS_PAGE_BREAK_BEFORE_INHERIT = CSS_BREAK_AFTER_INHERIT, CSS_PAGE_BREAK_BEFORE_AUTO = CSS_BREAK_AFTER_AUTO, CSS_PAGE_BREAK_BEFORE_AVOID = CSS_BREAK_AFTER_AVOID, CSS_PAGE_BREAK_BEFORE_ALWAYS = CSS_BREAK_AFTER_ALWAYS, CSS_PAGE_BREAK_BEFORE_LEFT = CSS_BREAK_AFTER_LEFT, CSS_PAGE_BREAK_BEFORE_RIGHT = CSS_BREAK_AFTER_RIGHT }; enum css_page_break_inside_e { CSS_PAGE_BREAK_INSIDE_INHERIT = CSS_BREAK_AFTER_INHERIT, CSS_PAGE_BREAK_INSIDE_AUTO = CSS_BREAK_AFTER_AUTO, CSS_PAGE_BREAK_INSIDE_AVOID = CSS_BREAK_AFTER_AVOID }; enum css_position_e { CSS_POSITION_INHERIT = 0x0, CSS_POSITION_STATIC = 0x1, CSS_POSITION_RELATIVE = 0x2, CSS_POSITION_ABSOLUTE = 0x3, CSS_POSITION_FIXED = 0x4 }; enum css_quotes_e { CSS_QUOTES_INHERIT = 0x0, /* Consult pointer in struct to determine which */ CSS_QUOTES_STRING = 0x1, CSS_QUOTES_NONE = 0x1 }; enum css_right_e { CSS_RIGHT_INHERIT = 0x0, CSS_RIGHT_SET = 0x1, CSS_RIGHT_AUTO = 0x2 }; enum css_table_layout_e { CSS_TABLE_LAYOUT_INHERIT = 0x0, CSS_TABLE_LAYOUT_AUTO = 0x1, CSS_TABLE_LAYOUT_FIXED = 0x2 }; enum css_text_align_e { CSS_TEXT_ALIGN_INHERIT = 0x0, CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC = 0x1, CSS_TEXT_ALIGN_LEFT = 0x2, CSS_TEXT_ALIGN_RIGHT = 0x3, CSS_TEXT_ALIGN_CENTER = 0x4, CSS_TEXT_ALIGN_JUSTIFY = 0x5, CSS_TEXT_ALIGN_DEFAULT = 0x6, CSS_TEXT_ALIGN_LIBCSS_LEFT = 0x7, CSS_TEXT_ALIGN_LIBCSS_CENTER = 0x8, CSS_TEXT_ALIGN_LIBCSS_RIGHT = 0x9 }; enum css_text_decoration_e { CSS_TEXT_DECORATION_INHERIT = 0x00, CSS_TEXT_DECORATION_NONE = 0x10, CSS_TEXT_DECORATION_BLINK = (1<<3), CSS_TEXT_DECORATION_LINE_THROUGH = (1<<2), CSS_TEXT_DECORATION_OVERLINE = (1<<1), CSS_TEXT_DECORATION_UNDERLINE = (1<<0) }; enum css_text_indent_e { CSS_TEXT_INDENT_INHERIT = 0x0, CSS_TEXT_INDENT_SET = 0x1 }; enum css_text_transform_e { CSS_TEXT_TRANSFORM_INHERIT = 0x0, CSS_TEXT_TRANSFORM_CAPITALIZE = 0x1, CSS_TEXT_TRANSFORM_UPPERCASE = 0x2, CSS_TEXT_TRANSFORM_LOWERCASE = 0x3, CSS_TEXT_TRANSFORM_NONE = 0x4 }; enum css_top_e { CSS_TOP_INHERIT = 0x0, CSS_TOP_SET = 0x1, CSS_TOP_AUTO = 0x2 }; enum css_unicode_bidi_e { CSS_UNICODE_BIDI_INHERIT = 0x0, CSS_UNICODE_BIDI_NORMAL = 0x1, CSS_UNICODE_BIDI_EMBED = 0x2, CSS_UNICODE_BIDI_BIDI_OVERRIDE = 0x3 }; enum css_vertical_align_e { CSS_VERTICAL_ALIGN_INHERIT = 0x0, CSS_VERTICAL_ALIGN_BASELINE = 0x1, CSS_VERTICAL_ALIGN_SUB = 0x2, CSS_VERTICAL_ALIGN_SUPER = 0x3, CSS_VERTICAL_ALIGN_TOP = 0x4, CSS_VERTICAL_ALIGN_TEXT_TOP = 0x5, CSS_VERTICAL_ALIGN_MIDDLE = 0x6, CSS_VERTICAL_ALIGN_BOTTOM = 0x7, CSS_VERTICAL_ALIGN_TEXT_BOTTOM = 0x8, CSS_VERTICAL_ALIGN_SET = 0x9 }; enum css_visibility_e { CSS_VISIBILITY_INHERIT = 0x0, CSS_VISIBILITY_VISIBLE = 0x1, CSS_VISIBILITY_HIDDEN = 0x2, CSS_VISIBILITY_COLLAPSE = 0x3 }; enum css_white_space_e { CSS_WHITE_SPACE_INHERIT = 0x0, CSS_WHITE_SPACE_NORMAL = 0x1, CSS_WHITE_SPACE_PRE = 0x2, CSS_WHITE_SPACE_NOWRAP = 0x3, CSS_WHITE_SPACE_PRE_WRAP = 0x4, CSS_WHITE_SPACE_PRE_LINE = 0x5 }; enum css_widows_e { CSS_WIDOWS_INHERIT = 0x0, CSS_WIDOWS_SET = 0x1 }; enum css_width_e { CSS_WIDTH_INHERIT = 0x0, CSS_WIDTH_SET = 0x1, CSS_WIDTH_AUTO = 0x2 }; enum css_word_spacing_e { CSS_WORD_SPACING_INHERIT = 0x0, CSS_WORD_SPACING_SET = 0x1, CSS_WORD_SPACING_NORMAL = 0x2 }; enum css_writing_mode_e { CSS_WRITING_MODE_INHERIT = 0x0, CSS_WRITING_MODE_HORIZONTAL_TB = 0x1, CSS_WRITING_MODE_VERTICAL_RL = 0x2, CSS_WRITING_MODE_VERTICAL_LR = 0x3 }; enum css_z_index_e { CSS_Z_INDEX_INHERIT = 0x0, CSS_Z_INDEX_SET = 0x1, CSS_Z_INDEX_AUTO = 0x2 }; #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/include/libcss/hint.h0000644000175000017500000000206712377676736020135 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef libcss_hint_h_ #define libcss_hint_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #include /** * Length object for use in presentational hints */ typedef struct css_hint_length { css_fixed value; css_unit unit; } css_hint_length; /** * Presentational hints */ typedef struct css_hint { /* Ownership of all data is passed to libcss */ union { css_computed_clip_rect *clip; css_color color; css_computed_content_item *content; css_computed_counter *counter; css_fixed fixed; int32_t integer; css_hint_length length; struct { css_hint_length h; css_hint_length v; } position; lwc_string *string; lwc_string **strings; } data; uint8_t status; } css_hint; #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/test/0000755000175000017500000000000012377713347015060 5ustar vincevincenetsurf-all-3.2/libcss/test/dump_computed.h0000644000175000017500000017103212377676736020114 0ustar vincevince#include #include #include static size_t dump_css_fixed(css_fixed f, char *ptr, size_t len) { #define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x)) uint32_t uintpart = FIXTOINT(ABS(f)); /* + 500 to ensure round to nearest (division will truncate) */ uint32_t fracpart = ((ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10); #undef ABS size_t flen = 0; char tmp[20]; size_t tlen = 0; char *buf = ptr; if (len == 0) return 0; if (f < 0) { buf[0] = '-'; buf++; len--; } do { tmp[tlen] = "0123456789"[uintpart % 10]; tlen++; uintpart /= 10; } while (tlen < 20 && uintpart != 0); while (tlen > 0 && len > 0) { buf[0] = tmp[--tlen]; buf++; len--; } if (len > 0) { buf[0] = '.'; buf++; len--; } do { tmp[tlen] = "0123456789"[fracpart % 10]; tlen++; fracpart /= 10; } while (tlen < 20 && fracpart != 0); while (tlen > 0 && len > 0) { buf[0] = tmp[--tlen]; buf++; flen++; len--; } while (flen < 3 && len > 0) { buf[0] = '0'; buf++; flen++; len--; } if (len > 0) buf[0] = '\0'; return buf - ptr; } static size_t dump_css_number(css_fixed val, char *ptr, size_t len) { if (INTTOFIX(FIXTOINT(val)) == val) return snprintf(ptr, len, "%d", FIXTOINT(val)); else return dump_css_fixed(val, ptr, len); } static size_t dump_css_unit(css_fixed val, css_unit unit, char *ptr, size_t len) { size_t ret = dump_css_number(val, ptr, len); switch (unit) { case CSS_UNIT_PX: ret += snprintf(ptr + ret, len - ret, "px"); break; case CSS_UNIT_EX: ret += snprintf(ptr + ret, len - ret, "ex"); break; case CSS_UNIT_EM: ret += snprintf(ptr + ret, len - ret, "em"); break; case CSS_UNIT_IN: ret += snprintf(ptr + ret, len - ret, "in"); break; case CSS_UNIT_CM: ret += snprintf(ptr + ret, len - ret, "cm"); break; case CSS_UNIT_MM: ret += snprintf(ptr + ret, len - ret, "mm"); break; case CSS_UNIT_PT: ret += snprintf(ptr + ret, len - ret, "pt"); break; case CSS_UNIT_PC: ret += snprintf(ptr + ret, len - ret, "pc"); break; case CSS_UNIT_PCT: ret += snprintf(ptr + ret, len - ret, "%%"); break; case CSS_UNIT_DEG: ret += snprintf(ptr + ret, len - ret, "deg"); break; case CSS_UNIT_GRAD: ret += snprintf(ptr + ret, len - ret, "grad"); break; case CSS_UNIT_RAD: ret += snprintf(ptr + ret, len - ret, "rad"); break; case CSS_UNIT_MS: ret += snprintf(ptr + ret, len - ret, "ms"); break; case CSS_UNIT_S: ret += snprintf(ptr + ret, len - ret, "s"); break; case CSS_UNIT_HZ: ret += snprintf(ptr + ret, len - ret, "Hz"); break; case CSS_UNIT_KHZ: ret += snprintf(ptr + ret, len - ret, "kHz"); break; } return ret; } static void dump_computed_style(const css_computed_style *style, char *buf, size_t *len) { char *ptr = buf; size_t wrote = 0; uint8_t val; css_color color = 0; lwc_string *url = NULL; css_fixed len1 = 0, len2 = 0; css_unit unit1 = CSS_UNIT_PX, unit2 = CSS_UNIT_PX; css_computed_clip_rect rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, true, true, true, true }; const css_computed_content_item *content = NULL; const css_computed_counter *counter = NULL; lwc_string **string_list = NULL; int32_t zindex = 0; /* background-attachment */ val = css_computed_background_attachment(style); switch (val) { case CSS_BACKGROUND_ATTACHMENT_INHERIT: wrote = snprintf(ptr, *len, "background-attachment: inherit\n"); break; case CSS_BACKGROUND_ATTACHMENT_FIXED: wrote = snprintf(ptr, *len, "background-attachment: fixed\n"); break; case CSS_BACKGROUND_ATTACHMENT_SCROLL: wrote = snprintf(ptr, *len, "background-attachment: scroll\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* background-color */ val = css_computed_background_color(style, &color); switch (val) { case CSS_BACKGROUND_COLOR_INHERIT: wrote = snprintf(ptr, *len, "background-color: inherit\n"); break; case CSS_BACKGROUND_COLOR_COLOR: wrote = snprintf(ptr, *len, "background-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* background-image */ val = css_computed_background_image(style, &url); if (val == CSS_BACKGROUND_IMAGE_INHERIT) { wrote = snprintf(ptr, *len, "background-image: inherit\n"); } else if (val == CSS_BACKGROUND_IMAGE_IMAGE && url != NULL) { wrote = snprintf(ptr, *len, "background-image: url('%.*s')\n", (int) lwc_string_length(url), lwc_string_data(url)); } else if (val == CSS_BACKGROUND_IMAGE_NONE) { wrote = snprintf(ptr, *len, "background-image: none\n"); } else { wrote = 0; } ptr += wrote; *len -= wrote; /* background-position */ val = css_computed_background_position(style, &len1, &unit1, &len2, &unit2); if (val == CSS_BACKGROUND_POSITION_INHERIT) { wrote = snprintf(ptr, *len, "background-position: inherit\n"); ptr += wrote; *len -= wrote; } else if (val == CSS_BACKGROUND_POSITION_SET) { wrote = snprintf(ptr, *len, "background-position: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, " "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len2, unit2, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); ptr += wrote; *len -= wrote; } /* background-repeat */ val = css_computed_background_repeat(style); switch (val) { case CSS_BACKGROUND_REPEAT_INHERIT: wrote = snprintf(ptr, *len, "background-repeat: inherit\n"); break; case CSS_BACKGROUND_REPEAT_REPEAT_X: wrote = snprintf(ptr, *len, "background-repeat: repeat-x\n"); break; case CSS_BACKGROUND_REPEAT_REPEAT_Y: wrote = snprintf(ptr, *len, "background-repeat: repeat-y\n"); break; case CSS_BACKGROUND_REPEAT_REPEAT: wrote = snprintf(ptr, *len, "background-repeat: repeat\n"); break; case CSS_BACKGROUND_REPEAT_NO_REPEAT: wrote = snprintf(ptr, *len, "background-repeat: no-repeat\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-collapse */ val = css_computed_border_collapse(style); switch (val) { case CSS_BORDER_COLLAPSE_INHERIT: wrote = snprintf(ptr, *len, "border-collapse: inherit\n"); break; case CSS_BORDER_COLLAPSE_SEPARATE: wrote = snprintf(ptr, *len, "border-collapse: separate\n"); break; case CSS_BORDER_COLLAPSE_COLLAPSE: wrote = snprintf(ptr, *len, "border-collapse: collapse\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-spacing */ val = css_computed_border_spacing(style, &len1, &unit1, &len2, &unit2); if (val == CSS_BORDER_SPACING_INHERIT) { wrote = snprintf(ptr, *len, "border-spacing: inherit\n"); ptr += wrote; *len -= wrote; } else if (val == CSS_BORDER_SPACING_SET) { wrote = snprintf(ptr, *len, "border-spacing: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, " "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len2, unit2, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); ptr += wrote; *len -= wrote; } /* border-top-color */ val = css_computed_border_top_color(style, &color); switch (val) { case CSS_BORDER_COLOR_INHERIT: wrote = snprintf(ptr, *len, "border-top-color: inherit\n"); break; case CSS_BORDER_COLOR_CURRENT_COLOR: wrote = snprintf(ptr, *len, "border-top-color: currentColor\n"); break; case CSS_BORDER_COLOR_COLOR: wrote = snprintf(ptr, *len, "border-top-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-right-color */ val = css_computed_border_right_color(style, &color); switch (val) { case CSS_BORDER_COLOR_INHERIT: wrote = snprintf(ptr, *len, "border-right-color: inherit\n"); break; case CSS_BORDER_COLOR_CURRENT_COLOR: wrote = snprintf(ptr, *len, "border-right-color: currentColor\n"); break; case CSS_BORDER_COLOR_COLOR: wrote = snprintf(ptr, *len, "border-right-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-bottom-color */ val = css_computed_border_bottom_color(style, &color); switch (val) { case CSS_BORDER_COLOR_INHERIT: wrote = snprintf(ptr, *len, "border-bottom-color: inherit\n"); break; case CSS_BORDER_COLOR_CURRENT_COLOR: wrote = snprintf(ptr, *len, "border-bottom-color: currentColor\n"); break; case CSS_BORDER_COLOR_COLOR: wrote = snprintf(ptr, *len, "border-bottom-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-left-color */ val = css_computed_border_left_color(style, &color); switch (val) { case CSS_BORDER_COLOR_INHERIT: wrote = snprintf(ptr, *len, "border-left-color: inherit\n"); break; case CSS_BORDER_COLOR_CURRENT_COLOR: wrote = snprintf(ptr, *len, "border-left-color: currentColor\n"); break; case CSS_BORDER_COLOR_COLOR: wrote = snprintf(ptr, *len, "border-left-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-top-style */ val = css_computed_border_top_style(style); switch (val) { case CSS_BORDER_STYLE_INHERIT: wrote = snprintf(ptr, *len, "border-top-style: inherit\n"); break; case CSS_BORDER_STYLE_NONE: wrote = snprintf(ptr, *len, "border-top-style: none\n"); break; case CSS_BORDER_STYLE_HIDDEN: wrote = snprintf(ptr, *len, "border-top-style: hidden\n"); break; case CSS_BORDER_STYLE_DOTTED: wrote = snprintf(ptr, *len, "border-top-style: dotted\n"); break; case CSS_BORDER_STYLE_DASHED: wrote = snprintf(ptr, *len, "border-top-style: dashed\n"); break; case CSS_BORDER_STYLE_SOLID: wrote = snprintf(ptr, *len, "border-top-style: solid\n"); break; case CSS_BORDER_STYLE_DOUBLE: wrote = snprintf(ptr, *len, "border-top-style: double\n"); break; case CSS_BORDER_STYLE_GROOVE: wrote = snprintf(ptr, *len, "border-top-style: groove\n"); break; case CSS_BORDER_STYLE_RIDGE: wrote = snprintf(ptr, *len, "border-top-style: ridge\n"); break; case CSS_BORDER_STYLE_INSET: wrote = snprintf(ptr, *len, "border-top-style: inset\n"); break; case CSS_BORDER_STYLE_OUTSET: wrote = snprintf(ptr, *len, "border-top-style: outset\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-right-style */ val = css_computed_border_right_style(style); switch (val) { case CSS_BORDER_STYLE_INHERIT: wrote = snprintf(ptr, *len, "border-right-style: inherit\n"); break; case CSS_BORDER_STYLE_NONE: wrote = snprintf(ptr, *len, "border-right-style: none\n"); break; case CSS_BORDER_STYLE_HIDDEN: wrote = snprintf(ptr, *len, "border-right-style: hidden\n"); break; case CSS_BORDER_STYLE_DOTTED: wrote = snprintf(ptr, *len, "border-right-style: dotted\n"); break; case CSS_BORDER_STYLE_DASHED: wrote = snprintf(ptr, *len, "border-right-style: dashed\n"); break; case CSS_BORDER_STYLE_SOLID: wrote = snprintf(ptr, *len, "border-right-style: solid\n"); break; case CSS_BORDER_STYLE_DOUBLE: wrote = snprintf(ptr, *len, "border-right-style: double\n"); break; case CSS_BORDER_STYLE_GROOVE: wrote = snprintf(ptr, *len, "border-right-style: groove\n"); break; case CSS_BORDER_STYLE_RIDGE: wrote = snprintf(ptr, *len, "border-right-style: ridge\n"); break; case CSS_BORDER_STYLE_INSET: wrote = snprintf(ptr, *len, "border-right-style: inset\n"); break; case CSS_BORDER_STYLE_OUTSET: wrote = snprintf(ptr, *len, "border-right-style: outset\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-bottom-style */ val = css_computed_border_bottom_style(style); switch (val) { case CSS_BORDER_STYLE_INHERIT: wrote = snprintf(ptr, *len, "border-bottom-style: inherit\n"); break; case CSS_BORDER_STYLE_NONE: wrote = snprintf(ptr, *len, "border-bottom-style: none\n"); break; case CSS_BORDER_STYLE_HIDDEN: wrote = snprintf(ptr, *len, "border-bottom-style: hidden\n"); break; case CSS_BORDER_STYLE_DOTTED: wrote = snprintf(ptr, *len, "border-bottom-style: dotted\n"); break; case CSS_BORDER_STYLE_DASHED: wrote = snprintf(ptr, *len, "border-bottom-style: dashed\n"); break; case CSS_BORDER_STYLE_SOLID: wrote = snprintf(ptr, *len, "border-bottom-style: solid\n"); break; case CSS_BORDER_STYLE_DOUBLE: wrote = snprintf(ptr, *len, "border-bottom-style: double\n"); break; case CSS_BORDER_STYLE_GROOVE: wrote = snprintf(ptr, *len, "border-bottom-style: groove\n"); break; case CSS_BORDER_STYLE_RIDGE: wrote = snprintf(ptr, *len, "border-bottom-style: ridge\n"); break; case CSS_BORDER_STYLE_INSET: wrote = snprintf(ptr, *len, "border-bottom-style: inset\n"); break; case CSS_BORDER_STYLE_OUTSET: wrote = snprintf(ptr, *len, "border-bottom-style: outset\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-left-style */ val = css_computed_border_left_style(style); switch (val) { case CSS_BORDER_STYLE_INHERIT: wrote = snprintf(ptr, *len, "border-left-style: inherit\n"); break; case CSS_BORDER_STYLE_NONE: wrote = snprintf(ptr, *len, "border-left-style: none\n"); break; case CSS_BORDER_STYLE_HIDDEN: wrote = snprintf(ptr, *len, "border-left-style: hidden\n"); break; case CSS_BORDER_STYLE_DOTTED: wrote = snprintf(ptr, *len, "border-left-style: dotted\n"); break; case CSS_BORDER_STYLE_DASHED: wrote = snprintf(ptr, *len, "border-left-style: dashed\n"); break; case CSS_BORDER_STYLE_SOLID: wrote = snprintf(ptr, *len, "border-left-style: solid\n"); break; case CSS_BORDER_STYLE_DOUBLE: wrote = snprintf(ptr, *len, "border-left-style: double\n"); break; case CSS_BORDER_STYLE_GROOVE: wrote = snprintf(ptr, *len, "border-left-style: groove\n"); break; case CSS_BORDER_STYLE_RIDGE: wrote = snprintf(ptr, *len, "border-left-style: ridge\n"); break; case CSS_BORDER_STYLE_INSET: wrote = snprintf(ptr, *len, "border-left-style: inset\n"); break; case CSS_BORDER_STYLE_OUTSET: wrote = snprintf(ptr, *len, "border-left-style: outset\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-top-width */ val = css_computed_border_top_width(style, &len1, &unit1); switch (val) { case CSS_BORDER_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "border-top-width: inherit\n"); break; case CSS_BORDER_WIDTH_THIN: wrote = snprintf(ptr, *len, "border-top-width: thin\n"); break; case CSS_BORDER_WIDTH_MEDIUM: wrote = snprintf(ptr, *len, "border-top-width: medium\n"); break; case CSS_BORDER_WIDTH_THICK: wrote = snprintf(ptr, *len, "border-top-width: thick\n"); break; case CSS_BORDER_WIDTH_WIDTH: wrote = snprintf(ptr, *len, "border-top-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-right-width */ val = css_computed_border_right_width(style, &len1, &unit1); switch (val) { case CSS_BORDER_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "border-right-width: inherit\n"); break; case CSS_BORDER_WIDTH_THIN: wrote = snprintf(ptr, *len, "border-right-width: thin\n"); break; case CSS_BORDER_WIDTH_MEDIUM: wrote = snprintf(ptr, *len, "border-right-width: medium\n"); break; case CSS_BORDER_WIDTH_THICK: wrote = snprintf(ptr, *len, "border-right-width: thick\n"); break; case CSS_BORDER_WIDTH_WIDTH: wrote = snprintf(ptr, *len, "border-right-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-bottom-width */ val = css_computed_border_bottom_width(style, &len1, &unit1); switch (val) { case CSS_BORDER_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "border-bottom-width: inherit\n"); break; case CSS_BORDER_WIDTH_THIN: wrote = snprintf(ptr, *len, "border-bottom-width: thin\n"); break; case CSS_BORDER_WIDTH_MEDIUM: wrote = snprintf(ptr, *len, "border-bottom-width: medium\n"); break; case CSS_BORDER_WIDTH_THICK: wrote = snprintf(ptr, *len, "border-bottom-width: thick\n"); break; case CSS_BORDER_WIDTH_WIDTH: wrote = snprintf(ptr, *len, "border-bottom-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* border-left-width */ val = css_computed_border_left_width(style, &len1, &unit1); switch (val) { case CSS_BORDER_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "border-left-width: inherit\n"); break; case CSS_BORDER_WIDTH_THIN: wrote = snprintf(ptr, *len, "border-left-width: thin\n"); break; case CSS_BORDER_WIDTH_MEDIUM: wrote = snprintf(ptr, *len, "border-left-width: medium\n"); break; case CSS_BORDER_WIDTH_THICK: wrote = snprintf(ptr, *len, "border-left-width: thick\n"); break; case CSS_BORDER_WIDTH_WIDTH: wrote = snprintf(ptr, *len, "border-left-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* bottom */ val = css_computed_bottom(style, &len1, &unit1); switch (val) { case CSS_BOTTOM_INHERIT: wrote = snprintf(ptr, *len, "bottom: inherit\n"); break; case CSS_BOTTOM_AUTO: wrote = snprintf(ptr, *len, "bottom: auto\n"); break; case CSS_BOTTOM_SET: wrote = snprintf(ptr, *len, "bottom: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* caption-side */ val = css_computed_caption_side(style); switch (val) { case CSS_CAPTION_SIDE_INHERIT: wrote = snprintf(ptr, *len, "caption-side: inherit\n"); break; case CSS_CAPTION_SIDE_TOP: wrote = snprintf(ptr, *len, "caption-side: top\n"); break; case CSS_CAPTION_SIDE_BOTTOM: wrote = snprintf(ptr, *len, "caption-side: bottom\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* clear */ val = css_computed_clear(style); switch (val) { case CSS_CLEAR_INHERIT: wrote = snprintf(ptr, *len, "clear: inherit\n"); break; case CSS_CLEAR_NONE: wrote = snprintf(ptr, *len, "clear: none\n"); break; case CSS_CLEAR_LEFT: wrote = snprintf(ptr, *len, "clear: left\n"); break; case CSS_CLEAR_RIGHT: wrote = snprintf(ptr, *len, "clear: right\n"); break; case CSS_CLEAR_BOTH: wrote = snprintf(ptr, *len, "clear: both\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* clip */ val = css_computed_clip(style, &rect); switch (val) { case CSS_CLIP_INHERIT: wrote = snprintf(ptr, *len, "clip: inherit\n"); break; case CSS_CLIP_AUTO: wrote = snprintf(ptr, *len, "clip: auto\n"); break; case CSS_CLIP_RECT: wrote = snprintf(ptr, *len, "clip: rect( "); ptr += wrote; *len -= wrote; if (rect.top_auto) wrote = snprintf(ptr, *len, "auto"); else wrote = dump_css_unit(rect.top, rect.tunit, ptr, *len); wrote += snprintf(ptr + wrote, *len - wrote, ", "); ptr += wrote; *len -= wrote; if (rect.right_auto) wrote = snprintf(ptr, *len, "auto"); else wrote = dump_css_unit(rect.right, rect.runit, ptr, *len); wrote += snprintf(ptr + wrote, *len - wrote, ", "); ptr += wrote; *len -= wrote; if (rect.bottom_auto) wrote = snprintf(ptr, *len, "auto"); else wrote = dump_css_unit(rect.bottom, rect.bunit, ptr, *len); wrote += snprintf(ptr + wrote, *len - wrote, ", "); ptr += wrote; *len -= wrote; if (rect.left_auto) wrote = snprintf(ptr, *len, "auto"); else wrote = dump_css_unit(rect.left, rect.lunit, ptr, *len); wrote += snprintf(ptr + wrote, *len - wrote, ")\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* color */ val = css_computed_color(style, &color); if (val == CSS_COLOR_INHERIT) { wrote = snprintf(ptr, *len, "color: inherit\n"); } else if (val == CSS_COLOR_COLOR) { wrote = snprintf(ptr, *len, "color: #%08x\n", color); } ptr += wrote; *len -= wrote; /* content */ val = css_computed_content(style, &content); switch (val) { case CSS_CONTENT_INHERIT: wrote = snprintf(ptr, *len, "content: inherit\n"); break; case CSS_CONTENT_NONE: wrote = snprintf(ptr, *len, "content: none\n"); break; case CSS_CONTENT_NORMAL: wrote = snprintf(ptr, *len, "content: normal\n"); break; case CSS_CONTENT_SET: wrote = snprintf(ptr, *len, "content:"); ptr += wrote; *len -= wrote; while (content->type != CSS_COMPUTED_CONTENT_NONE) { wrote = snprintf(ptr, *len, " "); switch (content->type) { case CSS_COMPUTED_CONTENT_STRING: wrote += snprintf(ptr + wrote, *len - wrote, "\"%.*s\"", (int) lwc_string_length( content->data.string), lwc_string_data( content->data.string)); break; case CSS_COMPUTED_CONTENT_URI: wrote += snprintf(ptr + wrote, *len - wrote, "uri(\"%.*s\")", (int) lwc_string_length( content->data.uri), lwc_string_data( content->data.uri)); break; case CSS_COMPUTED_CONTENT_COUNTER: wrote += snprintf(ptr + wrote, *len - wrote, "counter(%.*s)", (int) lwc_string_length( content->data.counter.name), lwc_string_data( content->data.counter.name)); break; case CSS_COMPUTED_CONTENT_COUNTERS: wrote += snprintf(ptr + wrote, *len - wrote, "counters(%.*s, " "\"%.*s\")", (int) lwc_string_length( content->data.counters.name), lwc_string_data( content->data.counters.name), (int) lwc_string_length( content->data.counters.sep), lwc_string_data( content->data.counters.sep)); break; case CSS_COMPUTED_CONTENT_ATTR: wrote += snprintf(ptr + wrote, *len - wrote, "attr(%.*s)", (int) lwc_string_length( content->data.attr), lwc_string_data( content->data.attr)); break; case CSS_COMPUTED_CONTENT_OPEN_QUOTE: wrote += snprintf(ptr + wrote, *len - wrote, "open-quote"); break; case CSS_COMPUTED_CONTENT_CLOSE_QUOTE: wrote += snprintf(ptr + wrote, *len - wrote, "close-quote"); break; case CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE: wrote += snprintf(ptr + wrote, *len - wrote, "no-open-quote"); break; case CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE: wrote += snprintf(ptr + wrote, *len - wrote, "no-close-quote"); break; } ptr += wrote; *len -= wrote; content++; } wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* counter-increment */ val = css_computed_counter_increment(style, &counter); if (val == CSS_COUNTER_INCREMENT_INHERIT) { wrote = snprintf(ptr, *len, "counter-increment: inherit\n"); } else if (counter == NULL) { wrote = snprintf(ptr, *len, "counter-increment: none\n"); } else { wrote = snprintf(ptr, *len, "counter-increment:"); ptr += wrote; *len -= wrote; while (counter->name != NULL) { wrote = snprintf(ptr, *len, " %.*s ", (int) lwc_string_length(counter->name), lwc_string_data(counter->name)); ptr += wrote; *len -= wrote; wrote = dump_css_fixed(counter->value, ptr, *len); ptr += wrote; *len -= wrote; counter++; } wrote = snprintf(ptr, *len, "\n"); } ptr += wrote; *len -= wrote; /* counter-reset */ val = css_computed_counter_reset(style, &counter); if (val == CSS_COUNTER_RESET_INHERIT) { wrote = snprintf(ptr, *len, "counter-reset: inherit\n"); } else if (counter == NULL) { wrote = snprintf(ptr, *len, "counter-reset: none\n"); } else { wrote = snprintf(ptr, *len, "counter-reset:"); ptr += wrote; *len -= wrote; while (counter->name != NULL) { wrote = snprintf(ptr, *len, " %.*s ", (int) lwc_string_length(counter->name), lwc_string_data(counter->name)); ptr += wrote; *len -= wrote; wrote = dump_css_fixed(counter->value, ptr, *len); ptr += wrote; *len -= wrote; counter++; } wrote = snprintf(ptr, *len, "\n"); } ptr += wrote; *len -= wrote; /* cursor */ val = css_computed_cursor(style, &string_list); wrote = snprintf(ptr, *len, "cursor:"); ptr += wrote; *len -= wrote; if (string_list != NULL) { while (*string_list != NULL) { wrote = snprintf(ptr, *len, " url('%.*s')", (int) lwc_string_length(*string_list), lwc_string_data(*string_list)); ptr += wrote; *len -= wrote; string_list++; } } switch (val) { case CSS_CURSOR_INHERIT: wrote = snprintf(ptr, *len, " inherit\n"); break; case CSS_CURSOR_AUTO: wrote = snprintf(ptr, *len, " auto\n"); break; case CSS_CURSOR_CROSSHAIR: wrote = snprintf(ptr, *len, " crosshair\n"); break; case CSS_CURSOR_DEFAULT: wrote = snprintf(ptr, *len, " default\n"); break; case CSS_CURSOR_POINTER: wrote = snprintf(ptr, *len, " pointer\n"); break; case CSS_CURSOR_MOVE: wrote = snprintf(ptr, *len, " move\n"); break; case CSS_CURSOR_E_RESIZE: wrote = snprintf(ptr, *len, " e-resize\n"); break; case CSS_CURSOR_NE_RESIZE: wrote = snprintf(ptr, *len, " ne-resize\n"); break; case CSS_CURSOR_NW_RESIZE: wrote = snprintf(ptr, *len, " nw-resize\n"); break; case CSS_CURSOR_N_RESIZE: wrote = snprintf(ptr, *len, " n-resize\n"); break; case CSS_CURSOR_SE_RESIZE: wrote = snprintf(ptr, *len, " se-resize\n"); break; case CSS_CURSOR_SW_RESIZE: wrote = snprintf(ptr, *len, " sw-resize\n"); break; case CSS_CURSOR_S_RESIZE: wrote = snprintf(ptr, *len, " s-resize\n"); break; case CSS_CURSOR_W_RESIZE: wrote = snprintf(ptr, *len, " w-resize\n"); break; case CSS_CURSOR_TEXT: wrote = snprintf(ptr, *len, " text\n"); break; case CSS_CURSOR_WAIT: wrote = snprintf(ptr, *len, " wait\n"); break; case CSS_CURSOR_HELP: wrote = snprintf(ptr, *len, " help\n"); break; case CSS_CURSOR_PROGRESS: wrote = snprintf(ptr, *len, " progress\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* direction */ val = css_computed_direction(style); switch (val) { case CSS_DIRECTION_INHERIT: wrote = snprintf(ptr, *len, "direction: inherit\n"); break; case CSS_DIRECTION_LTR: wrote = snprintf(ptr, *len, "direction: ltr\n"); break; case CSS_DIRECTION_RTL: wrote = snprintf(ptr, *len, "direction: rtl\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* display */ val = css_computed_display_static(style); switch (val) { case CSS_DISPLAY_INHERIT: wrote = snprintf(ptr, *len, "display: inherit\n"); break; case CSS_DISPLAY_INLINE: wrote = snprintf(ptr, *len, "display: inline\n"); break; case CSS_DISPLAY_BLOCK: wrote = snprintf(ptr, *len, "display: block\n"); break; case CSS_DISPLAY_LIST_ITEM: wrote = snprintf(ptr, *len, "display: list-item\n"); break; case CSS_DISPLAY_RUN_IN: wrote = snprintf(ptr, *len, "display: run-in\n"); break; case CSS_DISPLAY_INLINE_BLOCK: wrote = snprintf(ptr, *len, "display: inline-block\n"); break; case CSS_DISPLAY_TABLE: wrote = snprintf(ptr, *len, "display: table\n"); break; case CSS_DISPLAY_INLINE_TABLE: wrote = snprintf(ptr, *len, "display: inline-table\n"); break; case CSS_DISPLAY_TABLE_ROW_GROUP: wrote = snprintf(ptr, *len, "display: table-row-group\n"); break; case CSS_DISPLAY_TABLE_HEADER_GROUP: wrote = snprintf(ptr, *len, "display: table-header-group\n"); break; case CSS_DISPLAY_TABLE_FOOTER_GROUP: wrote = snprintf(ptr, *len, "display: table-footer-group\n"); break; case CSS_DISPLAY_TABLE_ROW: wrote = snprintf(ptr, *len, "display: table-row\n"); break; case CSS_DISPLAY_TABLE_COLUMN_GROUP: wrote = snprintf(ptr, *len, "display: table-column-group\n"); break; case CSS_DISPLAY_TABLE_COLUMN: wrote = snprintf(ptr, *len, "display: table-column\n"); break; case CSS_DISPLAY_TABLE_CELL: wrote = snprintf(ptr, *len, "display: table-cell\n"); break; case CSS_DISPLAY_TABLE_CAPTION: wrote = snprintf(ptr, *len, "display: table-caption\n"); break; case CSS_DISPLAY_NONE: wrote = snprintf(ptr, *len, "display: none\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* empty-cells */ val = css_computed_empty_cells(style); switch (val) { case CSS_EMPTY_CELLS_INHERIT: wrote = snprintf(ptr, *len, "empty-cells: inherit\n"); break; case CSS_EMPTY_CELLS_SHOW: wrote = snprintf(ptr, *len, "empty-cells: show\n"); break; case CSS_EMPTY_CELLS_HIDE: wrote = snprintf(ptr, *len, "empty-cells: hide\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* float */ val = css_computed_float(style); switch (val) { case CSS_FLOAT_INHERIT: wrote = snprintf(ptr, *len, "float: inherit\n"); break; case CSS_FLOAT_LEFT: wrote = snprintf(ptr, *len, "float: left\n"); break; case CSS_FLOAT_RIGHT: wrote = snprintf(ptr, *len, "float: right\n"); break; case CSS_FLOAT_NONE: wrote = snprintf(ptr, *len, "float: none\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* font-family */ val = css_computed_font_family(style, &string_list); if (val == CSS_FONT_FAMILY_INHERIT) { wrote = snprintf(ptr, *len, "font-family: inherit\n"); ptr += wrote; *len -= wrote; } else { wrote = snprintf(ptr, *len, "font-family:"); ptr += wrote; *len -= wrote; if (string_list != NULL) { while (*string_list != NULL) { wrote = snprintf(ptr, *len, " \"%.*s\"", (int) lwc_string_length(*string_list), lwc_string_data(*string_list)); ptr += wrote; *len -= wrote; string_list++; } } switch (val) { case CSS_FONT_FAMILY_SERIF: wrote = snprintf(ptr, *len, " serif\n"); break; case CSS_FONT_FAMILY_SANS_SERIF: wrote = snprintf(ptr, *len, " sans-serif\n"); break; case CSS_FONT_FAMILY_CURSIVE: wrote = snprintf(ptr, *len, " cursive\n"); break; case CSS_FONT_FAMILY_FANTASY: wrote = snprintf(ptr, *len, " fantasy\n"); break; case CSS_FONT_FAMILY_MONOSPACE: wrote = snprintf(ptr, *len, " monospace\n"); break; } ptr += wrote; *len -= wrote; } /* font-size */ val = css_computed_font_size(style, &len1, &unit1); switch (val) { case CSS_FONT_SIZE_INHERIT: wrote = snprintf(ptr, *len, "font-size: inherit\n"); break; case CSS_FONT_SIZE_XX_SMALL: wrote = snprintf(ptr, *len, "font-size: xx-small\n"); break; case CSS_FONT_SIZE_X_SMALL: wrote = snprintf(ptr, *len, "font-size: x-small\n"); break; case CSS_FONT_SIZE_SMALL: wrote = snprintf(ptr, *len, "font-size: small\n"); break; case CSS_FONT_SIZE_MEDIUM: wrote = snprintf(ptr, *len, "font-size: medium\n"); break; case CSS_FONT_SIZE_LARGE: wrote = snprintf(ptr, *len, "font-size: large\n"); break; case CSS_FONT_SIZE_X_LARGE: wrote = snprintf(ptr, *len, "font-size: x-large\n"); break; case CSS_FONT_SIZE_XX_LARGE: wrote = snprintf(ptr, *len, "font-size: xx-large\n"); break; case CSS_FONT_SIZE_LARGER: wrote = snprintf(ptr, *len, "font-size: larger\n"); break; case CSS_FONT_SIZE_SMALLER: wrote = snprintf(ptr, *len, "font-size: smaller\n"); break; case CSS_FONT_SIZE_DIMENSION: wrote = snprintf(ptr, *len, "font-size: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* font-style */ val = css_computed_font_style(style); switch (val) { case CSS_FONT_STYLE_INHERIT: wrote = snprintf(ptr, *len, "font-style: inherit\n"); break; case CSS_FONT_STYLE_NORMAL: wrote = snprintf(ptr, *len, "font-style: normal\n"); break; case CSS_FONT_STYLE_ITALIC: wrote = snprintf(ptr, *len, "font-style: italic\n"); break; case CSS_FONT_STYLE_OBLIQUE: wrote = snprintf(ptr, *len, "font-style: oblique\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* font-variant */ val = css_computed_font_variant(style); switch (val) { case CSS_FONT_VARIANT_INHERIT: wrote = snprintf(ptr, *len, "font-variant: inherit\n"); break; case CSS_FONT_VARIANT_NORMAL: wrote = snprintf(ptr, *len, "font-variant: normal\n"); break; case CSS_FONT_VARIANT_SMALL_CAPS: wrote = snprintf(ptr, *len, "font-variant: small-caps\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* font-weight */ val = css_computed_font_weight(style); switch (val) { case CSS_FONT_WEIGHT_INHERIT: wrote = snprintf(ptr, *len, "font-weight: inherit\n"); break; case CSS_FONT_WEIGHT_NORMAL: wrote = snprintf(ptr, *len, "font-weight: normal\n"); break; case CSS_FONT_WEIGHT_BOLD: wrote = snprintf(ptr, *len, "font-weight: bold\n"); break; case CSS_FONT_WEIGHT_BOLDER: wrote = snprintf(ptr, *len, "font-weight: bolder\n"); break; case CSS_FONT_WEIGHT_LIGHTER: wrote = snprintf(ptr, *len, "font-weight: lighter\n"); break; case CSS_FONT_WEIGHT_100: wrote = snprintf(ptr, *len, "font-weight: 100\n"); break; case CSS_FONT_WEIGHT_200: wrote = snprintf(ptr, *len, "font-weight: 200\n"); break; case CSS_FONT_WEIGHT_300: wrote = snprintf(ptr, *len, "font-weight: 300\n"); break; case CSS_FONT_WEIGHT_400: wrote = snprintf(ptr, *len, "font-weight: 400\n"); break; case CSS_FONT_WEIGHT_500: wrote = snprintf(ptr, *len, "font-weight: 500\n"); break; case CSS_FONT_WEIGHT_600: wrote = snprintf(ptr, *len, "font-weight: 600\n"); break; case CSS_FONT_WEIGHT_700: wrote = snprintf(ptr, *len, "font-weight: 700\n"); break; case CSS_FONT_WEIGHT_800: wrote = snprintf(ptr, *len, "font-weight: 800\n"); break; case CSS_FONT_WEIGHT_900: wrote = snprintf(ptr, *len, "font-weight: 900\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* height */ val = css_computed_height(style, &len1, &unit1); switch (val) { case CSS_HEIGHT_INHERIT: wrote = snprintf(ptr, *len, "height: inherit\n"); break; case CSS_HEIGHT_AUTO: wrote = snprintf(ptr, *len, "height: auto\n"); break; case CSS_HEIGHT_SET: wrote = snprintf(ptr, *len, "height: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* left */ val = css_computed_left(style, &len1, &unit1); switch (val) { case CSS_LEFT_INHERIT: wrote = snprintf(ptr, *len, "left: inherit\n"); break; case CSS_LEFT_AUTO: wrote = snprintf(ptr, *len, "left: auto\n"); break; case CSS_LEFT_SET: wrote = snprintf(ptr, *len, "left: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* letter-spacing */ val = css_computed_letter_spacing(style, &len1, &unit1); switch (val) { case CSS_LETTER_SPACING_INHERIT: wrote = snprintf(ptr, *len, "letter-spacing: inherit\n"); break; case CSS_LETTER_SPACING_NORMAL: wrote = snprintf(ptr, *len, "letter-spacing: normal\n"); break; case CSS_LETTER_SPACING_SET: wrote = snprintf(ptr, *len, "letter-spacing: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* line-height */ val = css_computed_line_height(style, &len1, &unit1); switch (val) { case CSS_LINE_HEIGHT_INHERIT: wrote = snprintf(ptr, *len, "line-height: inherit\n"); break; case CSS_LINE_HEIGHT_NORMAL: wrote = snprintf(ptr, *len, "line-height: normal\n"); break; case CSS_LINE_HEIGHT_NUMBER: wrote = snprintf(ptr, *len, "line-height: "); ptr += wrote; *len -= wrote; wrote = dump_css_fixed(len1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; case CSS_LINE_HEIGHT_DIMENSION: wrote = snprintf(ptr, *len, "line-height: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* list-style-image */ val = css_computed_list_style_image(style, &url); if (val == CSS_LIST_STYLE_IMAGE_INHERIT) { wrote = snprintf(ptr, *len, "list-style-image: inherit\n"); } else if (url != NULL) { wrote = snprintf(ptr, *len, "list-style-image: url('%.*s')\n", (int) lwc_string_length(url), lwc_string_data(url)); } else if (val == CSS_LIST_STYLE_IMAGE_NONE) { wrote = snprintf(ptr, *len, "list-style-image: none\n"); } else { wrote = 0; } ptr += wrote; *len -= wrote; /* list-style-position */ val = css_computed_list_style_position(style); switch (val) { case CSS_LIST_STYLE_POSITION_INHERIT: wrote = snprintf(ptr, *len, "list-style-position: inherit\n"); break; case CSS_LIST_STYLE_POSITION_INSIDE: wrote = snprintf(ptr, *len, "list-style-position: inside\n"); break; case CSS_LIST_STYLE_POSITION_OUTSIDE: wrote = snprintf(ptr, *len, "list-style-position: outside\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* list-style-type */ val = css_computed_list_style_type(style); switch (val) { case CSS_LIST_STYLE_TYPE_INHERIT: wrote = snprintf(ptr, *len, "list-style-type: inherit\n"); break; case CSS_LIST_STYLE_TYPE_DISC: wrote = snprintf(ptr, *len, "list-style-type: disc\n"); break; case CSS_LIST_STYLE_TYPE_CIRCLE: wrote = snprintf(ptr, *len, "list-style-type: circle\n"); break; case CSS_LIST_STYLE_TYPE_SQUARE: wrote = snprintf(ptr, *len, "list-style-type: square\n"); break; case CSS_LIST_STYLE_TYPE_DECIMAL: wrote = snprintf(ptr, *len, "list-style-type: decimal\n"); break; case CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO: wrote = snprintf(ptr, *len, "list-style-type: decimal-leading-zero\n"); break; case CSS_LIST_STYLE_TYPE_LOWER_ROMAN: wrote = snprintf(ptr, *len, "list-style-type: lower-roman\n"); break; case CSS_LIST_STYLE_TYPE_UPPER_ROMAN: wrote = snprintf(ptr, *len, "list-style-type: upper-roman\n"); break; case CSS_LIST_STYLE_TYPE_LOWER_GREEK: wrote = snprintf(ptr, *len, "list-style-type: lower-greek\n"); break; case CSS_LIST_STYLE_TYPE_LOWER_LATIN: wrote = snprintf(ptr, *len, "list-style-type: lower-latin\n"); break; case CSS_LIST_STYLE_TYPE_UPPER_LATIN: wrote = snprintf(ptr, *len, "list-style-type: upper-latin\n"); break; case CSS_LIST_STYLE_TYPE_ARMENIAN: wrote = snprintf(ptr, *len, "list-style-type: armenian\n"); break; case CSS_LIST_STYLE_TYPE_GEORGIAN: wrote = snprintf(ptr, *len, "list-style-type: georgian\n"); break; case CSS_LIST_STYLE_TYPE_LOWER_ALPHA: wrote = snprintf(ptr, *len, "list-style-type: lower-alpha\n"); break; case CSS_LIST_STYLE_TYPE_UPPER_ALPHA: wrote = snprintf(ptr, *len, "list-style-type: upper-alpha\n"); break; case CSS_LIST_STYLE_TYPE_NONE: wrote = snprintf(ptr, *len, "list-style-type: none\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* margin-top */ val = css_computed_margin_top(style, &len1, &unit1); switch (val) { case CSS_MARGIN_INHERIT: wrote = snprintf(ptr, *len, "margin-top: inherit\n"); break; case CSS_MARGIN_AUTO: wrote = snprintf(ptr, *len, "margin-top: auto\n"); break; case CSS_MARGIN_SET: wrote = snprintf(ptr, *len, "margin-top: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* margin-right */ val = css_computed_margin_right(style, &len1, &unit1); switch (val) { case CSS_MARGIN_INHERIT: wrote = snprintf(ptr, *len, "margin-right: inherit\n"); break; case CSS_MARGIN_AUTO: wrote = snprintf(ptr, *len, "margin-right: auto\n"); break; case CSS_MARGIN_SET: wrote = snprintf(ptr, *len, "margin-right: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* margin-bottom */ val = css_computed_margin_bottom(style, &len1, &unit1); switch (val) { case CSS_MARGIN_INHERIT: wrote = snprintf(ptr, *len, "margin-bottom: inherit\n"); break; case CSS_MARGIN_AUTO: wrote = snprintf(ptr, *len, "margin-bottom: auto\n"); break; case CSS_MARGIN_SET: wrote = snprintf(ptr, *len, "margin-bottom: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* margin-left */ val = css_computed_margin_left(style, &len1, &unit1); switch (val) { case CSS_MARGIN_INHERIT: wrote = snprintf(ptr, *len, "margin-left: inherit\n"); break; case CSS_MARGIN_AUTO: wrote = snprintf(ptr, *len, "margin-left: auto\n"); break; case CSS_MARGIN_SET: wrote = snprintf(ptr, *len, "margin-left: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* max-height */ val = css_computed_max_height(style, &len1, &unit1); switch (val) { case CSS_MAX_HEIGHT_INHERIT: wrote = snprintf(ptr, *len, "max-height: inherit\n"); break; case CSS_MAX_HEIGHT_NONE: wrote = snprintf(ptr, *len, "max-height: none\n"); break; case CSS_MAX_HEIGHT_SET: wrote = snprintf(ptr, *len, "max-height: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* max-width */ val = css_computed_max_width(style, &len1, &unit1); switch (val) { case CSS_MAX_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "max-width: inherit\n"); break; case CSS_MAX_WIDTH_NONE: wrote = snprintf(ptr, *len, "max-width: none\n"); break; case CSS_MAX_WIDTH_SET: wrote = snprintf(ptr, *len, "max-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* min-height */ val = css_computed_min_height(style, &len1, &unit1); switch (val) { case CSS_MIN_HEIGHT_INHERIT: wrote = snprintf(ptr, *len, "min-height: inherit\n"); break; case CSS_MIN_HEIGHT_SET: wrote = snprintf(ptr, *len, "min-height: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* min-width */ val = css_computed_min_width(style, &len1, &unit1); switch (val) { case CSS_MIN_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "min-width: inherit\n"); break; case CSS_MIN_WIDTH_SET: wrote = snprintf(ptr, *len, "min-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* opacity */ val = css_computed_opacity(style, &len1); switch (val) { case CSS_OPACITY_INHERIT: wrote = snprintf(ptr, *len, "opacity: inherit\n"); break; case CSS_OPACITY_SET: wrote = snprintf(ptr, *len, "opacity: "); ptr += wrote; *len -= wrote; wrote = dump_css_fixed(len1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* outline-color */ val = css_computed_outline_color(style, &color); switch (val) { case CSS_OUTLINE_COLOR_INHERIT: wrote = snprintf(ptr, *len, "outline-color: inherit\n"); break; case CSS_OUTLINE_COLOR_INVERT: wrote = snprintf(ptr, *len, "outline-color: invert\n"); break; case CSS_OUTLINE_COLOR_COLOR: wrote = snprintf(ptr, *len, "outline-color: #%08x\n", color); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* outline-style */ val = css_computed_outline_style(style); switch (val) { case CSS_OUTLINE_STYLE_INHERIT: wrote = snprintf(ptr, *len, "outline-style: inherit\n"); break; case CSS_OUTLINE_STYLE_NONE: wrote = snprintf(ptr, *len, "outline-style: none\n"); break; case CSS_OUTLINE_STYLE_DOTTED: wrote = snprintf(ptr, *len, "outline-style: dotted\n"); break; case CSS_OUTLINE_STYLE_DASHED: wrote = snprintf(ptr, *len, "outline-style: dashed\n"); break; case CSS_OUTLINE_STYLE_SOLID: wrote = snprintf(ptr, *len, "outline-style: solid\n"); break; case CSS_OUTLINE_STYLE_DOUBLE: wrote = snprintf(ptr, *len, "outline-style: double\n"); break; case CSS_OUTLINE_STYLE_GROOVE: wrote = snprintf(ptr, *len, "outline-style: groove\n"); break; case CSS_OUTLINE_STYLE_RIDGE: wrote = snprintf(ptr, *len, "outline-style: ridge\n"); break; case CSS_OUTLINE_STYLE_INSET: wrote = snprintf(ptr, *len, "outline-style: inset\n"); break; case CSS_OUTLINE_STYLE_OUTSET: wrote = snprintf(ptr, *len, "outline-style: outset\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* outline-width */ val = css_computed_outline_width(style, &len1, &unit1); switch (val) { case CSS_OUTLINE_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "outline-width: inherit\n"); break; case CSS_OUTLINE_WIDTH_THIN: wrote = snprintf(ptr, *len, "outline-width: thin\n"); break; case CSS_OUTLINE_WIDTH_MEDIUM: wrote = snprintf(ptr, *len, "outline-width: medium\n"); break; case CSS_OUTLINE_WIDTH_THICK: wrote = snprintf(ptr, *len, "outline-width: thick\n"); break; case CSS_OUTLINE_WIDTH_WIDTH: wrote = snprintf(ptr, *len, "outline-width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* overflow-x */ val = css_computed_overflow_x(style); switch (val) { case CSS_OVERFLOW_INHERIT: wrote = snprintf(ptr, *len, "overflow-x: inherit\n"); break; case CSS_OVERFLOW_VISIBLE: wrote = snprintf(ptr, *len, "overflow-x: visible\n"); break; case CSS_OVERFLOW_HIDDEN: wrote = snprintf(ptr, *len, "overflow-x: hidden\n"); break; case CSS_OVERFLOW_SCROLL: wrote = snprintf(ptr, *len, "overflow-x: scroll\n"); break; case CSS_OVERFLOW_AUTO: wrote = snprintf(ptr, *len, "overflow-x: auto\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* overflow-y */ val = css_computed_overflow_y(style); switch (val) { case CSS_OVERFLOW_INHERIT: wrote = snprintf(ptr, *len, "overflow-y: inherit\n"); break; case CSS_OVERFLOW_VISIBLE: wrote = snprintf(ptr, *len, "overflow-y: visible\n"); break; case CSS_OVERFLOW_HIDDEN: wrote = snprintf(ptr, *len, "overflow-y: hidden\n"); break; case CSS_OVERFLOW_SCROLL: wrote = snprintf(ptr, *len, "overflow-y: scroll\n"); break; case CSS_OVERFLOW_AUTO: wrote = snprintf(ptr, *len, "overflow-y: auto\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* padding-top */ val = css_computed_padding_top(style, &len1, &unit1); switch (val) { case CSS_PADDING_INHERIT: wrote = snprintf(ptr, *len, "padding-top: inherit\n"); break; case CSS_PADDING_SET: wrote = snprintf(ptr, *len, "padding-top: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* padding-right */ val = css_computed_padding_right(style, &len1, &unit1); switch (val) { case CSS_PADDING_INHERIT: wrote = snprintf(ptr, *len, "padding-right: inherit\n"); break; case CSS_PADDING_SET: wrote = snprintf(ptr, *len, "padding-right: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* padding-bottom */ val = css_computed_padding_bottom(style, &len1, &unit1); switch (val) { case CSS_PADDING_INHERIT: wrote = snprintf(ptr, *len, "padding-bottom: inherit\n"); break; case CSS_PADDING_SET: wrote = snprintf(ptr, *len, "padding-bottom: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* padding-left */ val = css_computed_padding_left(style, &len1, &unit1); switch (val) { case CSS_PADDING_INHERIT: wrote = snprintf(ptr, *len, "padding-left: inherit\n"); break; case CSS_PADDING_SET: wrote = snprintf(ptr, *len, "padding-left: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* position */ val = css_computed_position(style); switch (val) { case CSS_POSITION_INHERIT: wrote = snprintf(ptr, *len, "position: inherit\n"); break; case CSS_POSITION_STATIC: wrote = snprintf(ptr, *len, "position: static\n"); break; case CSS_POSITION_RELATIVE: wrote = snprintf(ptr, *len, "position: relative\n"); break; case CSS_POSITION_ABSOLUTE: wrote = snprintf(ptr, *len, "position: absolute\n"); break; case CSS_POSITION_FIXED: wrote = snprintf(ptr, *len, "position: fixed\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* quotes */ val = css_computed_quotes(style, &string_list); if (val == CSS_QUOTES_STRING && string_list != NULL) { wrote = snprintf(ptr, *len, "quotes:"); ptr += wrote; *len -= wrote; while (*string_list != NULL) { wrote = snprintf(ptr, *len, " \"%.*s\"", (int) lwc_string_length(*string_list), lwc_string_data(*string_list)); ptr += wrote; *len -= wrote; string_list++; } wrote = snprintf(ptr, *len, "\n"); } else { switch (val) { case CSS_QUOTES_INHERIT: wrote = snprintf(ptr, *len, "quotes: inherit\n"); break; case CSS_QUOTES_NONE: wrote = snprintf(ptr, *len, "quotes: none\n"); break; default: wrote = 0; break; } } ptr += wrote; *len -= wrote; /* right */ val = css_computed_right(style, &len1, &unit1); switch (val) { case CSS_RIGHT_INHERIT: wrote = snprintf(ptr, *len, "right: inherit\n"); break; case CSS_RIGHT_AUTO: wrote = snprintf(ptr, *len, "right: auto\n"); break; case CSS_RIGHT_SET: wrote = snprintf(ptr, *len, "right: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* table-layout */ val = css_computed_table_layout(style); switch (val) { case CSS_TABLE_LAYOUT_INHERIT: wrote = snprintf(ptr, *len, "table-layout: inherit\n"); break; case CSS_TABLE_LAYOUT_AUTO: wrote = snprintf(ptr, *len, "table-layout: auto\n"); break; case CSS_TABLE_LAYOUT_FIXED: wrote = snprintf(ptr, *len, "table-layout: fixed\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* text-align */ val = css_computed_text_align(style); switch (val) { case CSS_TEXT_ALIGN_INHERIT: wrote = snprintf(ptr, *len, "text-align: inherit\n"); break; case CSS_TEXT_ALIGN_LEFT: wrote = snprintf(ptr, *len, "text-align: left\n"); break; case CSS_TEXT_ALIGN_RIGHT: wrote = snprintf(ptr, *len, "text-align: right\n"); break; case CSS_TEXT_ALIGN_CENTER: wrote = snprintf(ptr, *len, "text-align: center\n"); break; case CSS_TEXT_ALIGN_JUSTIFY: wrote = snprintf(ptr, *len, "text-align: justify\n"); break; case CSS_TEXT_ALIGN_DEFAULT: wrote = snprintf(ptr, *len, "text-align: default\n"); break; case CSS_TEXT_ALIGN_LIBCSS_LEFT: wrote = snprintf(ptr, *len, "text-align: -libcss-left\n"); break; case CSS_TEXT_ALIGN_LIBCSS_CENTER: wrote = snprintf(ptr, *len, "text-align: -libcss-center\n"); break; case CSS_TEXT_ALIGN_LIBCSS_RIGHT: wrote = snprintf(ptr, *len, "text-align: -libcss-right\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* text-decoration */ val = css_computed_text_decoration(style); if (val == CSS_TEXT_DECORATION_INHERIT) { wrote = snprintf(ptr, *len, "text-decoration: inherit\n"); ptr += wrote; *len -= wrote; } else if (val == CSS_TEXT_DECORATION_NONE) { wrote = snprintf(ptr, *len, "text-decoration: none\n"); ptr += wrote; *len -= wrote; } else { wrote = snprintf(ptr, *len, "text-decoration:"); ptr += wrote; *len -= wrote; if (val & CSS_TEXT_DECORATION_BLINK) { wrote = snprintf(ptr, *len, " blink"); ptr += wrote; *len -= wrote; } if (val & CSS_TEXT_DECORATION_LINE_THROUGH) { wrote = snprintf(ptr, *len, " line-through"); ptr += wrote; *len -= wrote; } if (val & CSS_TEXT_DECORATION_OVERLINE) { wrote = snprintf(ptr, *len, " overline"); ptr += wrote; *len -= wrote; } if (val & CSS_TEXT_DECORATION_UNDERLINE) { wrote = snprintf(ptr, *len, " underline"); ptr += wrote; *len -= wrote; } wrote = snprintf(ptr, *len, "\n"); ptr += wrote; *len -= wrote; } /* text-indent */ val = css_computed_text_indent(style, &len1, &unit1); switch (val) { case CSS_TEXT_INDENT_INHERIT: wrote = snprintf(ptr, *len, "text-indent: inherit\n"); break; case CSS_TEXT_INDENT_SET: wrote = snprintf(ptr, *len, "text-indent: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* text-transform */ val = css_computed_text_transform(style); switch (val) { case CSS_TEXT_TRANSFORM_INHERIT: wrote = snprintf(ptr, *len, "text-transform: inherit\n"); break; case CSS_TEXT_TRANSFORM_CAPITALIZE: wrote = snprintf(ptr, *len, "text-transform: capitalize\n"); break; case CSS_TEXT_TRANSFORM_UPPERCASE: wrote = snprintf(ptr, *len, "text-transform: uppercase\n"); break; case CSS_TEXT_TRANSFORM_LOWERCASE: wrote = snprintf(ptr, *len, "text-transform: lowercase\n"); break; case CSS_TEXT_TRANSFORM_NONE: wrote = snprintf(ptr, *len, "text-transform: none\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* top */ val = css_computed_top(style, &len1, &unit1); switch (val) { case CSS_TOP_INHERIT: wrote = snprintf(ptr, *len, "top: inherit\n"); break; case CSS_TOP_AUTO: wrote = snprintf(ptr, *len, "top: auto\n"); break; case CSS_TOP_SET: wrote = snprintf(ptr, *len, "top: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* unicode-bidi */ val = css_computed_unicode_bidi(style); switch (val) { case CSS_UNICODE_BIDI_INHERIT: wrote = snprintf(ptr, *len, "unicode-bidi: inherit\n"); break; case CSS_UNICODE_BIDI_NORMAL: wrote = snprintf(ptr, *len, "unicode-bidi: normal\n"); break; case CSS_UNICODE_BIDI_EMBED: wrote = snprintf(ptr, *len, "unicode-bidi: embed\n"); break; case CSS_UNICODE_BIDI_BIDI_OVERRIDE: wrote = snprintf(ptr, *len, "unicode-bidi: bidi-override\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* vertical-align */ val = css_computed_vertical_align(style, &len1, &unit1); switch (val) { case CSS_VERTICAL_ALIGN_INHERIT: wrote = snprintf(ptr, *len, "vertical-align: inherit\n"); break; case CSS_VERTICAL_ALIGN_BASELINE: wrote = snprintf(ptr, *len, "vertical-align: baseline\n"); break; case CSS_VERTICAL_ALIGN_SUB: wrote = snprintf(ptr, *len, "vertical-align: sub\n"); break; case CSS_VERTICAL_ALIGN_SUPER: wrote = snprintf(ptr, *len, "vertical-align: super\n"); break; case CSS_VERTICAL_ALIGN_TOP: wrote = snprintf(ptr, *len, "vertical-align: top\n"); break; case CSS_VERTICAL_ALIGN_TEXT_TOP: wrote = snprintf(ptr, *len, "vertical-align: text-top\n"); break; case CSS_VERTICAL_ALIGN_MIDDLE: wrote = snprintf(ptr, *len, "vertical-align: middle\n"); break; case CSS_VERTICAL_ALIGN_BOTTOM: wrote = snprintf(ptr, *len, "vertical-align: bottom\n"); break; case CSS_VERTICAL_ALIGN_TEXT_BOTTOM: wrote = snprintf(ptr, *len, "vertical-align: text-bottom\n"); break; case CSS_VERTICAL_ALIGN_SET: wrote = snprintf(ptr, *len, "vertical-align: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* visibility */ val = css_computed_visibility(style); switch (val) { case CSS_VISIBILITY_INHERIT: wrote = snprintf(ptr, *len, "visibility: inherit\n"); break; case CSS_VISIBILITY_VISIBLE: wrote = snprintf(ptr, *len, "visibility: visible\n"); break; case CSS_VISIBILITY_HIDDEN: wrote = snprintf(ptr, *len, "visibility: hidden\n"); break; case CSS_VISIBILITY_COLLAPSE: wrote = snprintf(ptr, *len, "visibility: collapse\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* white-space */ val = css_computed_white_space(style); switch (val) { case CSS_WHITE_SPACE_INHERIT: wrote = snprintf(ptr, *len, "white-space: inherit\n"); break; case CSS_WHITE_SPACE_NORMAL: wrote = snprintf(ptr, *len, "white-space: normal\n"); break; case CSS_WHITE_SPACE_PRE: wrote = snprintf(ptr, *len, "white-space: pre\n"); break; case CSS_WHITE_SPACE_NOWRAP: wrote = snprintf(ptr, *len, "white-space: nowrap\n"); break; case CSS_WHITE_SPACE_PRE_WRAP: wrote = snprintf(ptr, *len, "white-space: pre-wrap\n"); break; case CSS_WHITE_SPACE_PRE_LINE: wrote = snprintf(ptr, *len, "white-space: pre-line\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* width */ val = css_computed_width(style, &len1, &unit1); switch (val) { case CSS_WIDTH_INHERIT: wrote = snprintf(ptr, *len, "width: inherit\n"); break; case CSS_WIDTH_AUTO: wrote = snprintf(ptr, *len, "width: auto\n"); break; case CSS_WIDTH_SET: wrote = snprintf(ptr, *len, "width: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* word-spacing */ val = css_computed_word_spacing(style, &len1, &unit1); switch (val) { case CSS_WORD_SPACING_INHERIT: wrote = snprintf(ptr, *len, "word-spacing: inherit\n"); break; case CSS_WORD_SPACING_NORMAL: wrote = snprintf(ptr, *len, "word-spacing: normal\n"); break; case CSS_WORD_SPACING_SET: wrote = snprintf(ptr, *len, "word-spacing: "); ptr += wrote; *len -= wrote; wrote = dump_css_unit(len1, unit1, ptr, *len); ptr += wrote; *len -= wrote; wrote = snprintf(ptr, *len, "\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* writing-mode */ val = css_computed_writing_mode(style); switch (val) { case CSS_WRITING_MODE_INHERIT: wrote = snprintf(ptr, *len, "writing-mode: inherit\n"); break; case CSS_WRITING_MODE_HORIZONTAL_TB: wrote = snprintf(ptr, *len, "writing-mode: horizontal-tb\n"); break; case CSS_WRITING_MODE_VERTICAL_RL: wrote = snprintf(ptr, *len, "writing-mode: vertical-rl\n"); break; case CSS_WRITING_MODE_VERTICAL_LR: wrote = snprintf(ptr, *len, "writing-mode: vertical-lr\n"); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; /* z-index */ val = css_computed_z_index(style, &zindex); switch (val) { case CSS_Z_INDEX_INHERIT: wrote = snprintf(ptr, *len, "z-index: inherit\n"); break; case CSS_Z_INDEX_AUTO: wrote = snprintf(ptr, *len, "z-index: auto\n"); break; case CSS_Z_INDEX_SET: wrote = snprintf(ptr, *len, "z-index: %d\n", zindex); break; default: wrote = 0; break; } ptr += wrote; *len -= wrote; } netsurf-all-3.2/libcss/test/select-common.c0000644000175000017500000010245012377676736020005 0ustar vincevince#include #include #include #include #include #include #include #include #include #include #include "utils/utils.h" #include "dump_computed.h" #include "testutils.h" typedef struct attribute { lwc_string *name; lwc_string *value; } attribute; typedef struct node { lwc_string *name; uint32_t n_classes; lwc_string **classes; uint32_t n_attrs; attribute *attrs; void *libcss_node_data; struct node *parent; struct node *next; struct node *prev; struct node *children; struct node *last_child; } node; typedef struct sheet_ctx { css_stylesheet *sheet; css_origin origin; uint64_t media; } sheet_ctx; typedef struct line_ctx { size_t explen; size_t expused; char *exp; bool intree; bool insheet; bool inerrors; bool inexp; node *tree; node *current; uint32_t depth; uint32_t n_sheets; sheet_ctx *sheets; uint64_t media; uint32_t pseudo_element; node *target; lwc_string *attr_class; lwc_string *attr_id; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void css__parse_tree(line_ctx *ctx, const char *data, size_t len); static void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len); static void css__parse_sheet(line_ctx *ctx, const char *data, size_t len); static void css__parse_media_list(const char **data, size_t *len, uint64_t *media); static void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element); static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(line_ctx *ctx, const char *exp, size_t explen); static void destroy_tree(node *root); static css_error node_name(void *pw, void *node, css_qname *qname); static css_error node_classes(void *pw, void *n, lwc_string ***classes, uint32_t *n_classes); static css_error node_id(void *pw, void *node, lwc_string **id); static css_error named_ancestor_node(void *pw, void *node, const css_qname *qname, void **ancestor); static css_error named_parent_node(void *pw, void *node, const css_qname *qname, void **parent); static css_error named_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); static css_error named_generic_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); static css_error parent_node(void *pw, void *node, void **parent); static css_error sibling_node(void *pw, void *node, void **sibling); static css_error node_has_name(void *pw, void *node, const css_qname *qname, bool *match); static css_error node_has_class(void *pw, void *node, lwc_string *name, bool *match); static css_error node_has_id(void *pw, void *node, lwc_string *name, bool *match); static css_error node_has_attribute(void *pw, void *node, const css_qname *qname, bool *match); static css_error node_has_attribute_equal(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_dashmatch(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_includes(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_prefix(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_suffix(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_substring(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_is_root(void *pw, void *node, bool *match); static css_error node_count_siblings(void *pw, void *node, bool same_name, bool after, int32_t *count); static css_error node_is_empty(void *pw, void *node, bool *match); static css_error node_is_link(void *pw, void *node, bool *match); static css_error node_is_visited(void *pw, void *node, bool *match); static css_error node_is_hover(void *pw, void *node, bool *match); static css_error node_is_active(void *pw, void *node, bool *match); static css_error node_is_focus(void *pw, void *node, bool *match); static css_error node_is_enabled(void *pw, void *node, bool *match); static css_error node_is_disabled(void *pw, void *node, bool *match); static css_error node_is_checked(void *pw, void *node, bool *match); static css_error node_is_target(void *pw, void *node, bool *match); static css_error node_is_lang(void *pw, void *node, lwc_string *lang, bool *match); static css_error node_presentational_hint(void *pw, void *node, uint32_t property, css_hint *hint); static css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint); static css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size); static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data); static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data); static css_select_handler select_handler = { CSS_SELECT_HANDLER_VERSION_1, node_name, node_classes, node_id, named_ancestor_node, named_parent_node, named_sibling_node, named_generic_sibling_node, parent_node, sibling_node, node_has_name, node_has_class, node_has_id, node_has_attribute, node_has_attribute_equal, node_has_attribute_dashmatch, node_has_attribute_includes, node_has_attribute_prefix, node_has_attribute_suffix, node_has_attribute_substring, node_is_root, node_count_siblings, node_is_empty, node_is_link, node_is_visited, node_is_hover, node_is_active, node_is_focus, node_is_enabled, node_is_disabled, node_is_checked, node_is_target, node_is_lang, node_presentational_hint, ua_default_for_property, compute_font_size, set_libcss_node_data, get_libcss_node_data }; static css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs) { UNUSED(pw); UNUSED(base); /* About as useless as possible */ *abs = lwc_string_ref(rel); return CSS_OK; } static bool fail_because_lwc_leaked = false; static void printing_lwc_iterator(lwc_string *str, void *pw) { UNUSED(pw); printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str)); fail_because_lwc_leaked = true; } int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } memset(&ctx, 0, sizeof(ctx)); lwc_intern_string("class", SLEN("class"), &ctx.attr_class); lwc_intern_string("id", SLEN("id"), &ctx.attr_id); assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.tree != NULL) run_test(&ctx, ctx.exp, ctx.expused); free(ctx.exp); lwc_string_unref(ctx.attr_class); lwc_string_unref(ctx.attr_id); lwc_iterate_strings(printing_lwc_iterator, NULL); assert(fail_because_lwc_leaked == false); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; css_error error; if (data[0] == '#') { if (ctx->intree) { if (strncasecmp(data+1, "errors", 6) == 0) { ctx->intree = false; ctx->insheet = false; ctx->inerrors = true; ctx->inexp = false; } else { /* Assume start of stylesheet */ css__parse_sheet(ctx, data + 1, datalen - 1); ctx->intree = false; ctx->insheet = true; ctx->inerrors = false; ctx->inexp = false; } } else if (ctx->insheet) { if (strncasecmp(data+1, "errors", 6) == 0) { assert(css_stylesheet_data_done( ctx->sheets[ctx->n_sheets - 1].sheet) == CSS_OK); ctx->intree = false; ctx->insheet = false; ctx->inerrors = true; ctx->inexp = false; } else if (strncasecmp(data+1, "ua", 2) == 0 || strncasecmp(data+1, "user", 4) == 0 || strncasecmp(data+1, "author", 6) == 0) { assert(css_stylesheet_data_done( ctx->sheets[ctx->n_sheets - 1].sheet) == CSS_OK); css__parse_sheet(ctx, data + 1, datalen - 1); } else { error = css_stylesheet_append_data( ctx->sheets[ctx->n_sheets - 1].sheet, (const uint8_t *) data, datalen); assert(error == CSS_OK || error == CSS_NEEDDATA); } } else if (ctx->inerrors) { ctx->intree = false; ctx->insheet = false; ctx->inerrors = false; ctx->inexp = true; } else if (ctx->inexp) { /* This marks end of testcase, so run it */ run_test(ctx, ctx->exp, ctx->expused); ctx->expused = 0; ctx->intree = false; ctx->insheet = false; ctx->inerrors = false; ctx->inexp = false; } else { /* Start state */ if (strncasecmp(data+1, "tree", 4) == 0) { css__parse_tree(ctx, data + 5, datalen - 5); ctx->intree = true; ctx->insheet = false; ctx->inerrors = false; ctx->inexp = false; } } } else { if (ctx->intree) { /* Not interested in the '|' */ css__parse_tree_data(ctx, data + 1, datalen - 1); } else if (ctx->insheet) { error = css_stylesheet_append_data( ctx->sheets[ctx->n_sheets - 1].sheet, (const uint8_t *) data, datalen); assert(error == CSS_OK || error == CSS_NEEDDATA); } else if (ctx->inexp) { css__parse_expected(ctx, data, datalen); } } return true; } void css__parse_tree(line_ctx *ctx, const char *data, size_t len) { const char *p = data; const char *end = data + len; size_t left; /* [ ? ] ? */ ctx->media = CSS_MEDIA_ALL; ctx->pseudo_element = CSS_PSEUDO_ELEMENT_NONE; /* Consume any leading whitespace */ while (p < end && isspace(*p)) p++; if (p < end) { left = end - p; css__parse_media_list(&p, &left, &ctx->media); end = p + left; } if (p < end) { left = end - p; css__parse_pseudo_list(&p, &left, &ctx->pseudo_element); } } void css__parse_tree_data(line_ctx *ctx, const char *data, size_t len) { const char *p = data; const char *end = data + len; const char *name = NULL; const char *value = NULL; size_t namelen = 0; size_t valuelen = 0; uint32_t depth = 0; bool target = false; /* ' '{depth+1} [ '*'? | ] * * ::= [^=*[:space:]]+ * ::= [^=*[:space:]]+ '=' [^[:space:]]* */ while (p < end && isspace(*p)) { depth++; p++; } depth--; /* Get element/attribute name */ name = p; while (p < end && *p != '=' && *p != '*' && isspace(*p) == false) { namelen++; p++; } /* Skip whitespace */ while (p < end && isspace(*p)) p++; if (p < end && *p == '=') { /* Attribute value */ p++; value = p; while (p < end && isspace(*p) == false) { valuelen++; p++; } } else if (p < end && *p == '*') { /* Element is target node */ target = true; } if (value == NULL) { /* We have an element, so create it */ node *n = malloc(sizeof(node)); assert(n != NULL); memset(n, 0, sizeof(node)); lwc_intern_string(name, namelen, &n->name); /* Insert it into tree */ if (ctx->tree == NULL) { ctx->tree = n; } else { assert(depth > 0); assert(depth <= ctx->depth + 1); /* Find node to insert into */ while (depth <= ctx->depth) { ctx->depth--; ctx->current = ctx->current->parent; } /* Insert into current node */ if (ctx->current->children == NULL) { ctx->current->children = n; ctx->current->last_child = n; } else { ctx->current->last_child->next = n; n->prev = ctx->current->last_child; ctx->current->last_child = n; } n->parent = ctx->current; } ctx->current = n; ctx->depth = depth; /* Mark the target, if it's us */ if (target) ctx->target = n; } else { /* New attribute */ bool amatch = false; attribute *attr; node *n = ctx->current; attribute *temp = realloc(n->attrs, (n->n_attrs + 1) * sizeof(attribute)); assert(temp != NULL); n->attrs = temp; attr = &n->attrs[n->n_attrs]; lwc_intern_string(name, namelen, &attr->name); lwc_intern_string(value, valuelen, &attr->value); assert(lwc_string_caseless_isequal( n->attrs[n->n_attrs].name, ctx->attr_class, &amatch) == lwc_error_ok); if (amatch == true) { n->classes = realloc(NULL, sizeof(lwc_string **)); assert(n->classes != NULL); n->classes[0] = lwc_string_ref( n->attrs[n->n_attrs]. value); n->n_classes = 1; } n->n_attrs++; } } void css__parse_sheet(line_ctx *ctx, const char *data, size_t len) { css_stylesheet_params params; const char *p; const char *end = data + len; css_origin origin = CSS_ORIGIN_AUTHOR; uint64_t media = CSS_MEDIA_ALL; css_stylesheet *sheet; sheet_ctx *temp; /* ? */ /* Find end of origin */ for (p = data; p < end; p++) { if (isspace(*p)) break; } if (p - data == 6 && strncasecmp(data, "author", 6) == 0) origin = CSS_ORIGIN_AUTHOR; else if (p - data == 4 && strncasecmp(data, "user", 4) == 0) origin = CSS_ORIGIN_USER; else if (p - data == 2 && strncasecmp(data, "ua", 2) == 0) origin = CSS_ORIGIN_UA; else assert(0 && "Unknown stylesheet origin"); /* Skip any whitespace */ while (p < end && isspace(*p)) p++; if (p < end) { size_t ignored = end - p; css__parse_media_list(&p, &ignored, &media); } params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1; params.level = CSS_LEVEL_21; params.charset = "UTF-8"; params.url = "foo"; params.title = "foo"; params.allow_quirks = false; params.inline_style = false; params.resolve = resolve_url; params.resolve_pw = NULL; params.import = NULL; params.import_pw = NULL; params.color = NULL; params.color_pw = NULL; params.font = NULL; params.font_pw = NULL; /** \todo How are we going to handle @import? */ assert(css_stylesheet_create(¶ms, &sheet) == CSS_OK); /* Extend array of sheets and append new sheet to it */ temp = realloc(ctx->sheets, (ctx->n_sheets + 1) * sizeof(sheet_ctx)); assert(temp != NULL); ctx->sheets = temp; ctx->sheets[ctx->n_sheets].sheet = sheet; ctx->sheets[ctx->n_sheets].origin = origin; ctx->sheets[ctx->n_sheets].media = media; ctx->n_sheets++; } void css__parse_media_list(const char **data, size_t *len, uint64_t *media) { const char *p = *data; const char *end = p + *len; uint64_t result = 0; /* [ ',' ]* */ while (p < end) { const char *start = p; /* consume a medium */ while (isspace(*p) == false && *p != ',') p++; if (p - start == 10 && strncasecmp(start, "projection", 10) == 0) result |= CSS_MEDIA_PROJECTION; else if (p - start == 8 && strncasecmp(start, "handheld", 8) == 0) result |= CSS_MEDIA_HANDHELD; else if (p - start == 8 && strncasecmp(start, "embossed", 8) == 0) result |= CSS_MEDIA_EMBOSSED; else if (p - start == 7 && strncasecmp(start, "braille", 7) == 0) result |= CSS_MEDIA_BRAILLE; else if (p - start == 6 && strncasecmp(start, "speech", 6) == 0) result |= CSS_MEDIA_SPEECH; else if (p - start == 6 && strncasecmp(start, "screen", 6) == 0) result |= CSS_MEDIA_SCREEN; else if (p - start == 5 && strncasecmp(start, "print", 5) == 0) result |= CSS_MEDIA_PRINT; else if (p - start == 5 && strncasecmp(start, "aural", 5) == 0) result |= CSS_MEDIA_AURAL; else if (p - start == 3 && strncasecmp(start, "tty", 3) == 0) result |= CSS_MEDIA_TTY; else if (p - start == 3 && strncasecmp(start, "all", 3) == 0) result |= CSS_MEDIA_ALL; else if (p - start == 2 && strncasecmp(start, "tv", 2) == 0) result |= CSS_MEDIA_TV; else assert(0 && "Unknown media type"); /* Consume whitespace */ while (p < end && isspace(*p)) p++; /* Stop if we've reached the end */ if (p == end || *p != ',') break; /* Consume comma */ p++; /* Consume whitespace */ while (p < end && isspace(*p)) p++; } *media = result; *data = p; *len = end - p; } void css__parse_pseudo_list(const char **data, size_t *len, uint32_t *element) { const char *p = *data; const char *end = p + *len; /* [ ',' ]* */ *element = CSS_PSEUDO_ELEMENT_NONE; while (p < end) { const char *start = p; /* consume a pseudo */ while (isspace(*p) == false && *p != ',') p++; /* Pseudo elements */ if (p - start == 12 && strncasecmp(start, "first-letter", 12) == 0) *element = CSS_PSEUDO_ELEMENT_FIRST_LETTER; else if (p - start == 10 && strncasecmp(start, "first-line", 10) == 0) *element = CSS_PSEUDO_ELEMENT_FIRST_LINE; else if (p - start == 6 && strncasecmp(start, "before", 6) == 0) *element = CSS_PSEUDO_ELEMENT_BEFORE; else if (p - start == 5 && strncasecmp(start, "after", 5) == 0) *element = CSS_PSEUDO_ELEMENT_AFTER; else assert(0 && "Unknown pseudo"); /* Consume whitespace */ while (p < end && isspace(*p)) p++; /* Stop if we've reached the end */ if (p == end || *p != ',') break; /* Consume comma */ p++; /* Consume whitespace */ while (p < end && isspace(*p)) p++; } *data = p; *len = end - p; } void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { while (ctx->expused + len >= ctx->explen) { size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2; char *temp = realloc(ctx->exp, required); if (temp == NULL) { assert(0 && "No memory for expected output"); } ctx->exp = temp; ctx->explen = required; } memcpy(ctx->exp + ctx->expused, data, len); ctx->expused += len; } void run_test(line_ctx *ctx, const char *exp, size_t explen) { css_select_ctx *select; css_select_results *results; uint32_t i; char *buf; size_t buflen; static int testnum; UNUSED(exp); buf = malloc(8192); if (buf == NULL) { assert(0 && "No memory for result data"); } buflen = 8192; assert(css_select_ctx_create(&select) == CSS_OK); for (i = 0; i < ctx->n_sheets; i++) { assert(css_select_ctx_append_sheet(select, ctx->sheets[i].sheet, ctx->sheets[i].origin, ctx->sheets[i].media) == CSS_OK); } testnum++; assert(css_select_style(select, ctx->target, ctx->media, NULL, &select_handler, ctx, &results) == CSS_OK); assert(results->styles[ctx->pseudo_element] != NULL); dump_computed_style(results->styles[ctx->pseudo_element], buf, &buflen); if (8192 - buflen != explen || memcmp(buf, exp, explen) != 0) { printf("Expected (%u):\n%.*s\n", (int) explen, (int) explen, exp); printf("Result (%u):\n%.*s\n", (int) (8192 - buflen), (int) (8192 - buflen), buf); assert(0 && "Result doesn't match expected"); } /* Clean up */ css_select_results_destroy(results); css_select_ctx_destroy(select); destroy_tree(ctx->tree); for (i = 0; i < ctx->n_sheets; i++) { css_stylesheet_destroy(ctx->sheets[i].sheet); } ctx->tree = NULL; ctx->current = NULL; ctx->depth = 0; ctx->n_sheets = 0; free(ctx->sheets); ctx->sheets = NULL; ctx->target = NULL; free(buf); printf("Test %d: PASS\n", testnum); } void destroy_tree(node *root) { node *n, *p; uint32_t i; for (n = root->children; n != NULL; n = p) { p = n->next; destroy_tree(n); } for (i = 0; i < root->n_attrs; ++i) { lwc_string_unref(root->attrs[i].name); lwc_string_unref(root->attrs[i].value); } free(root->attrs); if (root->classes != NULL) { for (i = 0; i < root->n_classes; ++i) { lwc_string_unref(root->classes[i]); } free(root->classes); } if (root->libcss_node_data != NULL) { css_libcss_node_data_handler(&select_handler, CSS_NODE_DELETED, NULL, root, NULL, root->libcss_node_data); } lwc_string_unref(root->name); free(root); } css_error node_name(void *pw, void *n, css_qname *qname) { node *node = n; UNUSED(pw); qname->name = lwc_string_ref(node->name); return CSS_OK; } static css_error node_classes(void *pw, void *n, lwc_string ***classes, uint32_t *n_classes) { unsigned int i; node *node = n; UNUSED(pw); *classes = node->classes; *n_classes = node->n_classes; for (i = 0; i < *n_classes; i++) (*classes)[i] = lwc_string_ref(node->classes[i]); return CSS_OK; } css_error node_id(void *pw, void *n, lwc_string **id) { node *node = n; uint32_t i; line_ctx *lc = pw; for (i = 0; i < node->n_attrs; i++) { bool amatch = false; assert(lwc_string_caseless_isequal( node->attrs[i].name, lc->attr_id, &amatch) == lwc_error_ok); if (amatch == true) break; } if (i != node->n_attrs) *id = lwc_string_ref(node->attrs[i].value); else *id = NULL; return CSS_OK; } css_error named_ancestor_node(void *pw, void *n, const css_qname *qname, void **ancestor) { node *node = n; UNUSED(pw); for (node = node->parent; node != NULL; node = node->parent) { bool match = false; assert(lwc_string_caseless_isequal( qname->name, node->name, &match) == lwc_error_ok); if (match == true) break; } *ancestor = (void *) node; return CSS_OK; } css_error named_parent_node(void *pw, void *n, const css_qname *qname, void **parent) { node *node = n; UNUSED(pw); *parent = NULL; if (node->parent != NULL) { bool match = false; assert(lwc_string_caseless_isequal( qname->name, node->parent->name, &match) == lwc_error_ok); if (match == true) *parent = (void *) node->parent; } return CSS_OK; } css_error named_sibling_node(void *pw, void *n, const css_qname *qname, void **sibling) { node *node = n; UNUSED(pw); *sibling = NULL; if (node->prev != NULL) { bool match = false; assert(lwc_string_caseless_isequal( qname->name, node->prev->name, &match) == lwc_error_ok); if (match == true) *sibling = (void *) node->prev; } return CSS_OK; } css_error named_generic_sibling_node(void *pw, void *n, const css_qname *qname, void **sibling) { node *node = n; UNUSED(pw); for (node = node->prev; node != NULL; node = node->prev) { bool match = false; assert(lwc_string_caseless_isequal( qname->name, node->name, &match) == lwc_error_ok); if (match == true) break; } *sibling = (void *) node; return CSS_OK; } css_error parent_node(void *pw, void *n, void **parent) { node *node = n; UNUSED(pw); *parent = (void *) node->parent; return CSS_OK; } css_error sibling_node(void *pw, void *n, void **sibling) { node *node = n; UNUSED(pw); *sibling = (void *) node->prev; return CSS_OK; } css_error node_has_name(void *pw, void *n, const css_qname *qname, bool *match) { node *node = n; UNUSED(pw); if (lwc_string_length(qname->name) == 1 && lwc_string_data(qname->name)[0] == '*') *match = true; else assert(lwc_string_caseless_isequal(node->name, qname->name, match) == lwc_error_ok); return CSS_OK; } css_error node_has_class(void *pw, void *n, lwc_string *name, bool *match) { node *node = n; uint32_t i; line_ctx *ctx = pw; for (i = 0; i < node->n_attrs; i++) { bool amatch = false; assert(lwc_string_caseless_isequal( node->attrs[i].name, ctx->attr_class, &amatch) == lwc_error_ok); if (amatch == true) break; } /* Classes are case-sensitive in HTML */ if (i != node->n_attrs && name == node->attrs[i].value) *match = true; else *match = false; return CSS_OK; } css_error node_has_id(void *pw, void *n, lwc_string *name, bool *match) { node *node = n; uint32_t i; line_ctx *ctx = pw; for (i = 0; i < node->n_attrs; i++) { bool amatch = false; assert(lwc_string_caseless_isequal( node->attrs[i].name, ctx->attr_id, &amatch) == lwc_error_ok); if (amatch == true) break; } /* IDs are case-sensitive in HTML */ if (i != node->n_attrs && name == node->attrs[i].value) *match = true; else *match = false; return CSS_OK; } css_error node_has_attribute(void *pw, void *n, const css_qname *qname, bool *match) { node *node = n; uint32_t i; UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } return CSS_OK; } css_error node_has_attribute_equal(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { assert(lwc_string_caseless_isequal( node->attrs[i].name, value, match) == lwc_error_ok); } return CSS_OK; } css_error node_has_attribute_includes(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; size_t vlen = lwc_string_length(value); UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { const char *p; const char *start = lwc_string_data(node->attrs[i].value); const char *end = start + lwc_string_length(node->attrs[i].value); *match = false; for (p = start; p < end; p++) { if (*p == ' ') { if ((size_t) (p - start) == vlen && strncasecmp(start, lwc_string_data(value), vlen) == 0) { *match = true; break; } start = p + 1; } } } return CSS_OK; } css_error node_has_attribute_dashmatch(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; size_t vlen = lwc_string_length(value); UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { const char *p; const char *start = lwc_string_data(node->attrs[i].value); const char *end = start + lwc_string_length(node->attrs[i].value); *match = false; for (p = start; p < end; p++) { if (*p == '-') { if ((size_t) (p - start) == vlen && strncasecmp(start, lwc_string_data(value), vlen) == 0) { *match = true; break; } start = p + 1; } } } return CSS_OK; } css_error node_has_attribute_prefix(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { size_t len = lwc_string_length(node->attrs[i].value); const char *data = lwc_string_data(node->attrs[i].value); size_t vlen = lwc_string_length(value); const char *vdata = lwc_string_data(value); if (len < vlen) *match = false; else *match = (strncasecmp(data, vdata, vlen) == 0); } return CSS_OK; } css_error node_has_attribute_suffix(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { size_t len = lwc_string_length(node->attrs[i].value); const char *data = lwc_string_data(node->attrs[i].value); size_t vlen = lwc_string_length(value); const char *vdata = lwc_string_data(value); size_t suffix_start = len - vlen; if (len < vlen) *match = false; else { *match = (strncasecmp(data + suffix_start, vdata, vlen) == 0); } } return CSS_OK; } css_error node_has_attribute_substring(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { node *node = n; uint32_t i; UNUSED(pw); *match = false; for (i = 0; i < node->n_attrs; i++) { assert(lwc_string_caseless_isequal( node->attrs[i].name, qname->name, match) == lwc_error_ok); if (*match == true) break; } if (*match == true) { size_t len = lwc_string_length(node->attrs[i].value); const char *data = lwc_string_data(node->attrs[i].value); size_t vlen = lwc_string_length(value); const char *vdata = lwc_string_data(value); const char *last_start = data + len - vlen; if (len < vlen) *match = false; else { while (data <= last_start) { if (strncasecmp(data, vdata, vlen) == 0) { *match = true; break; } data++; } if (data > last_start) *match = false; } } return CSS_OK; } css_error node_is_root(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); *match = (node->parent == NULL); return CSS_OK; } css_error node_count_siblings(void *pw, void *n, bool same_name, bool after, int32_t *count) { int32_t cnt = 0; bool match = false; node *node = n; lwc_string *name = node->name; UNUSED(pw); if (after) { while (node->next != NULL) { if (same_name) { assert(lwc_string_caseless_isequal( name, node->next->name, &match) == lwc_error_ok); if (match) cnt++; } else { cnt++; } node = node->next; } } else { while (node->prev != NULL) { if (same_name) { assert(lwc_string_caseless_isequal( name, node->prev->name, &match) == lwc_error_ok); if (match) cnt++; } else { cnt++; } node = node->prev; } } *count = cnt; return CSS_OK; } css_error node_is_empty(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); *match = (node->children == NULL); return CSS_OK; } css_error node_is_link(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_visited(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_hover(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_active(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_focus(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_enabled(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_disabled(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_checked(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_target(void *pw, void *n, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); *match = false; return CSS_OK; } css_error node_is_lang(void *pw, void *n, lwc_string *lang, bool *match) { node *node = n; UNUSED(pw); UNUSED(node); UNUSED(lang); *match = false; return CSS_OK; } css_error node_presentational_hint(void *pw, void *node, uint32_t property, css_hint *hint) { UNUSED(pw); UNUSED(node); UNUSED(property); UNUSED(hint); return CSS_PROPERTY_NOT_SET; } css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint) { UNUSED(pw); if (property == CSS_PROP_COLOR) { hint->data.color = 0xff000000; hint->status = CSS_COLOR_COLOR; } else if (property == CSS_PROP_FONT_FAMILY) { hint->data.strings = NULL; hint->status = CSS_FONT_FAMILY_SANS_SERIF; } else if (property == CSS_PROP_QUOTES) { /* Not exactly useful :) */ hint->data.strings = NULL; hint->status = CSS_QUOTES_NONE; } else if (property == CSS_PROP_VOICE_FAMILY) { /** \todo Fix this when we have voice-family done */ hint->data.strings = NULL; hint->status = 0; } else { return CSS_INVALID; } return CSS_OK; } css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size) { static css_hint_length sizes[] = { { FLTTOFIX(6.75), CSS_UNIT_PT }, { FLTTOFIX(7.50), CSS_UNIT_PT }, { FLTTOFIX(9.75), CSS_UNIT_PT }, { FLTTOFIX(12.0), CSS_UNIT_PT }, { FLTTOFIX(13.5), CSS_UNIT_PT }, { FLTTOFIX(18.0), CSS_UNIT_PT }, { FLTTOFIX(24.0), CSS_UNIT_PT } }; const css_hint_length *parent_size; UNUSED(pw); /* Grab parent size, defaulting to medium if none */ if (parent == NULL) { parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1]; } else { assert(parent->status == CSS_FONT_SIZE_DIMENSION); assert(parent->data.length.unit != CSS_UNIT_EM); assert(parent->data.length.unit != CSS_UNIT_EX); parent_size = &parent->data.length; } assert(size->status != CSS_FONT_SIZE_INHERIT); if (size->status < CSS_FONT_SIZE_LARGER) { /* Keyword -- simple */ size->data.length = sizes[size->status - 1]; } else if (size->status == CSS_FONT_SIZE_LARGER) { /** \todo Step within table, if appropriate */ size->data.length.value = FMUL(parent_size->value, FLTTOFIX(1.2)); size->data.length.unit = parent_size->unit; } else if (size->status == CSS_FONT_SIZE_SMALLER) { /** \todo Step within table, if appropriate */ size->data.length.value = FMUL(parent_size->value, FLTTOFIX(1.2)); size->data.length.unit = parent_size->unit; } else if (size->data.length.unit == CSS_UNIT_EM || size->data.length.unit == CSS_UNIT_EX) { size->data.length.value = FMUL(size->data.length.value, parent_size->value); if (size->data.length.unit == CSS_UNIT_EX) { size->data.length.value = FMUL(size->data.length.value, FLTTOFIX(0.6)); } size->data.length.unit = parent_size->unit; } else if (size->data.length.unit == CSS_UNIT_PCT) { size->data.length.value = FDIV(FMUL(size->data.length.value, parent_size->value), FLTTOFIX(100)); size->data.length.unit = parent_size->unit; } size->status = CSS_FONT_SIZE_DIMENSION; return CSS_OK; } static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data) { node *node = n; UNUSED(pw); node->libcss_node_data = libcss_node_data; return CSS_OK; } netsurf-all-3.2/libcss/test/csdetect.c0000644000175000017500000000505112377676736017035 0ustar vincevince#include #include #include #include #include #include #include #include "charset/detect.h" #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { size_t buflen; size_t bufused; uint8_t *buf; char enc[64]; bool indata; bool inenc; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(const uint8_t *data, size_t len, char *expected); int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.buf[0] = '\0'; ctx.enc[0] = '\0'; ctx.bufused = 0; ctx.indata = false; ctx.inenc = false; assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') ctx.bufused -= 1; run_test(ctx.buf, ctx.bufused, ctx.enc); free(ctx.buf); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inenc) { /* This marks end of testcase, so run it */ if (ctx->buf[ctx->bufused - 1] == '\n') ctx->bufused -= 1; run_test(ctx->buf, ctx->bufused, ctx->enc); ctx->buf[0] = '\0'; ctx->enc[0] = '\0'; ctx->bufused = 0; } ctx->indata = (strncasecmp(data+1, "data", 4) == 0); ctx->inenc = (strncasecmp(data+1, "encoding", 8) == 0); } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inenc) { strcpy(ctx->enc, data); if (ctx->enc[strlen(ctx->enc) - 1] == '\n') ctx->enc[strlen(ctx->enc) - 1] = '\0'; } } return true; } void run_test(const uint8_t *data, size_t len, char *expected) { uint16_t mibenum = 0; css_charset_source source = CSS_CHARSET_DEFAULT; static int testnum; assert(css__charset_extract(data, len, &mibenum, &source) == PARSERUTILS_OK); assert(mibenum != 0); printf("%d: Detected charset %s (%d) Source %d Expected %s (%d)\n", ++testnum, parserutils_charset_mibenum_to_name(mibenum), mibenum, source, expected, parserutils_charset_mibenum_from_name( expected, strlen(expected))); assert(mibenum == parserutils_charset_mibenum_from_name( expected, strlen(expected))); } netsurf-all-3.2/libcss/test/parse2-auto.c0000644000175000017500000001205112377676736017377 0ustar vincevince#include #include #include #include #include #include #include #include "utils/utils.h" #include "dump.h" #include "testutils.h" /** \todo at some point, we need to extend this to handle nested blocks */ typedef struct line_ctx { size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; char *exp; bool indata; bool inerrors; bool inexp; bool inrule; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen); static css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs) { UNUSED(pw); UNUSED(base); /* About as useless as possible */ *abs = lwc_string_ref(rel); return CSS_OK; } static bool fail_because_lwc_leaked = false; static void printing_lwc_iterator(lwc_string *str, void *pw) { UNUSED(pw); printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str)); fail_because_lwc_leaked = true; } int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.buf[0] = '\0'; ctx.bufused = 0; ctx.explen = 0; ctx.expused = 0; ctx.exp = NULL; ctx.indata = false; ctx.inerrors = false; ctx.inexp = false; assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) run_test(ctx.buf, ctx.bufused, ctx.exp, ctx.expused); free(ctx.buf); free(ctx.exp); lwc_iterate_strings(printing_lwc_iterator, NULL); assert(fail_because_lwc_leaked == false); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ run_test(ctx->buf, ctx->bufused, ctx->exp, ctx->expused); ctx->buf[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; } if (ctx->indata && strncasecmp(data+1, "errors", 6) == 0) { ctx->indata = false; ctx->inerrors = true; ctx->inexp = false; } else if (ctx->inerrors && strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inerrors = false; ctx->inexp = true; ctx->inrule = false; } else if (ctx->inexp && strncasecmp(data+1, "data", 4) == 0) { ctx->indata = true; ctx->inerrors = false; ctx->inexp = false; } else if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } else { ctx->indata = (strncasecmp(data+1, "data", 4) == 0); ctx->inerrors = (strncasecmp(data+1, "errors", 6) == 0); ctx->inexp = (strncasecmp(data+1, "expected", 8) == 0); } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { css__parse_expected(ctx, data, datalen); } } return true; } void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { while (ctx->expused + len >= ctx->explen) { size_t required = ctx->explen == 0 ? 64 : ctx->explen * 2; char *temp = realloc(ctx->exp, required); if (temp == NULL) { assert(0 && "No memory for expected output"); } ctx->exp = temp; ctx->explen = required; } memcpy(ctx->exp + ctx->expused, data, len); ctx->expused += len; } void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) { css_stylesheet_params params; css_stylesheet *sheet; css_error error; char *buf; size_t buflen; static int testnum; buf = malloc(2 * explen); if (buf == NULL) { assert(0 && "No memory for result data"); } buflen = 2 * explen; params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1; params.level = CSS_LEVEL_21; params.charset = "UTF-8"; params.url = "foo"; params.title = NULL; params.allow_quirks = false; params.inline_style = false; params.resolve = resolve_url; params.resolve_pw = NULL; params.import = NULL; params.import_pw = NULL; params.color = NULL; params.color_pw = NULL; params.font = NULL; params.font_pw = NULL; assert(css_stylesheet_create(¶ms, &sheet) == CSS_OK); error = css_stylesheet_append_data(sheet, data, len); if (error != CSS_OK && error != CSS_NEEDDATA) { printf("Failed appending data: %d\n", error); assert(0); } assert(css_stylesheet_data_done(sheet) == CSS_OK); testnum++; dump_sheet(sheet, buf, &buflen); if (2 * explen - buflen != explen || memcmp(buf, exp, explen) != 0) { printf("Expected (%u):\n%.*s\n", (int) explen, (int) explen, exp); printf("Result (%u):\n%.*s\n", (int) (2 * explen - buflen), (int) (2 * explen - buflen), buf); assert(0 && "Result doesn't match expected"); } css_stylesheet_destroy(sheet); free(buf); printf("Test %d: PASS\n", testnum); } netsurf-all-3.2/libcss/test/number.c0000644000175000017500000000713212377676736016531 0ustar vincevince#include #include #include #include #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { size_t buflen; size_t bufused; uint8_t *buf; size_t explen; char exp[256]; bool indata; bool inexp; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen); static void print_css_fixed(char *buf, size_t len, css_fixed f); int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.buf[0] = '\0'; ctx.bufused = 0; ctx.explen = 0; ctx.indata = false; ctx.inexp = false; assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) run_test(ctx.buf, ctx.bufused - 1, ctx.exp, ctx.explen); free(ctx.buf); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ run_test(ctx->buf, ctx->bufused - 1, ctx->exp, ctx->explen); ctx->buf[0] = '\0'; ctx->bufused = 0; ctx->explen = 0; } if (ctx->indata && strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; } else if (!ctx->indata) { ctx->indata = (strncasecmp(data+1, "data", 4) == 0); ctx->inexp = (strncasecmp(data+1, "expected", 8) == 0); } else { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { if (data[datalen - 1] == '\n') datalen -= 1; memcpy(ctx->exp, data, datalen); ctx->explen = datalen; } } return true; } void run_test(const uint8_t *data, size_t len, const char *exp, size_t explen) { lwc_string *in; size_t consumed; css_fixed result; char buf[256]; UNUSED(exp); UNUSED(explen); assert(lwc_intern_string((const char *)data, len, &in) == lwc_error_ok); result = css__number_from_lwc_string(in, false, &consumed); print_css_fixed(buf, sizeof(buf), result); printf("got: %s expected: %.*s\n", buf, (int) explen, exp); assert(strncmp(buf, exp, explen) == 0); lwc_string_unref(in); } void print_css_fixed(char *buf, size_t len, css_fixed f) { #define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x)) uint32_t uintpart = FIXTOINT(ABS(f)); /* + 500 to ensure round to nearest (division will truncate) */ uint32_t fracpart = ((ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10); #undef ABS size_t flen = 0; char tmp[20]; size_t tlen = 0; if (len == 0) return; if (f < 0) { buf[0] = '-'; buf++; len--; } do { tmp[tlen] = "0123456789"[uintpart % 10]; tlen++; uintpart /= 10; } while (tlen < 20 && uintpart != 0); while (len > 0 && tlen > 0) { buf[0] = tmp[--tlen]; buf++; len--; } if (len > 0) { buf[0] = '.'; buf++; len--; } do { tmp[tlen] = "0123456789"[fracpart % 10]; tlen++; fracpart /= 10; } while (tlen < 20 && fracpart != 0); while (len > 0 && tlen > 0) { buf[0] = tmp[--tlen]; buf++; len--; flen++; } while (len > 0 && flen < 3) { buf[0] = '0'; buf++; len--; flen++; } if (len > 0) { buf[0] = '\0'; buf++; len--; } } netsurf-all-3.2/libcss/test/select-no-nd.c0000644000175000017500000000040412377676736017524 0ustar vincevince #include "select-common.c" static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data) { UNUSED(pw); UNUSED(n); /* Test case were node data is deleted, by not passing any node data */ *libcss_node_data = NULL; return CSS_OK; } netsurf-all-3.2/libcss/test/data/0000755000175000017500000000000012377713347015771 5ustar vincevincenetsurf-all-3.2/libcss/test/data/number/0000755000175000017500000000000012377713347017261 5ustar vincevincenetsurf-all-3.2/libcss/test/data/number/INDEX0000644000175000017500000000012612377676736020064 0ustar vincevince# Index file for generic CSS content # # Test Description number.dat Number tests netsurf-all-3.2/libcss/test/data/number/number.dat0000644000175000017500000000150312377676736021254 0ustar vincevince#data 1 #expected 1.000 #reset #data .0 #expected 0.000 #reset #data .5 #expected 0.500 #reset #data .999 #expected 0.999 #reset #data 2097151 #expected 2097151.000 #reset #data 2097152 #expected 2097151.999 #reset #data -1 #expected -1.000 #reset #data -.0 #expected 0.000 #reset #data -.5 #expected -0.500 #reset #data -.999 #expected -0.999 #reset #data -2097151 #expected -2097151.000 #reset #data -2097152 #expected -2097152 #reset #data -2097153 #expected -2097152 #reset #data -x #expected 0.000 #reset #data +x #expected 0.000 #reset #data x #expected 0.000 #reset #data 1.x #expected 1.000 #reset #data .x #expected 0.000 #reset #data - #expected 0.000 #reset #data + #expected 0.000 #reset #data 0.12345 #expected 0.123 #reset #data 0.12367 #expected 0.124 #reset #data 0.999512 #expected 1.000 #reset netsurf-all-3.2/libcss/test/data/parse/0000755000175000017500000000000012377713347017103 5ustar vincevincenetsurf-all-3.2/libcss/test/data/parse/atrules.dat0000644000175000017500000000032112377676736021262 0ustar vincevince## Basic @-rules #data @charset "UTF-8"; #errors #expected | 2 UTF-8 #reset #data @import "foo.css"; #errors #expected | 3 foo.css #reset #data @import url("bar.css"); #errors #expected | 3 bar.css #reset netsurf-all-3.2/libcss/test/data/parse/colours-hsl.dat0000644000175000017500000000301712377676736022062 0ustar vincevince## simple HSL color values ## red #data * { color: hsl(0, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset ## yellow #data * { color: hsl(60, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xffffff00 #reset ## green #data * { color: hsl(120, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xff00ff00 #reset ## cyan #data * { color: hsl(180, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xff00ffff #reset ## blue #data * { color: hsl(240, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xff0000ff #reset ## Magenta #data * { color: hsl(300, 100%, 50%) } #errors #expected | 1 * | 0x02000018 0xffff00ff #reset ## Selection of different HSL values #data * { color: hsl(0, 0%, 0%) } #errors #expected | 1 * | 0x02000018 0xff000000 #reset #data * { color: hsl(0, 0%, 100%) } #errors #expected | 1 * | 0x02000018 0xffffffff #reset #data * { color: hsl(0, 0%, 40%) } #errors #expected | 1 * | 0x02000018 0xff666666 #reset #data * { color: hsl(12, 44%, 66%) } #errors #expected | 1 * | 0x02000018 0xffCE9182 #reset #data * { color: hsl(69, 22%, 11%) } #errors #expected | 1 * | 0x02000018 0xff202215 #reset #data * { color: hsl(111, 22%, 33%) } #errors #expected | 1 * | 0x02000018 0xff476641 #reset #data * { color: hsl(188, 50%, 75%) } #errors #expected | 1 * | 0x02000018 0xff9FD6DF #reset #data * { color: hsl(222, 22%, 22%) } #errors #expected | 1 * | 0x02000018 0xff2b3344 #reset #data * { color: hsl(300, 30%, 30%) } #errors #expected | 1 * | 0x02000018 0xff633563 #reset netsurf-all-3.2/libcss/test/data/parse/README0000644000175000017500000000171712377676736020003 0ustar vincevinceParser testcases ================ Format ------ #data #errors (ignored at present) #expected #reset Format of rule list ------------------- line ::= rule | bytecode rule ::= '| ' type ' '+ name name ::= .+ type ::= [0-9]+ bytecode ::= '| ' ' '* hexnum (' '+ (hexnum | ptr))* hexnum ::= '0x' [0-9a-fA-F]+ ptr ::= 'PTR(' .* ')' Type corresponds to css_rule_type. Consult the library sources for the values. Bytecode may be split over multiple lines for readability. All bytecode is associated with the most-recently-declared rule. Consult the bytecode documentation for what the hexnums should be representing. Example ------- #data * { color: #ff0000; background-image: url("foo.png"); } #errors #expected | 1 * | 0x0200000f 0xff000000 | 0x02000003 PTR(foo.png) #reset TODO ---- + Permit nesting of rules (for nested block support) netsurf-all-3.2/libcss/test/data/parse/tests1.dat0000644000175000017500000000077112377676736021037 0ustar vincevince#data * { } #errors #expected | 1 * #reset #data * { color: #ff0000 } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: inherit } #errors #expected | 1 * | 0x00000818 #reset #data * { color: inherit ! important } #errors #expected | 1 * | 0x00000c18 #reset #data * { color: inherit !important } #errors #expected | 1 * | 0x00000c18 #reset #data * { background-image: url("foo.png"); color: inherit } #errors #expected | 1 * | 0x02000003 PTR(foo.png) 0x00000818 #reset netsurf-all-3.2/libcss/test/data/parse/INDEX0000644000175000017500000000037412377676736017713 0ustar vincevince# Index file for automated parser tests # # Test Description tests1.dat Basic tests selectors.dat Selectors atrules.dat @-rules colours.dat Colour values colours-hsl.dat HSL Colour values nth.dat :nth-* expressions properties.dat Properties netsurf-all-3.2/libcss/test/data/parse/colours.dat0000644000175000017500000000407312377676736021301 0ustar vincevince## Simple colour values #data * { color: red } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: #f00 } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: #ff0000 } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgb(255, 0, 0) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgb(100%, 0%, 0%) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: transparent } #errors #expected | 1 * | 0x00000018 #reset #data * { color: currentColor } #errors #expected | 1 * | 0x00040018 #reset #data * { opacity: 0 } #errors #expected | 1 * | 0x02000063 0x00000000 #reset #data * { opacity: 0.22 } #errors #expected | 1 * | 0x02000063 0x000000e1 #reset #data * { opacity: 0.22 !important } #errors #expected | 1 * | 0x02000463 0x000000e1 #reset #data * { opacity: inherit } #errors #expected | 1 * | 0x00000863 #reset #data * { opacity: inherit !important } #errors #expected | 1 * | 0x00000c63 #reset ## Out-of-range rgb() parameters #data * { color: rgb(300, 0, 0) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgb(-10, 0, 0) } #errors #expected | 1 * | 0x02000018 0xff000000 #reset #data * { color: rgb(150%, 0%, 0%) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgb(-10%, 0%, 0%) } #errors #expected | 1 * | 0x02000018 0xff000000 #reset #data * { color: rgba(255, 0, 0, 0) } #errors #expected | 1 * | 0x02000018 0x00ff0000 #reset #data * { color: rgba(255, 0, 0, 0.5) } #errors #expected | 1 * | 0x02000018 0x7fff0000 #reset #data * { color: rgba(255, 0, 0, 1.1) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgba(255, 0, 0, 128) } #errors #expected | 1 * | 0x02000018 0xffff0000 #reset #data * { color: rgba(-255, 0, 0, -255) } #errors #expected | 1 * | 0x02000018 0x00000000 #reset #data * { opacity: -0.22 } #errors #expected | 1 * | 0x02000063 0x00000000 #reset #data * { opacity: 1.22 } #errors #expected | 1 * | 0x02000063 0x00000400 #reset netsurf-all-3.2/libcss/test/data/parse/properties.dat0000644000175000017500000015334212377676736022013 0ustar vincevince## ## 00 - azimuth ## #data * { azimuth: left-side; } #errors #expected | 1 * | 0x00000000 #reset #data * { azimuth: far-left; } #errors #expected | 1 * | 0x00040000 #reset #data * { azimuth: left; } #errors #expected | 1 * | 0x00080000 #reset #data * { azimuth: center-left; } #errors #expected | 1 * | 0x000c0000 #reset #data * { azimuth: center-left; !important } #errors #expected | 1 * | 0x000c0000 #reset #data * { azimuth: center-left !important; } #errors #expected | 1 * | 0x000c0400 #reset #data * { azimuth: center-left ! important; } #errors #expected | 1 * | 0x000c0400 #reset #data * { azimuth: center; } #errors #expected | 1 * | 0x00100000 #reset #data * { azimuth: center-right; } #errors #expected | 1 * | 0x00140000 #reset #data * { azimuth: right; } #errors #expected | 1 * | 0x00180000 #reset #data * { azimuth: far-right; } #errors #expected | 1 * | 0x001c0000 #reset #data * { azimuth: right-side; } #errors #expected | 1 * | 0x00200000 #reset #data * { azimuth: behind; } #errors #expected | 1 * | 0x00900000 #reset #data * { azimuth: behind far-right; } #errors #expected | 1 * | 0x009c0000 #reset #data * { azimuth: far-right behind; } #errors #expected | 1 * | 0x009c0000 #reset #data * { azimuth: behind !important; } #errors #expected | 1 * | 0x00900400 #reset #data * { azimuth: behind far-right !important; } #errors #expected | 1 * | 0x009c0400 #reset #data * { azimuth: far-right behind !important; } #errors #expected | 1 * | 0x009c0400 #reset #data * { azimuth: far-right; } #errors #expected | 1 * | 0x001c0000 #reset #data * { azimuth: far-right !important behind; } #errors #expected | 1 * #reset #data * { azimuth: leftwards; } #errors #expected | 1 * | 0x01000000 #reset #data * { azimuth: rightwards; } #errors #expected | 1 * | 0x01040000 #reset #data * { azimuth: 45deg; } #errors #expected | 1 * | 0x02000000 0x0000b400 0x00000200 #reset #data * { azimuth: -45deg; } #errors #expected | 1 * | 0x02000000 0xffff4c00 0x00000200 #reset #data * { azimuth: 50grad; } #errors #expected | 1 * | 0x02000000 0x0000c800 0x00000201 #reset #data * { azimuth: 0.785rad; } #errors #expected | 1 * | 0x02000000 0x00000324 0x00000202 #reset #data * { azimuth: -0.785rad; } #errors #expected | 1 * | 0x02000000 0xfffffcdc 0x00000202 #reset ## ## 01 - background-attachment ## #data * { background-attachment: fixed; } #errors #expected | 1 * | 0x00000001 #reset #data * { background-attachment: scroll; } #errors #expected | 1 * | 0x00040001 #reset ## ## 02 - background-color ## #data * { background-color: #f08; } #errors #expected | 1 * | 0x02000002 0xffff0088 #reset #data * { background-color: transparent; } #errors #expected | 1 * | 0x00000002 #reset #data * { background-color: currentColor } #errors #expected | 1 * | 0x00040002 #reset ## ## 03 - background-image ## #data * { background-image: url(netsurf.png); } #errors #expected | 1 * | 0x02000003 PTR(netsurf.png) #reset #data * { background-image: url("netsurf.png"); } #errors #expected | 1 * | 0x02000003 PTR(netsurf.png) #reset #data * { background-image: none; } #errors #expected | 1 * | 0x00000003 #reset ## ## 04 - background-position ## #data * { background-position: left; } #errors #expected | 1 * | 0x00800004 #reset #data * { background-position: center; } #errors #expected | 1 * | 0x00000004 #reset #data * { background-position: right; } #errors #expected | 1 * | 0x00400004 #reset #data * { background-position: top; } #errors #expected | 1 * | 0x00080004 #reset #data * { background-position: bottom; } #errors #expected | 1 * | 0x00040004 #reset #data * { background-position: right bottom; } #errors #expected | 1 * | 0x00440004 #reset #data * { background-position: 10%; } #errors #expected | 1 * | 0x02000004 0x00002800 0x00000100 #reset #data * { background-position: 2px; } #errors #expected | 1 * | 0x02000004 0x00000800 0x00000000 #reset #data * { background-position: 10% 20%; } #errors #expected | 1 * | 0x02200004 0x00002800 0x00000100 0x00005000 0x00000100 #reset #data * { background-position: 10% 2px; } #errors #expected | 1 * | 0x02200004 0x00002800 0x00000100 0x00000800 0x00000000 #reset #data * { background-position: 2px bottom; } #errors #expected | 1 * | 0x02040004 0x00000800 0x00000000 #reset # possible quirk ##data #* { background-position: bottom 2px; } ##errors ##expected #| 1 * #| 0x02040004 0x00000800 0x00000000 ##reset #data * { background-position: left 10%; } #errors #expected | 1 * | 0x00a00004 0x00002800 0x00000100 #reset #data * { background-position: 10% 20% !important; } #errors #expected | 1 * | 0x02200404 0x00002800 0x00000100 0x00005000 0x00000100 #reset ## ## 05 - background-repeat ## #data * { background-repeat: no-repeat; } #errors #expected | 1 * | 0x00000005 #reset #data * { background-repeat: repeat-x; } #errors #expected | 1 * | 0x00040005 #reset #data * { background-repeat: repeat-y; } #errors #expected | 1 * | 0x00080005 #reset #data * { background-repeat: repeat; } #errors #expected | 1 * | 0x000c0005 #reset ## ## 06 - border-collapse ## #data * { border-collapse: separate; } #errors #expected | 1 * | 0x00000006 #reset #data * { border-collapse: collapse; } #errors #expected | 1 * | 0x00040006 #reset ## ## 07 - border-spacing ## #data * { border-spacing: 3em; } #errors #expected | 1 * | 0x02000007 0x00000c00 0x00000002 0x00000c00 0x00000002 #reset #data * { border-spacing: 2.5em 2.5em; } #errors #expected | 1 * | 0x02000007 0x00000a00 0x00000002 0x00000a00 0x00000002 #reset #data * { border-spacing: 3px 2.5em; } #errors #expected | 1 * | 0x02000007 0x00000c00 0x00000000 0x00000a00 0x00000002 #reset #data * { border-spacing: 3em !important; } #errors #expected | 1 * | 0x02000407 0x00000c00 0x00000002 0x00000c00 0x00000002 #reset #data * { border-spacing: 2.5em 2.5em !important; } #errors #expected | 1 * | 0x02000407 0x00000a00 0x00000002 0x00000a00 0x00000002 #reset #data * { border-spacing: 3px 2.5em !important; } #errors #expected | 1 * | 0x02000407 0x00000c00 0x00000000 0x00000a00 0x00000002 #reset ## ## 08 - border-top-color ## 09 - border-right-color ## 0a - border-bottom-color ## 0b - border-left-color ## #data * { border-top-color: #f48; } #errors #expected | 1 * | 0x02000008 0xffff4488 #reset #data * { border-right-color: #82b; } #errors #expected | 1 * | 0x02000009 0xff8822bb #reset #data * { border-bottom-color: #BBC; } #errors #expected | 1 * | 0x0200000a 0xffbbbbcc #reset #data * { border-left-color: transparent; } #errors #expected | 1 * | 0x0000000b #reset #data * { border-left-color: currentColor } #errors #expected | 1 * | 0x0004000b #reset ## ## 0c - border-top-style ## 0d - border-right-style ## 0e - border-bottom-style ## 0f - border-left-style ## #data * { border-top-style: none; } #errors #expected | 1 * | 0x0000000c #reset #data * { border-top-style: hidden; } #errors #expected | 1 * | 0x0004000c #reset #data * { border-right-style: dotted; } #errors #expected | 1 * | 0x0008000d #reset #data * { border-right-style: dashed; } #errors #expected | 1 * | 0x000c000d #reset #data * { border-bottom-style: solid; } #errors #expected | 1 * | 0x0010000e #reset #data * { border-bottom-style: double; } #errors #expected | 1 * | 0x0014000e #reset #data * { border-left-style: groove; } #errors #expected | 1 * | 0x0018000f #reset #data * { border-left-style: ridge; } #errors #expected | 1 * | 0x001c000f #reset #data * { border-top-style: inset; } #errors #expected | 1 * | 0x0020000c #reset #data * { border-top-style: outset; } #errors #expected | 1 * | 0x0024000c #reset ## ## 10 - border-top-width ## 11 - border-right-width ## 12 - border-bottom-width ## 13 - border-left-width ## #data * { border-top-width: thin; } #errors #expected | 1 * | 0x00000010 #reset #data * { border-right-width: medium; } #errors #expected | 1 * | 0x00040011 #reset #data * { border-bottom-width: thick; } #errors #expected | 1 * | 0x00080012 #reset #data * { border-left-width: 0; } #errors #expected | 1 * | 0x02000013 0x00000000 0x00000000 #reset #data * { border-top-width: 2px; } #errors #expected | 1 * | 0x02000010 0x00000800 0x00000000 #reset ## ## 14 - bottom ## #data * { bottom: auto; } #errors #expected | 1 * | 0x00000014 #reset #data * { bottom: 0.75em; } #errors #expected | 1 * | 0x02000014 0x00000300 0x00000002 #reset #data * { bottom: 66.667%; } #errors #expected | 1 * | 0x02000014 0x00010aab 0x00000100 #reset ## ## 15 - caption-side ## #data * { caption-side: top; } #errors #expected | 1 * | 0x00000015 #reset #data * { caption-side: bottom; } #errors #expected | 1 * | 0x00040015 #reset ## ## 16 - clear ## #data * { clear: none; } #errors #expected | 1 * | 0x00000016 #reset #data * { clear: left; } #errors #expected | 1 * | 0x00040016 #reset #data * { clear: right; } #errors #expected | 1 * | 0x00080016 #reset #data * { clear: both; } #errors #expected | 1 * | 0x000c0016 #reset ## ## 17 - clip ## #data * { clip: auto; } #errors #expected | 1 * | 0x00000017 #reset #data * { clip: rect(10px, auto, auto, 10px); } #errors #expected | 1 * | 0x02c00017 0x00002800 0x00000000 0x00002800 0x00000000 #reset #data * { clip: rect(auto, auto, auto, auto); } #errors #expected | 1 * | 0x03e00017 #reset #data * { clip: rect(1px, 2px, 3px, 4px); } #errors #expected | 1 * | 0x02000017 0x00000400 0x00000000 0x00000800 0x00000000 0x00000c00 0x00000000 0x00001000 0x00000000 #reset #data * { clip: rect(auto 1em 1em auto); } #errors #expected | 1 * | 0x03200017 0x00000400 0x00000002 0x00000400 0x00000002 #reset #data * { clip: rect(0px, 220px, 1.7em, 0px) } #errors #expected | 1 * | 0x02000017 0x00000000 0x00000000 0x00037000 0x00000000 0x000006cd 0x00000002 0x00000000 0x00000000 #reset #data * { clip: auto !important; } #errors #expected | 1 * | 0x00000417 #reset #data * { clip: rect(10px, auto, auto, 10px) !important; } #errors #expected | 1 * | 0x02c00417 0x00002800 0x00000000 0x00002800 0x00000000 #reset #data * { clip: rect(auto, auto, auto, auto) !important; } #errors #expected | 1 * | 0x03e00417 #reset #data * { clip: rect(1px, 2px, 3px, 4px) !important; } #errors #expected | 1 * | 0x02000417 0x00000400 0x00000000 0x00000800 0x00000000 0x00000c00 0x00000000 0x00001000 0x00000000 #reset #data * { clip: rect(auto 1em 1em auto) !important; } #errors #expected | 1 * | 0x03200417 0x00000400 0x00000002 0x00000400 0x00000002 #reset #data * { clip: rect(0px, 220px, 1.7em, 0px) !important } #errors #expected | 1 * | 0x02000417 0x00000000 0x00000000 0x00037000 0x00000000 0x000006cd 0x00000002 0x00000000 0x00000000 #reset ## ## 18 - color ## ## more fully tested in colours.dat #data * { color: #BBC } #errors #expected | 1 * | 0x02000018 0xffbbbbcc #reset ## more fully tested in colours-hsl.dat #data * { color: hsl(240,15%,77%) } #errors #expected | 1 * | 0x02000018 0xffbbbbcd #reset ## ## 19 - content ## #data p:after { content: normal; } #errors #expected | 1 p:after | 0x00000019 #reset #data p:after { content: none; } #errors #expected | 1 p:after | 0x00040019 #reset #data p:before { content: open-quote; } #errors #expected | 1 p:before | 0x00080019 0x00000000 #reset #data p:after { content: close-quote; } #errors #expected | 1 p:after | 0x000c0019 0x00000000 #reset #data p:before { content: no-open-quote; } #errors #expected | 1 p:before | 0x00100019 0x00000000 #reset #data p:after { content: no-close-quote; } #errors #expected | 1 p:after | 0x00140019 0x00000000 #reset #data a:after { content: " a"; } #errors #expected | 1 a:after | 0x02000019 PTR( a) 0x00000000 #reset #data p:after { content: url("http://www.netsurf-browser.org/"); } #errors #expected | 1 p:after | 0x02040019 PTR(http://www.netsurf-browser.org/) 0x00000000 #reset #data p:after { content: counter(n); } #errors #expected | 1 p:after | 0x0e080019 PTR(n) 0x00000000 #reset #data p:after { content: counter(n, upper-roman); } #errors #expected | 1 p:after | 0x1a080019 PTR(n) 0x00000000 #reset #data p:after { content: counters(n, "."); } #errors #expected | 1 p:after | 0x0e0c0019 PTR(n) PTR(.) 0x00000000 #reset #data p:after { content: counters(n, '.', disc); } #errors #expected | 1 p:after | 0x020c0019 PTR(n) PTR(.) 0x00000000 #reset #data p:after { content: attr(name); } #errors #expected | 1 p:after | 0x02100019 PTR(name) 0x00000000 #reset #data h2:before { content: "Chapter " counter(chapters) ': \''; } #errors #expected | 1 h2:before | 0x02000019 PTR(Chapter ) 0x00000382 PTR(chapters) 0x00000080 PTR(: ') 0x00000000 #reset #data p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " attr(name) " " counter(x) "." counters(y, ".") close-quote; } #errors #expected | 1 p:before | 0x00080019 0x00000081 PTR(http://picodrive.acornarcade.com/) 0x00000080 PTR( : ) 0x00000084 PTR(name) 0x00000080 PTR( ) 0x00000382 PTR(x) 0x00000080 PTR(.) 0x00000383 PTR(y) PTR(.) 0x00000003 0x00000000 #reset #data p:after { content: normal !important; } #errors #expected | 1 p:after | 0x00000419 #reset #data p:after { content: none !important; } #errors #expected | 1 p:after | 0x00040419 #reset #data p:before { content: open-quote !important; } #errors #expected | 1 p:before | 0x00080419 0x00000000 #reset #data p:after { content: close-quote !important; } #errors #expected | 1 p:after | 0x000c0419 0x00000000 #reset #data p:before { content: no-open-quote !important; } #errors #expected | 1 p:before | 0x00100419 0x00000000 #reset #data p:after { content: no-close-quote !important; } #errors #expected | 1 p:after | 0x00140419 0x00000000 #reset #data a:after { content: " a" !important; } #errors #expected | 1 a:after | 0x02000419 PTR( a) 0x00000000 #reset #data p:after { content: url("http://www.netsurf-browser.org/") !important; } #errors #expected | 1 p:after | 0x02040419 PTR(http://www.netsurf-browser.org/) 0x00000000 #reset #data p:after { content: counter(n) !important; } #errors #expected | 1 p:after | 0x0e080419 PTR(n) 0x00000000 #reset #data p:after { content: counter(n, upper-roman) !important; } #errors #expected | 1 p:after | 0x1a080419 PTR(n) 0x00000000 #reset #data p:after { content: counters(n, ".") !important; } #errors #expected | 1 p:after | 0x0e0c0419 PTR(n) PTR(.) 0x00000000 #reset #data p:after { content: counters(n, '.', disc) !important; } #errors #expected | 1 p:after | 0x020c0419 PTR(n) PTR(.) 0x00000000 #reset #data p:after { content: attr(name) !important; } #errors #expected | 1 p:after | 0x02100419 PTR(name) 0x00000000 #reset #data h2:before { content: "Chapter " counter(chapters) ': \'' !important; } #errors #expected | 1 h2:before | 0x02000419 PTR(Chapter ) 0x00000382 PTR(chapters) 0x00000080 PTR(: ') 0x00000000 #reset #data p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " attr(name) " " counter(x) "." counters(y, ".") close-quote !important; } #errors #expected | 1 p:before | 0x00080419 0x00000081 PTR(http://picodrive.acornarcade.com/) 0x00000080 PTR( : ) 0x00000084 PTR(name) 0x00000080 PTR( ) 0x00000382 PTR(x) 0x00000080 PTR(.) 0x00000383 PTR(y) PTR(.) 0x00000003 0x00000000 #reset ## ## 1a - counter-increment ## #data * { counter-increment: none; } #errors #expected | 1 * | 0x0000001a #reset #data * { counter-increment: a; } #errors #expected | 1 * | 0x0200001a PTR(a) 0x00000400 0x00000000 #reset #data * { counter-increment: moose 10; } #errors #expected | 1 * | 0x0200001a PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-increment: a moose 10; } #errors #expected | 1 * | 0x0200001a PTR(a) 0x00000400 0x00000080 PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-increment: a 2 moose; } #errors #expected | 1 * | 0x0200001a PTR(a) 0x00000800 0x00000080 PTR(moose) 0x00000400 0x00000000 #reset #data * { counter-increment: moose a; } #errors #expected | 1 * | 0x0200001a PTR(moose) 0x00000400 0x00000080 PTR(a) 0x00000400 0x00000000 #reset #data * { counter-increment: none !important; } #errors #expected | 1 * | 0x0000041a #reset #data * { counter-increment: a !important; } #errors #expected | 1 * | 0x0200041a PTR(a) 0x00000400 0x00000000 #reset #data * { counter-increment: moose 10 !important; } #errors #expected | 1 * | 0x0200041a PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-increment: a moose 10 !important; } #errors #expected | 1 * | 0x0200041a PTR(a) 0x00000400 0x00000080 PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-increment: a 2 moose !important; } #errors #expected | 1 * | 0x0200041a PTR(a) 0x00000800 0x00000080 PTR(moose) 0x00000400 0x00000000 #reset #data * { counter-increment: moose a !important; } #errors #expected | 1 * | 0x0200041a PTR(moose) 0x00000400 0x00000080 PTR(a) 0x00000400 0x00000000 #reset ## ## 1b - counter-reset ## #data * { counter-reset: none; } #errors #expected | 1 * | 0x0000001b #reset #data * { counter-reset: a; } #errors #expected | 1 * | 0x0200001b PTR(a) 0x00000000 0x00000000 #reset #data * { counter-reset: moose 10; } #errors #expected | 1 * | 0x0200001b PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-reset: a moose 10; } #errors #expected | 1 * | 0x0200001b PTR(a) 0x00000000 0x00000080 PTR(moose) 0x00002800 0x00000000 #reset #data * { counter-reset: a 2 moose; } #errors #expected | 1 * | 0x0200001b PTR(a) 0x00000800 0x00000080 PTR(moose) 0x00000000 0x00000000 #reset #data * { counter-reset: moose a; } #errors #expected | 1 * | 0x0200001b PTR(moose) 0x00000000 0x00000080 PTR(a) 0x00000000 0x00000000 #reset ## ## 1c - cue-after ## #data * { cue-after: none; } #errors #expected | 1 * | 0x0000001c #reset #data * { cue-after: url("sonic_boom.wav"); } #errors #expected | 1 * | 0x0200001c PTR(sonic_boom.wav) #reset ## ## 1d - cue-before ## #data * { cue-before: none; } #errors #expected | 1 * | 0x0000001d #reset #data * { cue-before: url(sonic_boom.wav); } #errors #expected | 1 * | 0x0200001d PTR(sonic_boom.wav) #reset ## ## 1e - cursor ## #data * { cursor: auto; } #errors #expected | 1 * | 0x0000001e #reset #data * { cursor: crosshair; } #errors #expected | 1 * | 0x0004001e #reset #data * { cursor: default; } #errors #expected | 1 * | 0x0008001e #reset #data * { cursor: pointer; } #errors #expected | 1 * | 0x000c001e #reset #data * { cursor: move; } #errors #expected | 1 * | 0x0010001e #reset #data * { cursor: e-resize; } #errors #expected | 1 * | 0x0014001e #reset #data * { cursor: ne-resize; } #errors #expected | 1 * | 0x0018001e #reset #data * { cursor: nw-resize; } #errors #expected | 1 * | 0x001c001e #reset #data * { cursor: n-resize; } #errors #expected | 1 * | 0x0020001e #reset #data * { cursor: se-resize; } #errors #expected | 1 * | 0x0024001e #reset #data * { cursor: sw-resize; } #errors #expected | 1 * | 0x0028001e #reset #data * { cursor: s-resize; } #errors #expected | 1 * | 0x002c001e #reset #data * { cursor: w-resize; } #errors #expected | 1 * | 0x0030001e #reset #data * { cursor: text; } #errors #expected | 1 * | 0x0034001e #reset #data * { cursor: wait; } #errors #expected | 1 * | 0x0038001e #reset #data * { cursor: help; } #errors #expected | 1 * | 0x003c001e #reset #data * { cursor: progress; } #errors #expected | 1 * | 0x0040001e #reset #data * { cursor: url(cursor.png), pointer; } #errors #expected | 1 * | 0x0200001e PTR(cursor.png) 0x00000003 #reset #data * { cursor: url(cursor.png), pointer !important; } #errors #expected | 1 * | 0x0200041e PTR(cursor.png) 0x00000003 #reset #data * { cursor: url(cursor.svg), url(cursor.png), pointer; } #errors #expected | 1 * | 0x0200001e PTR(cursor.svg) 0x00000080 PTR(cursor.png) 0x00000003 #reset ## ## 1f - direction ## #data * { direction: ltr; } #errors #expected | 1 * | 0x0000001f #reset #data * { direction: rtl; } #errors #expected | 1 * | 0x0004001f #reset ## ## 20 - display ## #data * { display: inline; } #errors #expected | 1 * | 0x00000020 #reset #data * { display: block; } #errors #expected | 1 * | 0x00040020 #reset #data * { display: list-item; } #errors #expected | 1 * | 0x00080020 #reset #data * { display: run-in; } #errors #expected | 1 * | 0x000c0020 #reset #data * { display: inline-block; } #errors #expected | 1 * | 0x00100020 #reset #data * { display: table; } #errors #expected | 1 * | 0x00140020 #reset #data * { display: inline-table; } #errors #expected | 1 * | 0x00180020 #reset #data * { display: table-row-group; } #errors #expected | 1 * | 0x001c0020 #reset #data * { display: table-header-group; } #errors #expected | 1 * | 0x00200020 #reset #data * { display: table-footer-group; } #errors #expected | 1 * | 0x00240020 #reset #data * { display: table-row; } #errors #expected | 1 * | 0x00280020 #reset #data * { display: table-column-group; } #errors #expected | 1 * | 0x002c0020 #reset #data * { display: table-column; } #errors #expected | 1 * | 0x00300020 #reset #data * { display: table-cell; } #errors #expected | 1 * | 0x00340020 #reset #data * { display: table-caption; } #errors #expected | 1 * | 0x00380020 #reset #data * { display: none; } #errors #expected | 1 * | 0x003c0020 #reset ## ## 21 - elevation ## #data * { elevation: below; } #errors #expected | 1 * | 0x00000021 #reset #data * { elevation: level; } #errors #expected | 1 * | 0x00040021 #reset #data * { elevation: above; } #errors #expected | 1 * | 0x00080021 #reset #data * { elevation: higher; } #errors #expected | 1 * | 0x000c0021 #reset #data * { elevation: lower; } #errors #expected | 1 * | 0x00100021 #reset #data * { elevation: 45deg; } #errors #expected | 1 * | 0x02000021 0x0000b400 0x00000200 #reset #data * { elevation: -45deg; } #errors #expected | 1 * | 0x02000021 0xffff4c00 0x00000200 #reset #data * { elevation: 50grad; } #errors #expected | 1 * | 0x02000021 0x0000c800 0x00000201 #reset #data * { elevation: 0.785rad; } #errors #expected | 1 * | 0x02000021 0x00000324 0x00000202 #reset #data * { elevation: lower !important; } #errors #expected | 1 * | 0x00100421 #reset #data * { elevation: 45deg !important; } #errors #expected | 1 * | 0x02000421 0x0000b400 0x00000200 #reset ## ## 22 - empty-cells ## #data * { empty-cells: show; } #errors #expected | 1 * | 0x00000022 #reset #data * { empty-cells: hide; } #errors #expected | 1 * | 0x00040022 #reset ## ## 23 - float ## #data * { float: left; } #errors #expected | 1 * | 0x00000023 #reset #data * { float: right; } #errors #expected | 1 * | 0x00040023 #reset #data * { float: none; } #errors #expected | 1 * | 0x00080023 #reset ## ## 24 - font-family ## #data * { font-family: serif; } #errors #expected | 1 * | 0x00040024 0x00000000 #reset #data * { font-family: sans-serif; } #errors #expected | 1 * | 0x00080024 0x00000000 #reset #data * { font-family: cursive; } #errors #expected | 1 * | 0x000c0024 0x00000000 #reset #data * { font-family: fantasy; } #errors #expected | 1 * | 0x00100024 0x00000000 #reset #data * { font-family: monospace; } #errors #expected | 1 * | 0x00140024 0x00000000 #reset #data * { font-family: Homerton; } #errors #expected | 1 * | 0x02040024 PTR(Homerton) 0x00000000 #reset #data * { font-family: "Oxford"; } #errors #expected | 1 * | 0x02000024 PTR(Oxford) 0x00000000 #reset #data * { font-family: "Oxford", 'Optima', 'Zapf Humanist', sans-serif; } #errors #expected | 1 * | 0x02000024 PTR(Oxford) 0x00000080 PTR(Optima) 0x00000080 PTR(Zapf Humanist) 0x00000002 0x00000000 #reset #data * { font-family: "Trinity", serif, 'Homerton', sans-serif; } #errors #expected | 1 * | 0x02000024 PTR(Trinity) 0x00000001 0x00000080 PTR(Homerton) 0x00000002 0x00000000 #reset ## ## 25 - font-size ## #data * { font-size: xx-small; } #errors #expected | 1 * | 0x00000025 #reset #data * { font-size: x-small; } #errors #expected | 1 * | 0x00040025 #reset #data * { font-size: small; } #errors #expected | 1 * | 0x00080025 #reset #data * { font-size: medium; } #errors #expected | 1 * | 0x000c0025 #reset #data * { font-size: large; } #errors #expected | 1 * | 0x00100025 #reset #data * { font-size: x-large; } #errors #expected | 1 * | 0x00140025 #reset #data * { font-size: xx-large; } #errors #expected | 1 * | 0x00180025 #reset #data * { font-size: larger; } #errors #expected | 1 * | 0x001c0025 #reset #data * { font-size: smaller; } #errors #expected | 1 * | 0x00200025 #reset #data * { font-size: 12pt; } #errors #expected | 1 * | 0x02000025 0x00003000 0x00000006 #reset #data * { font-size: 100px; } #errors #expected | 1 * | 0x02000025 0x00019000 0x00000000 #reset #data * { font-size: 120%; } #errors #expected | 1 * | 0x02000025 0x0001e000 0x00000100 #reset ## ## 26 - font-style ## #data * { font-style: normal; } #errors #expected | 1 * | 0x00000026 #reset #data * { font-style: italic; } #errors #expected | 1 * | 0x00040026 #reset #data * { font-style: oblique; } #errors #expected | 1 * | 0x00080026 #reset ## ## 27 - font-variant ## #data * { font-variant: normal; } #errors #expected | 1 * | 0x00000027 #reset #data * { font-variant: small-caps; } #errors #expected | 1 * | 0x00040027 #reset ## ## 28 - font-weight ## #data * { font-weight: normal; } #errors #expected | 1 * | 0x00000028 #reset #data * { font-weight: bold; } #errors #expected | 1 * | 0x00040028 #reset #data * { font-weight: bolder; } #errors #expected | 1 * | 0x00080028 #reset #data * { font-weight: lighter; } #errors #expected | 1 * | 0x000c0028 #reset #data * { font-weight: 100; } #errors #expected | 1 * | 0x00100028 #reset #data * { font-weight: 200; } #errors #expected | 1 * | 0x00140028 #reset #data * { font-weight: 300; } #errors #expected | 1 * | 0x00180028 #reset #data * { font-weight: 400; } #errors #expected | 1 * | 0x001c0028 #reset #data * { font-weight: 500; } #errors #expected | 1 * | 0x00200028 #reset #data * { font-weight: 600; } #errors #expected | 1 * | 0x00240028 #reset #data * { font-weight: 700; } #errors #expected | 1 * | 0x00280028 #reset #data * { font-weight: 800; } #errors #expected | 1 * | 0x002c0028 #reset #data * { font-weight: 900; } #errors #expected | 1 * | 0x00300028 #reset ## ## 29 - height ## #data * { height: auto; } #errors #expected | 1 * | 0x00000029 #reset #data * { height: 99999.999ex; } #errors #expected | 1 * | 0x02000029 0x061a7fff 0x00000001 #reset #data * { height: 66.667%; } #errors #expected | 1 * | 0x02000029 0x00010aab 0x00000100 #reset ## ## 2a - left ## #data * { left: auto; } #errors #expected | 1 * | 0x0000002a #reset #data * { left: 0.5in; } #errors #expected | 1 * | 0x0200002a 0x00000200 0x00000003 #reset #data * { left: 4%; } #errors #expected | 1 * | 0x0200002a 0x00001000 0x00000100 #reset ## ## 2b - letter-spacing ## #data * { letter-spacing: normal; } #errors #expected | 1 * | 0x0000002b #reset #data * { letter-spacing: 0.33cm; } #errors #expected | 1 * | 0x0200002b 0x00000152 0x00000004 #reset #data * { letter-spacing: 0.33cm !important; } #errors #expected | 1 * | 0x0200042b 0x00000152 0x00000004 #reset ## ## 2c - line-height ## #data * { line-height: normal; } #errors #expected | 1 * | 0x0000002c #reset #data * { line-height: 1.2; } #errors #expected | 1 * | 0x0200002c 0x000004cd #reset #data * { line-height: 12mm; } #errors #expected | 1 * | 0x0204002c 0x00003000 0x00000005 #reset #data * { line-height: 1.2 !important; } #errors #expected | 1 * | 0x0200042c 0x000004cd #reset #data * { line-height: 12mm !important; } #errors #expected | 1 * | 0x0204042c 0x00003000 0x00000005 #reset #data * { line-height: 33.33%; } #errors #expected | 1 * | 0x0204002c 0x00008552 0x00000100 #reset ## ## 2d - list-style-image ## #data * { list-style-image: none; } #errors #expected | 1 * | 0x0000002d #reset #data * { list-style-image: url("http://www.netsurf-browser.org/bullet.png"); } #errors #expected | 1 * | 0x0200002d PTR(http://www.netsurf-browser.org/bullet.png) #reset ## ## 2e - list-style-position ## #data * { list-style-position: inside; } #errors #expected | 1 * | 0x0000002e #reset #data * { list-style-position: outside; } #errors #expected | 1 * | 0x0004002e #reset ## ## 2f - list-style-type ## #data * { list-style-type: disc; } #errors #expected | 1 * | 0x0000002f #reset #data * { list-style-type: circle; } #errors #expected | 1 * | 0x0004002f #reset #data * { list-style-type: square; } #errors #expected | 1 * | 0x0008002f #reset #data * { list-style-type: decimal; } #errors #expected | 1 * | 0x000c002f #reset #data * { list-style-type: decimal-leading-zero; } #errors #expected | 1 * | 0x0010002f #reset #data * { list-style-type: lower-roman; } #errors #expected | 1 * | 0x0014002f #reset #data * { list-style-type: upper-roman; } #errors #expected | 1 * | 0x0018002f #reset #data * { list-style-type: lower-greek; } #errors #expected | 1 * | 0x001c002f #reset #data * { list-style-type: lower-latin; } #errors #expected | 1 * | 0x0020002f #reset #data * { list-style-type: upper-latin; } #errors #expected | 1 * | 0x0024002f #reset #data * { list-style-type: armenian; } #errors #expected | 1 * | 0x0028002f #reset #data * { list-style-type: georgian; } #errors #expected | 1 * | 0x002c002f #reset #data * { list-style-type: lower-alpha; } #errors #expected | 1 * | 0x0030002f #reset #data * { list-style-type: upper-alpha; } #errors #expected | 1 * | 0x0034002f #reset #data * { list-style-type: none; } #errors #expected | 1 * | 0x0038002f #reset ## ## 30 - margin-top ## 31 - margin-right ## 32 - margin-bottom ## 33 - margin-left ## #data * { margin-top: auto; } #errors #expected | 1 * | 0x00000030 #reset #data * { margin-right: auto; } #errors #expected | 1 * | 0x00000031 #reset #data * { margin-bottom: auto; } #errors #expected | 1 * | 0x00000032 #reset #data * { margin-left: auto; } #errors #expected | 1 * | 0x00000033 #reset #data * { margin-top: 10pc; } #errors #expected | 1 * | 0x02000030 0x00002800 0x00000007 #reset #data * { margin-right: 1px; } #errors #expected | 1 * | 0x02000031 0x00000400 0x00000000 #reset #data * { margin-bottom: 2em; } #errors #expected | 1 * | 0x02000032 0x00000800 0x00000002 #reset #data * { margin-left: 5%; } #errors #expected | 1 * | 0x02000033 0x00001400 0x00000100 #reset ## ## 34 - max-height ## #data * { max-height: none; } #errors #expected | 1 * | 0x00000034 #reset #data * { max-height: 100px; } #errors #expected | 1 * | 0x02000034 0x00019000 0x00000000 #reset #data * { max-height: 100px !important; } #errors #expected | 1 * | 0x02000434 0x00019000 0x00000000 #reset #data * { max-height: 50%; } #errors #expected | 1 * | 0x02000034 0x0000c800 0x00000100 #reset ## ## 35 - max-width ## #data * { max-width: none; } #errors #expected | 1 * | 0x00000035 #reset #data * { max-width: 100px; } #errors #expected | 1 * | 0x02000035 0x00019000 0x00000000 #reset #data * { max-width: 50%; } #errors #expected | 1 * | 0x02000035 0x0000c800 0x00000100 #reset ## ## 36 - min-height ## #data * { min-height: 100px; } #errors #expected | 1 * | 0x02000036 0x00019000 0x00000000 #reset #data * { min-height: 50%; } #errors #expected | 1 * | 0x02000036 0x0000c800 0x00000100 #reset ## ## 37 - min-width ## #data * { min-width: 100px; } #errors #expected | 1 * | 0x02000037 0x00019000 0x00000000 #reset #data * { min-width: 50%; } #errors #expected | 1 * | 0x02000037 0x0000c800 0x00000100 #reset ## ## 38 - orphans ## #data * { orphans: 3; } #errors #expected | 1 * | 0x02000038 0x00000c00 #reset ## ## 39 - outline-color ## #data * { outline-color: invert; } #errors #expected | 1 * | 0x00080039 #reset #data * { outline-color: #BBC; } #errors #expected | 1 * | 0x02000039 0xffbbbbcc #reset #data * { outline-color: currentColor } #errors #expected | 1 * | 0x00040039 #reset #data * { outline-color: transparent } #errors #expected | 1 * | 0x00000039 #reset ## ## 3a - outline-style ## #data * { outline-style: none; } #errors #expected | 1 * | 0x0000003a #reset #data * { outline-style: dotted; } #errors #expected | 1 * | 0x0008003a #reset #data * { outline-style: dashed; } #errors #expected | 1 * | 0x000c003a #reset #data * { outline-style: solid; } #errors #expected | 1 * | 0x0010003a #reset #data * { outline-style: double; } #errors #expected | 1 * | 0x0014003a #reset #data * { outline-style: groove; } #errors #expected | 1 * | 0x0018003a #reset #data * { outline-style: ridge; } #errors #expected | 1 * | 0x001c003a #reset #data * { outline-style: inset; } #errors #expected | 1 * | 0x0020003a #reset #data * { outline-style: outset; } #errors #expected | 1 * | 0x0024003a #reset ## ## 3b - outline-width ## #data * { outline-width: thin; } #errors #expected | 1 * | 0x0000003b #reset #data * { outline-width: medium; } #errors #expected | 1 * | 0x0004003b #reset #data * { outline-width: thick; } #errors #expected | 1 * | 0x0008003b #reset #data * { outline-width: 3px; } #errors #expected | 1 * | 0x0200003b 0x00000c00 0x00000000 #reset #data * { outline-width: 0; } #errors #expected | 1 * | 0x0200003b 0x00000000 0x00000000 #reset ## ## 3c - overflow-x ## #data * { overflow-x: visible; } #errors #expected | 1 * | 0x0000003c #reset #data * { overflow-x: hidden; } #errors #expected | 1 * | 0x0004003c #reset #data * { overflow-x: scroll; } #errors #expected | 1 * | 0x0008003c #reset #data * { overflow-x: auto; } #errors #expected | 1 * | 0x000c003c #reset ## ## 70 - overflow-y ## #data * { overflow-y: visible; } #errors #expected | 1 * | 0x00000070 #reset #data * { overflow-y: hidden; } #errors #expected | 1 * | 0x00040070 #reset #data * { overflow-y: scroll; } #errors #expected | 1 * | 0x00080070 #reset #data * { overflow-y: auto; } #errors #expected | 1 * | 0x000c0070 #reset ## ## 3d - padding-top ## 3e - padding-right ## 3f - padding-bottom ## 40 - padding-left ## #data * { padding-top: 10pc; } #errors #expected | 1 * | 0x0200003d 0x00002800 0x00000007 #reset #data * { padding-right: 1px; } #errors #expected | 1 * | 0x0200003e 0x00000400 0x00000000 #reset #data * { padding-bottom: 2em; } #errors #expected | 1 * | 0x0200003f 0x00000800 0x00000002 #reset #data * { padding-left: 5%; } #errors #expected | 1 * | 0x02000040 0x00001400 0x00000100 #reset ## ## 41 - page-break-after ## #data * { page-break-after: auto; } #errors #expected | 1 * | 0x00000041 #reset #data * { page-break-after: always; } #errors #expected | 1 * | 0x00040041 #reset #data * { page-break-after: avoid; } #errors #expected | 1 * | 0x00080041 #reset #data * { page-break-after: left; } #errors #expected | 1 * | 0x000c0041 #reset #data * { page-break-after: right; } #errors #expected | 1 * | 0x00100041 #reset ## ## 42 - page-break-before ## #data * { page-break-before: auto; } #errors #expected | 1 * | 0x00000042 #reset #data * { page-break-before: always; } #errors #expected | 1 * | 0x00040042 #reset #data * { page-break-before: avoid; } #errors #expected | 1 * | 0x00080042 #reset #data * { page-break-before: left; } #errors #expected | 1 * | 0x000c0042 #reset #data * { page-break-before: right; } #errors #expected | 1 * | 0x00100042 #reset ## ## 43 - page-break-inside ## #data * { page-break-inside: auto; } #errors #expected | 1 * | 0x00000043 #reset #data * { page-break-inside: avoid; } #errors #expected | 1 * | 0x00040043 #reset ## ## 44 - pause-after ## #data * { pause-after: 0; } #errors #expected | 1 * | 0x02000044 0x00000000 0x00000401 #reset #data * { pause-after: 100ms; } #errors #expected | 1 * | 0x02000044 0x00019000 0x00000400 #reset #data * { pause-after: 0.7s; } #errors #expected | 1 * | 0x02000044 0x000002cd 0x00000401 #reset #data * { pause-after: 120%; } #errors #expected | 1 * | 0x02000044 0x0001e000 0x00000100 #reset ## ## 45 - pause-before ## #data * { pause-before: 0; } #errors #expected | 1 * | 0x02000045 0x00000000 0x00000401 #reset #data * { pause-before: 100ms; } #errors #expected | 1 * | 0x02000045 0x00019000 0x00000400 #reset #data * { pause-before: 0.7s; } #errors #expected | 1 * | 0x02000045 0x000002cd 0x00000401 #reset #data * { pause-before: 120%; } #errors #expected | 1 * | 0x02000045 0x0001e000 0x00000100 #reset ## ## 46 - pitch-range ## #data * { pitch-range: 0; } #errors #expected | 1 * | 0x02000046 0x00000000 #reset #data * { pitch-range: 50; } #errors #expected | 1 * | 0x02000046 0x0000c800 #reset #data * { pitch-range: 100; } #errors #expected | 1 * | 0x02000046 0x00019000 #reset #data * { pitch-range: 100 !important; } #errors #expected | 1 * | 0x02000446 0x00019000 #reset ## ## 47 - pitch ## #data * { pitch: x-low; } #errors #expected | 1 * | 0x00000047 #reset #data * { pitch: low; } #errors #expected | 1 * | 0x00040047 #reset #data * { pitch: medium; } #errors #expected | 1 * | 0x00080047 #reset #data * { pitch: high; } #errors #expected | 1 * | 0x000c0047 #reset #data * { pitch: x-high; } #errors #expected | 1 * | 0x00100047 #reset #data * { pitch: 0; } #errors #expected | 1 * | 0x02000047 0x00000000 0x00000800 #reset #data * { pitch: 0 !important; } #errors #expected | 1 * | 0x02000447 0x00000000 0x00000800 #reset #data * { pitch: 400Hz; } #errors #expected | 1 * | 0x02000047 0x00064000 0x00000800 #reset #data * { pitch: 1.1kHz; } #errors #expected | 1 * | 0x02000047 0x00000466 0x00000801 #reset ## ## 48 - play-during ## #data * { play-during: auto; } #errors #expected | 1 * | 0x00000048 #reset #data * { play-during: none; } #errors #expected | 1 * | 0x00040048 #reset #data * { play-during: none !important; } #errors #expected | 1 * | 0x00040448 #reset #data * { play-during: url(death_rattle.wav); } #errors #expected | 1 * | 0x02000048 PTR(death_rattle.wav) #reset #data * { play-during: url(death_rattle.wav) mix; } #errors #expected | 1 * | 0x03000048 PTR(death_rattle.wav) #reset #data * { play-during: url(death_rattle.wav) mix repeat; } #errors #expected | 1 * | 0x03800048 PTR(death_rattle.wav) #reset #data * { play-during: url(death_rattle.wav) repeat mix; } #errors #expected | 1 * | 0x03800048 PTR(death_rattle.wav) #reset #data * { play-during: url(death_rattle.wav) repeat; } #errors #expected | 1 * | 0x02800048 PTR(death_rattle.wav) #reset #data * { play-during: url(death_rattle.wav) repeat !important; } #errors #expected | 1 * | 0x02800448 PTR(death_rattle.wav) #reset ## ## 49 - position ## #data * { position: static; } #errors #expected | 1 * | 0x00000049 #reset #data * { position: relative; } #errors #expected | 1 * | 0x00040049 #reset #data * { position: absolute; } #errors #expected | 1 * | 0x00080049 #reset #data * { position: fixed; } #errors #expected | 1 * | 0x000c0049 #reset ## ## 4a - quotes ## #data * { quotes: none; } #errors #expected | 1 * | 0x0000004a #reset #data * { quotes: "\"" '"'; } #errors #expected | 1 * | 0x0200004a PTR(") PTR(") 0x00000000 #reset #data * { quotes: "'" '\'' '"' '"'; } #errors #expected | 1 * | 0x0200004a PTR(') PTR(') 0x00000080 PTR(") PTR(") 0x00000000 #reset #data * { quotes: "'" '\'' '"' '"' !important; } #errors #expected | 1 * | 0x0200044a PTR(') PTR(') 0x00000080 PTR(") PTR(") 0x00000000 #reset ## ## 4b - richness ## #data * { richness: 0; } #errors #expected | 1 * | 0x0200004b 0x00000000 #reset #data * { richness: 50; } #errors #expected | 1 * | 0x0200004b 0x0000c800 #reset #data * { richness: 100; } #errors #expected | 1 * | 0x0200004b 0x00019000 #reset ## ## 4c - right ## #data * { right: auto; } #errors #expected | 1 * | 0x0000004c #reset #data * { right: 0.5in; } #errors #expected | 1 * | 0x0200004c 0x00000200 0x00000003 #reset #data * { right: 4%; } #errors #expected | 1 * | 0x0200004c 0x00001000 0x00000100 #reset ## ## 4d - speak-header ## #data * { speak-header: once; } #errors #expected | 1 * | 0x0000004d #reset #data * { speak-header: always; } #errors #expected | 1 * | 0x0004004d #reset ## ## 4e - speak-numeral ## #data * { speak-numeral: digits; } #errors #expected | 1 * | 0x0000004e #reset #data * { speak-numeral: continuous; } #errors #expected | 1 * | 0x0004004e #reset ## ## 4f - speak-punctuation ## #data * { speak-punctuation: code; } #errors #expected | 1 * | 0x0000004f #reset #data * { speak-punctuation: none; } #errors #expected | 1 * | 0x0004004f #reset ## ## 50 - speak ## #data * { speak: normal; } #errors #expected | 1 * | 0x00000050 #reset #data * { speak: none; } #errors #expected | 1 * | 0x00040050 #reset #data * { speak: spell-out; } #errors #expected | 1 * | 0x00080050 #reset ## ## 51 - speech-rate ## #data * { speech-rate: x-slow; } #errors #expected | 1 * | 0x00000051 #reset #data * { speech-rate: slow; } #errors #expected | 1 * | 0x00040051 #reset #data * { speech-rate: medium; } #errors #expected | 1 * | 0x00080051 #reset #data * { speech-rate: fast; } #errors #expected | 1 * | 0x000c0051 #reset #data * { speech-rate: x-fast; } #errors #expected | 1 * | 0x00100051 #reset #data * { speech-rate: faster; } #errors #expected | 1 * | 0x00140051 #reset #data * { speech-rate: slower; } #errors #expected | 1 * | 0x00180051 #reset #data * { speech-rate: 190; } #errors #expected | 1 * | 0x02000051 0x0002f800 #reset #data * { speech-rate: 190 !important; } #errors #expected | 1 * | 0x02000451 0x0002f800 #reset ## ## 52 - stress ## #data * { stress: 0; } #errors #expected | 1 * | 0x02000052 0x00000000 #reset #data * { stress: 0 !important; } #errors #expected | 1 * | 0x02000452 0x00000000 #reset #data * { stress: 50; } #errors #expected | 1 * | 0x02000052 0x0000c800 #reset #data * { stress: 100; } #errors #expected | 1 * | 0x02000052 0x00019000 #reset ## ## 53 - table-layout ## #data * { table-layout: auto; } #errors #expected | 1 * | 0x00000053 #reset #data * { table-layout: fixed; } #errors #expected | 1 * | 0x00040053 #reset ## ## 54 - text-align ## #data * { text-align: left; } #errors #expected | 1 * | 0x00000054 #reset #data * { text-align: right; } #errors #expected | 1 * | 0x00040054 #reset #data * { text-align: center; } #errors #expected | 1 * | 0x00080054 #reset #data * { text-align: justify; } #errors #expected | 1 * | 0x000c0054 #reset #data * { text-align: -libcss-left; } #errors #expected | 1 * | 0x00100054 #reset #data * { text-align: -libcss-center; } #errors #expected | 1 * | 0x00140054 #reset #data * { text-align: -libcss-right; } #errors #expected | 1 * | 0x00180054 #reset ## ## 55 - text-decoration ## #data * { text-decoration: none; } #errors #expected | 1 * | 0x00000055 #reset #data * { text-decoration: underline; } #errors #expected | 1 * | 0x00040055 #reset #data * { text-decoration: overline; } #errors #expected | 1 * | 0x00080055 #reset #data * { text-decoration: line-through; } #errors #expected | 1 * | 0x00100055 #reset #data * { text-decoration: blink; } #errors #expected | 1 * | 0x00200055 #reset #data * { text-decoration: underline overline; } #errors #expected | 1 * | 0x000c0055 #reset #data * { text-decoration: overline underline; } #errors #expected | 1 * | 0x000c0055 #reset #data * { text-decoration: underline blink; } #errors #expected | 1 * | 0x00240055 #reset ## ## 56 - text-indent ## #data * { text-indent: 0; } #errors #expected | 1 * | 0x02000056 0x00000000 0x00000000 #reset #data * { text-indent: 12mm; } #errors #expected | 1 * | 0x02000056 0x00003000 0x00000005 #reset #data * { text-indent: 33.33%; } #errors #expected | 1 * | 0x02000056 0x00008552 0x00000100 #reset ## ## 57 - text-transform ## #data * { text-transform: capitalize; } #errors #expected | 1 * | 0x00000057 #reset #data * { text-transform: uppercase; } #errors #expected | 1 * | 0x00040057 #reset #data * { text-transform: lowercase; } #errors #expected | 1 * | 0x00080057 #reset #data * { text-transform: none; } #errors #expected | 1 * | 0x000c0057 #reset ## ## 58 - top ## #data * { top: auto; } #errors #expected | 1 * | 0x00000058 #reset #data * { top: 0.5in; } #errors #expected | 1 * | 0x02000058 0x00000200 0x00000003 #reset #data * { top: 4%; } #errors #expected | 1 * | 0x02000058 0x00001000 0x00000100 #reset ## ## 59 - unicode-bidi ## #data * { unicode-bidi: normal; } #errors #expected | 1 * | 0x00000059 #reset #data * { unicode-bidi: embed; } #errors #expected | 1 * | 0x00040059 #reset #data * { unicode-bidi: bidi-override; } #errors #expected | 1 * | 0x00080059 #reset ## ## 5a - vertical-align ## #data * { vertical-align: baseline; } #errors #expected | 1 * | 0x0000005a #reset #data * { vertical-align: sub; } #errors #expected | 1 * | 0x0004005a #reset #data * { vertical-align: super; } #errors #expected | 1 * | 0x0008005a #reset #data * { vertical-align: top; } #errors #expected | 1 * | 0x000c005a #reset #data * { vertical-align: text-top; } #errors #expected | 1 * | 0x0010005a #reset #data * { vertical-align: middle; } #errors #expected | 1 * | 0x0014005a #reset #data * { vertical-align: bottom; } #errors #expected | 1 * | 0x0018005a #reset #data * { vertical-align: text-bottom; } #errors #expected | 1 * | 0x001c005a #reset #data * { vertical-align: -10% !important; } #errors #expected | 1 * | 0x0200045a 0xffffd800 0x00000100 #reset #data * { vertical-align: -10%; } #errors #expected | 1 * | 0x0200005a 0xffffd800 0x00000100 #reset #data * { vertical-align: 20%; } #errors #expected | 1 * | 0x0200005a 0x00005000 0x00000100 #reset #data * { vertical-align: 4px; } #errors #expected | 1 * | 0x0200005a 0x00001000 0x00000000 #reset #data * { vertical-align: -4px; } #errors #expected | 1 * | 0x0200005a 0xfffff000 0x00000000 #reset ## ## 5b - visibility ## #data * { visibility: visible; } #errors #expected | 1 * | 0x0000005b #reset #data * { visibility: hidden; } #errors #expected | 1 * | 0x0004005b #reset #data * { visibility: collapse; } #errors #expected | 1 * | 0x0008005b #reset ## ## 5c - voice-family ## #data * { voice-family: male; } #errors #expected | 1 * | 0x0004005c 0x00000000 #reset #data * { voice-family: female; } #errors #expected | 1 * | 0x0008005c 0x00000000 #reset #data * { voice-family: child; } #errors #expected | 1 * | 0x000c005c 0x00000000 #reset #data * { voice-family: romeo; } #errors #expected | 1 * | 0x0204005c PTR(romeo) 0x00000000 #reset #data * { voice-family: child !important; } #errors #expected | 1 * | 0x000c045c 0x00000000 #reset #data * { voice-family: romeo !important; } #errors #expected | 1 * | 0x0204045c PTR(romeo) 0x00000000 #reset #data * { voice-family: "juliet"; } #errors #expected | 1 * | 0x0200005c PTR(juliet) 0x00000000 #reset #data * { voice-family: "tlsa", 'romeo', male; } #errors #expected | 1 * | 0x0200005c PTR(tlsa) 0x00000080 PTR(romeo) 0x00000001 0x00000000 #reset #data * { voice-family: "juliet", female, 'romeo', male; } #errors #expected | 1 * | 0x0200005c PTR(juliet) 0x00000002 0x00000080 PTR(romeo) 0x00000001 0x00000000 #reset ## ## 5d - volume ## #data * { volume: silent; } #errors #expected | 1 * | 0x0000005d #reset #data * { volume: x-soft; } #errors #expected | 1 * | 0x0004005d #reset #data * { volume: soft; } #errors #expected | 1 * | 0x0008005d #reset #data * { volume: medium; } #errors #expected | 1 * | 0x000c005d #reset #data * { volume: loud; } #errors #expected | 1 * | 0x0010005d #reset #data * { volume: x-loud; } #errors #expected | 1 * | 0x0014005d #reset #data * { volume: 50; } #errors #expected | 1 * | 0x0200005d 0x0000c800 #reset #data * { volume: 50 !important; } #errors #expected | 1 * | 0x0200045d 0x0000c800 #reset # dunno if % can be tested here, cos it's a percentage of the inherited value #data * { volume: 33.33%; } #errors #expected | 1 * | 0x0204005d 0x00008552 0x00000100 #reset # dunno if % can be tested here, cos it's a percentage of the inherited value #data * { volume: 33.33% !important; } #errors #expected | 1 * | 0x0204045d 0x00008552 0x00000100 #reset ## ## 5e - white-space ## #data * { white-space: normal; } #errors #expected | 1 * | 0x0000005e #reset #data * { white-space: pre; } #errors #expected | 1 * | 0x0004005e #reset #data * { white-space: nowrap; } #errors #expected | 1 * | 0x0008005e #reset #data * { white-space: pre-wrap; } #errors #expected | 1 * | 0x000c005e #reset #data * { white-space: pre-line; } #errors #expected | 1 * | 0x0010005e #reset ## ## 5f - widows ## #data * { widows: 3; } #errors #expected | 1 * | 0x0200005f 0x00000c00 #reset ## ## 60 - width ## #data * { width: auto; } #errors #expected | 1 * | 0x00000060 #reset #data * { width: 99999.999ex; } #errors #expected | 1 * | 0x02000060 0x061a7fff 0x00000001 #reset #data * { width: 66.667%; } #errors #expected | 1 * | 0x02000060 0x00010aab 0x00000100 #reset ## ## 61 - word-spacing ## #data * { word-spacing: normal; } #errors #expected | 1 * | 0x00000061 #reset #data * { word-spacing: 0.1em; } #errors #expected | 1 * | 0x02000061 0x00000066 0x00000002 #reset ## ## 62 - z-index ## #data * { z-index: auto; } #errors #expected | 1 * | 0x00000062 #reset #data * { z-index: 2; } #errors #expected | 1 * | 0x02000062 0x00000800 #reset #data * { z-index: auto !important; } #errors #expected | 1 * | 0x00000462 #reset #data * { z-index: 2 !important; } #errors #expected | 1 * | 0x02000462 0x00000800 #reset #data * { z-index: -1; } #errors #expected | 1 * | 0x02000062 0xfffffc00 #reset ## ## 64 - break-after ## #data * { break-after: auto; } #errors #expected | 1 * | 0x00000064 #reset #data * { break-after: always; } #errors #expected | 1 * | 0x00040064 #reset #data * { break-after: avoid; } #errors #expected | 1 * | 0x00080064 #reset #data * { break-after: left; } #errors #expected | 1 * | 0x000c0064 #reset #data * { break-after: right; } #errors #expected | 1 * | 0x00100064 #reset #data * { break-after: page; } #errors #expected | 1 * | 0x00140064 #reset #data * { break-after: column; } #errors #expected | 1 * | 0x00180064 #reset #data * { break-after: avoid-page; } #errors #expected | 1 * | 0x001c0064 #reset #data * { break-after: avoid-column; } #errors #expected | 1 * | 0x00200064 #reset ## ## 65 - break-before ## #data * { break-before: auto; } #errors #expected | 1 * | 0x00000065 #reset #data * { break-before: always; } #errors #expected | 1 * | 0x00040065 #reset #data * { break-before: avoid; } #errors #expected | 1 * | 0x00080065 #reset #data * { break-before: left; } #errors #expected | 1 * | 0x000c0065 #reset #data * { break-before: right; } #errors #expected | 1 * | 0x00100065 #reset #data * { break-before: page; } #errors #expected | 1 * | 0x00140065 #reset #data * { break-before: column; } #errors #expected | 1 * | 0x00180065 #reset #data * { break-before: avoid-page; } #errors #expected | 1 * | 0x001c0065 #reset #data * { break-before: avoid-column; } #errors #expected | 1 * | 0x00200065 #reset ## ## 66 - break-inside ## #data * { break-inside: auto; } #errors #expected | 1 * | 0x00000066 #reset #data * { break-inside: avoid; } #errors #expected | 1 * | 0x00040066 #reset #data * { break-inside: avoid-page; } #errors #expected | 1 * | 0x00080066 #reset #data * { break-inside: avoid-column; } #errors #expected | 1 * | 0x000c0066 #reset ## ## 67 - column-count ## #data * { column-count: auto; } #errors #expected | 1 * | 0x00000067 #reset #data * { column-count: 2; } #errors #expected | 1 * | 0x02000067 0x00000800 #reset ## ## 68 - column-fill ## #data * { column-fill: balance; } #errors #expected | 1 * | 0x00000068 #reset #data * { column-fill: auto; } #errors #expected | 1 * | 0x00040068 #reset ## ## 69 - column-gap ## #data * { column-gap: normal; } #errors #expected | 1 * | 0x00000069 #reset #data * { column-gap: 0.1em; } #errors #expected | 1 * | 0x02000069 0x00000066 0x00000002 #reset ## ## 6a - column-rule-color ## #data * { column-rule-color: #BBC; } #errors #expected | 1 * | 0x0200006a 0xffbbbbcc #reset #data * { column-rule-color: currentColor } #errors #expected | 1 * | 0x0004006a #reset #data * { column-rule-color: transparent } #errors #expected | 1 * | 0x0000006a #reset ## ## 6b - column-rule-style ## #data * { column-rule-style: none; } #errors #expected | 1 * | 0x0000006b #reset #data * { column-rule-style: hidden; } #errors #expected | 1 * | 0x0004006b #reset #data * { column-rule-style: dotted; } #errors #expected | 1 * | 0x0008006b #reset #data * { column-rule-style: dashed; } #errors #expected | 1 * | 0x000c006b #reset #data * { column-rule-style: solid; } #errors #expected | 1 * | 0x0010006b #reset #data * { column-rule-style: double; } #errors #expected | 1 * | 0x0014006b #reset #data * { column-rule-style: groove; } #errors #expected | 1 * | 0x0018006b #reset #data * { column-rule-style: ridge; } #errors #expected | 1 * | 0x001c006b #reset #data * { column-rule-style: inset; } #errors #expected | 1 * | 0x0020006b #reset #data * { column-rule-style: outset; } #errors #expected | 1 * | 0x0024006b #reset ## ## 6c - column-rule-width ## #data * { column-rule-width: thin; } #errors #expected | 1 * | 0x0000006c #reset #data * { column-rule-width: medium; } #errors #expected | 1 * | 0x0004006c #reset #data * { column-rule-width: thick; } #errors #expected | 1 * | 0x0008006c #reset #data * { column-rule-width: 3px; } #errors #expected | 1 * | 0x0200006c 0x00000c00 0x00000000 #reset #data * { column-rule-width: 0; } #errors #expected | 1 * | 0x0200006c 0x00000000 0x00000000 #reset ## ## 6d - column-span ## #data * { column-span: none; } #errors #expected | 1 * | 0x0000006d #reset #data * { column-span: all; } #errors #expected | 1 * | 0x0004006d #reset ## ## 6e - column-width ## #data * { column-width: auto; } #errors #expected | 1 * | 0x0000006e #reset #data * { column-width: 0.1em; } #errors #expected | 1 * | 0x0200006e 0x00000066 0x00000002 #reset ## ## 6f - writing-mode ## #data * { writing-mode: horizontal-tb; } #errors #expected | 1 * | 0x0000006f #reset #data * { writing-mode: vertical-rl; } #errors #expected | 1 * | 0x0004006f #reset #data * { writing-mode: vertical-lr; } #errors #expected | 1 * | 0x0008006f #reset #data * { writing-mode: inherit } #errors #expected | 1 * | 0x0000086f #reset #data * { writing-mode: inherit ! important } #errors #expected | 1 * | 0x00000c6f #reset #data * { writing-mode: vertical-lr ! important } #errors #expected | 1 * | 0x0008046f #reset netsurf-all-3.2/libcss/test/data/parse/nth.dat0000644000175000017500000000474212377676736020407 0ustar vincevince# Test data for nth-* expressions # Odd and Even #data E:nth-child(odd) {} #errors #expected | 1 E:nth-child(2n+1) #reset #data E:nth-child(even) {} #errors #expected | 1 E:nth-child(2n+0) #reset # Basic numbers #data E:nth-child(1) {} #errors #expected | 1 E:nth-child(0n+1) #reset #data E:nth-child(-1) {} #errors #expected | 1 E:nth-child(0n+-1) #reset # IDENT ws [ NUMBER ws ]? #data E:nth-child(n) {} #errors #expected | 1 E:nth-child(1n+0) #reset #data E:nth-child(-n) {} #errors #expected | 1 E:nth-child(-1n+0) #reset #data E:nth-child(-n- 1) {} #errors #expected | 1 E:nth-child(-1n+-1) #reset #data E:nth-child(-n-1) {} #errors #expected | 1 E:nth-child(-1n+-1) #reset # DIMENSION ws [ NUMBER ws ]? #data E:nth-child(2n) {} #errors #expected | 1 E:nth-child(2n+0) #reset #data E:nth-child(-2n) {} #errors #expected | 1 E:nth-child(-2n+0) #reset #data E:nth-child(2n- 1) {} #errors #expected | 1 E:nth-child(2n+-1) #reset #data E:nth-child(-2n- 1) {} #errors #expected | 1 E:nth-child(-2n+-1) #reset #data E:nth-child(2n-1) {} #errors #expected | 1 E:nth-child(2n+-1) #reset #data E:nth-child(-2n-1) {} #errors #expected | 1 E:nth-child(-2n+-1) #reset # IDENT ws CHAR ws NUMBER ws #data E:nth-child(n - 1) {} #errors #expected | 1 E:nth-child(1n+-1) #reset #data E:nth-child(n+1) {} #errors #expected | 1 E:nth-child(1n+1) #reset #data E:nth-child(n + 1) {} #errors #expected | 1 E:nth-child(1n+1) #reset # DIMENSION ws CHAR ws NUMBER ws #data E:nth-child(2n - 1) {} #errors #expected | 1 E:nth-child(2n+-1) #reset #data E:nth-child(2n+1) {} #errors #expected | 1 E:nth-child(2n+1) #reset #data E:nth-child(2n + 1) {} #errors #expected | 1 E:nth-child(2n+1) #reset # Illegal inputs #data E:nth-child(n--1) {} #errors #expected #reset #data E:nth-child(n-+1) {} #errors #expected #reset #data E:nth-child(n- -1) {} #errors #expected #reset #data E:nth-child(n- +1) {} #errors #expected #reset #data E:nth-child(n + -1) {} #errors #expected #reset #data E:nth-child(n - +1) {} #errors #expected #reset #data E:nth-child(2n--1) {} #errors #expected #reset #data E:nth-child(2n-+1) {} #errors #expected #reset #data E:nth-child(2n- -1) {} #errors #expected #reset #data E:nth-child(2n- +1) {} #errors #expected #reset #data E:nth-child(2n + -1) {} #errors #expected #reset #data E:nth-child(2n - +1) {} #errors #expected #reset #data E:nth-child(3 n) {} #errors #expected #reset #data E:nth-child(+2 n) {} #errors #expected #reset #data E:nth-child(+ 2) {} #errors #expected #reset netsurf-all-3.2/libcss/test/data/parse/selectors.dat0000644000175000017500000001263612377676736021622 0ustar vincevince## Simple selectors & basic combinators #data * {} #errors #expected | 1 * #reset #data E {} #errors #expected | 1 E #reset #data E F {} #errors #expected | 1 E F #reset #data E > F {} #errors #expected | 1 E > F #reset #data E:first-child {} #errors #expected | 1 E:first-child #reset #data E:link {} #errors #expected | 1 E:link #reset #data E:visited {} #errors #expected | 1 E:visited #reset #data E:active {} #errors #expected | 1 E:active #reset #data E:hover {} #errors #expected | 1 E:hover #reset #data E:focus {} #errors #expected | 1 E:focus #reset #data E:lang(c) {} #errors #expected | 1 E:lang(c) #reset #data E:left {} #errors #expected | 1 E:left #reset #data E:right {} #errors #expected | 1 E:right #reset #data E:first {} #errors #expected | 1 E:first #reset #data E:root {} #errors #expected | 1 E:root #reset #data E:nth-child(2n+1) {} #errors #expected | 1 E:nth-child(2n+1) #reset #data E:nth-last-child(2n+1) {} #errors #expected | 1 E:nth-last-child(2n+1) #reset #data E:nth-of-type(2n+1) {} #errors #expected | 1 E:nth-of-type(2n+1) #reset #data E:nth-last-of-type(2n+1) {} #errors #expected | 1 E:nth-last-of-type(2n+1) #reset #data E:last-child {} #errors #expected | 1 E:last-child #reset #data E:first-of-type {} #errors #expected | 1 E:first-of-type #reset #data E:last-of-type {} #errors #expected | 1 E:last-of-type #reset #data E:only-child {} #errors #expected | 1 E:only-child #reset #data E:only-of-type {} #errors #expected | 1 E:only-of-type #reset #data E:empty {} #errors #expected | 1 E:empty #reset #data E:target {} #errors #expected | 1 E:target #reset #data E:enabled {} #errors #expected | 1 E:enabled #reset #data E:disabled {} #errors #expected | 1 E:disabled #reset #data E:checked {} #errors #expected | 1 E:checked #reset #data E:first-line {} #errors #expected | 1 E:first-line #reset #data E:first-letter {} #errors #expected | 1 E:first-letter #reset #data E:before {} #errors #expected | 1 E:before #reset #data E:after {} #errors #expected | 1 E:after #reset #data E::first-line {} #errors #expected | 1 E:first-line #reset #data E::first-letter {} #errors #expected | 1 E:first-letter #reset #data E::before {} #errors #expected | 1 E:before #reset #data E::after {} #errors #expected | 1 E:after #reset #data E + F {} #errors #expected | 1 E + F #reset #data E ~ F {} #errors #expected | 1 E ~ F #reset #data E[foo] {} #errors #expected | 1 E[foo] #reset #data E[foo="warning"] {} #errors #expected | 1 E[foo="warning"] #reset #data E[foo~="warning"] {} #errors #expected | 1 E[foo~="warning"] #reset #data E[lang|="en"] {} #errors #expected | 1 E[lang|="en"] #reset #data E[foo^="warning"] {} #errors #expected | 1 E[foo^="warning"] #reset #data E[foo$="warning"] {} #errors #expected | 1 E[foo$="warning"] #reset #data E[foo*="warning"] {} #errors #expected | 1 E[foo*="warning"] #reset #data DIV.warning {} #errors #expected | 1 DIV.warning #reset #data .warning {} #errors #expected | 1 .warning #reset #data E#myid {} #errors #expected | 1 E#myid #reset #data #myid {} #errors #expected | 1 #myid #reset ## Multiple specifics in simple selectors #data foo.bar#baz {} #errors #expected | 1 foo.bar#baz #reset #data [bar="baz"][foo|="bar"] {} #errors #expected | 1 [bar="baz"][foo|="bar"] #reset #data .foo[bar~="baz"] {} #errors #expected | 1 .foo[bar~="baz"] #reset #data #myid:link:before {} #errors #expected | 1 #myid:link:before #reset #data .class:lang(c):after {} #errors #expected | 1 .class:lang(c):after #reset #data .class:lang(c) > #myid:before {} #errors #expected | 1 .class:lang(c) > #myid:before #reset ## Multiple selectors in a rule #data foo,bar {} #errors #expected | 1 foo, bar #reset #data E>F,bar {} #errors #expected | 1 E > F, bar #reset #data E+F,bar {} #errors #expected | 1 E + F, bar #reset #data E F,bar {} #errors #expected | 1 E F, bar #reset #data E:first-child,bar {} #errors #expected | 1 E:first-child, bar #reset #data E:link,bar {} #errors #expected | 1 E:link, bar #reset #data E:visited,bar {} #errors #expected | 1 E:visited, bar #reset #data E:active,bar {} #errors #expected | 1 E:active, bar #reset #data E:hover,bar {} #errors #expected | 1 E:hover, bar #reset #data E:focus,bar {} #errors #expected | 1 E:focus, bar #reset #data E:lang(c),bar {} #errors #expected | 1 E:lang(c), bar #reset #data E[foo],bar {} #errors #expected | 1 E[foo], bar #reset #data E[foo="warning"],bar {} #errors #expected | 1 E[foo="warning"], bar #reset #data E[foo~="warning"],bar {} #errors #expected | 1 E[foo~="warning"], bar #reset #data E[lang|="en"],bar {} #errors #expected | 1 E[lang|="en"], bar #reset #data DIV.warning,bar {} #errors #expected | 1 DIV.warning, bar #reset #data .warning,bar {} #errors #expected | 1 .warning, bar #reset #data E#myid,bar {} #errors #expected | 1 E#myid, bar #reset #data #myid,bar {} #errors #expected | 1 #myid, bar #reset # Not pseudo class #data E:not(bar) {} #errors #expected | 1 E:not(bar) #reset #data E:not(*) {} #errors #expected | 1 E:not(*) #reset #data E:not(#foo) {} #errors #expected | 1 E:not(#foo) #reset #data E:not(.bar) {} #errors #expected | 1 E:not(.bar) #reset #data E:not([bar]) {} #errors #expected | 1 E:not([bar]) #reset #data E:not(:first-child) {} #errors #expected | 1 E:not(:first-child) #reset #data E:not(:nth-child(2n+1)) {} #errors #expected | 1 E:not(:nth-child(2n+1)) #reset #data E:not(:first-line) {} #errors #expected #reset #data E:not(:not(bar)) {} #errors #expected #reset netsurf-all-3.2/libcss/test/data/parse/makeopv.pl0000755000175000017500000000034312377676736021117 0ustar vincevince#!/usr/bin/perl use warnings; use strict; die "Usage: makeopv.pl \n" if (@ARGV != 3); my ($opcode, $flags, $value) = @ARGV; printf("0x%.8x\n", oct($opcode) | oct($flags) << 10 | oct($value) << 18); netsurf-all-3.2/libcss/test/data/parse/makefixed.pl0000755000175000017500000000042612377676736021414 0ustar vincevince#!/usr/bin/perl use warnings; use strict; die "Usage: makefixed.pl \n" if (@ARGV != 1); my $val = shift @ARGV; $val *= (1 << 10); # Round away from zero if ($val < 0) { $val -= 0.5; } else { $val += 0.5; } # Truncates back towards zero printf("0x%.8x\n", $val); netsurf-all-3.2/libcss/test/data/csdetect/0000755000175000017500000000000012377713347017567 5ustar vincevincenetsurf-all-3.2/libcss/test/data/csdetect/bom.dat0000644000175000017500000000060412377676736021050 0ustar vincevince#data html{color:green;} /* starts with utf-32be bom */ #encoding utf-32be #data html{color:green;} /* starts with utf-32le bom */ #encoding utf-32le #data html{color:green;} /* starts with utf-16be bom */ #encoding utf-16be #data html{color:green;} /* starts with utf-16le bom */ #encoding utf-16le #data 鏤html{color:green} /* starts with utf-8 bom */ #encoding utf-8 netsurf-all-3.2/libcss/test/data/csdetect/INDEX0000644000175000017500000000022512377676736020372 0ustar vincevince# Index file for charset detection tests # # Test Description bom.dat UTF Byte Order Mark detection tests bom-charset.dat BOM + @charset tests netsurf-all-3.2/libcss/test/data/csdetect/bom-charset.dat0000644000175000017500000000052212377676736022476 0ustar vincevince#data 鏤@charset "UTF-8";html{color:green} /* starts with utf-8 bom */ #encoding utf-8 #data 鏤@charset "ISO-8859-1";html{color:green} /* starts with utf-8 bom, so @charset is ignored */ #encoding utf-8 #data @charset "ISO-8859-2";html{color:green} #encoding iso-8859-2 #data @charset "IMadeThisUp";html{color:green} #encoding utf-8 netsurf-all-3.2/libcss/test/data/select/0000755000175000017500000000000012377713347017250 5ustar vincevincenetsurf-all-3.2/libcss/test/data/select/tests1.dat0000644000175000017500000024231712377676736021210 0ustar vincevince#tree | div | id=foo | p* | class=green #ua div, p { display: block; } #user .green { color: #f00 !important; } #author div#foo { background-color: #bbc; } .green { color: #0f0; } div#foo { float: right; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: #ffff0000 content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | id=foo | p* | class=green #ua div, p { display: none; float: right; position: absolute; } #user p { display: inherit; float: none; } .green { color: #f00 !important; } #author div#foo { background-color: #bbc; } .green { color: #0f0; display: table-row-group; display: table-cell !important; } div p.green { float: left !important; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: #ffff0000 content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: absolute quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | class=moose | div* | div | div #ua div { display: block; } #user .moose { color: #fff !important; } #author .moose { color: #bbc !important; } div.moose > div { border-top-style: none; } div.moose > div + div { border-top-style: solid; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | class=moose | div | div* | div #ua div { display: block; } #user .moose { color: #fff !important; } #author .moose { color: #bbc !important; } div.moose > div { border-top-style: none; } div.moose > div + div { border-top-style: solid; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: solid border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree screen | div* #ua div { display: block; } #user print div { display: inline; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: separate border-spacing: 0px 0px border-top-color: #ff000000 border-right-color: #ff000000 border-bottom-color: #ff000000 border-left-color: #ff000000 border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: 2px border-right-width: 2px border-bottom-width: 2px border-left-width: 2px bottom: auto caption-side: top clear: none clip: auto color: #ff000000 content: normal counter-increment: none counter-reset: none cursor: auto direction: ltr display: block empty-cells: show float: none font-family: sans-serif font-size: 12pt font-style: normal font-variant: normal font-weight: normal height: auto left: auto letter-spacing: normal line-height: normal list-style-image: none list-style-position: outside list-style-type: disc margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: none right: auto table-layout: auto text-align: default text-decoration: none text-indent: 0px text-transform: none top: auto unicode-bidi: normal vertical-align: baseline visibility: visible white-space: normal width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree all | div* #author div { color: currentColor; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: separate border-spacing: 0px 0px border-top-color: #ff000000 border-right-color: #ff000000 border-bottom-color: #ff000000 border-left-color: #ff000000 border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: 2px border-right-width: 2px border-bottom-width: 2px border-left-width: 2px bottom: auto caption-side: top clear: none clip: auto color: #ff000000 content: normal counter-increment: none counter-reset: none cursor: auto direction: ltr display: inline empty-cells: show float: none font-family: sans-serif font-size: 12pt font-style: normal font-variant: normal font-weight: normal height: auto left: auto letter-spacing: normal line-height: normal list-style-image: none list-style-position: outside list-style-type: disc margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: none right: auto table-layout: auto text-align: default text-decoration: none text-indent: 0px text-transform: none top: auto unicode-bidi: normal vertical-align: baseline visibility: visible white-space: normal width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree all | div* #author div { background-color: #000; } div:active { background-color: #bbc; } #errors #expected background-attachment: scroll background-color: #ff000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: separate border-spacing: 0px 0px border-top-color: #ff000000 border-right-color: #ff000000 border-bottom-color: #ff000000 border-left-color: #ff000000 border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: 2px border-right-width: 2px border-bottom-width: 2px border-left-width: 2px bottom: auto caption-side: top clear: none clip: auto color: #ff000000 content: normal counter-increment: none counter-reset: none cursor: auto direction: ltr display: inline empty-cells: show float: none font-family: sans-serif font-size: 12pt font-style: normal font-variant: normal font-weight: normal height: auto left: auto letter-spacing: normal line-height: normal list-style-image: none list-style-position: outside list-style-type: disc margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: none right: auto table-layout: auto text-align: default text-decoration: none text-indent: 0px text-transform: none top: auto unicode-bidi: normal vertical-align: baseline visibility: visible white-space: normal width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p* #author p:first-child { background-color: #bbc; } #errors #expected background-attachment: scroll background-color: #ffbbbbcc background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: inline empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree screen | div* #author div { quotes: "a" "b" } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: separate border-spacing: 0px 0px border-top-color: #ff000000 border-right-color: #ff000000 border-bottom-color: #ff000000 border-left-color: #ff000000 border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: 2px border-right-width: 2px border-bottom-width: 2px border-left-width: 2px bottom: auto caption-side: top clear: none clip: auto color: #ff000000 content: normal counter-increment: none counter-reset: none cursor: auto direction: ltr display: inline empty-cells: show float: none font-family: sans-serif font-size: 12pt font-style: normal font-variant: normal font-weight: normal height: auto left: auto letter-spacing: normal line-height: normal list-style-image: none list-style-position: outside list-style-type: disc margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: "a" "b" right: auto table-layout: auto text-align: default text-decoration: none text-indent: 0px text-transform: none top: auto unicode-bidi: normal vertical-align: baseline visibility: visible white-space: normal width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p | p* #ua div, p { display: block; } #user #author div p + p { background-attachment: fixed; } #errors #expected background-attachment: fixed background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p* | p #ua div, p { display: block; } #user #author div p + p { background-attachment: fixed; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p* | p #ua div, p { display: block; } #user #author div p { background-attachment: scroll; } div p + p { background-attachment: fixed; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p | p* #ua div, p { display: block; } p { background-position: 2px; background-repeat: no-repeat; } #user p { background-image: none; background-position: 40% 40%; background-repeat: repeat-x; } #author p { background-image: url("Sonic.png"); background-position: left top; background-repeat: repeat-y; } div p + p { background-image: url("Sonic2.png"); background-position: center; } div p + p { background-image: url("Sonic_the_Hedgehog.png"); background-position: bottom right; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: url('Sonic_the_Hedgehog.png') background-position: 100% 100% background-repeat: repeat-y border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | p | p* #ua div, p { display: block; } #user p { background-image: none; background-repeat: true;} #author p { background-image: url("Sonic.png"); background-position: center 20%;} div p + p { background-image: url("Sonic2.png"); } div p + p { background-image: url("Sonic_the_Hedgehog.png"); background-repeat: repeat} #errors #expected background-attachment: scroll background-color: #00000000 background-image: url('Sonic_the_Hedgehog.png') background-position: 50% 20% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr* | th | td | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-row empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr | th* | td | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr | th | td* | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr | th | td* | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author .hedgehog tr > td {border-color:#00000000;} #sonic tr > td {border-top-color:#fff;border-right-color:#8040ff;border-bottom-color:black;border-left-color:rgb(255,0,255);} td,th {border-top-style: none;border-right-style: hidden;border-bottom-style: dotted;border-left-style: dashed} tr > td {border-top-width: thin;border-right-width: medium;border-bottom-width: thick;border-left-width: 2px;} #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: #ffffffff border-right-color: #ff8040ff border-bottom-color: #ff000000 border-left-color: #ffff00ff border-top-style: none border-right-style: hidden border-bottom-style: dotted border-left-style: dashed border-top-width: thin border-right-width: medium border-bottom-width: thick border-left-width: 2px bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr | th | td* | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author .hedgehog tr > td {border-color:#000000;} td,th {border-top-style: solid;border-right-style: double;border-bottom-style: groove;border-left-style: ridge} tr > td {border-top-width: 0;border-right-width: 2em;border-bottom-width: thick;border-left-width: -2px;} #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: #ff000000 border-right-color: #ff000000 border-bottom-color: #ff000000 border-left-color: #ff000000 border-top-style: solid border-right-style: double border-bottom-style: groove border-left-style: ridge border-top-width: 0px border-right-width: 2em border-bottom-width: thick border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table | id=sonic | class=hedgehog | tr | th | td* | tr | th | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author .hedgehog > tr > td {border-style:inset outset;} #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: inset border-right-style: outset border-bottom-style: inset border-left-style: outset border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table-cell empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; border-spacing:2px;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 2px 2px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: inherit direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; border-spacing:2px 0;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 2px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: inherit direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; background-image: url(sonic-the-hedgehog.png); background-color: #1122ee; cursor: auto;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: #ff1122ee background-image: url('sonic-the-hedgehog.png') background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; background-image: inherit; background-color: inherit; clear: none; cursor: crosshair;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: crosshair direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; background-image: inherit; background-color: inherit; clear: inherit; cursor:default; } tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: inherit clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: default direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: hide; background-image: inherit; background-color: inherit; clear: left; cursor: pointer; } tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: left clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: pointer direction: inherit display: table empty-cells: hide float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: show; background-image: inherit; background-color: inherit; clear: both; cursor: move; } tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: both clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: move direction: inherit display: table empty-cells: show float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: e-resize;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: e-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: ne-resize;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: ne-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: nw-resize; font-size: smaller;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: nw-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: smaller font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: n-resize; font-size: larger; } tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: n-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: larger font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: se-resize; font-size: xx-large;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: se-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: xx-large font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: sw-resize; font-size: x-large;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: sw-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: x-large font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: s-resize; font-size:large;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: s-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: large font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: w-resize; font-size: medium;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: w-resize direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: medium font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: text; font-size: small;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: text direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: small font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: wait; font-size: x-small;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: wait direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: x-small font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: help; font-size: xx-small;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: help direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: xx-small font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: progress; opacity: 0.5; font-size: 40px; } tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: progress direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: 40px font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 0.500 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | table* | id=sonic | class=hedgehog | tr | td | td | tr | td | td #ua div {display:block;} table {display:table; empty-cells: inherit; background-image: inherit; clear: right; background-color: inherit; cursor: url(sonic-team.png),pointer; opacity: inherit; font-size: inherit;} tr {display:table-row;} td,th {display:table-cell;} #user #author #errors #expected background-attachment: scroll background-color: inherit background-image: inherit background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: right clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: url('sonic-team.png') pointer direction: inherit display: table empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: inherit outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: static quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | id=foo | p* #ua div, p { display: none; float: right; position: absolute; } #user p { display: inherit; float: none; } #author div#foo { background-color: #bbc; letter-spacing: 200%; } div#foo p { letter-spacing: 300%; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: 0px 0px border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: auto direction: inherit display: inherit empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: normal line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: 2px overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: absolute quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: normal writing-mode: horizontal-tb z-index: auto #reset #tree | div | id=foo | p* #ua div, p { display: none; float: right; position: absolute; } #user p { display: inherit; float: none; } #author div#foo { background-color: #bbc; letter-spacing: 20mm; } div#foo p { letter-spacing: 300px; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: inherit direction: inherit display: inherit empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: 300px line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: absolute quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: horizontal-tb z-index: auto #reset #tree | div | id=foo | p* #ua div, p { display: none; float: right; position: absolute; } #user p { display: block; writing-mode: vertical-lr; } #author div#foo p { letter-spacing: inherit; } div p { letter-spacing: horizontal-tb; } #errors #expected background-attachment: scroll background-color: #00000000 background-image: none background-position: 0% 0% background-repeat: repeat border-collapse: inherit border-spacing: inherit border-top-color: currentColor border-right-color: currentColor border-bottom-color: currentColor border-left-color: currentColor border-top-style: none border-right-style: none border-bottom-style: none border-left-style: none border-top-width: medium border-right-width: medium border-bottom-width: medium border-left-width: medium bottom: auto caption-side: inherit clear: none clip: auto color: inherit content: normal counter-increment: none counter-reset: none cursor: inherit direction: inherit display: block empty-cells: inherit float: none font-family: inherit font-size: inherit font-style: inherit font-variant: inherit font-weight: inherit height: auto left: auto letter-spacing: inherit line-height: inherit list-style-image: inherit list-style-position: inherit list-style-type: inherit margin-top: 0px margin-right: 0px margin-bottom: 0px margin-left: 0px max-height: none max-width: none min-height: 0px min-width: 0px opacity: 1.000 outline-color: invert outline-style: none outline-width: medium overflow-x: visible overflow-y: visible padding-top: 0px padding-right: 0px padding-bottom: 0px padding-left: 0px position: absolute quotes: inherit right: auto table-layout: auto text-align: inherit text-decoration: none text-indent: inherit text-transform: inherit top: auto unicode-bidi: normal vertical-align: baseline visibility: inherit white-space: inherit width: auto word-spacing: inherit writing-mode: vertical-lr z-index: auto #reset netsurf-all-3.2/libcss/test/data/select/INDEX0000644000175000017500000000013012377676736020046 0ustar vincevince# Index file for automated parser tests # # Test Description tests1.dat Basic tests netsurf-all-3.2/libcss/test/data/parse2/0000755000175000017500000000000012377713347017165 5ustar vincevincenetsurf-all-3.2/libcss/test/data/parse2/border.dat0000644000175000017500000007652112377676736021161 0ustar vincevince#data * { border: inherit; } #errors #expected | * | border-top-color: inherit | border-top-style: inherit | border-top-width: inherit | border-right-color: inherit | border-right-style: inherit | border-right-width: inherit | border-bottom-color: inherit | border-bottom-style: inherit | border-bottom-width: inherit | border-left-color: inherit | border-left-style: inherit | border-left-width: inherit #reset #data * { border: red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: none | border-top-width: medium | border-right-color: #ffff0000 | border-right-style: none | border-right-width: medium | border-bottom-color: #ffff0000 | border-bottom-style: none | border-bottom-width: medium | border-left-color: #ffff0000 | border-left-style: none | border-left-width: medium #reset #data * { border: transparent; } #errors #expected | * | border-top-color: transparent | border-top-style: none | border-top-width: medium | border-right-color: transparent | border-right-style: none | border-right-width: medium | border-bottom-color: transparent | border-bottom-style: none | border-bottom-width: medium | border-left-color: transparent | border-left-style: none | border-left-width: medium #reset #data * { border: currentColor; } #errors #expected | * | border-top-color: currentColor | border-top-style: none | border-top-width: medium | border-right-color: currentColor | border-right-style: none | border-right-width: medium | border-bottom-color: currentColor | border-bottom-style: none | border-bottom-width: medium | border-left-color: currentColor | border-left-style: none | border-left-width: medium #reset #data * { border: solid; } #errors #expected | * | border-top-color: currentColor | border-top-style: solid | border-top-width: medium | border-right-color: currentColor | border-right-style: solid | border-right-width: medium | border-bottom-color: currentColor | border-bottom-style: solid | border-bottom-width: medium | border-left-color: currentColor | border-left-style: solid | border-left-width: medium #reset #data * { border: thin; } #errors #expected | * | border-top-color: currentColor | border-top-style: none | border-top-width: thin | border-right-color: currentColor | border-right-style: none | border-right-width: thin | border-bottom-color: currentColor | border-bottom-style: none | border-bottom-width: thin | border-left-color: currentColor | border-left-style: none | border-left-width: thin #reset #data * { border: red solid; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: medium | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: medium | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: medium | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: medium #reset #data * { border: solid red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: medium | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: medium | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: medium | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: medium #reset #data * { border: red thin; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: none | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: none | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: none | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: none | border-left-width: thin #reset #data * { border: thin red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: none | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: none | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: none | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: none | border-left-width: thin #reset #data * { border: solid thin; } #errors #expected | * | border-top-color: currentColor | border-top-style: solid | border-top-width: thin | border-right-color: currentColor | border-right-style: solid | border-right-width: thin | border-bottom-color: currentColor | border-bottom-style: solid | border-bottom-width: thin | border-left-color: currentColor | border-left-style: solid | border-left-width: thin #reset #data * { border: thin solid; } #errors #expected | * | border-top-color: currentColor | border-top-style: solid | border-top-width: thin | border-right-color: currentColor | border-right-style: solid | border-right-width: thin | border-bottom-color: currentColor | border-bottom-style: solid | border-bottom-width: thin | border-left-color: currentColor | border-left-style: solid | border-left-width: thin #reset #data * { border: red solid thin; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: red thin solid; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: solid red thin; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: solid thin red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: thin red solid; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: thin solid red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border: inherit !important; } #errors #expected | * | border-top-color: inherit !important | border-top-style: inherit !important | border-top-width: inherit !important | border-right-color: inherit !important | border-right-style: inherit !important | border-right-width: inherit !important | border-bottom-color: inherit !important | border-bottom-style: inherit !important | border-bottom-width: inherit !important | border-left-color: inherit !important | border-left-style: inherit !important | border-left-width: inherit !important #reset #data * { border: red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: none !important | border-top-width: medium !important | border-right-color: #ffff0000 !important | border-right-style: none !important | border-right-width: medium !important | border-bottom-color: #ffff0000 !important | border-bottom-style: none !important | border-bottom-width: medium !important | border-left-color: #ffff0000 !important | border-left-style: none !important | border-left-width: medium !important #reset #data * { border: solid !important; } #errors #expected | * | border-top-color: currentColor !important | border-top-style: solid !important | border-top-width: medium !important | border-right-color: currentColor !important | border-right-style: solid !important | border-right-width: medium !important | border-bottom-color: currentColor !important | border-bottom-style: solid !important | border-bottom-width: medium !important | border-left-color: currentColor !important | border-left-style: solid !important | border-left-width: medium !important #reset #data * { border: thin !important; } #errors #expected | * | border-top-color: currentColor !important | border-top-style: none !important | border-top-width: thin !important | border-right-color: currentColor !important | border-right-style: none !important | border-right-width: thin !important | border-bottom-color: currentColor !important | border-bottom-style: none !important | border-bottom-width: thin !important | border-left-color: currentColor !important | border-left-style: none !important | border-left-width: thin !important #reset #data * { border: red solid !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: medium !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: medium !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: medium !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: medium !important #reset #data * { border: solid red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: medium !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: medium !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: medium !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: medium !important #reset #data * { border: red thin !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: none !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: none !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: none !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: none !important | border-left-width: thin !important #reset #data * { border: thin red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: none !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: none !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: none !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: none !important | border-left-width: thin !important #reset #data * { border: solid thin !important; } #errors #expected | * | border-top-color: currentColor !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: currentColor !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: currentColor !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: currentColor !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: thin solid !important; } #errors #expected | * | border-top-color: currentColor !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: currentColor !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: currentColor !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: currentColor !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: red solid thin !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: red thin solid !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: solid red thin !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: solid thin red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: thin red solid !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: thin solid red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-top-style: solid !important | border-top-width: thin !important | border-right-color: #ffff0000 !important | border-right-style: solid !important | border-right-width: thin !important | border-bottom-color: #ffff0000 !important | border-bottom-style: solid !important | border-bottom-width: thin !important | border-left-color: #ffff0000 !important | border-left-style: solid !important | border-left-width: thin !important #reset #data * { border: invalid; } #errors #expected | * #reset #data * { border: ; } #errors #expected | * #reset #data * { border:} #errors #expected | * #reset #data * { border: thin inherit; } #errors #expected | * #reset #data * { border: inherit thin; } #errors #expected | * #reset #data * { border: thin solid black inherit; } #errors #expected | * #reset #data * { border: thin inherit solid; } #errors #expected | * #reset #data * { border: inherit !important #ff9; } #errors #expected | * #reset #data * { border-color: red; } #errors #expected | * | border-top-color: #ffff0000 | border-right-color: #ffff0000 | border-bottom-color: #ffff0000 | border-left-color: #ffff0000 #reset #data * { border-color: inherit; } #errors #expected | * | border-top-color: inherit | border-right-color: inherit | border-bottom-color: inherit | border-left-color: inherit #reset #data * { border-color: red green; } #errors #expected | * | border-top-color: #ffff0000 | border-right-color: #ff008000 | border-bottom-color: #ffff0000 | border-left-color: #ff008000 #reset #data * { border-color: red green blue; } #errors #expected | * | border-top-color: #ffff0000 | border-right-color: #ff008000 | border-bottom-color: #ff0000ff | border-left-color: #ff008000 #reset #data * { border-color: red green blue yellow; } #errors #expected | * | border-top-color: #ffff0000 | border-right-color: #ff008000 | border-bottom-color: #ff0000ff | border-left-color: #ffffff00 #reset #data * { border-color: red !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-right-color: #ffff0000 !important | border-bottom-color: #ffff0000 !important | border-left-color: #ffff0000 !important #reset #data * { border-color: red green !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-right-color: #ff008000 !important | border-bottom-color: #ffff0000 !important | border-left-color: #ff008000 !important #reset #data * { border-color: red green blue !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-right-color: #ff008000 !important | border-bottom-color: #ff0000ff !important | border-left-color: #ff008000 !important #reset #data * { border-color: red green blue yellow !important; } #errors #expected | * | border-top-color: #ffff0000 !important | border-right-color: #ff008000 !important | border-bottom-color: #ff0000ff !important | border-left-color: #ffffff00 !important #reset #data * { border-color: invalid; } #errors #expected | * #reset #data * { border-color: ; } #errors #expected | * #reset #data * { border-color:} #errors #expected | * #reset #data * { border-style: solid; } #errors #expected | * | border-top-style: solid | border-right-style: solid | border-bottom-style: solid | border-left-style: solid #reset #data * { border-style: inherit; } #errors #expected | * | border-top-style: inherit | border-right-style: inherit | border-bottom-style: inherit | border-left-style: inherit #reset #data * { border-style: solid double; } #errors #expected | * | border-top-style: solid | border-right-style: double | border-bottom-style: solid | border-left-style: double #reset #data * { border-style: solid double groove; } #errors #expected | * | border-top-style: solid | border-right-style: double | border-bottom-style: groove | border-left-style: double #reset #data * { border-style: solid double groove ridge; } #errors #expected | * | border-top-style: solid | border-right-style: double | border-bottom-style: groove | border-left-style: ridge #reset #data * { border-style: solid !important; } #errors #expected | * | border-top-style: solid !important | border-right-style: solid !important | border-bottom-style: solid !important | border-left-style: solid !important #reset #data * { border-style: solid double !important; } #errors #expected | * | border-top-style: solid !important | border-right-style: double !important | border-bottom-style: solid !important | border-left-style: double !important #reset #data * { border-style: solid double groove !important; } #errors #expected | * | border-top-style: solid !important | border-right-style: double !important | border-bottom-style: groove !important | border-left-style: double !important #reset #data * { border-style: solid double groove ridge !important; } #errors #expected | * | border-top-style: solid !important | border-right-style: double !important | border-bottom-style: groove !important | border-left-style: ridge !important #reset #data * { border-style: invalid; } #errors #expected | * #reset #data * { border-style: ; } #errors #expected | * #reset #data * { border-style:} #errors #expected | * #reset #data * { border-width: thin; } #errors #expected | * | border-top-width: thin | border-right-width: thin | border-bottom-width: thin | border-left-width: thin #reset #data * { border-width: inherit; } #errors #expected | * | border-top-width: inherit | border-right-width: inherit | border-bottom-width: inherit | border-left-width: inherit #reset #data * { border-width: thin thick; } #errors #expected | * | border-top-width: thin | border-right-width: thick | border-bottom-width: thin | border-left-width: thick #reset #data * { border-width: thin thick medium; } #errors #expected | * | border-top-width: thin | border-right-width: thick | border-bottom-width: medium | border-left-width: thick #reset #data * { border-width: thin thick medium 0; } #errors #expected | * | border-top-width: thin | border-right-width: thick | border-bottom-width: medium | border-left-width: 0px #reset #data * { border-width: thin !important; } #errors #expected | * | border-top-width: thin !important | border-right-width: thin !important | border-bottom-width: thin !important | border-left-width: thin !important #reset #data * { border-width: thin thick !important; } #errors #expected | * | border-top-width: thin !important | border-right-width: thick !important | border-bottom-width: thin !important | border-left-width: thick !important #reset #data * { border-width: thin thick medium !important; } #errors #expected | * | border-top-width: thin !important | border-right-width: thick !important | border-bottom-width: medium !important | border-left-width: thick !important #reset #data * { border-width: thin thick medium 0 !important; } #errors #expected | * | border-top-width: thin !important | border-right-width: thick !important | border-bottom-width: medium !important | border-left-width: 0px !important #reset #data * { border-width: invalid; } #errors #expected | * #reset #data * { border-width: ; } #errors #expected | * #reset #data * { border-width:} #errors #expected | * #reset #data * { border-top: inherit; } #errors #expected | * | border-top-color: inherit | border-top-style: inherit | border-top-width: inherit #reset #data * { border-top: red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: none | border-top-width: medium #reset #data * { border-top: solid; } #errors #expected | * | border-top-color: currentColor | border-top-style: solid | border-top-width: medium #reset #data * { border-top: thin; } #errors #expected | * | border-top-color: currentColor | border-top-style: none | border-top-width: thin #reset #data * { border-top: red solid; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: medium #reset #data * { border-top: thin solid red; } #errors #expected | * | border-top-color: #ffff0000 | border-top-style: solid | border-top-width: thin #reset #data * { border-right: inherit; } #errors #expected | * | border-right-color: inherit | border-right-style: inherit | border-right-width: inherit #reset #data * { border-right: red; } #errors #expected | * | border-right-color: #ffff0000 | border-right-style: none | border-right-width: medium #reset #data * { border-right: solid; } #errors #expected | * | border-right-color: currentColor | border-right-style: solid | border-right-width: medium #reset #data * { border-right: thin; } #errors #expected | * | border-right-color: currentColor | border-right-style: none | border-right-width: thin #reset #data * { border-right: red solid; } #errors #expected | * | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: medium #reset #data * { border-right: thin solid red; } #errors #expected | * | border-right-color: #ffff0000 | border-right-style: solid | border-right-width: thin #reset #data * { border-bottom: inherit; } #errors #expected | * | border-bottom-color: inherit | border-bottom-style: inherit | border-bottom-width: inherit #reset #data * { border-bottom: red; } #errors #expected | * | border-bottom-color: #ffff0000 | border-bottom-style: none | border-bottom-width: medium #reset #data * { border-bottom: solid; } #errors #expected | * | border-bottom-color: currentColor | border-bottom-style: solid | border-bottom-width: medium #reset #data * { border-bottom: thin; } #errors #expected | * | border-bottom-color: currentColor | border-bottom-style: none | border-bottom-width: thin #reset #data * { border-bottom: red solid; } #errors #expected | * | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: medium #reset #data * { border-bottom: thin solid red; } #errors #expected | * | border-bottom-color: #ffff0000 | border-bottom-style: solid | border-bottom-width: thin #reset #data * { border-left: inherit; } #errors #expected | * | border-left-color: inherit | border-left-style: inherit | border-left-width: inherit #reset #data * { border-left: red; } #errors #expected | * | border-left-color: #ffff0000 | border-left-style: none | border-left-width: medium #reset #data * { border-left: solid; } #errors #expected | * | border-left-color: currentColor | border-left-style: solid | border-left-width: medium #reset #data * { border-left: thin; } #errors #expected | * | border-left-color: currentColor | border-left-style: none | border-left-width: thin #reset #data * { border-left: red solid; } #errors #expected | * | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: medium #reset #data * { border-left: thin solid red; } #errors #expected | * | border-left-color: #ffff0000 | border-left-style: solid | border-left-width: thin #reset #data * { border-collapse: inherit; } #errors #expected | * | border-collapse: inherit #reset #data * { border-spacing: inherit; } #errors #expected | * | border-spacing: inherit #reset #data * { border-top-color: inherit; } #errors #expected | * | border-top-color: inherit #reset #data * { border-right-style: inherit; } #errors #expected | * | border-right-style: inherit #reset #data * { border-bottom-width: inherit; } #errors #expected | * | border-bottom-width: inherit #reset #data * { border-left-color: inherit !important; } #errors #expected | * | border-left-color: inherit !important #reset #data * { border: red inherit; } #errors #expected | * #reset #data * { border: red inherit red; } #errors #expected | * #reset #data * { border: red red; } #errors #expected | * #reset #data * { border: inherit red medium; } #errors #expected | * #reset #data * { border: inherit red medium inherit; } #errors #expected | * #reset #data * { border: red medium inherit; } #errors #expected | * #reset #data * { border: inherit inherit; } #errors #expected | * #reset #data * { border: none inherit; } #errors #expected | * #reset #data * { border: none inherit red; } #errors #expected | * #reset #data * { border-width: inherit inherit; } #errors #expected | * #reset #data * { border-width: 0 inherit; } #errors #expected | * #reset #data * { border-width: 0 inherit 0; } #errors #expected | * #reset #data * { border-width: inherit 0 inherit 0; } #errors #expected | * #reset #data * { border-width: thin inherit; } #errors #expected | * #reset #data * { border-color: blue inherit; } #errors #expected | * #reset #data * { border-color: inherit blue; } #errors #expected | * #reset #data * { border-color: inherit inherit; } #errors #expected | * #reset #data * { border-color: thin; } #errors #expected | * #reset #data * { border-color: blue inherit green blue; } #errors #expected | * #reset #data * { border-style: solid inherit; } #errors #expected | * #reset #data * { border-style: inherit solid; } #errors #expected | * #reset #data * { border-style: inherit inherit; } #errors #expected | * #reset #data * { border-top: red inherit; } #errors #expected | * #reset #data * { border-top: red inherit red; } #errors #expected | * #reset #data * { border-top: red red; } #errors #expected | * #reset #data * { border-top: inherit red medium; } #errors #expected | * #reset #data * { border-top: inherit red medium inherit; } #errors #expected | * #reset #data * { border-top: red medium inherit; } #errors #expected | * #reset #data * { border-top: inherit inherit; } #errors #expected | * #reset #data * { border-top: none inherit; } #errors #expected | * #reset #data * { border-top: none inherit red; } #errors #expected | * #reset #data * { border-left: red inherit; } #errors #expected | * #reset #data * { border-left: red inherit red; } #errors #expected | * #reset #data * { border-left: red red; } #errors #expected | * #reset #data * { border-left: inherit red medium; } #errors #expected | * #reset #data * { border-left: inherit red medium inherit; } #errors #expected | * #reset #data * { border-left: red medium inherit; } #errors #expected | * #reset #data * { border-left: inherit inherit; } #errors #expected | * #reset #data * { border-left: none inherit; } #errors #expected | * #reset #data * { border-left: none inherit red; } #errors #expected | * #reset #data * { border-right: red inherit; } #errors #expected | * #reset #data * { border-right: red inherit red; } #errors #expected | * #reset #data * { border-right: red red; } #errors #expected | * #reset #data * { border-right: inherit red medium; } #errors #expected | * #reset #data * { border-right: inherit red medium inherit; } #errors #expected | * #reset #data * { border-right: red medium inherit; } #errors #expected | * #reset #data * { border-right: inherit inherit; } #errors #expected | * #reset #data * { border-right: none inherit; } #errors #expected | * #reset #data * { border-right: none inherit red; } #errors #expected | * #reset #data * { border-bottom: red inherit; } #errors #expected | * #reset #data * { border-bottom: red inherit red; } #errors #expected | * #reset #data * { border-bottom: red red; } #errors #expected | * #reset #data * { border-bottom: inherit red medium; } #errors #expected | * #reset #data * { border-bottom: inherit red medium inherit; } #errors #expected | * #reset #data * { border-bottom: red medium inherit; } #errors #expected | * #reset #data * { border-bottom: inherit inherit; } #errors #expected | * #reset #data * { border-bottom: none inherit; } #errors #expected | * #reset #data * { border-bottom: none inherit red; } #errors #expected | * #reset #data * { border-bottom-color: red !important; } #errors #expected | * | border-bottom-color: #ffff0000 !important #reset netsurf-all-3.2/libcss/test/data/parse2/illegal-values.dat0000644000175000017500000013010712377676736022601 0ustar vincevince#data * { azimuth: -361deg; } #errors #expected | * #reset #data * { azimuth: 361deg; } #errors #expected | * #reset #data * { azimuth: -6.284rad; } #errors #expected | * #reset #data * { azimuth: 6.284rad; } #errors #expected | * #reset #data * { azimuth: -6.283rad; } #errors #expected | * | azimuth: -6.283rad #reset #data * { azimuth: 6.283rad; } #errors #expected | * | azimuth: 6.283rad #reset #data * { azimuth: -400.001grad; } #errors #expected | * #reset #data * { azimuth: 400.001deg; } #errors #expected | * #reset #data * { azimuth: 0; azimuth: moose behind; } #errors #expected | * | azimuth: 0deg #reset #data * { azimuth: 0; azimuth: moose behind; } #errors #expected | * | azimuth: 0deg #reset #data * { azimuth: behind; azimuth: -left; } #errors #expected | * | azimuth: center behind #reset #data * { azimuth: -; } #errors #expected | * #reset #data * { background-attachment: well-stuck; } #errors #expected | * #reset #data * { background-attachment: 0; } #errors #expected | * #reset #data * { background-attachment: 100%; } #errors #expected | * #reset #data * { background-color: black and blue; } #errors #expected | * #reset #data * { background-color: 0; } #errors #expected | * #reset #data * { background-color: -bbc; } #errors #expected | * #reset #data * { background-color: -bbc111; } #errors #expected | * #reset #data * { background-image: 0; } #errors #expected | * #reset #data * { background-image: "sonic"; } #errors #expected | * #reset #data * { background-image: url"sonic"; } #errors #expected | * #reset #data * { background-image: url(); } #errors #expected | * | background-image: url('') #reset #data * { background-position: -20% 0; background-position: rightwards; } #errors #expected | * | background-position: -20% 0px #reset #data * { background-position: left; background-position: rightwards; } #errors #expected | * | background-position: left center #reset #data * { border-collapse: tweaked; } #errors #expected | * #reset #data * { border-top-color: 25grad; } #errors #expected | * #reset #data * { border-spacing: -1; } #errors #expected | * #reset #data * { border-spacing: -1px; } #errors #expected | * #reset #data * { border-spacing: 3px -30em; } #errors #expected | * #reset #data * { border-spacing: wide; } #errors #expected | * #reset #data * { border-top-style: thin; } #errors #expected | * #reset #data * { border-bottom-style: 7px; } #errors #expected | * #reset #data * { border-left-style: smidgin; } #errors #expected | * #reset #data * { border-right-style: url("Sonic"); } #errors #expected | * #reset #data * { border-left-width: url("Sonic"); } #errors #expected | * #reset #data * { border-left-width: inset; } #errors #expected | * #reset #data * { border-left-width: -4px; } #errors #expected | * #reset #data * { border-left-width: 0; } #errors #expected | * | border-left-width: 0px #reset #data * { border-left-width: hidden; } #errors #expected | * #reset #data * { border-left-style: none; } #errors #expected | * | border-left-style: none #reset #data * { border-bottom-style: hidden; } #errors #expected | * | border-bottom-style: hidden #reset #data * { bottom: -4; bottom: blunderbus; bottom: -50%; bottom: 6Hz; } #errors #expected | * | bottom: -50% #reset #data * { top: -4; top: blunderbus; top: -50%; top: 6Hz; } #errors #expected | * | top: -50% #reset #data * { caption-side: 0; } #errors #expected | * #reset #data * { caption-side: top "7"; } #errors #expected | * #reset #data * { caption-side: 7em; } #errors #expected | * #reset #data * { clip: rect("0 2px 30px 1px"); clip: rect(0 60px 40pt 0px); } #errors #expected | * | clip: rect(0px, 60px, 40pt, 0px) #reset #data * { clip: rect(1px 2px); } #errors #expected | * #reset #data * { clip: rect(1px 2px 1px 2px 1px); } #errors #expected | * #reset #data * { clip: 1px 2px 1px 2px; } #errors #expected | * #reset #data * { color: #gghhgg; } #errors #expected | * #reset #data * { color: #gghhgg; stress: 101; stress: 50px; stress: -50; stress: 50grad; } #errors #expected | * #reset #data * { content::; } #errors #expected | * #reset #data * { content: content: counters(n, ".", moo, moose); } #errors #expected | * #reset #data * { content: content: content: open-quote shoe-horn url('http://picodrive.acornarcade.com/') " : " attr(name) " " counter(x) "." counters(y, ".") close-quote; } #errors #expected | * #reset #data * { counter-increment: "moose" 7; } #errors #expected | * #reset #data * { counter-increment: 1st-moose 7; } #errors #expected | * #reset #data * { counter-increment: sonic&knuckles 7; } #errors #expected | * #reset #data * { counter-increment: sonic 7 2; } #errors #expected | * #reset #data * { counter-increment: sonic 7 knuckles 2; } #errors #expected | * | counter-increment: sonic 7 knuckles 2 #reset #data * { counter-increment: sonic 2nd; } #errors #expected | * #reset #data * { counter-increment: sonic 2px; } #errors #expected | * #reset #data * { counter-increment: sonic "2"; } #errors #expected | * #reset #data * { counter-increment: sonic url(2); } #errors #expected | * #reset #data * { counter-increment: url(2) 1; } #errors #expected | * #reset #data * { counter-increment: woo; } #errors #expected | * | counter-increment: woo 1 #reset #data * { counter-increment: 1; } #errors #expected | * #reset #data * { counter-reset: "moose" 7; } #errors #expected | * #reset #data * { counter-reset: 1st-moose 7; } #errors #expected | * #reset #data * { counter-reset: sonic&knuckles 7; } #errors #expected | * #reset #data * { counter-reset: sonic 7 2; } #errors #expected | * #reset #data * { counter-reset: sonic 7 knuckles 2; } #errors #expected | * | counter-reset: sonic 7 knuckles 2 #reset #data * { counter-reset: sonic 2nd; } #errors #expected | * #reset #data * { counter-reset: sonic 2px; } #errors #expected | * #reset #data * { counter-reset: sonic "2"; } #errors #expected | * #reset #data * { counter-reset: sonic url(2); } #errors #expected | * #reset #data * { counter-reset: url(2) 1; } #errors #expected | * #reset #data * { counter-reset: 1; } #errors #expected | * #reset #data * { counter-reset: woo; } #errors #expected | * | counter-reset: woo 0 #reset #data * { cue-after: url(mooo; } #errors #expected | * #reset #data * { cue-after: url(mooo) woo; } #errors #expected | * #reset #data * { cue-after: woo url(mooo); } #errors #expected | * #reset #data * { cue-after: ""; } #errors #expected | * #reset #data * { cue-after: "woo"; } #errors #expected | * #reset #data * { cue-after: url"woo"; } #errors #expected | * #reset #data * { cue-after: 10px; } #errors #expected | * #reset #data * { cue-after: 0; } #errors #expected | * #reset #data * { cue-after: sonic the hedgehog; } #errors #expected | * #reset #data * { cue-before: url(mooo; } #errors #expected | * #reset #data * { cue-before: url(mooo) woo; } #errors #expected | * #reset #data * { cue-before: woo url(mooo); } #errors #expected | * #reset #data * { cue-before: ""; } #errors #expected | * #reset #data * { cue-before: "woo"; } #errors #expected | * #reset #data * { cue-before: url"woo"; } #errors #expected | * #reset #data * { cue-before: 10px; } #errors #expected | * #reset #data * { cue-before: 0; } #errors #expected | * #reset #data * { cue-before: sonic the hedgehog; } #errors #expected | * #reset #data * { cursor: sonic the hedgehog; } #errors #expected | * #reset #data * { cursor: "sonic the hedgehog"; } #errors #expected | * #reset #data * { cursor: move help; } #errors #expected | * #reset #data * { cursor: move url("moose") help; } #errors #expected | * #reset #data * { direction: rtl ltr; } #errors #expected | * #reset #data * { direction: rtl, ltr; } #errors #expected | * #reset #data * { direction: "ltr"; } #errors #expected | * #reset #data * { direction: -ltr; } #errors #expected | * #reset #data * { direction: -1 ltr; } #errors #expected | * #reset #data * { direction: ltr -1; } #errors #expected | * #reset #data * { direction: -1; } #errors #expected | * #reset #data * { direction: 0; } #errors #expected | * #reset #data * { direction: url(knuckles); } #errors #expected | * #reset #data * { display: web; } #errors #expected | * #reset #data * { display: "sonic"; } #errors #expected | * #reset #data * { display: block inline-block; } #errors #expected | * #reset #data * { display: block, inline-block; } #errors #expected | * #reset #data * { display: block 0; } #errors #expected | * #reset #data * { display: 0 block; } #errors #expected | * #reset #data * { display: 0.00; } #errors #expected | * #reset #data * { display: 0.00em; } #errors #expected | * #reset #data * { display: 0.0%; } #errors #expected | * #reset #data * { display: ^; } #errors #expected | * #reset #data * { display: gB/ifwDuD0tDgBigBgBgBC0tufw/C/gB<:qB]gBe蔦@ 嚴LApWBgBA.嚴騒蔦gBgBgBgB47:twB`礙=w@.階.!礙\RGGBgB掾gBB=ww\Rw礙=w礙=wB( B4& 4礙=wB/w/GgBG/j/fwGuG0tGgBgBjgBF0twuwfww/F/j<:twB`j蔦C嚴OAれWBjA1嚴xw蔦v jjjj4L7!:vBb礙?@.(.#L礙\RIIBgB]gBB?\R礙?; position: fixed; } #errors #expected | * | position: fixed #reset #data * { elevation: 1000; } #errors #expected | * #reset #data * { elevation: 10; } #errors #expected | * #reset #data * { elevation: 0; } #errors #expected | * | elevation: 0deg #reset #data * { elevation: 91deg; } #errors #expected | * #reset #data * { elevation: -90.001deg; } #errors #expected | * #reset #data * { elevation: 90deg; } #errors #expected | * | elevation: 90deg #reset #data * { elevation: -90deg; } #errors #expected | * | elevation: -90deg #reset #data * { elevation: 100.1grad; } #errors #expected | * #reset #data * { elevation: -101grad; } #errors #expected | * #reset #data * { elevation: 100grad; } #errors #expected | * | elevation: 100grad #reset #data * { elevation: -99.9grad; } #errors #expected | * | elevation: -99.900grad #reset #data * { elevation: 1.571rad; } #errors #expected | * #reset #data * { elevation: -1.571rad; } #errors #expected | * #reset #data * { elevation: 1.57rad; } #errors #expected | * | elevation: 1.570rad #reset #data * { elevation: -1.569rad; } #errors #expected | * | elevation: -1.569rad #reset #data * { elevation: -1.1739673929057382429872339846535643689687rad; } #errors #expected | * | elevation: -1.174rad #reset #data * { elevation: lower -90deg; } #errors #expected | * #reset #data * { elevation: lower level; } #errors #expected | * #reset #data * { elevation: moo; } #errors #expected | * #reset #data * { elevation: "PicoDrive"; } #errors #expected | * #reset #data * { elevation: ""; } #errors #expected | * #reset #data * { elevation: 3em; } #errors #expected | * #reset #data * { empty-cells: slow; } #errors #expected | * #reset #data * { empty-cells: 13; } #errors #expected | * #reset #data * { empty-cells: 13em; } #errors #expected | * #reset #data * { empty-cells: "font-style: italic;"; } #errors #expected | * #reset #data * { empty-cells: show inherit; } #errors #expected | * #reset #data * { empty-cells: show 2; } #errors #expected | * #reset #data * { empty-cells: 0 show ; } #errors #expected | * #reset #data * { empty-cells: empty-cells: show; show; } #errors #expected | * #reset #data * { float: 0 none; } #errors #expected | * #reset #data * { float: left"; } #errors #expected | * #reset #data * { float: left right; } #errors #expected | * #reset #data * { float: "left"; } #errors #expected | * #reset #data * { float: ltr; } #errors #expected | * #reset #data * { float: -1pt; } #errors #expected | * #reset #data * { float: -1; } #errors #expected | * #reset #data * { float: 0; } #errors #expected | * #reset #data * { float: url(knuckles); } #errors #expected | * #reset #data * { font-family: 1000pt; } #errors #expected | * #reset #data * { font-family: 0; } #errors #expected | * #reset #data * { font-family: "; } #errors #expected | * #reset #data * { font-family: "'; } #errors #expected | * #reset #data * { font-family: serif, "Trinity"; } #errors #expected | * | font-family: serif, 'Trinity' #reset #data * { font-family: serif, sans-serif; } #errors #expected | * | font-family: serif, sans-serif #reset #data * { font-family: "Homerton", "Oxford", moose; } #errors #expected | * | font-family: 'Homerton', 'Oxford', 'moose' #reset #data * { font-family: "Homerton", "Oxford", sans-serif, moose; } #errors #expected | * | font-family: 'Homerton', 'Oxford', sans-serif, 'moose' #reset #data * { font-family: "Homerton" "Oxford" sans-serif; } #errors #expected | * #reset #data * { font-family: moo, "Homerton", "Oxford"; } #errors #expected | * | font-family: 'moo', 'Homerton', 'Oxford' #reset #data * { font-family: moo, "Homerton" "Oxford"; } #errors #expected | * #reset #data * { font-family: "Homerton", "Oxford", url(font); } #errors #expected | * #reset #data * { font-family: Soinc the Hedgehog; } #errors #expected | * | font-family: 'Soinc the Hedgehog' #reset #data * { font-size: xx-small larger; } #errors #expected | * #reset #data * { font-size: xx-small 3pt; } #errors #expected | * #reset #data * { font-size: 3pt xx-small; } #errors #expected | * #reset #data * { font-size: xx-small xx-small; } #errors #expected | * #reset #data * { font-size: normal; } #errors #expected | * #reset #data * { font-size: -10pt; } #errors #expected | * #reset #data * { font-size: 10pt 11pt; } #errors #expected | * #reset #data * { font-size: 0 larger; } #errors #expected | * #reset #data * { font-size: 0 0%; } #errors #expected | * #reset #data * { font-size: 6% larger; } #errors #expected | * #reset #data * { font-size: -150%; } #errors #expected | * #reset #data * { font-style: -150%; } #errors #expected | * #reset #data * { font-style: 150%; } #errors #expected | * #reset #data * { font-style: 150; } #errors #expected | * #reset #data * { font-style: 150ex; } #errors #expected | * #reset #data * { font-style: "hidden"; } #errors #expected | * #reset #data * { font-style: thin solid black; } #errors #expected | * #reset #data * { font-style: normally; } #errors #expected | * #reset #data * { font-style: normal%; } #errors #expected | * #reset #data * { font-style: 40pt italic; } #errors #expected | * #reset #data * { font-style: small-caps; } #errors #expected | * #reset #data * { font-style: url(), 20grad, common, "endless drivel"; } #errors #expected | * #reset #data * { font-style: " #errors #expected | * #reset #data * { font-style: , #errors #expected | * #reset #data * { font-style: { #errors #expected | * #reset #data * { font-style: } #errors #expected | * #reset #data * { font-variant: sixteen; } #errors #expected | * #reset #data * { font-variant: 17%; } #errors #expected | * #reset #data * { font-variant: 18pc; } #errors #expected | * #reset #data * { font-variant: 19; } #errors #expected | * #reset #data * { font-variant: 1,2,3,4,5; } #errors #expected | * #reset #data * { font-variant: 1, 2, 3, 4, 5; } #errors #expected | * #reset #data * { font-variant: bolder small-caps; } #errors #expected | * #reset #data * { font-variant: bolder, small-caps; } #errors #expected | * #reset #data * { font-variant: bolder,small-caps; } #errors #expected | * #reset #data * { font-variant: normal url("small-caps"); } #errors #expected | * #reset #data * { font-variant: "normal"; } #errors #expected | * #reset #data * { font-variant: "normal",; } #errors #expected | * #reset #data * { font-weight: 1000; } #errors #expected | * #reset #data * { font-weight: 450; } #errors #expected | * #reset #data * { font-weight: 100, 300; } #errors #expected | * #reset #data * { font-weight: 100 300; } #errors #expected | * #reset #data * { font-weight: 400 lighter; } #errors #expected | * #reset #data * { font-weight: bold lighter; } #errors #expected | * #reset #data * { height: 11; } #errors #expected | * #reset #data * { height: -11; } #errors #expected | * #reset #data * { height: 11Hz; } #errors #expected | * #reset #data * { height: -2grad; } #errors #expected | * #reset #data * { height: -2px; } #errors #expected | * #reset #data * { height: -20%; } #errors #expected | * #reset #data * { height: 20% 2pt; } #errors #expected | * #reset #data * { height: 2px tall; } #errors #expected | * #reset #data * { height: tall; } #errors #expected | * #reset #data * { height: auto 3px; } #errors #expected | * #reset #data * { height: 3px auto; } #errors #expected | * #reset #data * { height: "3"px; } #errors #expected | * #reset #data * { height: "3px"; } #errors #expected | * #reset #data * { height: 3px,; } #errors #expected | * #reset #data * { height: 3px, 10em; } #errors #expected | * #reset #data * { left: -4; left: blunderbus; left: -50%; left: 6Hz; } #errors #expected | * | left: -50% #reset #data * { left: -4px, 2px; } #errors #expected | * #reset #data * { left: -4px 2px; } #errors #expected | * #reset #data * { left: -; } #errors #expected | * #reset #data * { left: "3"en; } #errors #expected | * #reset #data * { left: "3en"; } #errors #expected | * #reset #data * { letter-spacing: 30%; } #errors #expected | * #reset #data * { letter-spacing: normal 0; letter-spacing: -1px; } #errors #expected | * | letter-spacing: -1px #reset #data * { letter-spacing: 1px 2px; } #errors #expected | * #reset #data * { letter-spacing: --1px; } #errors #expected | * #reset #data * { line-height: 1.1 1.1; } #errors #expected | * #reset #data * { line-height: -1.1; } #errors #expected | * #reset #data * { line-height: -1; } #errors #expected | * #reset #data * { line-height: -1%; } #errors #expected | * #reset #data * { line-height: -100%; } #errors #expected | * #reset #data * { line-height: -10em; } #errors #expected | * #reset #data * { line-height: 10em normal; } #errors #expected | * #reset #data * { list-style-image: url(Sonic) url(Knuckles); } #errors #expected | * #reset #data * { list-style-image: "Knuckles"; } #errors #expected | * #reset #data * { list-style-image: url(Knuckles) none; } #errors #expected | * #reset #data * { list-style-image: url(,"Knuckles"); } #errors #expected | * #reset #data * { list-style-image: inherit none; } #errors #expected | * #reset #data * { list-style-position: internal; } #errors #expected | * #reset #data * { list-style-position: -external; } #errors #expected | * #reset #data * { list-style-position: "inside"; } #errors #expected | * #reset #data * { list-style-position: -"inside"; } #errors #expected | * #reset #data * { list-style-position: 3.14em; } #errors #expected | * #reset #data * { list-style-position: none; } #errors #expected | * #reset #data * { list-style-position: normal; } #errors #expected | * #reset #data * { list-style-type: normal; } #errors #expected | * #reset #data * { list-style-type: normal; } #errors #expected | * #reset #data * { list-style-type: disc circle; } #errors #expected | * #reset #data * { list-style-type: 24pt circle; } #errors #expected | * #reset #data * { list-style-type: 24pt, circle; } #errors #expected | * #reset #data * { list-style-type: "circle"; } #errors #expected | * #reset #data * { list-style-type: lower_alpha; } #errors #expected | * #reset #data * { list-style-position: url(,"inside"); } #errors #expected | * #reset #data * { margin-left: url("wide"); } #errors #expected | * #reset #data * { margin-left: ; margin-right: -100px; } #errors #expected | * | margin-right: -100px #reset #data * { margin-left: margin-top: 0;; } #errors #expected | * #reset #data * { margin-top: 0 0 0 0; } #errors #expected | * #reset #data * { margin-top: 0 2em; } #errors #expected | * #reset #data * { margin-bottom: 2rad; } #errors #expected | * #reset #data * { margin-bottom: 20px 10%; } #errors #expected | * #reset #data * { margin-bottom: auto 10%; } #errors #expected | * #reset #data * { margin-right: 10% auto; } #errors #expected | * #reset #data * { max-height: 10% auto; } #errors #expected | * #reset #data * { max-height: 10% none; } #errors #expected | * #reset #data * { max-height: auto; } #errors #expected | * #reset #data * { max-height: -3em; } #errors #expected | * #reset #data * { max-height: -30%; } #errors #expected | * #reset #data * { max-height: none; } #errors #expected | * | max-height: none #reset #data * { min-height: -3em; } #errors #expected | * #reset #data * { min-height: -100%; } #errors #expected | * #reset #data * { min-height: -10%; } #errors #expected | * #reset #data * { min-height: 2px 2in; } #errors #expected | * #reset #data * { min-height: 2px, 2in; } #errors #expected | * #reset #data * { min-height: url( SEGA ); } #errors #expected | * #reset #data * { min-height: none; } #errors #expected | * #reset #data * { min-width: none; } #errors #expected | * #reset #data * { min-width: -67%; } #errors #expected | * #reset #data * { min-width: -200px; } #errors #expected | * #reset #data * { min-width: 2em 3em; } #errors #expected | * #reset #data * { min-width: "Sonic & Knuckles"; } #errors #expected | * #reset #data * { max-width: -24pt; } #errors #expected | * #reset #data * { max-width: -50%; } #errors #expected | * #reset #data * { max-width: 7 thousand 6 hundred and twenty 3cm; } #errors #expected | * #reset #data * { max-width: "50"in; } #errors #expected | * #reset #data * { orphans: -3; } #errors #expected | * #reset #data * { orphans: 3em; } #errors #expected | * #reset #data * { orphans: "3; } #errors #expected | * #reset #data * { orphans: ,3; } #errors #expected | * #reset #data * { orphans: 3,; } #errors #expected | * #reset #data * { orphans: 3.3; } #errors #expected | * #reset #data * { orphans: 3.3cm; } #errors #expected | * #reset #data * { orphans: #567; } #errors #expected | * #reset #data * { orphans: red; } #errors #expected | * #reset #data * { outline-color: red black; } #errors #expected | * #reset #data * { outline-color: #BBC Radio 4; } #errors #expected | * #reset #data * { outline-color: -#BBC; } #errors #expected | * #reset #data * { outline-color: rgb); } #errors #expected | * #reset #data * { outline-color: rgb),,); } #errors #expected | * #reset #data * { outline-color: rgb)2,3,5); } #errors #expected | * #reset #data * { outline-color: rgb (2,30,5); } #errors #expected | * #reset #data * { outline-color: rgb; } #errors #expected | * #reset #data * { outline-color: Green Hill Zone; } #errors #expected | * #reset #data * { outline-color: green hill zone; } #errors #expected | * #reset #data * { outline-color: "Green Hill Zone"; outline-color: invert; } #errors #expected | * | outline-color: invert #reset #data * { outline-style: hidden; } #errors #expected | * #reset #data * { outline-style: none solid; } #errors #expected | * #reset #data * { outline-style: Spin-dash; } #errors #expected | * #reset #data * { outline-width: thin medium; } #errors #expected | * #reset #data * { outline-width: 00 medium; } #errors #expected | * #reset #data * { outline-width: 00; } #errors #expected | * | outline-width: 0px #reset #data * { outline-width: 00em; } #errors #expected | * | outline-width: 0em #reset #data * { outline-width: 24px 2px; } #errors #expected | * #reset #data * { outline-width: 5%; } #errors #expected | * #reset #data * { overflow: 5%; } #errors #expected | * #reset #data * { overflow: "hidden"; } #errors #expected | * #reset #data * { overflow: none; } #errors #expected | * #reset #data * { overflow: auto visible; } #errors #expected | * #reset #data * { overflow: 6; } #errors #expected | * #reset #data * { overflow: 62em; } #errors #expected | * #reset #data * { padding-left: -2em; } #errors #expected | * #reset #data * { padding-right: -40%; } #errors #expected | * #reset #data * { padding-top: -2em; } #errors #expected | * #reset #data * { padding-bottom: -4.0%; } #errors #expected | * #reset #data * { padding-top: 2em 4em; } #errors #expected | * #reset #data * { padding-left: 0 4em; } #errors #expected | * #reset #data * { padding-right: "Chemical Plant Zone"; } #errors #expected | * #reset #data * { padding-right: thick; } #errors #expected | * #reset #data * { page-break-after: 0; } #errors #expected | * #reset #data * { page-break-after: 2em; } #errors #expected | * #reset #data * { page-break-after: -2em; } #errors #expected | * #reset #data * { page-break-after: "Hedgehog"; } #errors #expected | * #reset #data * { page-break-after: PicoDrive; } #errors #expected | * #reset #data * { page-break-after: always left; } #errors #expected | * #reset #data * { page-break-after: auto 0; } #errors #expected | * #reset #data * { page-break-before: 0; } #errors #expected | * #reset #data * { page-break-before: 2em; } #errors #expected | * #reset #data * { page-break-before: -2em; } #errors #expected | * #reset #data * { page-break-before: "Hedgehog"; } #errors #expected | * #reset #data * { page-break-before: PicoDrive; } #errors #expected | * #reset #data * { page-break-before: always left; } #errors #expected | * #reset #data * { page-break-before: auto 0; } #errors #expected | * #reset #data * { page-break-inside: 0; } #errors #expected | * #reset #data * { page-break-inside: 2em; } #errors #expected | * #reset #data * { page-break-inside: -2em; } #errors #expected | * #reset #data * { page-break-inside: "Hedgehog"; } #errors #expected | * #reset #data * { page-break-inside: PicoDrive; } #errors #expected | * #reset #data * { page-break-inside: auto avoid; } #errors #expected | * #reset #data * { page-break-inside: auto 0; } #errors #expected | * #reset #data * { pause-after: auto 0; } #errors #expected | * #reset #data * { pause-after: auto; } #errors #expected | * #reset #data * { pause-after: none; } #errors #expected | * #reset #data * { pause-after: 1s 2s; } #errors #expected | * #reset #data * { pause-after: -1s; } #errors #expected | * #reset #data * { pause-after: -1.2ms; } #errors #expected | * #reset #data * { pause-after: -90%; } #errors #expected | * #reset #data * { pause-after: 24; } #errors #expected | * #reset #data * { pause-after: 24hrs; } #errors #expected | * #reset #data * { pause-after: pause; } #errors #expected | * #reset #data * { pause-after: "pause"; } #errors #expected | * #reset #data * { pause-after: 0 0; } #errors #expected | * #reset #data * { pause-after: 0 inherit; } #errors #expected | * #reset #data * { pause-after: inherit 0; } #errors #expected | * #reset #data * { pause-before: auto 0; } #errors #expected | * #reset #data * { pause-before: auto; } #errors #expected | * #reset #data * { pause-before: none; } #errors #expected | * #reset #data * { pause-before: 1s 2s; } #errors #expected | * #reset #data * { pause-before: -1s; } #errors #expected | * #reset #data * { pause-before: -1.2ms; } #errors #expected | * #reset #data * { pause-before: -90%; } #errors #expected | * #reset #data * { pause-before: 24; } #errors #expected | * #reset #data * { pause-before: 24hrs; } #errors #expected | * #reset #data * { pause-before: pause; } #errors #expected | * #reset #data * { pause-before: "pause"; } #errors #expected | * #reset #data * { pause-before: 0 0; } #errors #expected | * #reset #data * { pause-before: 0 inherit; } #errors #expected | * #reset #data * { pause-before: inherit 0; } #errors #expected | * #reset #data * { pitch-range: -1; } #errors #expected | * #reset #data * { pitch-range: -0.01; } #errors #expected | * #reset #data * { pitch-range: 101; } #errors #expected | * #reset #data * { pitch-range: 100.1; } #errors #expected | * #reset #data * { pitch-range: 50 50; } #errors #expected | * #reset #data * { pitch-range: +50; } #errors #expected | * | pitch-range: 50 #reset #data * { pitch-range: inherit 25; } #errors #expected | * #reset #data * { pitch-range: 50Hz; } #errors #expected | * #reset #data * { pitch-range: high; } #errors #expected | * #reset #data * { pitch-range: wide; } #errors #expected | * #reset #data * { pitch-range: "subtle"; } #errors #expected | * #reset #data * { pitch-range: url"()#ff9; } #errors #expected | * #reset #data * { pitch-range: #ff9; } #errors #expected | * #reset #data * { pitch: -10Hz; } #errors #expected | * #reset #data * { pitch: -1kHz; } #errors #expected | * #reset #data * { pitch: kHz; } #errors #expected | * #reset #data * { pitch: Hz; } #errors #expected | * #reset #data * { pitch: low, high; } #errors #expected | * #reset #data * { pitch: low high; } #errors #expected | * #reset #data * { pitch: 200Hz high; } #errors #expected | * #reset #data * { pitch: "high"; } #errors #expected | * #reset #data * { pitch: ; } #errors #expected | * #reset #data * { play-during: url(sonic_boom.ogg) mix repeat auto; } #errors #expected | * #reset #data * { play-during: mix repeat url(sonic_boom.ogg); } #errors #expected | * #reset #data * { play-during: none url(sonic_boom.ogg); } #errors #expected | * #reset #data * { play-during: "mix" url(intro); } #errors #expected | * #reset #data * { play-during: mix; } #errors #expected | * #reset #data * { play-during: repeat; } #errors #expected | * #reset #data * { play-during: repeat mix; } #errors #expected | * #reset #data * { play-during: 12; } #errors #expected | * #reset #data * { play-during: 12s; } #errors #expected | * #reset #data * { position: fixed; position: 3; } #errors #expected | * | position: fixed #reset #data * { position: 50Hz; } #errors #expected | * #reset #data * { position: 50em; } #errors #expected | * #reset #data * { position: hidden; } #errors #expected | * #reset #data * { position: "fixed"; } #errors #expected | * #reset #data * { position: static inherit; } #errors #expected | * #reset #data * { position:fixed; font-family: 'Trinity max-height: 30%; min-height: 2em; } #errors #expected | * | position: fixed #reset #data * { position:fixed; font-family: 'Trinity max-height: 30%; min-height: 2em; } #errors #expected | * | position: fixed | min-height: 2em #reset #data * { position:fixed; font-family: 'Trinity ; max-height: 30px; min-height: 2em; } #errors #expected | * | position: fixed | max-height: 30px | min-height: 2em #reset #data * { quotes: "'"; } #errors #expected | * #reset #data * { quotes: "'" '"' "'"; } #errors #expected | * #reset #data * { quotes: "'" 0 "'"; } #errors #expected | * #reset #data * { quotes: "'" "'" 0 0; } #errors #expected | * #reset #data * { quotes: "'" "'" url(tails) url(tails); } #errors #expected | * #reset #data * { quotes: 25%; } #errors #expected | * #reset #data * { quotes: 25% 20%; } #errors #expected | * #reset #data * { quotes: "'", "'"; } #errors #expected | * #reset #data * { quotes: "'" "'", '"' '"'; } #errors #expected | * #reset #data * { quotes: "'" "'" '"' '"' none; } #errors #expected | * #reset #data * { richness: 25%; } #errors #expected | * #reset #data * { richness: -34%; } #errors #expected | * #reset #data * { richness: 2kHz; } #errors #expected | * #reset #data * { richness: kHz; } #errors #expected | * #reset #data * { richness: -1; } #errors #expected | * #reset #data * { richness: -0.01; } #errors #expected | * #reset #data * { richness: 100.001; } #errors #expected | * #reset #data * { richness: 101; } #errors #expected | * #reset #data * { richness: 75 rich; } #errors #expected | * #reset #data * { richness: rich; } #errors #expected | * #reset #data * { richness: "rich"; } #errors #expected | * #reset #data * { right: -4; right: blunderbus; right: 1em; right: 6Hz; } #errors #expected | * | right: 1em #reset #data * { right: "twelve"; } #errors #expected | * #reset #data * { right: auto inherit; } #errors #expected | * #reset #data * { speak-header: twice; } #errors #expected | * #reset #data * { speak-header: once always; } #errors #expected | * #reset #data * { speak-header: 1 once; } #errors #expected | * #reset #data * { speak-header: 1s once; } #errors #expected | * #reset #data * { speak-header: once url(); } #errors #expected | * #reset #data * { speak-header: url() always; } #errors #expected | * #reset #data * { speak-numeral: digits inherit; } #errors #expected | * #reset #data * { speak-numeral: 2 digits; } #errors #expected | * #reset #data * { speak-numeral: 2em; } #errors #expected | * #reset #data * { speak-numeral: once; } #errors #expected | * #reset #data * { speak-numeral: 0; } #errors #expected | * #reset #data * { speak-punctuation: 0; } #errors #expected | * #reset #data * { speak-punctuation: none 0; } #errors #expected | * #reset #data * { speak-punctuation: 0pt; } #errors #expected | * #reset #data * { speak-punctuation: -0pt; } #errors #expected | * #reset #data * { speak-punctuation: code inherit; } #errors #expected | * #reset #data * { speak: 23s; } #errors #expected | * #reset #data * { speak: 0; } #errors #expected | * #reset #data * { speak: auto; } #errors #expected | * #reset #data * { speak: none spell-out; } #errors #expected | * #reset #data * { speak: spell-out "Sonic"; } #errors #expected | * #reset #data * { speak: spell-out url("Sonic"); } #errors #expected | * #reset #data * { speech-rate: -10; } #errors #expected | * #reset #data * { speech-rate: slow medium; } #errors #expected | * #reset #data * { speech-rate: 120 slow; } #errors #expected | * #reset #data * { speech-rate: 2s slow; } #errors #expected | * #reset #data * { speech-rate: 2s; } #errors #expected | * #reset #data * { speech-rate: "2"; } #errors #expected | * #reset #data * { speech-rate: #BBC; } #errors #expected | * #reset #data * { stress: 50 medium; } #errors #expected | * #reset #data * { stress: -0.1; } #errors #expected | * #reset #data * { stress: 101; } #errors #expected | * #reset #data * { stress: normal; } #errors #expected | * #reset #data * { stress: medium 50; } #errors #expected | * #reset #data * { stress: medium 50; stress: 40; position: "fixed"; } #errors #expected | * | stress: 40 #reset #data * { table-layout: none 0; } #errors #expected | * #reset #data * { table-layout: 0pt; } #errors #expected | * #reset #data * { table-layout: -0pt; } #errors #expected | * #reset #data * { table-layout: fixed inherit; } #errors #expected | * #reset #data * { text-align: none 0; } #errors #expected | * #reset #data * { text-align: 0pt; } #errors #expected | * #reset #data * { text-align: -0pt; } #errors #expected | * #reset #data * { text-align: fixed inherit; } #errors #expected | * #reset #data * { text-align: left right; } #errors #expected | * #reset #data * { text-align: left, right; } #errors #expected | * #reset #data * { text-align: left | right; } #errors #expected | * #reset #data * { text-align: justified; } #errors #expected | * #reset #data * { text-align: center 50%; } #errors #expected | * #reset #data * { text-align: 50%; } #errors #expected | * #reset #data * { text-decoration: underline overline none; } #errors #expected | * #reset #data * { text-decoration: underline overline moose; } #errors #expected | * #reset #data * { text-decoration: underline moose overline; } #errors #expected | * #reset #data * { text-decoration: moose underline overline; } #errors #expected | * #reset #data * { text-decoration: blink hidden underline overline; } #errors #expected | * #reset #data * { text-decoration: blink 0 underline overline; } #errors #expected | * #reset #data * { text-decoration: overline url("Sonic"); } #errors #expected | * #reset #data * { text-decoration: inherit overline; } #errors #expected | * #reset #data * { text-indent: -3000px; text-indent: 0 0%; } #errors #expected | * | text-indent: -3000px #reset #data * { text-indent: 30%, 5%; } #errors #expected | * #reset #data * { text-indent: 30% 5%; } #errors #expected | * #reset #data * { text-indent: 2em, 4em } #errors #expected | * #reset #data * { text-indent: hidden; } #errors #expected | * #reset #data * { text-indent: inherit 30%; } #errors #expected | * #reset #data * { text-indent: 30px inherit; } #errors #expected | * #reset #data * { text-transform: capitalise; } #errors #expected | * #reset #data * { text-transform: uppercase lowercase; } #errors #expected | * #reset #data * { text-transform: lowercase none; } #errors #expected | * #reset #data * { text-transform: inherit "Sonic"; } #errors #expected | * #reset #data * { text-transform: 0; } #errors #expected | * #reset #data * { text-transform: 40px; } #errors #expected | * #reset #data * { text-transform: #BBCbbc; } #errors #expected | * #reset #data * { top: 50em; bottom: 11; } #errors #expected | * | top: 50em #reset #data * { top: 50s; } #errors #expected | * #reset #data * { top: "7"; } #errors #expected | * #reset #data * { top: "7; } #errors #expected | * #reset #data * { top: ""7em; } #errors #expected | * #reset #data * { top: #147; } #errors #expected | * #reset #data * { unicode-bidi: normal embed; } #errors #expected | * #reset #data * { unicode-bidi: 74px; } #errors #expected | * #reset #data * { unicode-bidi: 74 px; } #errors #expected | * #reset #data * { unicode-bidi: px; } #errors #expected | * #reset #data * { unicode-bidi: override; } #errors #expected | * #reset #data * { unicode-bidi: 4x4=16; } #errors #expected | * #reset #data * { unicode-bidi: 4x4 =16; } #errors #expected | * #reset #data * { unicode-bidi: "trivial"; } #errors #expected | * #reset #data * { vertical-align: "trivial"; } #errors #expected | * #reset #data * { vertical-align: #445"; } #errors #expected | * #reset #data * { vertical-align: text-top 30px; } #errors #expected | * #reset #data * { vertical-align: -4cm; vertical-align: 30px -30px; } #errors #expected | * | vertical-align: -4cm #reset #data * { vertical-align: - 30px; } #errors #expected | * #reset #data * { vertical-align: - 20%; } #errors #expected | * #reset #data * { vertical-align: 3% super; } #errors #expected | * #reset #data * { vertical-align: sub super; } #errors #expected | * #reset #data * { vertical-align: top; } #errors #expected | * | vertical-align: top #reset #data * { visibility: 23pt; } #errors #expected | * #reset #data * { visibility: 44em hidden; } #errors #expected | * #reset #data * { visibility: both hidden; } #errors #expected | * #reset #data * { visibility: single; } #errors #expected | * #reset #data * { visibility: "Knuckles"; } #errors #expected | * #reset #data * { visibility: HiDDen; } #errors #expected | * | visibility: hidden #reset #data * { visibility: ?hidden; } #errors #expected | * #reset #data * { visibility: hidden???; } #errors #expected | * #reset #data * { visibility: hidden ???; } #errors #expected | * #reset #data * { visibility: inherit 4in; } #errors #expected | * #reset #data * { voice-family: 1000pt; } #errors #expected | * #reset #data * { voice-family: 0; } #errors #expected | * #reset #data * { voice-family: "; } #errors #expected | * #reset #data * { voice-family: "'; } #errors #expected | * #reset #data * { voice-family: serif, "Trinity"; } #errors #expected | * | voice-family: 'serif', 'Trinity' #reset #data * { voice-family: serif, sans-serif; } #errors #expected | * | voice-family: 'serif', 'sans-serif' #reset #data * { voice-family: "Homerton", "Oxford", moose; } #errors #expected | * | voice-family: 'Homerton', 'Oxford', 'moose' #reset #data * { voice-family: "Homerton", "Oxford", sans-serif, moose; } #errors #expected | * | voice-family: 'Homerton', 'Oxford', 'sans-serif', 'moose' #reset #data * { voice-family: "Homerton" "Oxford" sans-serif; } #errors #expected | * #reset #data * { voice-family: moo, "Homerton", "Oxford"; } #errors #expected | * | voice-family: 'moo', 'Homerton', 'Oxford' #reset #data * { voice-family: moo, "Homerton" "Oxford"; } #errors #expected | * #reset #data * { voice-family: "Homerton", "Oxford", url(font); } #errors #expected | * #reset #data * { voice-family: male, "Trinity"; } #errors #expected | * | voice-family: male, 'Trinity' #reset #data * { voice-family: male, female; } #errors #expected | * | voice-family: male, female #reset #data * { voice-family: "Homerton", "Oxford", child, moose; } #errors #expected | * | voice-family: 'Homerton', 'Oxford', child, 'moose' #reset #data * { voice-family: "Homerton" "Oxford" child; } #errors #expected | * #reset #data * { volume: racket; } #errors #expected | * #reset #data * { volume: "loud"; } #errors #expected | * #reset #data * { volume: louder; } #errors #expected | * #reset #data * { volume: loud 75; } #errors #expected | * #reset #data * { volume: -1; } #errors #expected | * #reset #data * { volume: 101; } #errors #expected | * #reset #data * { volume: 3 7; } #errors #expected | * #reset #data * { volume: 55 20%; } #errors #expected | * #reset #data * { volume: 55 %; } #errors #expected | * #reset #data * { volume: 150%; volume: -40%; } #errors #expected | * | volume: 150% #reset #data * { volume: 55% url(222); } #errors #expected | * #reset #data * { white-space: pre pre; } #errors #expected | * #reset #data * { white-space: pre per; } #errors #expected | * #reset #data * { white-space: per; } #errors #expected | * #reset #data * { white-space: nowrap pre-line; } #errors #expected | * #reset #data * { white-space: nowrap 0; } #errors #expected | * #reset #data * { white-space: #449; } #errors #expected | * #reset #data * { white-space: ,cube; } #errors #expected | * #reset #data * { white-space: pre"; } #errors #expected | * #reset #data * { white-space: pre,; } #errors #expected | * #reset #data * { white-space: normal|; } #errors #expected | * #reset #data * { white-space: normal |; } #errors #expected | * #reset #data * { white-space: |; } #errors #expected | * #reset #data * { widows: -4; } #errors #expected | * #reset #data * { widows: 20%; } #errors #expected | * #reset #data * { widows: 3em; } #errors #expected | * #reset #data * { widows: 3 3; } #errors #expected | * #reset #data * { widows: 3 3pt; } #errors #expected | * #reset #data * { widows: 3 %; } #errors #expected | * #reset #data * { widows: 4,; } #errors #expected | * #reset #data * { width: -10%; } #errors #expected | * #reset #data * { width: -1px; } #errors #expected | * #reset #data * { width: -1; } #errors #expected | * #reset #data * { width: - 4em; } #errors #expected | * #reset #data * { width: 4px 2px; } #errors #expected | * #reset #data * { width: url(3em); } #errors #expected | * #reset #data * { width: "3em"; } #errors #expected | * #reset #data * { width: auto 0; } #errors #expected | * #reset #data * { width: auto, 0; } #errors #expected | * #reset #data * { width: auto,,,,,,, 0; } #errors #expected | * #reset #data * { width: ,,,,,,, 0; } #errors #expected | * #reset #data * { width: ,,,,, ,,; } #errors #expected | * #reset #data * { width: wider; } #errors #expected | * #reset #data * { word-spacing: normally; } #errors #expected | * #reset #data * { word-spacing: 23pt 3px; } #errors #expected | * #reset #data * { word-spacing: g; } #errors #expected | * #reset #data * { word-spacing: %; } #errors #expected | * #reset #data * { word-spacing: 10%; } #errors #expected | * #reset #data * { word-spacing: em; } #errors #expected | * #reset #data * { word-spacing: 0.1em; } #errors #expected | * | word-spacing: 0.100em #reset #data * { writing-mode: em; } #errors #expected | * #reset #data * { writing-mode: 2em; } #errors #expected | * #reset #data * { writing-mode: vertical; } #errors #expected | * #reset #data * { z-index: - 40; } #errors #expected | * #reset #data * { z-index: --3; } #errors #expected | * #reset #data * { z-index: 3 3; } #errors #expected | * #reset #data * { z-index: 4%; } #errors #expected | * #reset #data * { z-index: 4em; } #errors #expected | * #reset #data * { z-index: 4 auto; } #errors #expected | * #reset #data * { z-index: auto 4; } #errors #expected | * #reset #data * { z-index: "4"; } #errors #expected | * #reset #data * { z-index: #333; } #errors #expected | * #reset #data * { z-index: url("-2"); } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/font.dat0000644000175000017500000003043712377676736020646 0ustar vincevince#data * { font: inherit; } #errors #expected | * | font-style: inherit | font-variant: inherit | font-weight: inherit | font-size: inherit | line-height: inherit | font-family: inherit #reset #data * { font: 10pt serif; } #errors #expected | * | font-style: normal | font-variant: normal | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: 10pt; } #errors #expected | * #reset #data * { font: serif; } #errors #expected | * #reset #data * { font: italic 10pt serif; } #errors #expected | * | font-style: italic | font-variant: normal | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: oblique 10pt serif; } #errors #expected | * | font-style: oblique | font-variant: normal | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: 12pt serif; } #errors #expected | * | font-style: normal | font-variant: normal | font-weight: normal | font-size: 12pt | line-height: normal | font-family: serif #reset #data * { font: serif 12pt; } #errors #expected | * #reset #data * { font: small-caps 10pt serif; } #errors #expected | * | font-style: normal | font-variant: small-caps | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: bold 10pt serif; } #errors #expected | * | font-style: normal | font-variant: normal | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: italic bold 10pt serif; } #errors #expected | * | font-style: italic | font-variant: normal | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: italic 400 10pt serif; } #errors #expected | * | font-style: italic | font-variant: normal | font-weight: 400 | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: bold italic 10pt serif; } #errors #expected | * | font-style: italic | font-variant: normal | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: italic small-caps 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: small-caps italic 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: normal | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: small-caps bold 10pt serif; } #errors #expected | * | font-style: normal | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: bold small-caps 10pt serif; } #errors #expected | * | font-style: normal | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: italic bold small-caps 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: bold italic small-caps 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: bold small-caps italic 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: small-caps bold italic 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: small-caps italic bold 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: italic small-caps bold 10pt serif; } #errors #expected | * | font-style: italic | font-variant: small-caps | font-weight: bold | font-size: 10pt | line-height: normal | font-family: serif #reset #data * { font: 10pt/50% serif; } #errors #expected | * | font-style: normal | font-variant: normal | font-weight: normal | font-size: 10pt | line-height: 50% | font-family: serif #reset #data * { font: 10pt Times New Roman; } #errors #expected | * | font-style: normal | font-variant: normal | font-weight: normal | font-size: 10pt | line-height: normal | font-family: 'Times New Roman' #reset #data * { font: invalid; } #errors #expected | * #reset #data * { font: ; } #errors #expected | * #reset #data * { font:} #errors #expected | * #reset #data * { font: 10pt inherit; } #errors #expected | * #reset #data * { font: inherit 10pt; } #errors #expected | * #reset #data * { font: 'Sonic the Hedgehog' 12pt inherit; } #errors #expected | * #reset #data * { font: 'Sonic the Hedgehog' inherit 12pt; } #errors #expected | * #reset #data * { font: inherit 12pt 'Sonic the Hedgehog'; } #errors #expected | * #reset #data * { font: inherit inherit; } #errors #expected | * #reset #data * { font-family: inherit; } #errors #expected | * | font-family: inherit #reset #data * { font-size: inherit; } #errors #expected | * | font-size: inherit #reset #data * { font-style: inherit; } #errors #expected | * | font-style: inherit #reset #data * { font-variant: inherit; } #errors #expected | * | font-variant: inherit #reset #data * { font-weight: inherit; } #errors #expected | * | font-weight: inherit #reset #data * { font: inherit !important; } #errors #expected | * | font-style: inherit !important | font-variant: inherit !important | font-weight: inherit !important | font-size: inherit !important | line-height: inherit !important | font-family: inherit !important #reset #data * { font: 10pt serif !important; } #errors #expected | * | font-style: normal !important | font-variant: normal !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: 10pt !important; } #errors #expected | * #reset #data * { font: serif !important; } #errors #expected | * #reset #data * { font: italic 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: normal !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: small-caps 10pt serif !important; } #errors #expected | * | font-style: normal !important | font-variant: small-caps !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: bold 10pt serif !important; } #errors #expected | * | font-style: normal !important | font-variant: normal !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: italic bold 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: normal !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: italic 400 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: normal !important | font-weight: 400 !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: bold italic 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: normal !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: italic small-caps 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: small-caps italic 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: small-caps bold 10pt serif !important; } #errors #expected | * | font-style: normal !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: bold small-caps 10pt serif !important; } #errors #expected | * | font-style: normal !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: italic bold small-caps 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: bold italic small-caps 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: bold small-caps italic 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: small-caps bold italic 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: small-caps italic bold 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: italic small-caps bold 10pt serif !important; } #errors #expected | * | font-style: italic !important | font-variant: small-caps !important | font-weight: bold !important | font-size: 10pt !important | line-height: normal !important | font-family: serif !important #reset #data * { font: 10pt/50% serif !important; } #errors #expected | * | font-style: normal !important | font-variant: normal !important | font-weight: normal !important | font-size: 10pt !important | line-height: 50% !important | font-family: serif !important #reset #data * { font: 10pt "Times New Roman" !important; } #errors #expected | * | font-style: normal !important | font-variant: normal !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: 'Times New Roman' !important #reset #data * { font: 10pt Times New Roman !important; } #errors #expected | * | font-style: normal !important | font-variant: normal !important | font-weight: normal !important | font-size: 10pt !important | line-height: normal !important | font-family: 'Times New Roman' !important #reset #data * { font: bold inherit italic 10pt serif; } #errors #expected | * #reset #data * { font: bold italic 10pt inherit serif; } #errors #expected | * #reset #data * { font: bold italic 10pt serif inherit; } #errors #expected | * #reset #data * { font: inherit serif; } #errors #expected | * #reset #data * { font: serif inherit; } #errors #expected | * #reset #data * { font: inherit inherit; } #errors #expected | * #reset #data * { font: italic 10pt inherit serif; } #errors #expected | * #reset #data * { font: italic 10pt serif inherit; } #errors #expected | * #reset #data * { font: italic 10pt serif inherit !important; } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/margin.dat0000644000175000017500000000751412377676736021155 0ustar vincevince#data * { margin: 0 0 0 0; } #errors #expected | * | margin-top: 0px | margin-right: 0px | margin-bottom: 0px | margin-left: 0px #reset #data * { margin: 2em; } #errors #expected | * | margin-top: 2em | margin-right: 2em | margin-bottom: 2em | margin-left: 2em #reset #data * { margin: 2em auto; } #errors #expected | * | margin-top: 2em | margin-right: auto | margin-bottom: 2em | margin-left: auto #reset #data * { margin: 10% 5px -4em -50%; } #errors #expected | * | margin-top: 10% | margin-right: 5px | margin-bottom: -4em | margin-left: -50% #reset #data * { margin: 10% 5px -4em; } #errors #expected | * | margin-top: 10% | margin-right: 5px | margin-bottom: -4em | margin-left: 5px #reset #data * { margin: 10% 5px "Hello!" -4em; } #errors #expected | * #reset #data * { margin: auto; } #errors #expected | * | margin-top: auto | margin-right: auto | margin-bottom: auto | margin-left: auto #reset #data * { margin: auto auto; } #errors #expected | * | margin-top: auto | margin-right: auto | margin-bottom: auto | margin-left: auto #reset #data * { margin: auto inherit; } #errors #expected | * #reset #data * { margin: inherit; } #errors #expected | * | margin-top: inherit | margin-right: inherit | margin-bottom: inherit | margin-left: inherit #reset #data * { margin: inherit auto auto; } #errors #expected | * #reset #data * { margin: auto auto 0; } #errors #expected | * | margin-top: auto | margin-right: auto | margin-bottom: 0px | margin-left: auto #reset #data * { margin: auto auto 10px 0; } #errors #expected | * | margin-top: auto | margin-right: auto | margin-bottom: 10px | margin-left: 0px #reset #data * { margin: auto !important; } #errors #expected | * | margin-top: auto !important | margin-right: auto !important | margin-bottom: auto !important | margin-left: auto !important #reset #data * { margin: auto auto !important; } #errors #expected | * | margin-top: auto !important | margin-right: auto !important | margin-bottom: auto !important | margin-left: auto !important #reset #data * { margin: auto auto inherit auto ! important; } #errors #expected | * #reset #data * { margin: inherit !important; } #errors #expected | * | margin-top: inherit !important | margin-right: inherit !important | margin-bottom: inherit !important | margin-left: inherit !important #reset #data * { margin: auto auto 0 !important; } #errors #expected | * | margin-top: auto !important | margin-right: auto !important | margin-bottom: 0px !important | margin-left: auto !important #reset #data * { margin: auto auto 10px 0 !important; } #errors #expected | * | margin-top: auto !important | margin-right: auto !important | margin-bottom: 10px !important | margin-left: 0px !important #reset #data * { margin: auto auto 10px !important 0; } #errors #expected | * #reset #data * { margin: invalid; } #errors #expected | * #reset #data * { margin: ; } #errors #expected | * #reset #data * { margin:} #errors #expected | * #reset #data * { margin: 2px inherit; } #errors #expected | * #reset #data * { margin: inherit 2px; } #errors #expected | * #reset #data * { margin: 2px 3em inherit; } #errors #expected | * #reset #data * { margin: 2px inherit 3em; } #errors #expected | * #reset #data * { margin: 2px 0 0 0 inherit; } #errors #expected | * #reset #data * { margin: inherit inherit; } #errors #expected | * #reset #data * { margin: inherit 0 !important; } #errors #expected | * #reset #data * { margin-top: inherit;} #errors #expected | * | margin-top: inherit #reset #data * { margin-right: inherit;} #errors #expected | * | margin-right: inherit #reset #data * { margin-bottom: inherit;} #errors #expected | * | margin-bottom: inherit #reset #data * { margin-bottom: 2em inherit;} #errors #expected | * #reset #data * { margin-left: inherit;} #errors #expected | * | margin-left: inherit #reset netsurf-all-3.2/libcss/test/data/parse2/list.dat0000644000175000017500000002040112377676736020641 0ustar vincevince#data * { list-style: inherit; } #errors #expected | * | list-style-image: inherit | list-style-position: inherit | list-style-type: inherit #reset #data * { list-style: circle; } #errors #expected | * | list-style-image: none | list-style-position: outside | list-style-type: circle #reset #data * { list-style: inside; } #errors #expected | * | list-style-image: none | list-style-position: inside | list-style-type: disc #reset #data * { list-style: url(foo); } #errors #expected | * | list-style-image: url('foo') | list-style-position: outside | list-style-type: disc #reset #data * { list-style: circle inside; } #errors #expected | * | list-style-image: none | list-style-position: inside | list-style-type: circle #reset #data * { list-style: inside circle; } #errors #expected | * | list-style-image: none | list-style-position: inside | list-style-type: circle #reset #data * { list-style: inside url(foo); } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: disc #reset #data * { list-style: url(foo) inside; } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: disc #reset #data * { list-style: circle url(foo); } #errors #expected | * | list-style-image: url('foo') | list-style-position: outside | list-style-type: circle #reset #data * { list-style: url(foo) circle; } #errors #expected | * | list-style-image: url('foo') | list-style-position: outside | list-style-type: circle #reset #data * { list-style: circle inside url(foo); } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: circle url(foo) inside; } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: inside circle url(foo); } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: inside url(foo) circle; } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: url(foo) circle inside; } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: url(foo) inside circle; } #errors #expected | * | list-style-image: url('foo') | list-style-position: inside | list-style-type: circle #reset #data * { list-style: invalid; } #errors #expected | * #reset #data * { list-style: ; } #errors #expected | * #reset #data * { list-style:} #errors #expected | * #reset #data * { list-style: inherit circle; } #errors #expected | * #reset #data * { list-style: disc inherit; } #errors #expected | * #reset #data * { list-style: circle inside inherit; } #errors #expected | * #reset #data * { list-style: inherit disc inside; } #errors #expected | * #reset #data * { list-style: disc circle; } #errors #expected | * #reset #data * { list-style: inside inherit url('PicoDrive'); } #errors #expected | * #reset #data * { list-style: !important disc circle; } #errors #expected | * #reset #data * { list-style: !important disc inherit; } #errors #expected | * #reset #data * { list-style: disc inherit !important; } #errors #expected | * #reset #data * { list-style: inherit !important; } #errors #expected | * | list-style-image: inherit !important | list-style-position: inherit !important | list-style-type: inherit !important #reset #data * { list-style: circle !important; } #errors #expected | * | list-style-image: none !important | list-style-position: outside !important | list-style-type: circle !important #reset #data * { list-style: inside !important; } #errors #expected | * | list-style-image: none !important | list-style-position: inside !important | list-style-type: disc !important #reset #data * { list-style: url(foo) !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: outside !important | list-style-type: disc !important #reset #data * { list-style: circle inside !important; } #errors #expected | * | list-style-image: none !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: inside circle !important; } #errors #expected | * | list-style-image: none !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: inside url(foo) !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: disc !important #reset #data * { list-style: url(foo) inside !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: disc !important #reset #data * { list-style: circle url(foo) !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: outside !important | list-style-type: circle !important #reset #data * { list-style: url(foo) circle !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: outside !important | list-style-type: circle !important #reset #data * { list-style: circle inside url(foo) !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: circle url(foo) inside !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: inside circle url(foo) !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: inside url(foo) circle !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: url(foo) circle inside !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { list-style: url(foo) inside circle !important; } #errors #expected | * | list-style-image: url('foo') !important | list-style-position: inside !important | list-style-type: circle !important #reset #data * { content: inherit; } #errors #expected | * | content: inherit #reset #data * { list-style-position: inherit; } #errors #expected | * | list-style-position: inherit #reset #data * { list-style-type: inherit; } #errors #expected | * | list-style-type: inherit #reset #data * { quotes: inherit; } #errors #expected | * | quotes: inherit #reset #data * { counter-reset: inherit; } #errors #expected | * | counter-reset: inherit #reset #data * { content: open-quote; } #errors #expected | * | content: open-quote #reset #data * { content: open-quote "moose" close-quote; } #errors #expected | * | content: open-quote 'moose' close-quote #reset #data * { content: no-open-quote "moose" no-close-quote; } #errors #expected | * | content: no-open-quote 'moose' no-close-quote #reset #data * { content: no-close-quote "moose" no-open-quote; } #errors #expected | * | content: no-close-quote 'moose' no-open-quote #reset #data * { content: open-quote "moose" close-quote open-quote no-open-quote "moose" no-close-quote close-quote; } #errors #expected | * | content: open-quote 'moose' close-quote open-quote no-open-quote 'moose' no-close-quote close-quote #reset #data * { list-style: inherit inside; } #errors #expected | * #reset #data * { list-style: inherit inside inherit; } #errors #expected | * #reset #data * { list-style: inherit inherit; } #errors #expected | * #reset #data * { list-style: inherit url(foo); } #errors #expected | * #reset #data * { list-style: url(foo) inherit; } #errors #expected | * #reset #data * { list-style: circle inherit inside; } #errors #expected | * #reset #data * { list-style: inherit circle inside; } #errors #expected | * #reset #data * { list-style: circle inside inherit; } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/comments.dat0000644000175000017500000000141312377676736021515 0ustar vincevince#data /**/* /* 2 *//*3*/ {/*4*/ background-attachment:/*5*/ fixed/**/;/*7*/ } #errors #expected | * | background-attachment: fixed #reset #data /**/* /* } *//*3*/ {/*;*/ background-attachment/* display: */:/*6}*/ scroll/**/;/*8*/ } #errors #expected | * | background-attachment: scroll #reset #data /**/* /* 2 *//*3*/ {/*4*/ background-attachment:/*5*/ fixed/**/;/*7*/ speech-rate: /*/*//*/**/ medium; } #errors #expected | * | background-attachment: fixed | speech-rate: medium #reset #data * {/* stress:100; } #errors #expected | * #reset #data * /*{ stress:100; } #errors #expected #reset #data */* { stress:100; } #errors #expected #reset #data * { stress:/*100; } #errors #expected | * #reset #data * { stress:100/*; } #errors #expected | * | stress: 100 #reset netsurf-all-3.2/libcss/test/data/parse2/outline.dat0000644000175000017500000002234512377676736021356 0ustar vincevince#data * { outline: inherit; } #errors #expected | * | outline-color: inherit | outline-style: inherit | outline-width: inherit #reset #data * { outline: red; } #errors #expected | * | outline-color: #ffff0000 | outline-style: none | outline-width: medium #reset #data * { outline: transparent; } #errors #expected | * | outline-color: transparent | outline-style: none | outline-width: medium #reset #data * { outline: currentColor; } #errors #expected | * | outline-color: currentColor | outline-style: none | outline-width: medium #reset #data * { outline: solid; } #errors #expected | * | outline-color: invert | outline-style: solid | outline-width: medium #reset #data * { outline: thin; } #errors #expected | * | outline-color: invert | outline-style: none | outline-width: thin #reset #data * { outline: red solid; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: medium #reset #data * { outline: solid red; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: medium #reset #data * { outline: red thin; } #errors #expected | * | outline-color: #ffff0000 | outline-style: none | outline-width: thin #reset #data * { outline: thin red; } #errors #expected | * | outline-color: #ffff0000 | outline-style: none | outline-width: thin #reset #data * { outline: solid thin; } #errors #expected | * | outline-color: invert | outline-style: solid | outline-width: thin #reset #data * { outline: thin solid; } #errors #expected | * | outline-color: invert | outline-style: solid | outline-width: thin #reset #data * { outline: red solid thin; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: red thin solid; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: solid red thin; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: solid thin red; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: thin red solid; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: thin solid red; } #errors #expected | * | outline-color: #ffff0000 | outline-style: solid | outline-width: thin #reset #data * { outline: inherit !important; } #errors #expected | * | outline-color: inherit !important | outline-style: inherit !important | outline-width: inherit !important #reset #data * { outline: red !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: none !important | outline-width: medium !important #reset #data * { outline: solid !important; } #errors #expected | * | outline-color: invert !important | outline-style: solid !important | outline-width: medium !important #reset #data * { outline: thin !important; } #errors #expected | * | outline-color: invert !important | outline-style: none !important | outline-width: thin !important #reset #data * { outline: red solid !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: medium !important #reset #data * { outline: solid red !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: medium !important #reset #data * { outline: red thin !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: none !important | outline-width: thin !important #reset #data * { outline: thin red !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: none !important | outline-width: thin !important #reset #data * { outline: solid thin !important; } #errors #expected | * | outline-color: invert !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: thin solid !important; } #errors #expected | * | outline-color: invert !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: red solid thin !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: red thin solid !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: solid red thin !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: solid thin red !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: thin red solid !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: thin solid red !important; } #errors #expected | * | outline-color: #ffff0000 !important | outline-style: solid !important | outline-width: thin !important #reset #data * { outline: invalid; } #errors #expected | * #reset #data * { outline: ; } #errors #expected | * #reset #data * { outline:} #errors #expected | * #reset #data * { outline: thin solid red inherit; } #errors #expected | * #reset #data * { outline: inherit thin solid #fff; } #errors #expected | * #reset #data * { outline: inherit thin; } #errors #expected | * #reset #data * { outline: thin inherit; } #errors #expected | * #reset #data * { outline: inherit inherit; } #errors #expected | * #reset #data * { outline: inherit #BBC !important; } #errors #expected | * #reset #data * { outline: #BBC !important inherit; } #errors #expected | * #reset #data * { outline-color: red; } #errors #expected | * | outline-color: #ffff0000 #reset #data * { outline-color: inherit; } #errors #expected | * | outline-color: inherit #reset #data * { outline-color: red green; } #errors #expected | * #reset #data * { outline-color: red green blue; } #errors #expected | * #reset #data * { outline-color: red green blue yellow; } #errors #expected | * #reset #data * { outline-color: red !important; } #errors #expected | * | outline-color: #ffff0000 !important #reset #data * { outline-color: red green !important; } #errors #expected | * #reset #data * { outline-color: red green blue !important; } #errors #expected | * #reset #data * { outline-color: red green blue yellow !important; } #errors #expected | * #reset #data * { outline-color: invalid; } #errors #expected | * #reset #data * { outline-color: ; } #errors #expected | * #reset #data * { outline-color:} #errors #expected | * #reset #data * { outline-style: solid; } #errors #expected | * | outline-style: solid #reset #data * { outline-style: inherit; } #errors #expected | * | outline-style: inherit #reset #data * { outline-style: solid double; } #errors #expected | * #reset #data * { outline-style: solid double groove; } #errors #expected | * #reset #data * { outline-style: solid double groove ridge; } #errors #expected | * #reset #data * { outline-style: solid !important; } #errors #expected | * | outline-style: solid !important #reset #data * { outline-style: solid double !important; } #errors #expected | * #reset #data * { outline-style: solid double groove !important; } #errors #expected | * #reset #data * { outline-style: solid double groove ridge !important; } #errors #expected | * #reset #data * { outline-style: invalid; } #errors #expected | * #reset #data * { outline-style: ; } #errors #expected | * #reset #data * { outline-style:} #errors #expected | * #reset #data * { outline-width: thin; } #errors #expected | * | outline-width: thin #reset #data * { outline-width: inherit; } #errors #expected | * | outline-width: inherit #reset #data * { outline-width: thin thick; } #errors #expected | * #reset #data * { outline-width: thin thick medium; } #errors #expected | * #reset #data * { outline-width: thin thick medium 0; } #errors #expected | * #reset #data * { outline-width: thin !important; } #errors #expected | * | outline-width: thin !important #reset #data * { outline-width: thin thick !important; } #errors #expected | * #reset #data * { outline-width: thin thick medium !important; } #errors #expected | * #reset #data * { outline-width: thin thick medium 0 !important; } #errors #expected | * #reset #data * { outline-width: invalid; } #errors #expected | * #reset #data * { outline-width: ; } #errors #expected | * #reset #data * { outline-width:} #errors #expected | * #reset #data * { outline: red inherit; } #errors #expected | * #reset #data * { outline: inherit inherit; } #errors #expected | * #reset #data * { outline: inherit red; } #errors #expected | * #reset #data * { outline: thin inherit red; } #errors #expected | * #reset #data * { outline: thin inherit; } #errors #expected | * #reset #data * { outline: solid inherit; } #errors #expected | * #reset #data * { outline-color: red !important; } #errors #expected | * | outline-color: #ffff0000 !important #reset netsurf-all-3.2/libcss/test/data/parse2/README0000644000175000017500000000114512377676736020060 0ustar vincevinceParser testcases ================ Format ------ #data #errors (ignored at present) #expected #reset Format of cssom tree -------------------- line ::= rule | declaration rule ::= '| ' name name ::= .+ declaration ::= '| ' property-name ': ' property-value Example ------- #data * { color: #ff0000; background-image: url("foo.png"); } #errors #expected | * | color: #ff000000 | background-image: url("foo.png") #reset TODO ---- + Permit nesting of rules (for nested block support) netsurf-all-3.2/libcss/test/data/parse2/tests1.dat0000644000175000017500000000313512377676736021116 0ustar vincevince#data * { } #errors #expected | * #reset #data * { color: #ff0000 } #errors #expected | * | color: #ffff0000 #reset #data * { color: inherit } #errors #expected | * | color: inherit #reset #data * { azimuth: 45deg !important } #errors #expected | * | azimuth: 45deg !important #reset #data * { cursor: inherit } #errors #expected | * | cursor: inherit #reset #data * { cursor: text inherit } #errors #expected | * #reset #data * { cursor: inherit auto } #errors #expected | * #reset #data * { background-image: url("foo.png"); color: inherit } #errors #expected | * | background-image: url('foo.png') | color: inherit #reset #data * { display: block; display: table-cell; } #errors #expected | * | display: block | display: table-cell #reset #data * { display: inherit; } #errors #expected | * | display: inherit #reset #data * { height: inherit; } #errors #expected | * | height: inherit #reset #data * { line-height: inherit; } #errors #expected | * | line-height: inherit #reset #data * { max-height: inherit; } #errors #expected | * | max-height: inherit #reset #data * { max-width: inherit; } #errors #expected | * | max-width: inherit #reset #data * { min-height: inherit; } #errors #expected | * | min-height: inherit #reset #data * { min-width: inherit; } #errors #expected | * | min-width: inherit #reset #data * { width: inherit; } #errors #expected | * | width: inherit #reset #data * { display: block inherit; } #errors #expected | * #reset #data * { cursor: url("foo.png"), url("bar.gif"), pointer; } #errors #expected | * | cursor: url('foo.png'), url('bar.gif'), pointer #reset netsurf-all-3.2/libcss/test/data/parse2/au.dat0000644000175000017500000002112712377676736020301 0ustar vincevince#data * { cue: inherit; } #errors #expected | * | cue-before: inherit | cue-after: inherit #reset #data * { cue: none; } #errors #expected | * | cue-before: none | cue-after: none #reset #data * { cue: url(foo); } #errors #expected | * | cue-before: url('foo') | cue-after: url('foo') #reset #data * { cue: none url(foo); } #errors #expected | * | cue-before: none | cue-after: url('foo') #reset #data * { cue: url(foo) none; } #errors #expected | * | cue-before: url('foo') | cue-after: none #reset #data * { cue: inherit !important; } #errors #expected | * | cue-before: inherit !important | cue-after: inherit !important #reset #data * { cue: none !important; } #errors #expected | * | cue-before: none !important | cue-after: none !important #reset #data * { cue: url(foo) !important; } #errors #expected | * | cue-before: url('foo') !important | cue-after: url('foo') !important #reset #data * { cue: none url(foo) !important; } #errors #expected | * | cue-before: none !important | cue-after: url('foo') !important #reset #data * { cue: url(foo) none !important; } #errors #expected | * | cue-before: url('foo') !important | cue-after: none !important #reset #data * { cue: invalid; } #errors #expected | * #reset #data * { cue: ; } #errors #expected | * #reset #data * { cue: inherit inherit; } #errors #expected | * #reset #data * { cue: none inherit; } #errors #expected | * #reset #data * { cue: inherit none; } #errors #expected | * #reset #data * { cue: none url(foo) !important inherit; } #errors #expected | * #reset #data * { cue: inherit none url(foo) !important; } #errors #expected | * #reset #data * { cue: inherit url(foo) !important; } #errors #expected | * #reset #data * { cue:} #errors #expected | * #reset #data * { cue: url(foo) inherit none; } #errors #expected | * #reset #data * { cue: inherit url(foo) none !important;} #errors #expected | * #reset #data * { pause: inherit; } #errors #expected | * | pause-before: inherit | pause-after: inherit #reset #data * { pause: 0; } #errors #expected | * | pause-before: 0s | pause-after: 0s #reset #data * { pause: 50%; } #errors #expected | * | pause-before: 50% | pause-after: 50% #reset #data * { pause: 0 10ms; } #errors #expected | * | pause-before: 0s | pause-after: 10ms #reset #data * { pause: 10s 0; } #errors #expected | * | pause-before: 10s | pause-after: 0s #reset #data * { pause: 0 50%; } #errors #expected | * | pause-before: 0s | pause-after: 50% #reset #data * { pause: 50% 0; } #errors #expected | * | pause-before: 50% | pause-after: 0s #reset #data * { pause: 50% 0 5s; } #errors #expected | * #reset #data * { pause: inherit 0 5s; } #errors #expected | * #reset #data * { pause: 50% inherit 5s; } #errors #expected | * #reset #data * { pause: 50% 0 inherit; } #errors #expected | * #reset #data * { pause: inherit !important; } #errors #expected | * | pause-before: inherit !important | pause-after: inherit !important #reset #data * { pause: 0 !important; } #errors #expected | * | pause-before: 0s !important | pause-after: 0s !important #reset #data * { pause: 50% !important; } #errors #expected | * | pause-before: 50% !important | pause-after: 50% !important #reset #data * { pause: 0 10s !important; } #errors #expected | * | pause-before: 0s !important | pause-after: 10s !important #reset #data * { pause: 10s 0 !important; } #errors #expected | * | pause-before: 10s !important | pause-after: 0s !important #reset #data * { pause: 0 50% !important; } #errors #expected | * | pause-before: 0s !important | pause-after: 50% !important #reset #data * { pause: 50% 0 !important; } #errors #expected | * | pause-before: 50% !important | pause-after: 0s !important #reset #data * { pause: invalid; } #errors #expected | * #reset #data * { pause: ; } #errors #expected | * #reset #data * { pause:} #errors #expected | * #reset #data * { pause} #errors #expected | * #reset #data * { cue: none inherit; } #errors #expected | * #reset #data * { cue: inherit url(Sonic.png); } #errors #expected | * #reset #data * { pause: 0 inherit; } #errors #expected | * #reset #data * { pause: 7ms inherit !important; } #errors #expected | * #reset #data * { pause: inherit 4%; } #errors #expected | * #reset #data * { pause: inherit 0 !important; } #errors #expected | * #reset #data * { azimuth: behind behind; } #errors #expected | * #reset #data * { azimuth: inherit behind; } #errors #expected | * #reset #data * { azimuth: left-side inherit; } #errors #expected | * #reset #data * { azimuth: left-side behind; } #errors #expected | * | azimuth: left-side behind #reset #data * { azimuth: behind left-side; } #errors #expected | * | azimuth: left-side behind #reset #data * { azimuth: far-left behind; } #errors #expected | * | azimuth: far-left behind #reset #data * { azimuth: behind far-left; } #errors #expected | * | azimuth: far-left behind #reset #data * { azimuth: behind left; } #errors #expected | * | azimuth: left behind #reset #data * { azimuth: center-left behind; } #errors #expected | * | azimuth: center-left behind #reset #data * { azimuth: behind center-left; } #errors #expected | * | azimuth: center-left behind #reset #data * { azimuth: center-left behind center-left; } #errors #expected | * #reset #data * { azimuth: behind center; } #errors #expected | * | azimuth: center behind #reset #data * { azimuth: center-right behind; } #errors #expected | * | azimuth: center-right behind #reset #data * { azimuth: behind center-right; } #errors #expected | * | azimuth: center-right behind #reset #data * { azimuth: behind right; } #errors #expected | * | azimuth: right behind #reset #data * { azimuth: far-right behind; } #errors #expected | * | azimuth: far-right behind #reset #data * { azimuth: behind right-side; } #errors #expected | * | azimuth: right-side behind #reset #data * { elevation: inherit; } #errors #expected | * | elevation: inherit #reset #data * { elevation: 0deg inherit; } #errors #expected | * #reset #data * { pitch: inherit; } #errors #expected | * | pitch: inherit #reset #data * { play-during: inherit !important; } #errors #expected | * | play-during: inherit !important #reset #data * { richness: inherit; } #errors #expected | * | richness: inherit #reset #data * { richness: inherit !important; } #errors #expected | * | richness: inherit !important #reset #data * { speak-header: inherit; } #errors #expected | * | speak-header: inherit #reset #data * { speak-header: inherit !important; } #errors #expected | * | speak-header: inherit !important #reset #data * { speak-numeral: inherit; } #errors #expected | * | speak-numeral: inherit #reset #data * { speak-numeral: inherit !important; } #errors #expected | * | speak-numeral: inherit !important #reset #data * { speak-punctuation: inherit; } #errors #expected | * | speak-punctuation: inherit #reset #data * { speak-punctuation: inherit !important; } #errors #expected | * | speak-punctuation: inherit !important #reset #data * { speak: inherit; } #errors #expected | * | speak: inherit #reset #data * { speak: inherit !important; } #errors #expected | * | speak: inherit !important #reset #data * { speech-rate: inherit; } #errors #expected | * | speech-rate: inherit #reset #data * { speech-rate: inherit !important; } #errors #expected | * | speech-rate: inherit !important #reset #data * { stress: inherit; } #errors #expected | * | stress: inherit #reset #data * { stress: inherit !important; } #errors #expected | * | stress: inherit !important #reset #data * { voice-family: inherit; } #errors #expected | * | voice-family: inherit #reset #data * { voice-family: inherit !important; } #errors #expected | * | voice-family: inherit !important #reset #data * { volume: inherit; } #errors #expected | * | volume: inherit #reset #data * { volume: inherit !important; } #errors #expected | * | volume: inherit !important #reset #data * { pause-before: inherit; } #errors #expected | * | pause-before: inherit #reset #data * { pause-before: inherit !important; } #errors #expected | * | pause-before: inherit !important #reset #data * { pause-after: inherit; } #errors #expected | * | pause-after: inherit #reset #data * { pause-after: inherit !important; } #errors #expected | * | pause-after: inherit !important #reset #data * { cue-before: inherit; } #errors #expected | * | cue-before: inherit #reset #data * { cue-before: inherit !important; } #errors #expected | * | cue-before: inherit !important #reset #data * { cue-after: inherit; } #errors #expected | * | cue-after: inherit #reset #data * { cue-after: inherit !important; } #errors #expected | * | cue-after: inherit !important #reset netsurf-all-3.2/libcss/test/data/parse2/INDEX0000644000175000017500000000134512377676736017774 0ustar vincevince# Index file for automated parser tests # # Test Description tests1.dat Basic tests eof.dat Unexpected EOF tests comments.dat Comment tests selectors.dat Invalid selector tests illegal-values.dat Illegal value tests malformed-declarations.dat Malformed declaration tests unknown-properties.dat Unknown property tests bgpos.dat Illegal background-position values au.dat Aural property tests bg.dat Background property tests border.dat Border property tests font.dat Font property tests list.dat List property tests margin.dat Margin property tests outline.dat Outline property tests overflow.dat Overflow property tests padding.dat Padding property tests multicol.dat Multi-column layout property tests netsurf-all-3.2/libcss/test/data/parse2/eof.dat0000644000175000017500000000565412377676736020454 0ustar vincevince#data #errors #expected #reset #data #errors #expected #reset #data f #errors #expected #reset #data f #errors #expected #reset #data f{ #errors #expected | f #reset #data f{ #errors #expected | f #reset #data f{; #errors #expected | f #reset #data f{ ; #errors #expected | f #reset #data f{; #errors #expected | f #reset #data f{g #errors #expected | f #reset #data f{g #errors #expected | f #reset #data f{g: #errors #expected | f #reset #data f{g : #errors #expected | f #reset #data f{g: #errors #expected | f #reset #data f{clear:both #errors #expected | f | clear: both #reset #data f{clear:both; #errors #expected | f | clear: both #reset #data f{clear:both} #errors #expected | f | clear: both #reset #data @f #errors #expected #reset #data @f #errors #expected #reset #data @f{ #errors #expected #reset #data @f{ #errors #expected #reset #data @f{{ #errors #expected #reset #data @f{@g #errors #expected #reset #data @f{; #errors #expected #reset #data @f{} #errors #expected #reset #data @f; #errors #expected #reset #data @media screen #errors #expected | @media #reset #data @media screen #errors #expected | @media #reset #data @media screen{ #errors #expected | @media #reset #data @media screen{ #errors #expected | @media #reset #data @media screen{{ #errors #expected | @media #reset #data @media screen{; #errors #expected | @media #reset #data @media screen{f #errors #expected | @media | f #reset #data @media screen{f{ #errors #expected | @media | f #reset #data @media screen{f{color #errors #expected | @media | f #reset #data @media screen{f{color: #errors #expected | @media | f #reset #data @media screen{f{color:blue #errors #expected | @media | f | color: #ff0000ff #reset #data @media screen{f{color:blue; #errors #expected | @media | f | color: #ff0000ff #reset #data @media screen{f{color:blue} #errors #expected | @media | f | color: #ff0000ff #reset #data @media screen{f{color:blue;} #errors #expected | @media | f | color: #ff0000ff #reset #data @media screen{f{color:blue;}} #errors #expected | @media | f | color: #ff0000ff #reset #data l( #errors #expected #reset #data l ( #errors #expected #reset #data l( #errors #expected #reset #data l(m #errors #expected #reset #data l(m #errors #expected #reset #data l(m) #errors #expected #reset #data l(m) #errors #expected #reset #data ( #errors #expected #reset #data ( #errors #expected #reset #data ( #errors #expected #reset #data (m #errors #expected #reset #data ( m #errors #expected #reset #data (m #errors #expected #reset #data (m) #errors #expected #reset #data [ #errors #expected #reset #data [ #errors #expected #reset #data [ #errors #expected #reset #data [m #errors #expected #reset #data [ m #errors #expected #reset #data [m #errors #expected #reset #data [m] #errors #expected #reset #data *{f:{ #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/multicol.dat0000644000175000017500000003746512377676736021540 0ustar vincevince#data * { break-after: #fff inherit; } #errors #expected | * #reset #data * { break-after: 10; } #errors #expected | * #reset #data * { break-after: 10em !important; } #errors #expected | * #reset #data * { break-after: column; } #errors #expected | * | break-after: column #reset #data * { break-after: page !important; } #errors #expected | * | break-after: page !important #reset #data * { break-after: inherit; } #errors #expected | * | break-after: inherit #reset #data * { break-after: normal; } #errors #expected | * #reset #data * { break-before: #fff inherit; } #errors #expected | * #reset #data * { break-before: 10; } #errors #expected | * #reset #data * { break-before: 10em !important; } #errors #expected | * #reset #data * { break-before: column; } #errors #expected | * | break-before: column #reset #data * { break-before: page !important; } #errors #expected | * | break-before: page !important #reset #data * { break-before: inherit; } #errors #expected | * | break-before: inherit #reset #data * { break-before: normal; } #errors #expected | * #reset #data * { break-inside: #fff inherit; } #errors #expected | * #reset #data * { break-inside: 10; } #errors #expected | * #reset #data * { break-inside: 10em !important; } #errors #expected | * #reset #data * { break-inside: avoid-column; } #errors #expected | * | break-inside: avoid-column #reset #data * { break-inside: avoid-page !important; } #errors #expected | * | break-inside: avoid-page !important #reset #data * { break-inside: page !important; } #errors #expected | * #reset #data * { break-inside: inherit; } #errors #expected | * | break-inside: inherit #reset #data * { break-inside: normal; } #errors #expected | * #reset #data * { column-count: normal; } #errors #expected | * #reset #data * { column-count: auto; } #errors #expected | * | column-count: auto #reset #data * { column-count: 3; } #errors #expected | * | column-count: 3 #reset #data * { column-count: 3px; } #errors #expected | * #reset #data * { column-count: 2 3; } #errors #expected | * #reset #data * { column-fill: 2; } #errors #expected | * #reset #data * { column-fill: 2em; } #errors #expected | * #reset #data * { column-fill: normal; } #errors #expected | * #reset #data * { column-fill: balance; } #errors #expected | * | column-fill: balance #reset #data * { column-fill: auto; } #errors #expected | * | column-fill: auto #reset #data * { column-fill: inherit; } #errors #expected | * | column-fill: inherit #reset #data * { column-fill: inherit !important; } #errors #expected | * | column-fill: inherit !important #reset #data * { column-gap: 2; } #errors #expected | * #reset #data * { column-gap: ; } #errors #expected | * #reset #data * { column-gap: auto; } #errors #expected | * #reset #data * { column-gap: normal; } #errors #expected | * | column-gap: normal #reset #data * { column-gap: 2em; } #errors #expected | * | column-gap: 2em #reset #data * { column-gap: inherit; } #errors #expected | * | column-gap: inherit #reset #data * { column-gap: inherit !important; } #errors #expected | * | column-gap: inherit !important #reset #data * { column-gap: !important; } #errors #expected | * #reset #data * { column-rule-color: !important; } #errors #expected | * #reset #data * { column-rule-color: red green; } #errors #expected | * #reset #data * { column-rule-color: normal; } #errors #expected | * #reset #data * { column-rule-color: auto; } #errors #expected | * #reset #data * { column-rule-color: red; } #errors #expected | * | column-rule-color: #ffff0000 #reset #data * { column-rule-color: red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important #reset #data * { column-rule-color: #BBC; } #errors #expected | * | column-rule-color: #ffbbbbcc #reset #data * { column-rule-style: !important; } #errors #expected | * #reset #data * { column-rule-style: none auto; } #errors #expected | * #reset #data * { column-rule-style: normal; } #errors #expected | * #reset #data * { column-rule-style: solid 10px; } #errors #expected | * #reset #data * { column-rule-style: 10px; } #errors #expected | * #reset #data * { column-rule-style: dashed; } #errors #expected | * | column-rule-style: dashed #reset #data * { column-rule-style: groove; } #errors #expected | * | column-rule-style: groove #reset #data * { column-rule-style: none; } #errors #expected | * | column-rule-style: none #reset #data * { column-rule-style: dotted; } #errors #expected | * | column-rule-style: dotted #reset #data * { column-rule-style: outset; } #errors #expected | * | column-rule-style: outset #reset #data * { column-rule-style: solid !important; } #errors #expected | * | column-rule-style: solid !important #reset #data * { column-rule-style: inset; } #errors #expected | * | column-rule-style: inset #reset #data * { column-rule-style: inherit; } #errors #expected | * | column-rule-style: inherit #reset #data * { column-rule-style: hidden; } #errors #expected | * | column-rule-style: hidden #reset #data * { column-rule-width: !important; } #errors #expected | * #reset #data * { column-rule-width: red green; } #errors #expected | * #reset #data * { column-rule-width: normal; } #errors #expected | * #reset #data * { column-rule-width: auto; } #errors #expected | * #reset #data * { column-rule-width: thin; } #errors #expected | * | column-rule-width: thin #reset #data * { column-rule-width: medium !important; } #errors #expected | * | column-rule-width: medium !important #reset #data * { column-rule-width: 3px; } #errors #expected | * | column-rule-width: 3px #reset #data * { column-rule-width: 3px !important; } #errors #expected | * | column-rule-width: 3px !important #reset #data * { column-rule-width: inherit; } #errors #expected | * | column-rule-width: inherit #reset #data * { column-span: !important; } #errors #expected | * #reset #data * { column-span: auto; } #errors #expected | * #reset #data * { column-span: 4em; } #errors #expected | * #reset #data * { column-span: 3; } #errors #expected | * #reset #data * { column-span: 3 !important; } #errors #expected | * #reset #data * { column-span: all; } #errors #expected | * | column-span: all #reset #data * { column-span: none; } #errors #expected | * | column-span: none #reset #data * { column-span: none !important; } #errors #expected | * | column-span: none !important #reset #data * { column-width: !important; } #errors #expected | * #reset #data * { column-width: red green; } #errors #expected | * #reset #data * { column-width: normal; } #errors #expected | * #reset #data * { column-width: auto; } #errors #expected | * | column-width: auto #reset #data * { column-width: 30em; } #errors #expected | * | column-width: 30em #reset #data * { column-width: 30em !important; } #errors #expected | * | column-width: 30em !important #reset #data * { column-width: inherit; } #errors #expected | * | column-width: inherit #reset #data * { columns: 30em; } #errors #expected | * | column-width: 30em | column-count: auto #reset #data * { columns: auto; } #errors #expected | * | column-width: auto | column-count: auto #reset #data * { columns: auto auto; } #errors #expected | * | column-width: auto | column-count: auto #reset #data * { columns: 30em 2; } #errors #expected | * | column-width: 30em | column-count: 2 #reset #data * { columns: 4; } #errors #expected | * | column-width: auto | column-count: 4 #reset #data * { columns: 40%; } #errors #expected | * #reset #data * { columns: 90deg; } #errors #expected | * #reset #data * { columns: inherit 4; } #errors #expected | * #reset #data * { columns: inherit 400px; } #errors #expected | * #reset #data * { columns: auto auto auto; } #errors #expected | * #reset #data * { columns: invalid; } #errors #expected | * #reset #data * { columns: inherit 3em; } #errors #expected | * #reset #data * { columns: 3em inherit; } #errors #expected | * #reset #data * { columns: 3 inherit; } #errors #expected | * #reset #data * { columns: inherit inherit; } #errors #expected | * #reset #data * { columns: inherit; } #errors #expected | * | column-width: inherit | column-count: inherit #reset #data * { columns: inherit !important; } #errors #expected | * | column-width: inherit !important | column-count: inherit !important #reset #data * { columns: 30em !important; } #errors #expected | * | column-width: 30em !important | column-count: auto !important #reset #data * { columns: auto !important; } #errors #expected | * | column-width: auto !important | column-count: auto !important #reset #data * { columns: auto auto !important; } #errors #expected | * | column-width: auto !important | column-count: auto !important #reset #data * { columns: 30em 2 !important; } #errors #expected | * | column-width: 30em !important | column-count: 2 !important #reset #data * { columns: 4 !important; } #errors #expected | * | column-width: auto !important | column-count: 4 !important #reset #data * { column-rule: inherit; } #errors #expected | * | column-rule-color: inherit | column-rule-style: inherit | column-rule-width: inherit #reset #data * { column-rule: red; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: none | column-rule-width: medium #reset #data * { column-rule: transparent; } #errors #expected | * | column-rule-color: transparent | column-rule-style: none | column-rule-width: medium #reset #data * { column-rule: currentColor; } #errors #expected | * | column-rule-color: currentColor | column-rule-style: none | column-rule-width: medium #reset #data * { column-rule: solid; } #errors #expected | * | column-rule-color: #00000000 | column-rule-style: solid | column-rule-width: medium #reset #data * { column-rule: thin; } #errors #expected | * | column-rule-color: #00000000 | column-rule-style: none | column-rule-width: thin #reset #data * { column-rule: red solid; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: medium #reset #data * { column-rule: solid red; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: medium #reset #data * { column-rule: red thin; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: none | column-rule-width: thin #reset #data * { column-rule: thin red; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: none | column-rule-width: thin #reset #data * { column-rule: solid thin; } #errors #expected | * | column-rule-color: #00000000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: thin solid; } #errors #expected | * | column-rule-color: #00000000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: red solid thin; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: red thin solid; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: solid red thin; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: solid thin red; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: thin red solid; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: thin solid red; } #errors #expected | * | column-rule-color: #ffff0000 | column-rule-style: solid | column-rule-width: thin #reset #data * { column-rule: inherit !important; } #errors #expected | * | column-rule-color: inherit !important | column-rule-style: inherit !important | column-rule-width: inherit !important #reset #data * { column-rule: red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: none !important | column-rule-width: medium !important #reset #data * { column-rule: solid !important; } #errors #expected | * | column-rule-color: #00000000 !important | column-rule-style: solid !important | column-rule-width: medium !important #reset #data * { column-rule: thin !important; } #errors #expected | * | column-rule-color: #00000000 !important | column-rule-style: none !important | column-rule-width: thin !important #reset #data * { column-rule: red solid !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: medium !important #reset #data * { column-rule: solid red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: medium !important #reset #data * { column-rule: red thin !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: none !important | column-rule-width: thin !important #reset #data * { column-rule: thin red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: none !important | column-rule-width: thin !important #reset #data * { column-rule: solid thin !important; } #errors #expected | * | column-rule-color: #00000000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: thin solid !important; } #errors #expected | * | column-rule-color: #00000000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: red solid thin !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: red thin solid !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: solid red thin !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: solid thin red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: thin red solid !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: thin solid red !important; } #errors #expected | * | column-rule-color: #ffff0000 !important | column-rule-style: solid !important | column-rule-width: thin !important #reset #data * { column-rule: invalid; } #errors #expected | * #reset #data * { column-rule: ; } #errors #expected | * #reset #data * { column-rule:} #errors #expected | * #reset #data * { column-rule: thin solid red inherit; } #errors #expected | * #reset #data * { column-rule: inherit thin solid #fff; } #errors #expected | * #reset #data * { column-rule: inherit thin; } #errors #expected | * #reset #data * { column-rule: thin inherit; } #errors #expected | * #reset #data * { column-rule: inherit inherit; } #errors #expected | * #reset #data * { column-rule: inherit #BBC !important; } #errors #expected | * #reset #data * { column-rule: #BBC !important inherit; } #errors #expected | * #reset #data * { column-rule: red inherit; } #errors #expected | * #reset #data * { column-rule: inherit inherit; } #errors #expected | * #reset #data * { column-rule: inherit red; } #errors #expected | * #reset #data * { column-rule: thin inherit red; } #errors #expected | * #reset #data * { column-rule: thin inherit; } #errors #expected | * #reset #data * { column-rule: solid inherit; } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/bgpos.dat0000644000175000017500000000131112377676736020777 0ustar vincevince#data * { background-position: left left; } #errors #expected | * #reset #data * { background-position: bottom 20%; } #errors #expected | * #reset #data * { background-position: right foo; } #errors #expected | * #reset #data * { background-position: left top inherit; } #errors #expected | * #reset #data * { background-position: inherit left top; } #errors #expected | * #reset #data * { background-position: left top; } #errors #expected | * | background-position: left top #reset #data * { background-position: left center; } #errors #expected | * | background-position: left center #reset #data * { background-position: 62% center; } #errors #expected | * | background-position: 62% center #reset netsurf-all-3.2/libcss/test/data/parse2/overflow.dat0000644000175000017500000000212612377676736021535 0ustar vincevince#data * { overflow: auto; } #errors #expected | * | overflow-x: auto | overflow-y: auto #reset #data * { overflow: hidden; } #errors #expected | * | overflow-x: hidden | overflow-y: hidden #reset #data * { overflow: visible; } #errors #expected | * | overflow-x: visible | overflow-y: visible #reset #data * { overflow: scroll; } #errors #expected | * | overflow-x: scroll | overflow-y: scroll #reset #data * { overflow: inherit; } #errors #expected | * | overflow-x: inherit | overflow-y: inherit #reset #data * { overflow-x: inherit; } #errors #expected | * | overflow-x: inherit #reset #data * { overflow-x: scroll; } #errors #expected | * | overflow-x: scroll #reset #data * { overflow-y: visible; } #errors #expected | * | overflow-y: visible #reset #data * { overflow-y: auto; } #errors #expected | * | overflow-y: auto #reset #data * { overflow-x: visible; overflow-y: hidden; } #errors #expected | * | overflow-x: visible | overflow-y: hidden #reset #data * { overflow-y: auto; overflow-x: inherit; } #errors #expected | * | overflow-y: auto | overflow-x: inherit #reset netsurf-all-3.2/libcss/test/data/parse2/padding.dat0000644000175000017500000000614412377676736021304 0ustar vincevince#data * { padding: 10px; } #errors #expected | * | padding-top: 10px | padding-right: 10px | padding-bottom: 10px | padding-left: 10px #reset #data * { padding: 10px 20px; } #errors #expected | * | padding-top: 10px | padding-right: 20px | padding-bottom: 10px | padding-left: 20px #reset #data * { padding: 10px 20px 30px; } #errors #expected | * | padding-top: 10px | padding-right: 20px | padding-bottom: 30px | padding-left: 20px #reset #data * { padding: 10px 20px 30px 40px; } #errors #expected | * | padding-top: 10px | padding-right: 20px | padding-bottom: 30px | padding-left: 40px #reset #data * { padding: inherit; } #errors #expected | * | padding-top: inherit | padding-right: inherit | padding-bottom: inherit | padding-left: inherit #reset #data * { padding: 20px inherit; } #errors #expected | * #reset #data * { padding: inherit 20px; } #errors #expected | * #reset #data * { padding: 10px !important; } #errors #expected | * | padding-top: 10px !important | padding-right: 10px !important | padding-bottom: 10px !important | padding-left: 10px !important #reset #data * { padding: 10px 20px !important; } #errors #expected | * | padding-top: 10px !important | padding-right: 20px !important | padding-bottom: 10px !important | padding-left: 20px !important #reset #data * { padding: 10px 20px 30px !important; } #errors #expected | * | padding-top: 10px !important | padding-right: 20px !important | padding-bottom: 30px !important | padding-left: 20px !important #reset #data * { padding: 10px 20px 30px 40px !important; } #errors #expected | * | padding-top: 10px !important | padding-right: 20px !important | padding-bottom: 30px !important | padding-left: 40px !important #reset #data * { padding: inherit !important; } #errors #expected | * | padding-top: inherit !important | padding-right: inherit !important | padding-bottom: inherit !important | padding-left: inherit !important #reset #data * { padding: 20px inherit !important; } #errors #expected | * #reset #data * { padding: invalid; } #errors #expected | * #reset #data * { padding: ; } #errors #expected | * #reset #data * { padding: 20deg; } #errors #expected | * #reset #data * { padding:} #errors #expected | * #reset #data * { padding: 2px inherit; } #errors #expected | * #reset #data * { padding: inherit 2px; } #errors #expected | * #reset #data * { padding: 2px 3em inherit; } #errors #expected | * #reset #data * { padding: 2px inherit 3em; } #errors #expected | * #reset #data * { padding: 2px 0 0 0 inherit; } #errors #expected | * #reset #data * { padding: inherit inherit; } #errors #expected | * #reset #data * { padding: inherit 0 !important; } #errors #expected | * #reset #data * { padding-top: inherit;} #errors #expected | * | padding-top: inherit #reset #data * { padding-right: inherit;} #errors #expected | * | padding-right: inherit #reset #data * { padding-bottom: inherit;} #errors #expected | * | padding-bottom: inherit #reset #data * { padding-bottom: 2em inherit;} #errors #expected | * #reset #data * { padding-left: inherit;} #errors #expected | * | padding-left: inherit #reset netsurf-all-3.2/libcss/test/data/parse2/bg.dat0000644000175000017500000001050712377676736020264 0ustar vincevince#data * { background: red; } #errors #expected | * | background-attachment: scroll | background-color: #ffff0000 | background-image: none | background-position: left top | background-repeat: repeat #reset #data * { background: transparent } #errors #expected | * | background-attachment: scroll | background-color: transparent | background-image: none | background-position: left top | background-repeat: repeat #reset #data * { background: currentColor } #errors #expected | * | background-attachment: scroll | background-color: currentColor | background-image: none | background-position: left top | background-repeat: repeat #reset #data * { background: url("chess.png") gray 40% repeat fixed; } #errors #expected | * | background-attachment: fixed | background-color: #ff808080 | background-image: url('chess.png') | background-position: 40% center | background-repeat: repeat #reset #data * { background: inherit; } #errors #expected | * | background-attachment: inherit | background-color: inherit | background-image: inherit | background-position: inherit | background-repeat: inherit #reset #data * { background: #fff url(bg.gif) no-repeat fixed top left; } #errors #expected | * | background-attachment: fixed | background-color: #ffffffff | background-image: url('bg.gif') | background-position: left top | background-repeat: no-repeat #reset #data * { background: #fff #000; } #errors #expected | * #reset #data * { background: #fff url(foo) repeat fixed right bottom #000; } #errors #expected | * #reset #data * { background: #fff inherit; } #errors #expected | * #reset #data * { background: inherit #fff; } #errors #expected | * #reset #data * { background: #fff inherit top left; } #errors #expected | * #reset #data * { background: inherit fixed !important; } #errors #expected | * #reset #data * { background: #fff url(foo) repeat fixed right bottom inherit; } #errors #expected | * #reset #data * { background: red !important; } #errors #expected | * | background-attachment: scroll !important | background-color: #ffff0000 !important | background-image: none !important | background-position: left top !important | background-repeat: repeat !important #reset #data * { background: url("chess.png") gray 50% repeat fixed ! important; } #errors #expected | * | background-attachment: fixed !important | background-color: #ff808080 !important | background-image: url('chess.png') !important | background-position: 50% center !important | background-repeat: repeat !important #reset #data * { background: inherit !important; } #errors #expected | * | background-attachment: inherit !important | background-color: inherit !important | background-image: inherit !important | background-position: inherit !important | background-repeat: inherit !important #reset #data * { background: #fff url(bg.gif) no-repeat fixed top left !important; } #errors #expected | * | background-attachment: fixed !important | background-color: #ffffffff !important | background-image: url('bg.gif') !important | background-position: left top !important | background-repeat: no-repeat !important #reset #data * { background: #fff #000 ! important; } #errors #expected | * #reset #data * { background: #fff url(foo) repeat fixed right bottom #000 ! important; } #errors #expected | * #reset #data * { background: invalid; } #errors #expected | * #reset #data * { background: url(foo) !important no-repeat; } #errors #expected | * #reset #data * { background-image: inherit; } #errors #expected | * | background-image: inherit #reset #data * { background-color: inherit; } #errors #expected | * | background-color: inherit #reset #data * { background-color: red inherit; } #errors #expected | * #reset #data * { background-color: inherit red; } #errors #expected | * #reset #data * { background-color: inherit red !important; } #errors #expected | * #reset #data * { background-color: red !important; } #errors #expected | * | background-color: #ffff0000 !important #reset #data * { background-attachment: inherit; } #errors #expected | * | background-attachment: inherit #reset #data * { background-position: inherit; } #errors #expected | * | background-position: inherit #reset #data * { background-repeat: inherit; } #errors #expected | * | background-repeat: inherit #reset #data * { background-repeat: red; } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/selectors.dat0000644000175000017500000000035012377676736021672 0ustar vincevince## Unknown combinator #data E & F {} #errors #expected #reset ## Unknown pseudo #data E:foobar {} #errors #expected #reset ## Pseudo element in non-terminal simple selector #data E:first-letter > B {} #errors #expected #reset netsurf-all-3.2/libcss/test/data/parse2/unknown-properties.dat0000644000175000017500000000043712377676736023566 0ustar vincevince#data * { dentist: "Mr Peg"; } #errors #expected | * #reset #data * { colour: #BBC; } #errors #expected | * #reset #data * { dentist: "Mr Peg"; color: #BBC; dentist: "Mr Peg"; } #errors #expected | * | color: #ffbbbbcc #reset #data * { padding-: 4em; } #errors #expected | * #reset netsurf-all-3.2/libcss/test/data/parse2/malformed-declarations.dat0000644000175000017500000000253112377676736024306 0ustar vincevince#data * { top: 1em; } #errors #expected | * | top: 1em #reset #data * { top: 1em; bottom } #errors #expected | * | top: 1em #reset #data * { top: 1em; bottom; bottom: 3px; } #errors #expected | * | top: 1em | bottom: 3px #reset #data * { top: 1em; bottom left; bottom: 3px; } #errors #expected | * | top: 1em | bottom: 3px #reset #data * { top: 1em; bottom: } #errors #expected | * | top: 1em #reset #data * { top: 1em; bottom:; left:1in; } #errors #expected | * | top: 1em | left: 1in #reset #data * { top: 1em; bottom{; left:1in} } #errors #expected | * | top: 1em #reset #data * { top: 1em; bottom{; left:1in}; color: #BBC; } #errors #expected | * | top: 1em | color: #ffbbbbcc #reset #data * { top: 1em; bottom{; left:1in}; color: #BBC; } #errors #expected | * | top: 1em | color: #ffbbbbcc #reset #data * { background-color: black; :; color: white; } #errors #expected | * | background-color: #ff000000 | color: #ffffffff #reset #data * { background-color: black; : color: white; } #errors #expected | * | background-color: #ff000000 #reset #data * { background-color: black; dentist: color: white; } #errors #expected | * | background-color: #ff000000 #reset #data *{f():{ #errors #expected | * #reset #data *{:{ #errors #expected | * #reset #data *{:{};f():{};font-size:{};clear:both} #errors #expected | * | clear: both #reset netsurf-all-3.2/libcss/test/data/lex/0000755000175000017500000000000012377713347016561 5ustar vincevincenetsurf-all-3.2/libcss/test/data/lex/regression.dat0000644000175000017500000000041612377676736021446 0ustar vincevince#data -1 #expected NUMBER:-1 S EOF #reset #data +1 #expected NUMBER:+1 S EOF #reset #data -1.0 #expected NUMBER:-1.0 S EOF #reset #data +1.0 #expected NUMBER:+1.0 S EOF #reset #data -.5 #expected NUMBER:-.5 S EOF #reset #data +.5 #expected NUMBER:+.5 S EOF #reset netsurf-all-3.2/libcss/test/data/lex/tests1.dat0000644000175000017500000000767712377676736020531 0ustar vincevince#data a #expected IDENT:a S EOF #reset #data Z #expected IDENT:Z S EOF #reset #data - #expected CHAR:- S EOF #reset #data _ #expected IDENT:_ S EOF #reset #data @ #expected CHAR:@ S EOF #reset #data # #expected CHAR:# S EOF #reset #data 0 #expected NUMBER:0 S EOF #reset #data 0.0 #expected NUMBER:0.0 S EOF #reset #data .0 #expected NUMBER:.0 S EOF #reset #data 10% #expected PERCENTAGE:10 S EOF #reset #data 10.5% #expected PERCENTAGE:10.5 S EOF #reset #data .5% #expected PERCENTAGE:.5 S EOF #reset #data 50px #expected DIMENSION:50px S EOF #reset #data 50.5px #expected DIMENSION:50.5px S EOF #reset #data .4px #expected DIMENSION:.4px S EOF #reset #data url() #expected URI: S EOF #reset #data url(123456\)); #expected URI:123456) CHAR:; S EOF #reset #data url("123456)"); #expected URI:123456) CHAR:; S EOF #reset #data url('123456)'); #expected URI:123456) CHAR:; S EOF #reset #data U+? #expected UNICODE-RANGE:? S EOF #reset #data U+?????1 #expected UNICODE-RANGE:?????1 S EOF #reset #data U+ffffff-000000 #expected UNICODE-RANGE:ffffff-000000 S EOF #reset #data U+02468ac #expected UNICODE-RANGE:02468a IDENT:c S EOF #reset #data < #expected CHAR:< S EOF #reset #data #expected CDC S EOF #reset #data #expected S EOF #reset #data /* *** / *** */ #expected S EOF #reset #data foo( #expected FUNCTION:foo S EOF #reset #data ~= #expected INCLUDES S EOF #reset #data |= #expected DASHMATCH S EOF #reset #data ^= #expected PREFIXMATCH S EOF #reset #data $= #expected SUFFIXMATCH S EOF #reset #data *= #expected SUBSTRINGMATCH S EOF #reset #data body #expected IDENT:body S EOF #reset #data @foo #expected ATKEYWORD:foo S EOF #reset #data #blah #expected HASH:blah S EOF #reset #data "foo" #expected STRING:foo S EOF #reset #data 'foo' #expected STRING:foo S EOF #reset #data 'foo\'' #expected STRING:foo' S EOF #reset #data 'blah \ xyz' #expected STRING:blah \n\txyz S EOF #reset #data url( foo); #expected URI:foo CHAR:; S EOF #reset #data url(foo ); #expected URI:foo CHAR:; S EOF #reset #data url( "foo" ); #expected URI:foo CHAR:; S EOF #reset #data @he\llo #expected ATKEYWORD:hello S EOF #reset #data -foo #expected IDENT:-foo S EOF #reset #data --x #expected CHAR:- IDENT:-x S EOF #reset #data -\x #expected IDENT:-x S EOF #reset #data /x #expected CHAR:/ IDENT:x S EOF #reset #data /***** *** /// ** #expected EOF #reset #data /* */ /* */ #expected S S EOF #reset #data \moo #expected IDENT:moo S EOF #reset #data ~x #expected CHAR:~ IDENT:x S EOF #reset #data . #expected CHAR:. S EOF #reset #data 0.5\px #expected DIMENSION:0.5px S EOF #reset #data @\x #expected ATKEYWORD:x S EOF #reset #data 0. #expected NUMBER:0 CHAR:. S EOF #reset #data ugh #expected IDENT:ugh S EOF #reset #data urx #expected IDENT:urx S EOF #reset #data urlx #expected IDENT:urlx S EOF #reset #data url(foo #expected FUNCTION:url IDENT:foo S EOF #reset #data url(foo x #expected FUNCTION:url IDENT:foo S IDENT:x S EOF #reset #data U+ #expected IDENT:U CHAR:+ S EOF #reset #data U+0-x #expected UNICODE-RANGE:0 IDENT:-x S EOF #reset #data "foo'" #expected STRING:foo' S EOF #reset #data 'foo"' #expected STRING:foo" S EOF #reset #data blah\2022 #expected IDENT:blah EOF #reset #data blah\2022x #expected IDENT:blahx S EOF #reset #data blah\2022 f #expected IDENT:blahf S EOF #reset #data \123\456 #expected IDENT:庁 EOF #reset #data \789\abc #expected IDENT:爲 EOF #reset #data \000d #expected IDENT:\n EOF #reset #data \d900 #expected IDENT:鐃 EOF #reset #data \dd00 #expected IDENT:鐃 EOF #reset #data \fffe #expected IDENT:鐃 EOF #reset # #data \1ffff #expected IDENT:鐃 EOF #reset #data \110000 #expected IDENT:鐃 EOF #reset #data tes\ t #expected IDENT:tes CHAR:\\ S IDENT:t S EOF #reset #data "tes\ t" #expected STRING:tes\nt S EOF #reset netsurf-all-3.2/libcss/test/data/lex/INDEX0000644000175000017500000000023312377676736017363 0ustar vincevince# Index file for automated lexer tests # # Test Description tests1.dat Basic tests tests2.dat More complicated tests regression.dat Regression tests netsurf-all-3.2/libcss/test/data/lex/tests2.dat0000644000175000017500000000364712377676736020523 0ustar vincevince#data p[example="public class foo\ {\ private int x;\ \ foo(int x) {\ this.x = x;\ }\ \ }"] { color: red } #expected IDENT:p CHAR:[ IDENT:example CHAR:= STRING:public class foo\n{\n private int x;\n\n foo(int x) {\n this.x = x;\n }\n\n} CHAR:] S CHAR:{ S IDENT:color CHAR:: S IDENT:red S CHAR:} S EOF #reset #data @import url("abcde ); #expected ATKEYWORD:import S FUNCTION:url INVALID:abcde S CHAR:) CHAR:; S EOF #reset #data body { font-family: "Bitstream Vera Sans; } .one { width: 10em; } #expected IDENT:body S CHAR:{ S IDENT:font-family CHAR:: S INVALID:Bitstream Vera Sans; S CHAR:} S CHAR:. IDENT:one S CHAR:{ S IDENT:width CHAR:: S DIMENSION:10em CHAR:; S CHAR:} S EOF #reset #data body { font-family: "Bitstream Vera Sans; } .two { width: 10em; } #expected IDENT:body S CHAR:{ S IDENT:font-family CHAR:: S INVALID:Bitstream Vera Sans; } S CHAR:. IDENT:two S CHAR:{ S IDENT:width CHAR:: S DIMENSION:10em CHAR:; S CHAR:} S EOF #reset #data "abcde #expected INVALID:abcde S EOF #reset #data #ad{color:/*{#ao{display:none}#ax{display:inline} #expected HASH:ad CHAR:{ IDENT:color CHAR:: EOF #reset #data #bd{background:url("xxx"}#bo{display:none}#bx{display:inline} #expected HASH:bd CHAR:{ IDENT:background CHAR:: FUNCTION:url STRING:xxx CHAR:} HASH:bo CHAR:{ IDENT:display CHAR:: IDENT:none CHAR:} HASH:bx CHAR:{ IDENT:display CHAR:: IDENT:inline CHAR:} S EOF #reset #data #cd{background:url('xxx'}#co{display:none}#cx{display:inline} #expected HASH:cd CHAR:{ IDENT:background CHAR:: FUNCTION:url STRING:xxx CHAR:} HASH:co CHAR:{ IDENT:display CHAR:: IDENT:none CHAR:} HASH:cx CHAR:{ IDENT:display CHAR:: IDENT:inline CHAR:} S EOF #reset #data #dd{background:url(xxx}#do{display:none}#dx{display:inline} #expected HASH:dd CHAR:{ IDENT:background CHAR:: FUNCTION:url IDENT:xxx CHAR:} HASH:do CHAR:{ IDENT:display CHAR:: IDENT:none CHAR:} HASH:dx CHAR:{ IDENT:display CHAR:: IDENT:inline CHAR:} S EOF #reset netsurf-all-3.2/libcss/test/data/css/0000755000175000017500000000000012377713347016561 5ustar vincevincenetsurf-all-3.2/libcss/test/data/css/color.css0000644000175000017500000000044612377676736020427 0ustar vincevinceh1 { color: red; color: #12f; color: #12345f; color: rgb(0, 0, 0); color: rgb(0%, 0%, 0%); color: rgb(300, 0, 0); color: rgb(-10, 0, 0); color: rgb(150%, 0%, 0%); color: rgb(-10%, 0%, 0%); color: 123; color: 123456; color: 12f; color: 12345f; color: 12f456; color: f00000; } netsurf-all-3.2/libcss/test/data/css/blocks.css0000644000175000017500000000055612377676736020570 0ustar vincevince@charset "UTF-8"; @import "simple.css"; @foo rgb(255,255,255); @bar (a,b,c); @media screen { body { background-color: green; color: yellow; background-image: url("foo"); color: [ ( { ] ) }; } @page :left { @margin { 10mm, 20mm, 30mm, 40mm }; margin-top: 50mm; } div { color: blue; } border-left: 10mm } @page { margin-left: 50mm; } netsurf-all-3.2/libcss/test/data/css/INDEX0000644000175000017500000000057712377676736017376 0ustar vincevince# Index file for generic CSS content # # Test Description simple.css Reasonably simple CSS file (semantically invalid) allzengarden.css All CSS Zen Garden stylesheets concatenated blocks.css Basic blocks and at-rule syntax malformed.css Malformed declarations from the CSS 2.1 spec badcomment.css Comment inside { ... } lacks starting /* fontface.css Various @font-face rulesnetsurf-all-3.2/libcss/test/data/css/allzengarden.css0000644000175000017500000437170012377676736021767 0ustar vincevince/* css Zen Garden default style - 'Tranquille' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: May 7th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* The Zen Garden default was the first I put together, and almost didn't make the cut. I briefly flirted with using 'Salmon Cream Cheese' as the main style for the Garden, but switched back to this one before launch. All graphics in this design were illustrated by me in Photoshop. Google Image Search provided inspiration for some of the elements. I did a bit of research on Kanji to come up with the characters on the top left. Anyone who can read that will most likely tell you it makes no sense, but the best I could do was putting together the characters for 'beginning' 'complete' and 'skill' to roughly say something like 'we're breaking fresh ground.' It's a stretch. */ /* basic elements */ html { margin: 0; padding: 0; } body { font: 75% georgia, sans-serif; line-height: 1.88889; color: #555753; background: #fff url(/001/blossoms.jpg) no-repeat bottom right; margin: 0; padding: 0; } p { margin-top: 0; text-align: justify; } h3 { font: italic normal 1.4em georgia, sans-serif; letter-spacing: 1px; margin-bottom: 0; color: #7D775C; } a:link { font-weight: bold; text-decoration: none; color: #B7A5DF; } a:visited { font-weight: bold; text-decoration: none; color: #D4CDDC; } a:hover, a:active { text-decoration: underline; color: #9685BA; } acronym { border-bottom: none; } /* specific divs */ #container { background: url(/001/zen-bg.jpg) no-repeat top left; padding: 0 175px 0 110px; margin: 0; position: relative; } #intro { min-width: 470px; width: 100%; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(/001/h1.gif) no-repeat top left; margin-top: 10px; display: block; width: 219px; height: 87px; float: left; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(/001/h2.gif) no-repeat top left; margin-top: 58px; margin-bottom: 40px; width: 200px; height: 18px; float: right; } #pageHeader h2 span { display:none } #pageHeader { padding-top: 20px; height: 87px; } #quickSummary { clear: both; margin: 20px 20px 20px 10px; width: 160px; float: left; } #quickSummary p { font: italic 1.1em/2.2 georgia; text-align: center; } #preamble { clear: right; padding: 0px 10px 0 10px; } #supportingText { padding-left: 10px; margin-bottom: 40px; } #footer { text-align: center; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList { margin-left: 600px; position: absolute; top: 0; right: 0; } #linkList2 { font: 10px verdana, sans-serif; background: transparent url(/001/paper-bg.jpg) top left repeat-y; padding: 10px; margin-top: 150px; width: 130px; } #linkList h3.select { background: transparent url(/001/h3.gif) no-repeat top left; margin: 10px 0 5px 0; width: 97px; height: 16px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(/001/h4.gif) no-repeat top left; margin: 25px 0 5px 0; width: 60px; height: 18px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(/001/h5.gif) no-repeat top left; margin: 25px 0 5px 0; width:57px; height: 14px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(/001/h6.gif) no-repeat top left; margin: 25px 0 5px 0; width:63px; height: 10px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0; padding: 0; } #linkList li { line-height: 1.3em; background: transparent url(/001/cr1.gif) no-repeat top center; display: block; padding-top: 5px; margin-bottom: 5px; list-style-type: none; } #linkList li a:link { color: #988F5E; } #linkList li a:visited { color: #B3AE94; } #extraDiv1 { background: transparent url(/001/cr2.gif) top left no-repeat; position: absolute; top: 40px; right: 0; width: 148px; height: 110px; } .accesskey { text-decoration: underline; }/* css Zen Garden submission 002 - 'Salmon Cream Cheese' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: May 7th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* If you're familiar with the life cycle of salmon, you'll know that at the end of their lives they fight their way upstream to the rivers where they were born, to spawn and then die. Growing up close to one of these so-called 'salmon runs', I once had a class field trip to the river for the afternoon to learn about the process. The funny thing about a bunch of dead salmon is that they stink. Quite bad. The second worst memory of that day was the smell of the fish. The worst memory of the day was opening my lunch to find my considerate mother had packed bagels. With, as you have guessed by now, salmon cream cheese. I rarely hear the word 'salmon' anymore without the 'cream cheese' playing in my head as an afterthought. Hence, this style is Salmon Cream Cheese. */ /* basic elements */ body { font: 11px/14px verdana, sans-serif; color: #AD7C77; background: #FFD7C4 url(/002/bg1.gif) top left repeat-x; padding: 65px 0px 0px 224px; margin: 0px; } p { font: 11px/14px verdana, sans-serif; text-align: justify; margin-top: 0px; } h3 { font: bold 16px 'arial narrow', sans-serif; text-transform: lowercase; margin-bottom: 0px; } acronym { border-bottom: dotted 1px #B27F66; } a:link { font-weight: bold; text-decoration: none; color: #E98376; } a:visited { font-weight: bold; text-decoration: none; color: #AD7C77; } a:active, a:hover { text-decoration: underline; } /* specific divs */ /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader { position: absolute; top: 0px; left: 0px; width: 770px; } #pageHeader h1 { background: transparent url(/002/h1.gif) no-repeat top left; width: 258px; height: 61px; float: left; margin: 1px 0px 0px 3px; } #pageHeader h1 span { display: none; } #pageHeader h2 { background: transparent url(/002/h2.gif) no-repeat top left; width: 206px; height: 28px; float: right; margin: 22px 15px 0px 0px; } #pageHeader h2 span { display: none; } /* sets up our floating area on the right. Kind of a hack, since there's a physical separation between two divs, filled in by tricky margins and compensated for with tricky padding, but it seems to hold up okay. */ #intro { background: #FFC5A9 url(/002/bg2.gif) top left repeat-x; } #preamble { padding: 0px 40px 0px 40px; } #preamble .p3 { margin-bottom: 0px; } #supportingText { background-color: #FFC5A9; margin: 0px; padding: 0px 40px 0px 40px; } #supportingText #explanation h3 { margin-top: 0px; padding-top: 20px; } #quickSummary { padding-top: 47px; } #quickSummary .p1 { width: 430px; height: 195px; background: transparent url(/002/splash.jpg) top left no-repeat; padding: 182px 0px 0px 10px; position: absolute; top: 93px; left: 244px; } #quickSummary .p1 span { display: none; } #quickSummary .p2 { font-size: 9px; line-height: 22px; text-align: left; color: #B27F66; background-color: #FFD7C4; display: block; border: solid 1px #FFBEA1; padding: 40px 15px 0px 419px; margin: 0px 10px 0px 40px; height: 140px; } #quickSummary .p2 a:link { color: #B27F66; } #footer { text-align: right; border-top: solid 1px #FFCDB5; padding-top: 10px; } #footer a:link, #footer a:visited { padding: 2px 6px 2px 6px; } #footer a:hover { background-color: #FFD7BF; text-decoration: none; } #linkList { background: transparent url(/002/cr1.gif) bottom right no-repeat; padding-bottom: 76px; position: absolute; top: 65px; left: 0px; } #linkList2 { padding: 40px 0px 10px 0px; width: 200px; } #linkList2 h3 span { display: none; } #linkList2 h3.select { background: transparent url(/002/h3.gif) no-repeat top left; width: 195px; height: 21px; } #linkList2 h3.favorites{ background: transparent url(/002/h4.gif) no-repeat top left; width: 195px; height: 21px; } #linkList2 h3.archives{ background: transparent url(/002/h5.gif) no-repeat top left; width: 195px; height: 21px; } #linkList2 h3.resources{ background: transparent url(/002/h6.gif) no-repeat top left; width: 195px; height: 21px; } #linkList .iL, #linkList li { font-size: 10px; line-height: 2.5ex; display: block; padding: 2px 0px 0px 25px; margin-bottom: 5px; } #linkList #lresources li { margin-bottom: 0px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; } /* css Zen Garden submission 003 - 'Stormweather' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: May 7th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Credit to Phillipe Wittenbergh at http://www.l-c-n.com/ for Mac testing */ /* The photos in this design come from my digital library. All were taken in Vancouver, BC. The car is on the Granville St. Bridge, the leaves are West 6th Ave, and the snow/tree is West 10th Ave. Guess which part of town I live in... I'm still rather fond of this design. I'm glad Phillipe was able to iron out the various CSS bugs */ /* basic elements */ body { font: 11px/15px georgia, serif; text-align: center; color: #fff; background: #748A9B url(bg2.gif) 0 0 repeat-y; margin: 0px; } p { /*font: 11px/15px georgia, serif;*/ text-align: justify; margin-top: 0; } h3 { font: bold 14px georgia, serif; text-transform: lowercase; margin-bottom: 0; } acronym { border-bottom: dotted 1px #fff; } a:link { font-weight: bold; text-decoration: underline; color: #A7D3F6; } a:visited { font-weight: bold; text-decoration: underline; color: #D1E9FC; } a:active, a:hover { text-decoration: underline; color: #fff; } /* specific divs */ #container { background: #849AA9 url(bg1.gif) top left repeat-y; text-align: left; width: 750px; margin: 0px auto; position: relative; } #supportingText { /*position: relative; top: -120px;*/ padding: 0px 40px 0px 0; /*clear:right;*/ float:right; width:430px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(h1.jpg) no-repeat top left; width: 750px; height: 152px; margin: 0px; } #pageHeader h1 span { display: none; } #pageHeader h2 span { display: none; } #quickSummary { width: 685px; margin: 0px auto; position: relative; top: -50px; } html>body #quickSummary { margin-top:-50px; top: 0; } #quickSummary .p1 { font-size: 1px; color: white; background: transparent url(panel1-2.jpg) no-repeat top left; width: 449px; padding: 10px 0px 0px 5px; float: left; height: 268px; voice-family: "\"}\""; voice-family:inherit; height: 258px; } #quickSummary .p1 span { display: none; } #quickSummary .p2 { color: #7593A7; background: transparent url(panel3.jpg) no-repeat 0 0; padding: 90px 45px 0px 45px; float: right; width: 214px; height: 338px; voice-family: "\"}\""; voice-family:inherit; width: 124px; height: 178px; } #quickSummary .p2 span { letter-spacing: -1px; line-height: 26px; display: block; } #quickSummary .p2 a:link, #quickSummary .p2 a:visited { color: #7593A7; } #quickSummary .p2 a:hover { color: #85ABC5; } #preamble { /*position: relative; top: -120px; */ padding: 0px 0px 70px 33px; margin: 0px 0 20px 0px; width: 210px; float: left; background: transparent url(tag.gif) 50% 100% no-repeat; } #preamble h2 { font: bold 14px georgia, serif; margin-top: 0px; padding: 0px; } #preamble p { font: italic 12px/20px georgia, serif; } #footer { text-align: right; clear: both; } #footer a { font-weight: normal; text-decoration: none; margin-right: 10px; border: solid 1px #859BAA; padding: 6px; } #footer a:hover { color: #7E868D; background-color: #fff; border-right: solid 1px #6F818D; border-bottom: solid 1px #6F818D; } #lselect { position: absolute; top: 15px; left: 0px; padding-left: 350px; margin: 0px auto; width: 730px; voice-family: "\"}\""; voice-family:inherit; width: 380px; } #linkList h3 { display: inline; margin-right: 5px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { font-size: 10px; margin-right: 5px; list-style-type: none; display: inline; } #linkList li a { font-weight: normal; } #lselect h3 { font: bold 11px georgia; letter-spacing: -1px; } #lselect li { font: 11px/12px georgia; letter-spacing: -1px; color: #758C9B; } #lselect li a:link, #lselect li a:visited { font-weight: normal; color: #fff; text-decoration: none; } #lselect li a:hover { color: #D1E9FC; text-decoration: underline; } #lresources, #larchives, #lfavorites { padding: 0px 40px 0px 266px; clear: both; /*position: relative; top: -20px;*/ }/* css Zen Garden submission 004 - 'arch4.20' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: May 7th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* The photo was taken inside the Vancouver Public Library. It has been mentioned the colours have a vaguely MetaFilter-like feel. I suppose they do... Unintentional. */ /* basic elements */ body { font: 11px tahoma, verdana, sans-serif; color: #fff; background: #005D87 url(bg1.gif) top left repeat-x; margin: 0px; } p { font: 11px/14px verdana, sans-serif; text-align: justify; margin-top: 0px; } h3 { font: bold 13px verdana, sans-serif; margin-bottom: 0px; } acronym { border-bottom: dotted 1px #fff; } a:link { font-weight: bold; text-decoration: none; color: #8AF44F; } a:visited { font-weight: bold; text-decoration: none; color: #55AB26; } a:active, a:hover { color: #8AF44F; text-decoration: underline; } /* specific divs */ #preamble { padding: 0px 180px 0px 25px; } #supportingText { padding: 0px 180px 0px 25px; } #pageHeader { width: 100%; height: 217px; background: #fff url(cr1.jpg) top left no-repeat; margin-top: 47px; } #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; width: 296px; height: 46px; position: absolute; top: 185px; right: 10px; } #pageHeader h1 span { display: none; } #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; width: 229px; height: 16px; position: absolute; top: 230px; right: 12px; } #pageHeader h2 span { display: none; } #quickSummary .p1 { font: 11px tahoma, verdana, sans-serif; line-height: 18px; color: #7799AC; background-color: #fff; padding: 2px; position: absolute; top: 65px; right: 10px; width: 150px; } #quickSummary .p2 { font: 10px tahoma, verdana, sans-serif; color: #7799AC; position: absolute; top: 32px; right: 5px; } #quickSummary .p2 a:link, #quickSummary .p2 a:visited { color: #7799AC; text-decoration: underline; } #quickSummary .p2 a:active, #quickSummary .p2 a:hover { color: #8AF44F; } #linkList{ font: 11px tahoma, verdana, sans-serif; line-height: 18px; color: #7799AC; position: absolute; top: 285px; right: 0px; width: 150px; } #linkList2 h3 span { display: none; } #linkList2 h3.select { background: transparent url(h3.gif) no-repeat top left; width: 157px; height: 14px; } #linkList2 h3.favorites{ background: transparent url(h5.gif) no-repeat top left; width: 157px; height: 14px; } #linkList2 h3.archives{ background: transparent url(h6.gif) no-repeat top left; width: 157px; height: 14px; } #linkList2 h3.resources{ background: transparent url(h4.gif) no-repeat top left; width: 157px; height: 14px; } #linkList li { font-size: 10px; line-height: 2.5ex; display: block; padding: 2px 10px 0px 0px; margin-bottom: 5px; } #linkList #lresources li { margin-bottom: 0px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; } #footer { text-align: right; border-top: solid 1px #1E5E82; padding-top: 10px; } #footer a:link, #footer a:visited { padding: 2px 6px 2px 6px; } #footer a:hover { background: transparent url(bg2.gif) top left repeat-x; text-decoration: none; }/* css Zen Garden submission 005 - 'Blood Lust' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: May 7th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* love it or hate it. This one is one of my favourites because I don't generally design this way. It reaches into the past for a vaguely Futurist style, complete with duotone for that screenprint feel, combined with modern GIF patterned-dithering to really mess with tradition. You may find it challenging, silly, visually stimulating, or a mess. I didn't do it for you, I did it for me. */ /* basic elements */ body { font: 12px/13px courier, monospace; color: #000; background-color: #fff; margin: 0px; } p { font: 12px/13px courier, monospace; text-align: justify; } h3 { font:bold 14px courier, monospace; letter-spacing: 1px; margin-bottom: 0px; color: #000; } a:link { font-weight: bold; text-decoration: underline; color: #FF4F3E; } a:visited { font-weight: bold; text-decoration: underline; color: #FF4F3E; } a:hover, a:active { text-decoration: underline; color: #000; } acronym { border-bottom: none; } /* specific divs */ #container { background: #fff url(bloodlust.gif) no-repeat top left; margin: 50px 0px 0px 0px; padding: 150px 0px 0px 200px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; margin-top: 10px; width: 461px; height: 116px; position: absolute; top: 20px; left: 305px; } #pageHeader h1 span { display: none; } #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; width: 253px; height: 34px; position: absolute; top: 150px; left: 216px; } #pageHeader h2 span { display: none; } #quickSummary .p1 { font: 400 18px/16px 'arial black', sans-serif; text-align: right; width: 340px; float: left; margin: 40px 20px 20px 0px; } #quickSummary .p2 { font: 9px verdana, sans-serif; text-align: left; line-height: 24px; width: 295px; position: absolute; top: 20px; left: 25px; } #preamble { width: 170px; float: right; margin-top: 50px; clear: left; position: relative; top: -270px; } #preamble h3 { font: bold 12pt/10pt 'trebuchet ms', sans-serif; text-align: right; } #preamble p { font: bold 10pt/11pt arial, sans-serif; text-align: right; } #supportingText { clear: left; } #explanation h3 { font: bold 18px courier, monospace; } #explanation .p1 { font: 18px courier, monospace; line-height: 5ex; } #explanation .p2 { font: 11px/16px courier, monospace; width: 220px; float: left; margin-right: 10px; } #explanation .p3 { font: 14px/14px courier, monospace; margin-top: 30px; } #participation h3 { background: transparent url(h3.gif) no-repeat top left; width: 174px; height: 66px; margin: 0px; float: left; } #participation h3 span { display: none; } #participation .p1:first-line { font: 16px 'arial black', sans-serif; } #participation .p2 { line-height: 16px; text-align: right; float: left; width: 200px; margin: 0px 5px 15px 0px; } #participation .p3 { font-family: arial, sans-serif; } #benefits h3 { background: transparent url(h4.gif) no-repeat top left; width: 107px; height: 26px; margin: 0px; float: left; } #benefits h3 span { display: none; } #requirements h3 { font: bold 18px 'arial black', sans-serif; clear: left; float: right; } #requirements .p1 { font: bold 11px/16px trebuchet ms, sans-serif; float: left; width: 300px; margin-right: 10px; } #requirements .p3 { font: 12px/11px arial, sans-serif; } #linkList { position: absolute; top: 0px; left: 20px; } #linkList2 { font: 12px courier, monospace; padding: 10px; margin-top: 115px; width: 130px; } #linkList li { line-height: 2.5ex; display: block; padding-top: 5px; margin-bottom: 5px; list-style-type: none; } #linkList ul { margin: 0px; padding: 0px; }/* css Zen Garden submission 006 - 'Wicked Grove' by D. Keith Robinson, http://www.7nights.com/asterisk/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, D. Keith Robinson */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { font: 10pt/14pt "Trebuchet MS", sans-serif; color: #000033; background: #69f; margin: 0px; } p { font: 10pt/16pt "Trebuchet MS", sans-serif; margin-top: 0px; text-align: justify; } h3 { font: bold normal 12pt "Trebuchet MS", sans-serif; letter-spacing: 3px; margin-bottom: 2px; color: #333333; text-align: left; } a:link { font-weight: bold; text-decoration: none; color: #FF6600; } a:visited { font-weight: bold; text-decoration: none; color: #CC0000; } a:hover, a:active { text-decoration: underline; color: #FF6600; } /* specific divs */ #container { background: #9cf url(trees.jpg) no-repeat left top; padding: 200px 0px 0px 0px; margin: 0px auto; width:800px; border-left: 2px dashed #fff; border-right: 2px dashed #fff; } #pageHeader { margin-bottom: 10px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent; margin-top: -180px; width: 500px; height: 87px; float: left; color:#fff; } #pageHeader h1 span { display:none; } #pageHeader h2 { background: transparent url(tag.gif) no-repeat top left; width: 300px; margin-top:-60px; margin-left:-190px; height: 100px; float: right; } #pageHeader h2 span { display:none; } #quickSummary { width: 130px; float: left; padding:5px; margin-right:15px; background:#0099FF; } #quickSummary p { font: bold 8pt/12pt verdana, sans-serif; text-align:right; color:#fff; } #quickSummary a:link { font-weight: bold; text-decoration: none; color: #003; } #quickSummary a:visited { font-weight: bold; text-decoration: none; color: #006; } #quickSummary a:hover, #quickSummary a:active { text-decoration: underline; color: #FF6600; } #preamble, #supporting text, #explanation, #participation, #benefits, #requirements { padding: 0px 170px 0px 30px; } #footer { text-align: center; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList { background: transparent url(menu.gif) top left no-repeat; position: absolute; top: 0px; padding: 15px; margin-top: 200px; margin-left: 650px; width: 130px; } #linkList2 { font: 10px verdana, sans-serif; padding-top:35px; } #linkList h3.select { background: transparent url(select.gif) top left no-repeat; width: 130px; height: 25px; margin-left:-8px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(favorites.gif) top left no-repeat; width: 130px; height: 25px; margin-left:-8px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.gif) top left no-repeat; width: 130px; height: 25px; margin-left:-8px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.gif) top left no-repeat; width: 130px; height: 25px; margin-left:-8px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; background: transparent; display: block; padding-top: 5px; margin-bottom: 5px; list-style-type: none; } #linkList li a:link { color: #FF3300; } #linkList li a:visited { color: #FF0000; } #extraDiv1 { background: transparent; position: absolute; top: 40px; right: 0px; width: 148px; height: 110px; } /* css Zen Garden submission 007 - 'deep thought' by Jason Estes, http://www.bewb.org/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jason Estes */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body#css-zen-garden { background-color:#424242; font-size:75%; font-family:arial, verdana, sans-serif; margin:0; padding:0; color:#fff; background-image:url(background.jpg); background-repeat:no-repeat; background-position:150px 50px; } a:link { color:#FF9638; background-color:transparent; } a:visited { color:#FF9638; background-color:transparent; } a:hover, a:active { color:#FF9638; background-color:transparent; } /* specific divs */ /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { margin:10px 15px; background-image:url(logo.gif); height:83px; background-color:transparent; width:480px; background-repeat:no-repeat; background-position:top right; color:#000; } #pageHeader h1 span { display:none } #pageHeader h2 { display:none; } #pageHeader h2 span { display:none; } #quickSummary { display:block; } #quickSummary .p1 { display:none; } #quickSummary .p2 { position:absolute; top:0px; left:300px; padding:0;margin:0; } #preamble { border-top:1px solid #fff; background-image:url(halfscreen-gray.gif); width:250px; margin-left:30px; position:absolute; top:18px; right:10px; } #preamble p{ margin:10px; } #preamble h3{ font-style:oblique; margin:10px; } #supportingText { margin:350px auto 0 auto; width:90%; } #supportingText div { /*background-image:url(halfscreen-gray.gif);*/ border-top:1px solid #fff; clear:both; } #supportingText h3 span{ display:none; } #supportingText p { padding:5px 10px; line-height:150%; } #explanation h3{ Float:left; background-image:url(about.gif); width:46px; height:234px; padding:0; margin:0 10px 0px 0px; border-right:1px solid white; } #explanation p{ margin:0px 0px 0px 43px; } #supportingText div#explanation { margin:20px 10px 0 200px; background:url(about_background.gif) no-repeat 100% 100%; min-height:234px; height:234px; clear:none; } #supportingText #explanation[id] { height:auto; } #participation h3{ Float:right; background-image:url(participation.gif); width:46px; height:234px; padding:0; margin:0 0px 0px 10px; border-left:1px solid white; } #supportingText #participation { margin:20px 200px 0 10px; min-height:234px; height:234px; background:url(participation_back.gif) no-repeat 0 100%; } #participation p{ margin:0px 43px 0px 0px; } #supportingText #participation[id] { height:auto; } #benefits h3{ Float:left; background-image:url(benefits.gif); width:46px; height:133px; padding:0; margin:0 10px 0px 0px; border-right:1px solid white; } #benefits p{ margin:0px 0px 0px 43px; } #supportingText #benefits { margin:20px 10px 0 200px; min-height:133px; height:133px; background:url(benefits_back.gif) no-repeat 100% 100%; } #supportingText #benefits[id] { height:auto; } #requirements h3{ Float:right; background-image:url(Requirements.gif); width:46px; height:234px; padding:0; margin:0 0px 0px 10px; border-left:1px solid white; } #requirements p{ margin:0px 43px 0px 0px; } #supportingText #requirements { margin:20px 200px 30px 10px; min-height:234px; height:234px ; background:url(requirements_back.gif) no-repeat 0 100%; } #supportingText #requirements[id] { height:auto; } #supportingText #footer { text-align:center; padding-top:3px; } #footer a:link, #footer a:visited { font-weight:bold; text-decoration:none; } #linkList { position:absolute; top:98px; left:30px; width:198px; } #linkList h3.select { height:53px; background-image:url(select.gif); margin:0px; padding:0px; } #linkList h3.select span { display:none } #linkList h3.favorites { height:53px; background-image:url(favorites.gif); margin:0px; padding:0px; } #linkList h3.favorites span { display:none } #linkList h3.archives { height:53px; background-image:url(archives.gif); margin:0px; padding:0px; } #linkList h3.archives span { display:none } #linkList h3.resources { height:53px; background-image:url(resources.gif); margin:0px; padding:0px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { display:block; background-image:url(halfscreen-gray.gif); padding:3px; margin:1px 0; list-style-type: none; } #linkList li a:link, #linkList li a:visited { color:#fff; background-color:transparent; } #extraDiv1 { clear:both; } acronym { color:#FF9638; background-color:transparent; border:0; cursor:help; }/* css Zen Garden submission 008 - 'RPM' by Bruno Cunha, http://www.kaosboy.net/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* Main image from http://www.karborn.com/FinalV6Old/Series/RPM/RPMImages.htm */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { background-image:url(bg.jpg); background-color:#fff; font-family:arial, sans serif; font-size:11px; line-height:15px; color:#fff; margin:0px; } #container { margin-left:0px; margin-top:0px; padding:0px; width:684px; z-index:1; } #intro { width:275px; position:absolute; left:88px; top:902px; z-index:2; } #supportingText { width:450px; position:absolute; left:411px; top:535px; z-index:2; } #explanation, #participation, #requirements, #benefits, #footer, #quickSummary, #preamble, #lselect, #lfavorites, #lresources, #larchives { padding:7px; margin:5px; border-left:1px solid #aaa; border-top:1px solid #aaa; border-right:1px solid #333; border-bottom:1px solid #333; background-image:url(transparent.gif); } #linkList2 { width:275px; position:absolute; left:88px; top:1244px; z-index:2; } #extraDiv1 { background-image:url(tunami2.jpg); position:absolute; left:0px; top:0px; width:684px; height:1515px; z-index:1; } #pageHeader { display:none; } h3 { font-family:arial, sans serif; color:#fff; font-size:11px; font-weight:bold; margin-top:3px; margin-bottom:0px; } p { margin:6px; } a { color:#e2e2e2; text-decoration:underline; } a:link { color:#e2e2e2; text-decoration:underline; } a:hover { color:#fff; font-weight:bold; text-decoration:underline; } a:visited { color:#e2e2e2; text-decoration:underline; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; display: inline; } /* css Zen Garden submission 009 - 'Dead or Alive' by Michael Pick, http://www.mikepick.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Michael Pick */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { color: #000; background: #fff url(body-bg.png); margin: 0px auto; } p { font: 12px/15px georgia, serif; text-align: justify; margin-top: 0; } a:link { font-weight: bold; text-decoration: none; color: #000; } a:visited { font-weight: bold; text-decoration: none; color: #333; } a:hover, a:active { text-decoration: underline; } /* specific divs */ #container { background: url(frill-bg.png) repeat-x; border-right: 1px solid #333; width: 800px; margin: 0px; } #intro { min-width: 470px; } #pageHeader { width: 280px; float: left; margin-top: 40px; } #pageHeader h1 { background: transparent url(pageheader-bg.png) no-repeat; margin-left: 40px; width: 240px; height: 220px; } #pageHeader h1 span { display:none } #pageHeader h2 span { display:none; } #quickSummary { clear:both; width: 280px; float: left; margin-bottom: 20px; } #quickSummary p { font-family: georgia, times, serif; font-size: 10px; text-transform: uppercase; text-align:center; padding-left: 60px; padding-right: 20px; } #preamble { margin-left: 280px; width: 460px; padding-top: 90px; } #preamble h3 { background: transparent url(preamble.png) no-repeat; width: 460px; height: 70px; } #preamble h3 span { display: none; } #preamble a:link { color: #600; } #preamble p { line-height: 150%; } #supportingText { margin-left: 0px; } #supportingText a:link { color: #600; } #explanation { margin-left: 280px; width: 460px; } #explanation h3 { background: transparent url(sowhat.png) no-repeat; width: 460px; height: 50px; margin-bottom: 20px; } #explanation h3 span { display: none; } #explanation p { line-height: 150%; } #participation { width: 460px; } #participation h3 { background: transparent url(participation.png) no-repeat; width: 460px; height: 50px; margin-bottom: 20px; } #participation h3 span { display: none; } #participation p { line-height: 150%; } #benefits { width: 460px; } #benefits h3 { background: transparent url(benefits.png) no-repeat; width: 460px; height: 50px; margin-bottom: 20px; } #benefits h3 span { display: none; } #benefits p { line-height: 140%; } #requirements { width: 460px; } #requirements h3 { background: transparent url(requirements.png) no-repeat; width: 460px; height: 50px; margin-bottom: 20px; } #requirements h3 span { display: none; } #requirements p { line-height: 140%; } #footer { margin-top: 40px; background: transparent url(footer.png) repeat-x; height: 58px; width: 800px; text-align: center; margin-left: -280px; } #linkList { position: absolute; top: 28em; left: 40px; width: 240px; } #linkList2 { font: 10px georgia, times, serif; text-transform: uppercase; } #linkList h3.select { background: transparent url(select.png) no-repeat top left; margin: 10px 0px 5px 0px; width: 240px; height: 50px; margin-bottom: 10px; } #lselect { padding-bottom: 20px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(favorites.png) no-repeat top left; width: 240px; height: 50px; margin-bottom: 10px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.png) no-repeat top left; width: 240px; height: 50px; margin-bottom: 10px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.png) no-repeat top left; width: 250px; height: 50px; margin-bottom: 10px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; display: block; text-align: center; padding-top: 5px; padding-left: 20px; padding-right: 20px; margin-bottom: 5px; list-style-type: none; } #linkList li a:link { color: #000; } #linkList li a:visited { color: #333; } #extraDiv1 { background: transparent url(certified.png) top left no-repeat; position: absolute; top: 160px; left: 0px; width: 100px; height: 110px; z-index: 0; } /* hidden from IE 5 mac */ @media all { #explanation { margin-left: 280px; } #participation { margin-left: 280px; } #benefits { margin-left: 280px; } #requirements { margin-left: 280px; } #footer { margin-left: 0px; } }/* css Zen Garden submission 010 - 'A Garden Apart' by Dan Cederholm, http://www.simplebits.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dan Cederholm */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font-family: trebuchet ms, verdana, sans-serif; font-size: 12px; line-height: 1.5em; color: #333; background: #cccc99; margin: 0; padding: 0; text-align: center; } p { margin-top: 0px; } h3 { font: bold 140% trebuchet ms; letter-spacing: -1px; margin-bottom: 0; color: #c96; } a:link { text-decoration: none; border-bottom: 1px dotted #369; color: #369; } a:visited { text-decoration: none; border-bottom: 1px dotted #369; color: #369; } a:hover, a:active { text-decoration: none; border-bottom: 1px solid #036; color: #036; } /* ---( specific divs )----------------------------- */ #container { position: relative; background: #FFFBDF url(fade.gif) no-repeat 0 92px; margin: 0 auto 10px auto; border-left: 1px solid #000; border-right: 1px solid #000; border-bottom: 1px solid #000; text-align: left; width: 800px; } #pageHeader { height: 92px; background: url(top.gif) no-repeat top left; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1, #pageHeader h2 span { margin: 0; padding: 0; display: none; } #pageHeader h2 { position: absolute; top: 110px; left: 20px; padding: 0; margin: 0; background: url(tagline.gif) no-repeat top left; width: 528px; height: 74px; } /* ---( quick summary)---------------------------- */ #quickSummary { position: absolute; top: 92px; right: 0; left: auto; z-index: 2; width: 298px; voice-family: "\"}\""; voice-family:inherit; width: 300px; } html>body #quickSummary { width: 300px; } #quickSummary p { margin: 15px 15px 15px 15px; font-style: italic; font-size: 140%; font-family: "trebuchet ms"; font-weight: bold; line-height: 1.5em; color: #444; } #quickSummary p.p2 { font-style: normal; font-weight: normal; font-size: 100%; margin-top: 0; } #preamble { margin: 104px 340px 0px 20px; } #supportingText { padding-left: 20px; margin: 0 350px 40px 0; } #footer { border-top: 1px dotted #CDC4AC; padding-top: 6px; text-align: center; } #footer a:link, #footer a:visited { margin-right: 6px; } /* ---( right side nav)----------------------------- */ #linkList { position: absolute; top: 92px; right: 0; left: auto; width: 300px; padding: 0; border-left: 1px solid #CDC4AC; border-bottom: 1px solid #CDC4AC; background: #E5E0D4 url(zen.gif) no-repeat; z-index: 1; } #linkList2 { margin: 190px 15px 15px 15px; } #linkList h3 { color: #635F57; font-family: trebuchet ms; font-size: 120%; margin: 0 0 6px 0; padding: 0; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { display: block; margin-bottom: 2px; padding-left: 14px; background: url(arrow.gif) no-repeat 0 5px; list-style-type: none; } #linkList li a:link { color: #c96; border-bottom: none; } #linkList li a:visited { color: #c96; border-bottom: none; } #linkList li a:hover { color: #963; } #lselect { padding: 12px 0 12px 0; border-top: 1px dashed #CDC4AC; border-bottom: 1px dashed #CDC4AC; } #lresources { margin-top: 12px; }/* css Zen Garden submission 011 - 'meliorism' by Brett J. Gilbert - www.paragraphic.co.uk */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* 'tree' graphic adapted from 'Bending Tree' by Robert Priseman, used with permission */ /* All other graphics copyright 2003, Brett J. Gilbert */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /*----------------------------------------* ** Global **----------------------------------------*/ body { margin: 0; padding: 0; text-align: center; color: #000; background: #f1f8f3 url(gradSky.jpg) repeat-x; } div,p,h1,h2,h3,ul,li { margin: 0; padding: 0; } h1 span,h2 span,h3 span { display: none; } /*----------------------------------------* ** Layout **----------------------------------------*/ #container { position: relative; width: 760px; margin: 0 auto; text-align: left; } #intro { position: absolute; top: 28px; left: 0; width: 310px; } #supportingText { width: 690px; } #linkList { position: absolute; top: 40px; left: 585px; width: 235px; } /*----------------------------------------* ** Links **----------------------------------------*/ a:link, a:visited { color: #49f; background-color: transparent; text-decoration: none; } a:hover { color: #f00; background-color: transparent; text-decoration: none; } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited { color: #348633; background-color: transparent; } #quickSummary p.p2 a:hover { color: #f00; background-color: transparent; } #footer a:link, #footer a:visited { color: #348633; background-color: transparent; } #footer a:hover { color: #f00; background-color: transparent; } #linkList a.c:link, #linkList a.c:visited { color: #fa5; background-color: transparent; } #linkList a.c:hover { color: #f00; background-color: transparent; } /*----------------------------------------* ** #intro **----------------------------------------*/ #intro { font: italic 11px/150% Georgia, Times, "Times New Roman", serif; color: #888; background-color: transparent; } #pageHeader h1 { margin-left: 4px; background: transparent url(introGarden.gif) no-repeat 0 0; width: 115px; height: 12px; } #pageHeader h2 { margin-top: 80px; background: transparent url(introBeauty.gif) no-repeat 0 0; width: 195px; height: 73px; } #quickSummary p.p1 { margin: 5px 0 55px 4px; color: #fa0; background-color: transparent; line-height: 160%; } #quickSummary p.p2 { margin: 0 150px 0 4px; padding: 5px 25px 5px 10px; background: transparent url(gradGreen.jpg) repeat-y; border-left: 1px solid #a7d9a8; color: #888; line-height: 130%; } #preamble { margin-left: 4px; padding: 20px 0 0 15px; border-left: 1px solid #a7d9a8; } #preamble h3 { background: transparent url(introEnlightenment.gif) no-repeat 0 0; width: 138px; height: 37px; } #preamble p { margin: 10px 140px 0 0; } /*----------------------------------------* ** #supportingText **----------------------------------------*/ #supportingText { padding: 430px 0 40px 0; font: 13px/140% Georgia, Times, "Times New Roman", serif; color: #888; background: transparent url(textBack.jpg) no-repeat 0 40px; } #supportingText p { margin: 0 125px 10px 221px; } #supportingText h3 { margin: 25px 0 6px 220px; width: 206px; height: 21px; } #explanation h3 { background: transparent url(textAbout.gif) no-repeat 0 0; margin-top: 0; } #participation h3 { background: transparent url(textParticipation.gif) no-repeat 0 0; } #benefits h3 { background: transparent url(textBenefits.gif) no-repeat 0 0; } /*----------------------------------------* ** #supportingText > #requirements **----------------------------------------*/ #requirements { margin: 30px 0 0 221px; padding: 0 0 15px 0; border-left: 1px solid #a7d9a8; font: italic 11px/150% Georgia, Times, "Times New Roman", serif; color: #888; background-color: transparent; } #requirements h3 { margin: 0 0 13px 0; background: transparent url(textRequirements.jpg) no-repeat 0 0; width: 175px; height: 25px; } #requirements p { margin: 9px 0 0 15px; } /*----------------------------------------* ** #supportingText > #footer **----------------------------------------*/ #footer { margin: 0 0 0 221px; padding: 4px 0 5px 15px; background: transparent url(gradGreen.jpg) repeat-y; border-left: 1px solid #a7d9a8; font: italic 11px/140% Georgia, Times, "Times New Roman", serif; } /*----------------------------------------* ** #linkList **----------------------------------------*/ #linkList { border-left: 1px solid #8bf; font: italic 11px/130% Georgia, Times, "Times New Roman", serif; color: #999; background: transparent url(linksBack.jpg) no-repeat; } #lselect h3 { background: transparent url(linksSelect.gif) no-repeat 0 0; margin: 240px 0 10px 14px; width: 118px; height: 73px; } div#lselect { margin-bottom: 50px; } #linkList ul { margin-left: 15px; } #linkList li { list-style-type: none; margin-top: 5px; } #lresources h3, #lfavorites h3, #larchives h3 { margin: 25px 0 8px 0; width: 175px; height: 25px; } #lresources h3 { background: transparent url(linksResources.jpg) no-repeat 0 0; } #lfavorites h3 { background: transparent url(linksFavorites.jpg) no-repeat 0 0; } #larchives h3 { background: transparent url(linksArchives.jpg) no-repeat 0 0; } /* css Zen Garden submission 012 - 'TechnOhm' by Joshua Ambrutis - http://www.visualcss.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Joshua Ambrutis */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* I've tried to keep the CSS in the sequence which I built it in... just to give another perspective of how others tackle this, you'll see in some spots I'll define an elements main box just to get it in the right place etc.. then refine it with specifics later in the stylesheet. I'm not saying this is right, just the way I usually go about it. There are also comments thrown in here and there to hopefully explain some of the strangeness */ body { margin: 0px; padding: 0px; background: url(to_pageback.gif) repeat fixed; color: #CCCCCC; font: 76% Arial, Helvetica, sans-serif; text-align: center; } div, p, ul, li, h1, h2, h3, h4, h5, h6 { margin: 0px; padding: 0px; } /* Why do I do that? ...hmm.. since switching from Tables to CSS, I've learned it is easier for MY feeble brain to lay out the design first with just colored boxes THEN paint it in photoshop, this just helps me to get the layout of the elements first. Then I refine theses values with more specifics through IDs and Classes when the graphics call for it, in my case the barebones basic layout comes first with designs in my head BEFORE I open PhotoShop... but that's just me */ h1, h2, h3, h4, h5, h6 { color: #FFAE00; } #container { margin: 0px auto 60px; width: 760px; border-top: 0px solid #000000; border-right: 2px solid #000000; border-bottom: 2px solid #000000; border-left: 2px solid #000000; padding: 0px 0px 150px; background: #404040 url(bandwidthkiller.jpg) no-repeat center bottom; text-align: left; position: relative; } #pageHeader h1 { margin-bottom: 12px; background: url(to_header_01.jpg) no-repeat; height: 186px; } #pageHeader h1 span { display: none; } /* Above: That's just for dumping the text allowing the backround image in it's containing element to show through*/ #pageHeader h2 { width: 261px; background: url(to_beauty.gif) no-repeat; position: absolute; height: 17px; top: 2px; right: 5px; cursor: text; /* just goofing off */ } #pageHeader h2 span { display: none; } #pageHeader { position: relative; } #quickSummary { margin: 0px; border: 0px none; padding: 0px; width: 220px; background: url(to_sumarytop_02.jpg) no-repeat; position: absolute; z-index: 1; left: 0px; height: 266px; } #preamble { margin: 10px 0px 30px 235px; width: 510px; border: 2px solid #000000; padding: 10px 0px; background: #60676F url(zen-image.jpg) repeat center top; text-align: center; position: relative; top: 0px; left: 0px; z-index: 3; } #preamble p { padding: 0px 0px 1.3em; margin: 0px auto; width: 320px; color: #F2F2F2; font: bold 1.2em/1em "Trebuchet MS", Arial, Helvetica, sans-serif; letter-spacing: 0.08em; text-align: left; } #preamble p.p3 { padding-bottom: 0px; } div#preamble h3 { width: 400px; margin: 0px; padding: 0px 0px 0px 34px; background: url(to_h3back_04.gif) no-repeat left top; font-size: 16px; line-height: 24px; text-align: left; position: absolute; top: -24px; z-index: 1; left: -3px; height: 23px; } #supportingText { margin: 0px 0px 0px 235px; width: 510px; padding: 0px; position: relative; } #linkList { margin: 7em 10px 0px 12px; padding: 0px; width: 200px; background: url(ani2.gif) no-repeat; /* this is just here as a preloader for the nav mouseover to kill the delay when it's first hit.. it can't be seen in this position because of an overlaying background image*/ position: absolute; left: 0px; top: 360px; z-index: 2; } #supportingText p { padding: 5px 12px 1em; } #supportingText div { border: 1px solid #000000; padding: 0px; margin: 22px 0px 40px; width: 510px; background: #61605F; position: relative; z-index: 2; } #supportingText h3 { width: 400px; margin: 0px; padding: 0px 0px 0px 34px; background: url(to_h3back_04.gif) no-repeat left top; font-size: 16px; line-height: 24px; position: absolute; top: -24px; z-index: 1; height: 23px; left: -2px; } #intro a { color: #FFCC00; font-weight: bold; text-decoration: none; } #supportingText a { color: #FFAE00; font-weight: bold; text-decoration: none; } #supportingText a:hover { border-bottom: 2px dashed #FFAE00; color: #CCCCCC; } #supportingText a:active { border-bottom: 2px dashed #333333; background: #5A6269; } div#supportingText div#requirements { margin-bottom: 0px; background: #61605F url(bandwidthkiller-alpha.jpg) no-repeat center bottom; } /* the background image above is what gives the transparency effect, it's just a carefully cut out chunk of the #container divs background image with a semi-transparent overlay on it. Oh... I can't wait for true PNG surrport*/ div#supportingText div#footer { width: 200px; border-top: 0px none #000000; border-right: 0px none #000000; border-bottom: 1px solid #000000; border-left: 0px none #000000; padding-top: 36px; padding-bottom: 12px; margin: 0px; background: transparent url(to_footerback_07.gif) no-repeat left top; text-align: center; position: relative; left: -220px; top: -64px; } #quickSummary p { margin: 0px 20px 10px 25px; color: #A3A3A3; font: bolder small-caps 1.1em/1em "Trebuchet MS", Arial, Helvetica, sans-serif; } #quickSummary p.p1 { margin-top: 20px; border: 1px solid #23282C; padding: 10px; color: #FFAE00; } #quickSummary p.p2 { color: #999999; font-weight: normal; text-align: center; } #quickSummary p a { color: #CCCCCC; font-weight: normal; text-decoration: none; } #lselect, #lfavorites, #larchives, #lresources { border: 1px solid #000000; padding: 0px; margin: 0px 0px 60px; background: #60676F; font-size: .9em; position: relative; } #linkList h3 { width: 200px; border-top: 0px #000000; border-right: 1px solid #000000; border-bottom: 0px #000000; border-left: 0px #000000; margin: 0px; padding: 0px; background: url(to_h3back_04.gif) no-repeat left top; font-size: 16px; line-height: 24px; position: absolute; top: -24px; z-index: 1; left: -2px; height: 23px; } #linkList h3 span { margin: 0px; padding: 0px 0px 0px 34px; } /*#linkList span { margin: 0px; padding: 0px; display: block; }*/ div#lselect a.c { margin: 0px 0px -15px; /* seemed to have to do that because of the extra   in each li item */ padding: 0px 15px 0px 0px; display: inline; background-image: none; color: #FFCC00; font-weight: normal; font-variant: normal; font-size: 1em; text-decoration: none; text-transform: capitalize; text-align: center; } /* The following 4 divs all use the same background file... it's larger than it needs to be to allow the text to resize PLUS you can use the background-position to offset it in different divs for the illusion of more than one file without the bandwith loss*/ div#lselect { background: url(to_leftcol_02.jpg) repeat-y -50px -60px; color: #999999; } div#lresources { background: url(to_leftcol_02.jpg) no-repeat -5px -20px; text-align: left; } div#larchives { background: url(to_leftcol_02.jpg) no-repeat -40px -220px; } div#lfavorites { background: url(to_leftcol_02.jpg) no-repeat -60px -20px; } /* Bahaaa! Somebody switched the menus to an unordered list structure, good bye spans! I have to jump back a few steps here and do the lists, I'll try to reorder the css later to make incremental sense */ #linkList ul { list-style: none; text-align: center; } #linkList li { margin: 0px; padding: 6px 0px; } #linkList a { padding-left: 32px; margin-left: 6px; display: block; background: url(ani1.gif) no-repeat left center; color: #BBBBBB; font-weight: bold; font-size: 1.1em; text-transform: uppercase; text-decoration: none; text-align: left; } #linkList a:hover { background: url(ani2.gif) no-repeat left center; color: #EBEBEB; } div#lselect a.c:hover { background: none; color: #CCCCCC; font-style: italic; text-decoration: none; } div#linkList div#lresources a { margin: 0px 0px -10px; padding: 0px; display: inline; background: url(none); text-transform: capitalize; } div#linkList div#lresources ul { margin: 0px; padding-left: 15px; text-align: left; } /* Stupid IE5, almost made it without a hack, but don't have time figure out how to get rid of extra pixels from the border or even if I can without resorting to a hack. By the way, this is called the SBMH short for Simple Box Model Hack, just Google it for more info if you need*/ #linkList h3 { \left: -1px; lef\t: -2px; \width: 201px; w\idth: 200px; } /* css Zen Garden submission 013 - 'Coastal Breeze' by Dave Shea, http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea*/ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* These illustrations were done by hand in Photoshop. No photos harmed in the making of this design. They were put together about two years ago for a former portfolio site, and luckily I still had the .PSD on hand. It felt like a good idea to convert this into a Zen Garden design. It has been said that this particular combination of objects has a west-coast British Columbia feel to it. I'm inclined to agree. */ /* basic elements */ body { font: 8pt/16pt georgia, serif; text-align: center; color: #464128; background: #fff url(coastal2.jpg) bottom center no-repeat; margin: 0px; } p { font: 8pt/16pt georgia, serif; color: #464128; background-color: transparent; margin-top: 0px; text-align: right; } h3 { font: bold 8pt/16pt georgia, serif; text-align: right; margin-bottom: 0px; background: transparent url(futz.gif) center right no-repeat; padding-right: 14px; } a { color: #464128; background-color: transparent; } a:visited { color: #000; background-color: transparent; } a:hover { color: #A29D66; background-color: transparent; } acronym { border-bottom: none; } /* specific elements */ #intro { background: transparent url(coastal.jpg) top left no-repeat; width: 700px; margin-left: auto; margin-right: auto; } #pageHeader { text-align: right; padding: 70px 60px 0px 0px; } #pageHeader h1 { background: transparent url(papier.jpg) top left no-repeat; width: 192px; height: 70px; margin: 0px 0px 0px 448px;; } #pageHeader h1 span { display: none; } #pageHeader h2 { background: transparent url(beauty.gif) top left no-repeat; width: 83px; height: 14px; margin: 0px 90px 0px 477px; position: relative; top: -17px; } #pageHeader h2 span { display: none; } #preamble { position: relative; top: -80px; padding-right: 250px; padding-left: 140px; } #quickSummary { float: right; text-align: left; padding-right: 70px; width: 230px; voice-family: "\"}\""; voice-family: inherit; width: 160px; } /* over-clarified to fix IE5/Win */ #quickSummary p, #quickSummary .p1, #quickSummary .p2 { font: italic 13pt/18pt garamond, serif; text-align: left; color: #A29D66; background-color: transparent; } #supportingText { margin-left: auto; margin-right: auto; padding-right: 250px; padding-left: 140px; position: relative; top: -70px; width: 700px; voice-family: "\"}\""; voice-family: inherit; width: 310px; } #linkList { font: italic 9pt/14pt garamond, georgia, serif; text-transform: lowercase; text-align: left; color: #A29D66; background-color: transparent; position: absolute; top: 33em; /*380px;*/ left: 0px; width: 100%; } #linkList2 { padding-left: 470px; padding-right: 70px; margin-left: auto; margin-right: auto; width: 700px; voice-family: "\"}\""; voice-family: inherit; width: 160px; } #linkList h3 { font: italic 12pt/15pt garamond, georgia, serif; text-transform: capitalize; color: #464128; background-color: transparent; text-align: left; background-image: none; } #linkList a { font: italic 11pt/14pt garamond, georgia, serif; color: #A29D66; background-color: transparent; text-decoration: none; } #linkList a:hover { color: #464128; background-color: transparent; text-decoration: underline; } #linkList a.c { font: italic 9pt/14pt garamond, georgia, serif; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { text-align: left; list-style-type: none; } #linkList h3 { margin-right: auto; margin-left: 0px; margin-top: 25px; } #linkList h3 span { display: none; } #linkList h3.select { width: 113px; height: 19px; background: transparent url(h-select.gif) top left no-repeat; } #linkList h3.archives { width: 134px; height: 17px; background: transparent url(h-archives.gif) top left no-repeat; } #linkList h3.favorites { width: 76px; height: 23px; background: transparent url(h-favorites.gif) top left no-repeat; position: relative; left: -10px; } #linkList h3.resources { width: 125px; height: 13px; background: transparent url(h-resources.gif) top left no-repeat; position: relative; left: -10px; } #footer a { font: italic 11pt/14pt garamond, georgia, serif; color: #A29D66; background-color: transparent; text-decoration: none; padding-left: 15px; } #footer a:hover { color: #464128; background: transparent url(fleurdelis.gif) center left no-repeat; text-decoration: none; border-bottom: dotted 1px #464128; } .accesskey { font-weight: bold; text-decoration: underline; } /* extra bits on the last paragraph in each text block */ #preamble .p3, #explanation .p2, #participation .p3, #benefits .p1, #requirements .p4 { background: transparent url(filler.gif) bottom center no-repeat; padding-bottom: 25px; } #extraDiv1 { text-align: center; position: absolute; top: 0px; left: 0px; width: 100%; } #extraDiv1 span { display: block; width: 600px; height: 82px; margin-left: auto; margin-right: auto; background: transparent url(fleur.gif) top right no-repeat; }/* css Zen Garden submission 014 - 'Samuraai' by Minz Meyer, http://www.minzweb.de/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Minz Meyer */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { background-image: url(background_body.jpg); background-color: #000; color: #D8E0BC; margin-top: 10px; margin-left: 50px; margin-right: 50px; margin-bottom: 10px; padding: 0; font: 12px/1.5 Verdana, sans-serif; } /* Basic styles */ h3 { background-color: #B1AD72; color: inherit; margin-top: 0; border-right: 4px solid #818343; border-bottom: 1px solid #818343; height: 25px; } h3 span { display: none; } div#preamble p.p3 { padding-bottom: 15px; } /* Main div styling */ div#container { background-color: #2F2F13; color: inherit; background-image: url(container_background.jpg); background-position: right; background-repeat: repeat-y; border-left: 1px solid #8F8C4E; border-bottom: 1px solid #8F8C4E; } div#intro { position: relative; overflow: hidden; } div#pageHeader { background-color: #000; color: inherit; background-image: url(umbrella.jpg); background-repeat: no-repeat; border-top: 1px solid #8F8C4E; border-bottom: 1px solid #8F8C4E; border-right: 1px solid #8F8C4E; height: 50px; margin-bottom: 15px; overflow: hidden; } div#pageHeader h1 { margin-top: 0px; margin-bottom: 0px; width: 500px; height: 46px; float: left; } div#pageHeader h1 span { visibility: hidden; } div#pageHeader h2 { background-image: url(beauty_background.gif); background-repeat: no-repeat; margin-top: 5px; margin-left: 0px; width: 348px; height: 39px; float: right; } div#pageHeader h2 span { display: none; } div#quickSummary { position: relative; float:left; width: 150px; margin-top: -10px; padding: 8px; background-color: transparent; color: inherit; } div#quickSummary p { margin-top: 0px; font: italic 14px Verdana, sans-serif; text-align: center; } div#quickSummary p.p2 { font: italic 11px Verdana, sans-serif; } div#preamble { border-bottom: 1px solid #8F8C4E; margin-top: -16px; margin-right: 222px; background-image: url(background-preamble.jpg); background-repeat: no-repeat; background-color: #000; color: inherit; } div#preamble h3 { background-image: url(preamble_h3_background.jpg); background-repeat: no-repeat; margin-top: 0px; margin-left: 170px; } div#preamble p { padding-right: 30px; margin-left: 200px; color: inherit; background-color: transparent; font: 14px/1.6 Verdana, sans-serif; text-align: justify; width: auto; } div#supportingText { margin-top: 0px; } div#explanation, div#participation, div#benefits, div#requirements { margin-right: 222px; margin-bottom: 30px; } div#supportingText p { padding-left: 30px; padding-right: 30px; } div#explanation h3 { background-image: url(explanation_h3_background.jpg); background-repeat: no-repeat; } div#participation h3 { background-image: url(participation_h3_background.jpg); background-repeat: no-repeat; } div#benefits h3 { background-image: url(benefits_h3_background.jpg); background-repeat: no-repeat; } div#requirements h3 { background-image: url(requirements_h3_background.jpg); background-repeat: no-repeat; } div#linkList { position: absolute; top: 62px; right: 50px; width: 220px; background-color: transparent; color: inherit; font: 10px/1.5 Verdana, sans-serif; } div#linkList h3.select { background-color: #2F2F13; background-image: url(select_h3_background.jpg); background-repeat: no-repeat; color: inherit; margin-top: 0; border-right: 4px solid #818343; border-bottom: 1px solid #818343; height: 25px; } div#linkList h3.resources { background-image: url(resource_h3_background.jpg); background-repeat: no-repeat; } div#linkList h3.archives { background-image: url(archives_h3_background.jpg); background-repeat: no-repeat; } div#linkList h3.favorites { background-image: url(favorites_h3_background.jpg); background-repeat: no-repeat; } div#linkList h3 { background-color: #2F2F13; color: inherit; margin-top: 20px; border-right: 4px solid #818343; border-bottom: 1px solid #818343; height: 25px; } span.iL { display: block; padding-left: 20px; padding-right: 20px; margin-bottom: 10px; line-height: 2; } div#linkList ul { list-style: none; } div#linkList li { margin-left: -15px; margin-bottom: 10px; line-height: 1.5; } a:link { color: #9BB574; background-color: transparent; text-decoration: none; font-weight: bold; padding: 2px; border-bottom: 1px solid; line-height: 1.5; } a:visited { color: #C6D2B3; background-color: transparent; text-decoration: line-through; font-weight: bold; padding: 2px; border-bottom: 1px solid; line-height: 1.5; } a:hover, a:focus { color: #D8E2C7; background-color: #828330; text-decoration: none; font-weight: bold; padding: 2px; border-bottom: 1px solid; line-height: 1.5; } div#footer { clear: both; background-color: #000; color: inherit; background-image: url(umbrella2.jpg); background-repeat: no-repeat; background-position: right; border-top: 1px solid #8F8C4E; border-right: 1px solid #8F8C4E; height: 50px; padding-left: 30px; vertical-align: bottom; overflow: hidden; } div#supportingText div#footer a { line-height: 40px; } acronym { border-bottom: none; cursor: help; }/* css Zen Garden submission 015 - 'boddhidarma' by Michael Angeles - http://studioid.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Michael Angeles */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* body and type */ html { background: rgb(93, 105, 40) url(bg_boddhidarma2.gif) no-repeat top left; } /* basic elements */ body { font: 9pt/16pt verdana, helvetica, sans-serif; color: #ffc; margin: 0 0 30px 0; } p { font: 9pt/16pt verdana, helvetica, sans-serif; padding-bottom: 5px; } h3 { font-size: 16pt; letter-spacing: 1px; margin: 0; padding: 0; color: #cc9; } a:link { font-weight: bold; text-decoration: none; color: #fe9201; } a:visited { font-weight: bold; text-decoration: none; color: #fe9201; border: none; } a:hover, a:active { color: #fe9201; } /* layout */ #container { text-align: left; background: url(sig.gif) no-repeat bottom right; } #intro { min-width: 400px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { margin: 10px 0 0 410px; padding: 0 0 0 0; width: 257px; height: 18px; background: transparent url(hd_zengarden.gif) no-repeat 0 0; } #pageHeader h1 span { display:none } #pageHeader h2 { padding: 0; margin: 210px 0 0 410px; width: 289px; height: 70px; background: transparent url(hd_beauty.gif) no-repeat 0 0; } #pageHeader h2 span { display:none; } #quickSummary p.p1 { position: absolute; top: 30px; left: 410px; margin: 0; padding: 0 50px 0 0; font: 14pt/18pt verdana, helvetica, sans-serif; text-transform: lowercase; color: #869152; } #quickSummary p.p2 { position: absolute; top: 850px; left: 0; width: 320px; margin: 0; padding: 15px 20px 15px 20px; text-align: left; font-size: 1.1em; font-weight: bold; background: #677235; } #preamble { margin: 10px 50px 40px 410px; padding: 20px 0 40px 0; border-top: 1px dotted #869152; background: url(koi.gif) no-repeat bottom center; } #preamble h3 { background: url(hd_enlighten.gif) no-repeat 0 0; width: 301px; height: 23px; } #preamble h3 span { display:none; } #supportingText { margin: 0 50px 0 410px; } #explanation { padding-bottom: 40px; background: url(koi.gif) no-repeat bottom center; } #explanation h3 { background: url(hd_about.gif) no-repeat 0 0; width: 302px; height: 19px; } #explanation h3 span { display:none; } #participation { margin-top: 20px; padding-bottom: 40px; background: url(koi.gif) no-repeat bottom center; } #participation h3 { background: transparent url(hd_participation.gif) no-repeat 0 0; width: 140px; height: 23px; } #participation h3 span { display:none; } #benefits { margin-top: 20px; padding-bottom: 40px; background: url(koi.gif) no-repeat bottom center; } #benefits h3 { background: transparent url(hd_benefits.gif) no-repeat 0 0; width: 106px; height: 24px; } #benefits h3 span { display:none; } #requirements { margin-top: 20px; padding-bottom: 40px; } #requirements h3 { background: transparent url(hd_requirements.gif) no-repeat 0 0; width: 155px; height: 23px; } #requirements h3 span { display:none; } #footer { margin-top: 20px; } #footer a:link, #footer a:visited { margin-right: 20px; } /* navigation / links */ #linkList { position: absolute; top: 940px; left: 0; width: 360px; text-align: left; padding: 0; margin: 0; font-size: .9em; } /* linklist WITHOUT favorites */ /* NOTE: keep this linklist CSS if favorites remains hidden */ #lselect { clear: none; float: left; width: 180px; padding: 0 19px 0 20px; margin: 0 0 30px 0; border-right: 1px solid #677235; voice-family: "\"}\""; voice-family: inherit; width: 140px; } html>body #lselect { width: 140px; } #larchives { float: right; width: 180px; padding: 0 0 0 20px; margin: 0 0 30px 0; voice-family: "\"}\""; voice-family: inherit; width: 160px; } html>body #larchives { width: 160px; } #lresources { float: left; width: 170px; padding: 0 0 0 20px; margin: 0 0 30px 0; voice-family: "\"}\""; voice-family: inherit; width: 160px; } html>body #lresources { width: 160px; } /* /end linklist WITHOUT favorites */ /* linklist WITH #lfavorites */ /* NOTE: in case you decide to uncomment #lfavorites div, comment the above link list CSS and uncomment the below #lselect { float: left; width: 150px; padding: 0 19px 0 20px; margin: 0 0 30px 0; border-right: 1px solid #677235; } #lfavorites { float: left; width: 150px; padding: 0 0 0 20px; margin: 0 0 30px 0; } #larchives { float: left; width: 150px; padding: 0 19px 0 20px; margin: 0 0 30px 0; border-right: 1px solid #677235; } #lresources { float: left; width: 150px; padding: 0 0 0 20px; margin: 0 0 30px 0; } end linklist WITH #lfavorites */ #linkList h3.select { background: url(hd_select.gif); margin: 0; width: 96px; height: 12px; border: 0; } #linkList h3.select span { display:none } #linkList h3.favorites { background: url(hd_favorites.gif); margin: 0; width: 58px; height: 10px; border: 0; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: url(hd_archives.gif); margin: 0; width: 53px; height: 10px; border: 0; } #linkList h3.archives span { display:none } #linkList h3.resources { background: url(hd_resources.gif); margin: 0; width: 66px; border: 0; height: 10px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; display: block; padding-top: 2px; margin-bottom: 2px; } #linkList li a:link { text-decoration: none; border: none; } #linkList li a:visited { text-decoration: none; border: none; } #linkList li a.c { text-decoration: none; border: none; } /* extra divs */ #extraDiv1 { margin: 10px 0 0 410px; background: url(sig.gif) no-repeat bottom right; } /* css Zen Garden submission 016 - 'The Garden Beneath' by Minz Meyer - www.minzweb.de */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Minz Meyer */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { background-image: url(deepblue.jpg); background-position: top right; background-color: #172E52; background-repeat: no-repeat; margin-top: 20px; padding: 0px; color: #88A3C9; font: 0.8em/1.6 Tahoma, sans-serif; letter-spacing: 0.1em; } #container { background-color: transparent; background-position: bottom left; background-image: url(manta.jpg); background-repeat: no-repeat; width: 99%; height: 100%; margin: 0; padding: 0; } #pageHeader h1 { background-image: url(zengarden.gif); background-repeat: no-repeat; width: 306px; height: 36px; margin: 0; } #pageHeader h1 span { display: none; } #pageHeader h2 { background-image: url(thebeauty.gif); background-repeat: no-repeat; width: 306px; height: 24px; margin: 0px; } #pageHeader h2 span { display: none; } #pageHeader { position: absolute; right: 28px; top: 195px; width: 306px; } #extraDiv3 { position: absolute; right: 30px; top: 280px; background-image: url(preamble.gif); background-repeat: no-repeat; height: 156px; width: 300px; padding-bottom: 20px; overflow: hidden; } #preamble { margin-right: 420px; margin-left: 25px; padding: 5px; border-top: 1px solid; border-right: 1px solid; } #preamble h3 { width: 190px; height: 190px; margin-top: 0; display: inline; float: left; background-image: url(theroad.jpg); } #preamble h3 span { display: none; } #preamble p { margin-left: 25px; margin-right: 15px; font-style: italic; text-align: justify; } #explanation { margin-left: 10px; margin-top: 30px; margin-bottom: 100px; margin-right: 370px; padding: 5px; border-top: 1px solid; border-left: 1px solid; } #explanation h3 { width: 150px; height: 140px; display: inline; float: left; background-image: url(whatabout.jpg); } #explanation h3 span { display: none; } #explanation p { margin-left: 25px; margin-right: 15px; text-align: justify; } #benefits { margin-left: 150px; margin-top: 30px; margin-bottom: 100px; margin-right: 340px; padding: 5px; border-top: 1px solid; border-left: 1px solid; } #benefits h3 { width: 150px; height: 150px; display: inline; float: right; background-image: url(benefits.jpg); } #benefits h3 span { display: none; } #benefits p { margin-left: 15px; margin-right: 25px; text-align: justify; } #participation { margin-top: 30px; margin-bottom: 110px; margin-left: 50px; margin-right: 335px; padding: 5px; border-top: 1px solid; border-right: 1px solid; } #participation h3 { width: 160px; height: 155px; margin-top: 15px; display: inline; float: left; background-image: url(participate.jpg); background-repeat: no-repeat; } #participation h3 span { display: none; } #participation p { margin-left: 25px; margin-right: 15px; text-align: justify; } #requirements { margin-top: 30px; margin-bottom: 100px; margin-left: 130px; margin-right: 150px; padding: 5px; border-top: 1px solid; border-right: 1px solid; } #requirements h3 { margin-top: 15px; width: 160px; height: 160px; display: inline; float: left; background-image: url(requirements.jpg); background-repeat: no-repeat; } #requirements h3 span { display: none; } #requirements p { margin-left: 25px; margin-right: 15px; text-align: justify; } #supportingText { margin-top: 100px; } #linkList { position: absolute; color: #425162; background-color: transparent; top: 437px; right: 30px; width: 300px; height: 450px; background-image: url(navigation.gif); background-repeat: no-repeat; background-position: right; } #linkList2 { margin-top: 30px; margin-left: 20px; margin-right: 25px; width: 260px; height: 350px; overflow: auto; font: 11px "Courier New", monospace; color: #95A5BB; background-color: transparent; } h3.select { font: bold 12px "Courier New", monospace; border: 1px solid; margin-top: 10px; margin-left: 10px; margin-right: 10px; margin-bottom: 0; padding-left: 5px; padding-right: 5px; color: #1D2139; background-color: #555764; } h3.archives { font: bold 12px "Courier New", monospace; border: 1px solid; margin-top: 10px; margin-left: 10px; margin-right: 10px; margin-bottom: 0; padding-left: 5px; padding-right: 5px; color: #1D2139; background-color: #555764; } h3.resources { font: bold 12px "Courier New", monospace; border: 1px solid; margin-top: 10px; margin-left: 10px; margin-right: 10px; margin-bottom: 0; padding-left: 5px; padding-right: 5px; color: #1D2139; background-color: #555764; } #linkList ul { list-style: none; margin-top: 0; } li { margin-left: -15px; margin-right: 15px; margin-bottom: 0px; } li:hover { margin-left: -15px; margin-right: 15px; background-color: #555764; color: #1D2139; } a:link { color: #C6B768; background-color: transparent; text-decoration: none; } a:visited { color: #867833; background-color: transparent; text-decoration: line-through; } a:hover, a:focus { color: #EBD678; background-color: transparent; text-decoration: underline; } #extraDiv1 { position: absolute; background-image: url(validation.gif); background-repeat: no-repeat; top: 887px; right: 30px; width: 300px; height: 100px; z-index: 1; } * html #footer { width: 260px; w\idth: 228px; } #footer { font: 11px "Courier New", monospace; position: absolute; top: 922px; right: 50px; z-index: 2; padding: 8px 15px; height: 20px; overflow: auto; width: 228px; } #extraDiv2 { position: absolute; background-image: url(download.gif); background-repeat: no-repeat; top: 987px; right: 30px; width: 300px; height: 100px; z-index: 1; } * html #quickSummary { width: 260px; w\idth: 228px; } #quickSummary { width: 228px; position: absolute; top: 1022px; right: 50px; z-index: 2; padding: 0 15px; height: 40px; overflow: auto; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { margin-top: 4px; color: #95A5BB; background-color: transparent; font: 11px "Courier New", monospace; }/* css Zen Garden submission 017 - 'Golden Mean' by Douglas Bowman, http://www.stopdesign.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Douglas Bowman*/ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Design and CSS created by Douglas Bowman */ /* www.stopdesign.com */ /* structure --------------------------------- */ body { margin:0; padding:0; background:#EBE8D0 url("bg_body.gif") repeat-x left top; color:#333; text-align:center; font:x-small Georgia,Serif; voice-family: "\"}\""; voice-family:inherit; font-size:small; } html>body {font-size:small;} #container { position:relative; width:732px; margin:0 auto; text-align:left; } #intro { border:1px solid #A79355; border-width:0 1px; } /* hidden text --------------------------------- */ h1, h2, h3 { margin:0; background-repeat:no-repeat; background-position:left top; } h1 span, h2 span, h3 span, #quickSummary p.p1 span {display:none;} /* header and summary --------------------------------- */ #pageHeader h1 { height:71px; background:url("bg_zengarden.gif") no-repeat 35px 42px; } #pageHeader h2 { height:115px; background:url("bg_beautyof.jpg") no-repeat left top; } #quickSummary p.p1 { height:76px; margin:0; background:url("bg_quicksum.gif") no-repeat 35px 18px; } #quickSummary p.p2 { position:absolute; top:78px; right:35px; width:200px; margin:0; font-size:93%; line-height:1.3em; text-align:right; color:#A79355; background-color:transparent; } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited { white-space:nowrap; font:bold 92%/1.3em Verdana,Arial,Sans-serif; text-transform:uppercase; } /* preamble --------------------------------- */ #preamble { position:absolute; top:304px; right:0; width:180px; } #preamble h3 { height:44px; background-image:url("bg_road.gif"); } #preamble p { margin:.5em 0; font-size:93%; font-style:italic; line-height:1.7em; color:#66472E; background-color:transparent; } /* supporting text --------------------------------- */ #supportingText { margin:0 200px; border:1px solid #A79355; border-width:0 1px; padding-bottom:8px; border-bottom:8px solid #BDAF83; } #supportingText p { margin:.75em 0; line-height:1.5em; padding:0 20px; } #supportingText h3 { height:40px; border:1px solid #A79355; border-width:1px 0; margin:1em 0 .5em; background-color:#D9D98B; } #explanation h3 { height:80px; background-image:url("bg_what.jpg"); border-top-width:0; margin:0 0 10px; } #participation h3 {background-image:url("bg_participation.jpg");} #benefits h3 {background-image:url("bg_benefits.jpg");} #requirements h3 {background-image:url("bg_requirements.jpg");} /* link list --------------------------------- */ #linkList { position:absolute; top:306px; left:0; width:180px; } #linkList h3 {height:23px;} #lselect h3 { height:41px; background-image:url("bg_select.gif"); } #larchives h3 {background-image:url("bg_archives.gif");} #lresources h3 {background-image:url("bg_resources.gif");} #linkList ul { margin:1em 0 1.5em; padding:0; font-size:93%; list-style:none; } #larchives li, #lresources li {text-transform:lowercase;} #linkList ul li { background:url("icon_diamond.gif") no-repeat 2px 50%; margin:0 0 .5em; padding:0 0 0 14px; line-height:1.5em; } #linkList li a:link, #linkList li a:visited { font-family:Verdana,Arial,Sans-serif; font-weight:bold; } #linkList #lselect li { background:url("icon_pg.gif") no-repeat 0 15%; color:#A79355; } #linkList #lselect a:link, #linkList #lselect a:visited {display:block;} #linkList #lselect a.c:link, #linkList #lselect a.c:visited { display:inline; font-family:Georgia,Serif; font-weight:normal; color:#616623; background-color:transparent; text-transform:lowercase; } /* footer --------------------------------- */ #footer { background:#D9D98B url("bg_pattern.gif"); color:#fff; margin:1.75em 0 0; padding:10px 20px; border:1px solid #A79355; border-width:1px 0; font:85% Verdana,Arial,Sans-serif; text-align:center; } #footer a:link, #footer a:visited { padding:0 5px; font-weight:normal; } /* links --------------------------------- */ a:link, a:visited { color:#703F0E; background-color:transparent; font-weight:bold; text-decoration:none; } a:hover { color:#616623; background-color:transparent; text-decoration:underline; } /* misc --------------------------------- */ acronym {border-width:0;}/* css Zen Garden submission 018 - 'Wrapped in Burlap' by John Simons, http://www.royalbarrel.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, John Simons*/ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Top-level stuff ------------------------------*/ body { margin:10px 0 0 0; padding:0; font-family:verdana; font-size:85%; background-color:#fff; } p { margin-top:0; } #container { width:745px; margin-left:30px; position:relative; background-color:#F7F0E9; } /* Intro section ------------------------------*/ #intro { position:relative; background-color:white; } #pageHeader { background-image:url("title.gif"); background-repeat:no-repeat; height:181px; } #pageHeader h1, #pageHeader h2 span { display:none; } #pageHeader h2 { width:75px; height:84px; background-image:url("small_tree.gif"); background-repeat:no-repeat; position:absolute; top:-10px; left:690px; margin:0;padding:0; } #quickSummary { text-align:right; position:absolute; top:75px; left:500px; width:245px; font-size:100%; font-style:italic; font-family:times new roman, serif; } #quickSummary p { margin-bottom:0px; } #quickSummary a { color:#C52E00; } /* Left-hand column ------------------------*/ #supportingText, #preamble { width:505px; background-image:url("burlap.jpg"); color:white; line-height:140%; } #supportingText p, #preamble p { margin:0; padding:4px 10px 10px 10px; } #supportingText a, #preamble a { color:#FFAF7F; } #preamble h3, #supportingText h3 { height:44px; margin:0; padding:0; border-top:1px solid #F7F0E9; border-bottom:1px solid #F7F0E9; border-left:1px solid #735B5A; } #preamble h3 { border-top-width:0px; } #preamble h3 span, #supportingText h3 span { display: none; } #preamble h3 { background-image:url("enlightenment.gif"); } #explanation h3 { background-image:url("whatabout.gif"); } #participation h3 { background-image:url("participation.gif"); } #benefits h3 { background-image:url("benefits.gif"); } #requirements h3 { background-image:url("requirements.gif"); } /* Footer -----------------------------*/ #footer { text-align:center; background:#F7F0E9 url("footer_bg.jpg"); padding:8px 0px; font-size:120%; font-weight:bold; } #footer a { color:#583C3B; text-decoration:none; } #footer a:hover { color:#D17B00; } /* Link List ------------------------------------*/ #linkList { position:absolute; top:181px; left:505px; width:240px; background-image:url("right_bg.jpg"); background-repeat:no-repeat; color:#774747; border-top:1px solid #E0D5CA; font-weight:bold; padding-bottom:200px; line-height:140%; } #linkList ul { padding-left:30px; margin-left:0px; } #linkList li { margin-bottom:15px; } #linkList a { color:#686057; text-decoration:none; } #linkList a:hover { text-decoration:underline; } #linkList a:visited { color:#999189; } /* To get a linebreak between title and author */ #linkList #lselect a { display:block; } #linkList #lselect a:hover {color:#C52E00; } #linkList #lselect a.c { display:inline; } #linkList #lselect a.c:hover {color:#686057; } #linkList h3 { margin:0; padding:0; background-repeat:no-repeat; height:46px; } #linkList h3 span { display:none; } #linkList h3.select { background-image:url("select.gif"); } #linkList h3.archives { background-image:url("archives.gif"); } #linkList h3.resources { background-image:url("resources.gif"); } /* css Zen Garden submission 019 - 'What Lies Beneath' v1.01 by Michael Pick, http://www.mikepick.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Mike Pick */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { font: 11px/18px verdana; color: #ffffff; background: #000000 url(body-background.jpg) repeat-x; margin: 0px; margin-bottom: 20px; width: 2300px; } p { font: 11px/18px verdana; margin-top: 0px; text-align: left; } h3 { font: 12pt georgia; margin-top: 0px; margin-bottom: 5px; color: #ffffff; } a:link { font-weight: bold; text-decoration: none; color: #E8AD62; } a:visited { font-weight: bold; text-decoration: none; color: #E0922F; } a:hover, a:active { text-decoration: underline; color: #FFCC00; } /* specific divs */ #pageheader { } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(title.jpg) no-repeat top left; width: 2300px; height: 85px; margin-top: 70px; } #pageHeader h1 span { display:none } #pageHeader h2 span { display:none; } #quickSummary { position: absolute; left: 55px; top: 170px; width: 250px; z-index: 2; } #quickSummary p { font: italic 10px/16px georgia; text-align: right; } #preamble { position: absolute; background: transparent url(femur.jpg) no-repeat bottom left; top: 170px; left: 545px; width: 300px; height: 431px; z-index: 2; } #preamble h3 { background: transparent url(the_road.jpg) no-repeat top left; width: 300px; height: 25px; } #preamble h3 span { display: none; } #supportingText { } #explanation { position: absolute; top: 170px; left: 865px; width: 300px; z-index: 2; } #explanation h3 { background: transparent url(so_what.jpg) no-repeat top left; width: 300px; height: 25px; } #explanation h3 span { display: none; } #participation { position: absolute; background: transparent url(tin_can.jpg) no-repeat top left; top: 170px; left: 1185px; width: 300px; z-index: 2; padding-bottom: 40px; } #participation h3 { background: transparent url(participation.jpg) no-repeat top left; width: 300px; height: 25px; } #participation h3 span { display: none; } #benefits { background: transparent url(ants.jpg) no-repeat top left; position: absolute; top: 170px; height: 450px; left: 1505px; width: 300px; z-index: 2; } #benefits h3 { background: transparent url(benefits.jpg) no-repeat top left; width: 300px; height: 25px; } #benefits h3 span { display: none; } #requirements { position: absolute; top: 170px; left: 1825px; width: 300px; z-index: 2; padding-bottom: 40px; } #requirements h3 { background: transparent url(requirements.jpg) no-repeat top left; width: 300px; height: 25px; } #requirements h3 span { display: none; } #requirements p { font: 9px/15px verdana; } #footer { position: absolute; background: transparent url(worm.jpg) no-repeat; text-align: right; top: 170px; left: 2145px; width: 100px; height: 325px; z-index: 2; } #footer a:link, #footer a:visited { display: block; } #linkList { position: absolute; left: 325px; top: 170px; width: 200px; z-index: 2; } #linkList2 { font: 9px verdana, sans-serif; } #linkList h3.select { background: transparent url(select.jpg) no-repeat top left; width: 200px; height: 25px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(favorites.jpg) no-repeat top left; margin-top: 15px; width: 200px; height: 25px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.jpg) no-repeat top left; margin-top: 15px; width: 200px; height: 25px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.jpg) no-repeat top left; margin-top: 15px; width: 200px; height: 25px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #E8AD62; } #linkList li a:visited { color: #E0922F; } #linklist li a:hover, a:active { color: #00CCFF; } #extraDiv1 { background: transparent url(mole.jpg) bottom left no-repeat; position: absolute; top: 0px; left: 0px; width: 2300px; height: 630px; z-index: 1; }/* css Zen Garden submission 020 - 'Friendly Beaches' by Sophie G - www.sophie-g.net */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Sophie G */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { background-color: #FFF; margin: 0px; padding: 10px; font-family: Georgia, "Times New Roman", Times, serif; font-size: 90%; } p { line-height: 180%; } #container { background-color: #EDEEF0; border: 1px solid #DAD5D9; padding: 0px; margin: 0px; } acronym { border-bottom: 1px #6BA0D2 dashed; } #pageHeader { font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; background-color: #A4ACB3; } #pageHeader h1 { height: 190px; margin: 0px; background-image: url(headerh1.jpg); background-repeat: no-repeat; } #pageHeader h1 span, #pageHeader h2 span { display: none; } #pageHeader h2 { background-color: #EDEEF0; margin: 0px; height: 24px; padding: 0px 14px 2px 14px; background-image: url(headerh2.gif); background-repeat: no-repeat; } #pageHeader h2 acronym { color: #FFF; border-bottom: 1px #FFF dashed; } #quickSummary p.p1 { position: absolute; right: 21px; top: 21px; width: 12em; height: 168px; padding: 0px; margin: 0px; border: 1px solid #0C2953; text-align: center; font-size: 90%; font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; line-height: 110%; color: #FFF; background-image: url(summary.jpg); background-repeat: no-repeat; background-position: 50% 100%; background-color: #0C2953; } #quickSummary p.p1 span { display: block; padding: 3px; } #preamble { padding: 0px 15em 0px 3em; } #preamble h3 { margin: 15px 0px 0px 0px; padding: 6px 20px 2px 6px; text-align: left; font-size: 180%; font-variant: small-caps; color: #6BA0D2; background-image: url(bordDroitPreambleh3.gif); background-repeat: no-repeat; background-position: 100% 0px; background-color: #F6F7F7; } #preamble h3 span { display: block; padding: 20px 0px 15px 48px; background-image: url(preambleShell.jpg); background-repeat: no-repeat; background-position: 0px 50%; } #preamble p { text-align: justify; } #preamble p.p1, #preamble p.p2 { margin: 0px; padding: 10px 20px 2px 6px; background-image: url(bordDroitPreamble.gif); background-repeat: repeat-y; background-position: 100% 0px; background-color: #F6F7F7; } #preamble p.p3 { margin: 0px; padding: 0px; background-image: url(bordBasPreamble.gif); background-repeat: no-repeat; background-position: 100% 100%; background-color: #F6F7F7; } #preamble p.p1 span, #preamble p.p2 span, #preamble p.p3 span { display: block; } #preamble p.p3 span { margin: 0px; padding: 10px 20px 20px 6px; background-image: url(bordBasPreambleGauche.gif); background-repeat: no-repeat; background-position: 0% 100%; } #preamble p:first-letter, #preamble p span:first-letter { color: #6BA0D2; font-size: 140%; font-weight: bold; margin: 0px 2px 0px 0px; } #supportingText { margin: 0px; padding: 10px 16em 0px 1em; font-size: 90%; } #explanation, #participation, #benefits, #requirements { border: 2px solid #FFF; padding: 0px; } #explanation { margin: 0px 0px 10px 0px; } #participation { margin: 0px 0px 10px 0px; float: left; width: 30%; } #benefits { margin: 0px 0px 10px 32%; } #requirements { margin: 0px 0px 10px 32%; } #supportingText h3 { margin: 0px; padding: 5px 30px 1px 2px; text-align: left; font-size: 120%; font-variant: small-caps; color: #6BA0D2; border-bottom: 1px solid #6BA0D2; background-color: #F6F7F7; background-repeat: no-repeat; background-position: 100% 50%; } #explanation h3 { background-image: url(explanationShell.jpg); } #participation h3 { background-image: url(participationShell.jpg); } #benefits h3 { background-image: url(benefitsShell.jpg); } #requirements h3 { background-image: url(requirementsRock.jpg); } #supportingText p { text-align: justify; margin: 10px 0px 0px 0px; padding: 1px 3px 2px 3px; } #supportingText p:first-letter, #supportingText p span:first-letter { font-weight: bold; } #supportingText a:link { color: #0083FF; font-weight: bold; } #supportingText a:visited { color: #204160; font-weight: bold; } #supportingText a:hover, #supportingText a:active { color: #8C0000; font-weight: bold; text-decoration: none; } #linkList, #quickSummary p.p2 { font-size: 90%; font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; position: absolute; right: 21px; width: 12em; border: 1px solid #0C2953; padding: 0px; margin: 0px; background-color: #A4ACB3; } #quickSummary p.p2 { height: 50px; text-align: center; top: 217px; } #quickSummary p.p2 span { font-size: 90%; display: block; padding: 3px; color: #FFF; } #linkList { top: 266px; } #linkList h3 { background-color: #0C2953; color: #FFF; margin: 0px; padding: 30px 1px 1px 1px; background-repeat: no-repeat; } #linkList h3.select { background-image: url(selecth3.jpg); background-position: 50% 0%; } #linkList h3.favorites { border-top: 1px solid #0C2953; background-image: url(favoritesh3.jpg); background-position: 40% 100%; } #linkList h3.archives { border-top: 1px solid #0C2953; background-image: url(archivesh3.jpg); background-position: 40% 100%; } #linkList h3.resources { border-top: 1px solid #0C2953; background-image: url(resourcesh3.jpg); background-position: 50% 30%; } #linkList h3:first-letter, #linkList h3 span:first-letter { color: #FFF; font-size: 160%; } #linkList ul { list-style-type: none; font-size: 90%; color: #FFF; margin: 0px; padding: 0px; background-color: #A4ACB3; } #linkList li { padding: 3px 2px 3px 2px; margin-bottom: 4px; } #linkList li:hover { padding: 2px 1px 2px 1px; border: 1px dotted #0C2953; background-color: #6BA0D2; } #quickSummary p.p2 span a:link { color: #FFF; font-weight: bold; } #quickSummary p.p2 span a:visited { color: #204160; } #quickSummary p.p2 span a:hover, #quickSummary p.p2 span a:active { color: #FFD800; font-weight: bold; text-decoration: none; } #linkList a:link, #linkList a:visited { border-left: 6px solid #FFF; padding-left: 2px; font-weight: bold; color: #FFF; } #linkList a:visited { color: #204160; } #linkList a:hover, #linkList a:active { border-left: 6px solid #FFD800; padding-left: 2px; color: #FFD800; text-decoration: none; font-weight: bold; } #linkList a.c:link, #linkList a.c:visited { border-left: none; padding-left: 0px; font-weight: normal; color: #FFF; } #linkList a.c:hover, #linkList a.c:active { border-left: none; padding-left: 0px; color: #FFD800; text-decoration: none; } #linkList acronym { border-bottom: 1px #FFF dashed; } #footer { clear: both; text-align: right; margin: 0px -16em 0px 0px; padding: 25px 0px 0px 0px; background-repeat: no-repeat; background-image: url(signSoph.gif); background-position: 0% 95%; } #footer a { font-size: 70%; font-family: Verdana, Arial, Geneva, Helvetica, sans-serif; }/* css Zen Garden submission 021 - 'Calm & Smooth' by Cornelia Lange - http://www.clkm.de/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Cornelia Lange */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* elements */ body { color: #000; background: #F1ECE3 url(topbg.gif) repeat-x; font: 90% Verdana, Arial, Helvetica, sans-serif; } body, html, h1, h2, h3, p, ul, li, div { margin: 0; padding: 0; } p { font-size: .82em; line-height: 140% } a { color: #069; font-weight: bold; text-decoration: none; background: transparent; } a:visited { color: #000; background: transparent; } a:hover { text-decoration: underline; color: #900; background: transparent; } ul, li { display: block; list-style: none; } acronym { border: 0 none; } /* divs and related classes */ #pageHeader h1 { font: bold 3.2em Arial, Helvetica, sans-serif; color: #8ab; background: transparent; position: absolute; top: 340px; left: 256px; z-index: 5; text-transform: lowercase; } #pageHeader h2 { position: absolute; left: 20px; top: 68px; display: block; width: 138px; height: 88px; font: bold 1em Arial, Helvetica, sans-serif; color: #449498; background: transparent url(cssdesign.gif) top left no-repeat; } #pageHeader h2 span { display: none; } #quickSummary { width: 200px; margin: 235px 0 20px 15px; padding: 20px 0 0 0; font-size: 0.92em; } #quickSummary .p2 { padding-top: 10px; } #preamble { margin: 0 0 0 13.5em; color: #000; background: transparent url(enlightenment.gif) top left no-repeat; height: 6em; clear: both; padding: 5.8em 0 0 4.7em; } #preamble h3 span { display: none; } #preamble .p1, #preamble .p2, #preamble .p3 { display: block; float: left; } #preamble .p1 { margin: 10px 20px 15px 0; width: 160px; } #preamble .p2 { margin: 10px 20px 15px 0; width: 230px; } #preamble .p3 { margin: 10px 15px 15px 0; width: 270px; } #preamble p:first-letter { font: bold 1.2em Tahoma, 'Trebuchet MS', Arial, Helvetica, sans-serif; color: #900; background: transparent; } /* supportingText */ #supportingText { margin: 0 0 0 13.5em; clear: both; } #supportingText .p1, #supportingText .p2, #supportingText .p3, #supportingText .p4, #supportingText .p5 { display: block; float: left; } #supportingText p:first-letter { font: bold 1.2em Tahoma, 'Trebuchet MS', Arial, Helvetica, sans-serif; color: #900; background: transparent; text-transform: capitalize; } #explanation { display: block; color: #000; background: transparent url(buddha.gif) top left no-repeat; height: 4em; clear: both; padding: 6.5em 0 0 4.7em; } #explanation h3 span { display: none; } #explanation .p1 { width: 320px; margin: 10px 20px 15px 0; } #explanation .p2 { width: 360px; margin: 10px 20px 15px 0; } #participation { display: block; height: 4em; color: #000; background: transparent url(participation.gif) top left no-repeat; clear: both; padding: 6em 0 0 4.7em; } #participation h3 span, #benefits h3 span { display: none; } #participation .p1 { width: 390px; margin: 10px 20px 15px 0; } #participation .p2 { width: 290px; margin: 10px 20px 15px 0; } #participation .p3 { width: 390px; margin: 10px 20px 15px 0; clear: left; } #participation .p4 { width: 290px; margin: 10px 20px 15px 0; } #benefits { display: block; height: 4em; margin: 30px 0 0 0; color: #000; background: transparent url(benefits.gif) top left no-repeat; clear: both; padding: 6.2em 0 0 4.7em; } #benefits p { width: 460px; margin: 10px 20px 15px 0; } #requirements { display: block; height: 4em; margin: 30px 0 0 0; color: #000; background: transparent url(requirements.gif) top left no-repeat; clear: both; padding: 7.3em 0 0 4.7em; } #requirements h3 span { display: none; } #requirements .p1 { width: 230px; margin: 10px 20px 15px 0; } #requirements .p2 { width: 450px; margin: 10px 20px 15px 0; } #requirements .p3 { width: 230px; margin: 10px 20px 15px 0; clear: left; } #requirements .p4 { width: 450px; margin: 10px 20px 15px 0; } #requirements .p5 { width: 450px; margin: 10px 20px 15px 0; clear: left; } #footer { border-top: 1px dashed #999; padding-top: 5px; margin: 20px 30px 20px 5em; clear: both; font-size: .82em; padding-left: 0.7em; } #footer a { padding: 0 10px 0 15px; color: #069; background: transparent url(link.gif) left no-repeat; } #footer a:link, #footer a:visited { color: #069; background: transparent url(link.gif) left no-repeat; } #footer a:hover, #footer a:active { color: #900; background: transparent url(linkhover.gif) left no-repeat; } /* left Menu */ #linkList { font-size: .82em; position: absolute; top: 33.6em; left: 15px; float: left; width: 18em; } #linkList h3 { color: #900; background: transparent; font-size: 1.2em; padding: 1em 0 0.4em 0; margin: 10px 0 0 0; } #linkList ul { margin-top: 0.5em; } #lselect li { display: block; height: 2.5em; margin-top: 0.5em; padding: 0 0 3px 20px; background: transparent url(css.gif) 0 3px no-repeat; } #lselect a { display: block; } #lselect a.c { display: inline; font-weight: normal; } #lselect a:hover.c { display: inline; font-weight: normal; } #larchives li { padding: 0 0 10px 0; text-transform: lowercase; color: #069; background: transparent url(linkhover.gif) 0 3px no-repeat; /* preload hoverimage */ } #larchives a { padding: 0 0 10px 20px; } #larchives a:link { color: #069; background: #F1ECE3 url(link.gif) 0 3px no-repeat; } #larchives a:visited { color: #000; background: #F1ECE3 url(link.gif) 0 3px no-repeat; } #larchives a:hover, #larchives a:active { color: #900; background: #F1ECE3 url(linkhover.gif) 0 3px no-repeat; text-decoration: none; } #lresources li { padding: 0 0 10px 0; text-transform: lowercase; color: #069; background: transparent url(linkhover.gif) 0 3px no-repeat; /* preload hoverimage */ } #lresources a { padding: 0 0 10px 20px; } #lresources a:link { color: #069; background: #F1ECE3 url(link.gif) 0 3px no-repeat; } #lresources a:visited { color: #000; background: #F1ECE3 url(link.gif) 0 3px no-repeat; } #lresources a:hover, #lresources a:active { color: #900; background: #F1ECE3 url(linkhover.gif) 0 3px no-repeat; text-decoration: none; } /* images */ #extraDiv1 { position: absolute; top: 0; left: 150px; width: 412px; height: 218px; color: #000; background: transparent url(beauty.gif) top left no-repeat; z-index: 5; } #extraDiv2 { position: absolute; top: 218px; left: 139px; width: 582px; height: 17px; color: #fff; background: transparent url(streifen.gif) top left no-repeat; } #extraDiv3 { position: absolute; top: 0; right: 0; width: 199px; height: 218px; color: #000; background: transparent url(graeser.gif) top right no-repeat; z-index: 2; } #extraDiv4 { position: absolute; top: 235px; left: 244px; width: 350px; height: 175px; color: #000; background: transparent url(seerosen.gif) top left no-repeat; } /* css Zen Garden submission 022 - 'viridity' by Laura MacArthur - http://www.tunnel-vision.org/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Laura MacArthur */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* based once upon a time on the css Zen Garden default style v1.01 Dave Shea*/ /* basic stuff */ html>body, html>body td, html>body th { font-size: small; } body { font: 10px/16px Arial, Helvetica, sans-serif; color: #330033; background: #669999 url(z_bgrnd.gif) repeat-x 0px 1px; margin: 0px; } /*rinse and repeat*/ div, p, th, td, li, dd, dl, dt { font-family: Arial, Helvetica, sans-serif; } p { font: 10px/18px Arial, Helvetica, sans-serif; margin-right: 15px; margin-left: 20px; margin-top: 5px; margin-bottom: 5px; padding-right: 15px; padding-left: 20px; padding-top: 5px; padding-bottom: 5px; letter-spacing: 1px; text-align: justify; } h3 { color: #336666; background-color: transparent; font: bold 14px "Trebuchet MS", Arial, Helvetica, sans-serif; letter-spacing: 4px; text-transform: lowercase; } a:link { color: #CCFFFF; background-color: transparent; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bold; text-decoration: none; } a:visited { color: #003333; background-color: #669999; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bold; text-decoration: none; } a:hover, a:active { color: #006666; background-color: #CCFFFF; font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bold; text-decoration: none; } /* specific divs */ /*outermost div*/ #container { position: absolute; margin-top: 0px; top: 0px; left: 0px; width: 75%; height: auto; z-index: 2; padding-left: 130px; } /* where the logos are */ #pageHeader { width: 575px; height: 65px; position: absolute; left: 0px; top: 0px; padding-top: 31px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ /*and this trick totally rocks*/ #pageHeader h1 { background: transparent url(zh1_combo.gif) no-repeat 0px 0px; width: 575px; height: 65px; float: left; top: 0px; margin-top: 0px; } #pageHeader h1 span { display:none; } #pageHeader h2 span { display:none; } #preamble h3 { background: #CCFFFF url(h3_preamble.gif) no-repeat left top; color: #003333; margin-top:0px; margin-bottom:0px; height: 25px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #003333; } #preamble h3 span{ display:none; } #explanation h3 { background: #CCFFFF url(h3_support1.gif) no-repeat left top; color: #003333; margin-top:0px; margin-bottom:0px; height: 25px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #003333; border-top-width: 1px; border-top-style: solid; border-top-color: #003333; } #explanation h3 span{ display:none; } #participation h3 { background: #CCFFFF url(h3_support2.gif) no-repeat left top; color: #003333; margin-top:0px; margin-bottom:0px; height: 25px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #003333; border-top-width: 1px; border-top-style: solid; border-top-color: #003333; } #participation h3 span{ display:none; } #benefits h3 { background: #CCFFFF url(h3_support3.gif) no-repeat left top; color: #003333; margin-top:0px; margin-bottom:0px; height: 25px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #003333; border-top-width: 1px; border-top-style: solid; border-top-color: #003333; } #benefits h3 span{ display:none; } #requirements h3 { background: #CCFFFF url(h3_support4.gif) no-repeat left top; color: #003333; margin-top:0px; margin-bottom:0px; height: 25px; border-bottom-width: 3px; border-bottom-style: solid; border-bottom-color: #003333; border-top-width: 1px; border-top-style: solid; border-top-color: #003333; } #requirements h3 span{ display:none; } /* blurb */ #quickSummary { color: #CCCCCC; background-color: transparent; width: 75%; height: auto; display: block; padding-top: 125px; } #quickSummary p { font: italic normal 10px/16px "Trebuchet MS", Arial, Helvetica, sans-serif; text-align:left; padding-top: 5px; } /* written intro - first paragraph */ #preamble { color: #333333; background-color: #99CCCC; width: 70%; clear: right; margin-bottom: 10px; padding-bottom: 10px; border: 1px solid #003333; } #preamble a:link { color: #CCFFFF; background-color: #669999; } #preamble a:hover, a:active { color: #006666; background-color: #CCFFFF; } /* the rest */ #supportingText { color: #333333; background-color: #99CCCC; width: 70%; clear: right; height: auto; border: 1px solid #003333; background-image: url(z_twig.gif); background-repeat: no-repeat; background-position: right bottom; } #supportingText a:link { color: #CCFFFF; background-color: #669999; } #supportingText a:hover, a:active { color: #006666; background-color: #CCFFFF; } #footer { color: #CCCCCC; background-color: #006666; text-align: center; border: 1px solid #003333; background-image: url(z_trim.png); background-repeat: repeat-x; background-position: 0px 0px; height: 32px; } /* link-tastic */ #linkList { position: absolute; top: 114px; left: 0px; z-index: auto; } #linkList2 { color: #333333; background-color: transparent; font: 10px "Trebuchet MS", Arial, Helvetica, sans-serif; width: 130px; height: auto; padding: 0px 0px 10px; margin-top: 0px; text-align: right; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; border-right-width: 1px; border-right-style: solid; border-right-color: #003333; } #linkList h3.select { background: transparent url(zh3_select.gif) no-repeat 0px 0px; margin: 0px 0px 5px; width: 130px; height: 100px; } #linkList h3.select span { display:none; } #linkList h3.favorites { background: transparent url(zh3_favs.gif) no-repeat left top; margin: 25px 0px 5px; width: 130px; height: 50px; } #linkList h3.favorites span { display:none; } #linkList h3.archives { background: transparent url(zh3_arch.gif) no-repeat left top; margin: 25px 0px 5px; width:130px; height: 50px; } #linkList h3.archives span { display:none; } #linkList h3.resources { background: transparent url(zh3_res.gif) no-repeat left top; margin: 25px 0px 5px; width:130px; height: 50px; } #linkList h3.resources span { display:none; } #linkList ul { margin: 0px 5px; padding: 0px 5px; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; } /* leaf */ #extraDiv1 { background-image: url(z_cont.gif); background-repeat: no-repeat; position: absolute; z-index: 1; left: 315px; top: 114px; height: 299px; width: 330px; } /* css Zen Garden submission 023 - 'fleur de l'avant-garde' by Michael Switzer, http://propagandabydesign.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Michael Switzer */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { margin: 0; padding: 0; border: 0; text-align: center; vertical-align: top; overflow: visible; background: #fff url(bg.gif) repeat-x; font: x-small Verdana,sans-serif; color: #333; } p, h3 { margin: 0; padding: 0 0px 5px 0; } ul { margin: 0; padding: 2px 0 5px 0; } acronym { border-bottom: 1px dashed #4C83AE; } a acronym { border-bottom: 0; } a:link { font-weight: 900; color: #4C83AE; text-decoration: none; } a:visited { font-weight: 900; color: #999; text-decoration: none; } a:hover, a:active { font-weight: 900; color: #9B3F17; } #container { position: relative; top: 0; margin: 0 auto; text-align: left; border-left: 1px dashed #666; border-right: 1px dashed #666; background: #FFF url(mainbg.jpg) no-repeat; width: 770px; height: 720px; padding: 0; display: block; } /* page intro and subsections */ #pageHeader { position: absolute; top: 30px; left: 520px; display: block; margin: 0; padding: 0; width: 245px; height: 30px; background: transparent url(logo.gif) no-repeat; border: 0; } #quickSummary p.p1 { position: absolute; top: 293px; left:640px; width: 122px; margin: 0; padding: 0; display: block; text-align: right; font: italic 14px/12px Garamond, Times, serif; color: #9B3F17; line-height: 1.2; } #quickSummary p.p2 { position: absolute; top: 72px; left: 0px; width:760px; text-align: right; font: 9px Verdana, sans-serif; color: #999999; z-index: 2; } #preamble { position: absolute; top: 97px; left: 230px; width: 540px; height: 173px; padding: 0; margin: 0 10 0 0; display: block; overflow: auto; } #preamble h3 { background: transparent url(roadtoenlightenment.gif) no-repeat top left; width: 257px; height: 27px; margin: 5px 0px 0px 5px; } #preamble p { margin: -2px 88px 7px 18px; font: 11px/7px Tahoma,sans-serif; line-height: 1.2; color: #fff; } /* main text and subsections */ #supportingText { position: absolute; top: 290px; left: 180px; width: 440px; margin: 0; padding: 0; display: block; } #supportingText p { font: x-small Verdana,sans-serif; color: #333; text-align: justify; } #explanation { position: relative; top: 0; left: 0; display: block; width: 440px; } #explanation h3 { width: 258px; height: 21px; margin: 0; padding: 0; display: block; background: transparent url(sowhatisthisabout.gif) no-repeat; } #participation { float: left; width: 210px; padding: 0; margin: 10px 0; } #participation h3 { width: 210px; height: 21px; margin: 0; padding: 0; display: block; background: transparent url(participation.gif) no-repeat; } #benefits { float: right; width: 210px; padding: 0; margin: 10px 0; } #benefits h3 { width: 210px; height: 21px; margin: 0; padding: 0; display: block; background: transparent url(benefits_old.gif) no-repeat; } #requirements { float: right; width: 210px; padding:0; margin: 10px 0; } #requirements h3 { width: 210px; height: 21px; margin: 0; padding: 0; display: block; background: transparent url(requirements.gif) no-repeat; } #footer { width: 210px; display: block; text-align: right; } #footer a { display: block; font: 9px Verdana, sans-serif; font-weight: 900; } /* links and subsections */ #linkList { position: absolute; top: 321px; left: 6px; width: 150px; height: 66%; } #linkList div { padding-bottom: 10px; } #linkList ul { margin-left: 5px; list-style: none; color: #fff; } #linkList ul li a { display: block; } #linkList ul li a:link { font-weight: 900; color: #4C83AE; } #linkList ul li a:visited { font-weight: 900; color: #999999; } #linkList ul li a:hover, #linkList ul li a:active { font-weight: 900; color: #9B3F17; } #linkList ul li a.c { display: inline; } #linkList ul li a.c:link { font-weight: 500; color: #4C83AE; } #linkList ul li a.c:visited { font-weight: 500; color: #999; } #linkList ul li a.c:hover, #linkList ul li a.c:active { font-weight: 500; color: #9B3F17; } #lselect h3 { width: 139px; height: 19px; background: transparent url(selectdesign.gif) no-repeat; } #larchives h3 { width: 75px; height: 16px; background: transparent url(archives.gif) no-repeat; } #lfavorites h3 { width: 89px; height: 19px; background: transparent url(favorites.gif) no-repeat; } #lresources h3 { width: 91px; height: 19px; background: transparent url(resources.gif) no-repeat; } #pageHeader h1, #pageHeader h2, #preamble h3 span, #supportingText h3 span, #linkList h3 span { display: none; }/* css Zen Garden submission 024 - 'Not So Minimal' by Daniel Rubin, http://www.superfluousbanter.org// */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Daniel Rubin */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* global ----------------------------------------------- */ body { background: #fff url(bg.gif) no-repeat fixed top left; font-family: verdana, helvetica, arial, sans-serif; margin: 0 20px 0 20px; color: #333; } /* layout ----------------------------------------------- */ #container { position: relative; background: url(header.jpg) no-repeat top left; margin: 0 auto -1px auto; padding-top: 144px; width: 710px; border-bottom: 5px solid #09345f; } #pageHeader { display: none; } #quickSummary { width: 100%; text-align: right; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { margin-top: 0; padding-right: 5px; } #preamble { margin: 22px 0 0 176px; width: 529px; } #explanation, #participation, #benefits, #requirements { margin: 25px 0 0 176px; width: 529px; } #footer { margin: 0 0 5px 0; padding: 10px 0 0 0; width: 100%; text-align: center; } #linkList { position: absolute; width: 150px; top: 166px; left: 5px; } /* text ----------------------------------------------- */ p { font-size: 12px; } #preamble p.p1, #supportingText p.p1 { margin-top: 10px; } #preamble p, #supportingText p { line-height: 18px; } #quickSummary p.p2 { font-size: 9px; color: #999; } #footer { font-size: 9px; } /* lists ----------------------------------------------- */ #linkList ul { font-size: 10px; list-style:none; margin: 5px 0 0 0; padding: 0 0 0 0; } #linkList ul li { background: url(bullet_single.gif) no-repeat 7px 4px; margin: 0; padding: 0 0 0 17px; line-height: 14px; color: #ccc; } #linkList #lselect li { background: url(bullet_double.gif) no-repeat 5px 2px; font-size: 9px; } #linkList #lselect a:link, #linkList #lselect a:visited { display: block; } #linkList #lselect a.c:link, #linkList #lselect a.c:visited { display:inline; } #larchives li, #lresources li { text-transform: lowercase; } /* links ----------------------------------------------- */ a, a:link, a:visited { color: #999; } a:hover { color: #333; } #quickSummary a, #quickSummary a:link, #quickSummary a:visited { font-weight: bold; text-transform: uppercase; text-decoration: none; } #quickSummary a:hover { text-decoration: underline; } #linkList a, #linkList a:link, #linkList a:visited { color: #666; text-decoration: none; } #linkList a:hover { text-decoration: underline; color: #333; } #linkList a.c, #linkList a.c:link, #linkList a.c:visited { color: #999; text-decoration: none; } #linkList a.c:hover { text-decoration: underline; color: #333; } #linkList #lselect a { font-size: 10px; } #linkList #lselect a.c { font-size: 9px; text-transform: lowercase; } #footer a, #footer a:link, #footer a:visited { font-weight: bold; text-transform: uppercase; text-decoration: none; } #footer a:hover { text-decoration: underline; } /* headings ----------------------------------------------- */ h3 { margin-bottom: 0px; } h3 span { display: none; } #supportingText h3 { width: 529px; height: 15px; } #linkList h3 { width: 150px; height: 20px; margin-top: 20px; } #preamble h3 { background: transparent url(h3_theroadtoenlightenment.gif) no-repeat top left; width: 529px; height: 26px; } #explanation h3 { background: transparent url(h3_sowhatisthisabout.gif) no-repeat top left; } #participation h3 { background: transparent url(h3_participation.gif) no-repeat top left; } #benefits h3 { background: transparent url(h3_benefits.gif) no-repeat top left; } #requirements h3 { background: transparent url(h3_requirements.gif) no-repeat top left; } #lselect h3 { background: transparent url(h3_selectadesign.gif) no-repeat top left; margin-top: 10px; } #lfavorites h3 { background: transparent url(h3_favorites.gif) no-repeat top left; } #larchives h3 { background: transparent url(h3_archives.gif) no-repeat top left; } #lresources h3 { background: transparent url(h3_resources.gif) no-repeat top left; } /* misc --------------------------------- */ acronym { border-width: 0; }/* css Zen Garden submission 025 - 'mnemonic', by Dave Shea, http://www.mezzoblue.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: July, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Built in Nick Bradbury's wonderful TopStyle Pro - http://www.bradsoft.com/topstyle/ */ /* See http://www.csszengarden.com/025/025-comments.css for the fully commented version of this file. */ /* See the last section, MOS Enhancements, on why some things look different between IE and the rest */ /* Basic HTML Elements */ html { margin: 0px; padding: 0px; } body { font-size: small; font-family: arial, sans-serif; background: #B0A40B url(bg-1.gif) top left repeat-x; margin: 0px; padding: 0px; } acronym { border-bottom: none; } ul { list-style-type: none; margin: 0px; padding: 0px; } a:link { color: #DF0245; font-weight: bold; text-decoration: none; } a:visited { color: #6F4600; font-weight: normal; text-decoration: underline; } a:hover, a:active { text-decoration: underline; } /*Structural Elements */ #container { background: transparent url(bg-2.gif) top right repeat-y; } #intro { padding: 0px; margin: 0px; } #pageHeader { height: 171px; padding: 0px; background: transparent url(bg-4.gif) top left repeat-x; } #pageHeader h1 { padding: 0px; margin: 0px; float: left; width: 396px; height: 171px; background: transparent url(cr-tl.jpg) top right no-repeat; } #pageHeader h1 span { display: none; } #pageHeader h2 { padding: 0px; margin: 0px; position: absolute; top: 0px; right: 0px; width: 350px; height: 171px; background: transparent url(cr-tr.gif) top right no-repeat; } #pageHeader h2 span { display: none; } #quickSummary p.p1 { width: 310px; height: 67px; background: transparent url(cr-r1.png) top right no-repeat; position: absolute; top: 171px; right: 0px; margin: 0px; } #quickSummary p.p1 span { display: none; } #quickSummary p.p2 { position: absolute; top: 154px; left: 25px; margin: 0px; font-size: 10px; color: #CDC667; padding-left: 8px; background: transparent url(glitch.gif) center left no-repeat; } #quickSummary p.p2 a { color: #D9D48C; font-weight: bold; text-decoration: none; } #quickSummary p.p2 a:hover { color: #fff; text-decoration: underline; } #preamble { display: none; } #supportingText { font: 85%/140% arial, sans-serif; color: #302D0A; background-color: #fff; border: solid 1px #997E00; /*height: 350px; overflow: auto;*/ margin-left: 21px; margin-right: 310px; padding: 10px 20px; } #explanation h3 { height: 10px; background: transparent url(h_sowhat.gif) top left no-repeat; } #participation h3 { height: 10px; background: transparent url(h_participation.gif) top left no-repeat; } #benefits h3 { height: 10px; background: transparent url(h_benefits.gif) top left no-repeat; } #requirements h3 { height: 10px; background: transparent url(h_requirements.gif) top left no-repeat; } #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display: none; } #footer { z-index: 1; position: absolute; top: 64px; left: 150px; text-align: center; width: 257px; background: transparent url(bg-6.png) top left no-repeat; height: 45px; padding-top: 13px; voice-family: "\"}\""; voice-family:inherit; height: 32px; } #footer a:link, #footer a:visited { font-size: 10px; font-weight: normal; color: #fff; text-decoration: none; padding: 4px 12px 4px 13px; } #footer a:hover { background: transparent url(bg-6a.png) center center no-repeat; } /*#footer a { color: #fff; text-decoration: none; text-align: center; display: block; float: left; width: 46px; height: 45px; margin: 0px; margin-right: 10px; background: transparent url(bg-5.png) top left no-repeat; } #footer a:hover { background: transparent url(bg-5a.png) top left no-repeat; }*/ /* left hand fooling around */ #lselect { position: absolute; top: 238px; right: 0px; background: transparent url(cr-r2a.png) top right no-repeat; width: 310px; height: 213px; padding: 10px 60px 10px 55px; voice-family: "\"}\""; voice-family:inherit; width: 195px; height: 193px; } #lselect h3 { height: 15px; background: transparent url(h_select.gif) top left no-repeat; margin: 0px 10px 8px 0px; position: relative; left: -20px; } #lselect h3 span { display: none; } #lselect li { font: normal 10px arial, sans-serif; line-height: 170%; text-decoration: none; color: #6D6100; letter-spacing: -1px; } #lselect a { font: bold 10px arial, sans-serif; text-decoration: none; text-transform: uppercase; color: #fff; letter-spacing: normal; } #lselect a.c { font-weight: normal; color: #6D6100; text-transform: lowercase; letter-spacing: -1px; } #lselect a:hover { text-decoration: underline; } #larchives { position: absolute; line-height: 80%; text-align: center; top: 451px; right: 0px; background: transparent url(cr-r3a.png) top right no-repeat; width: 310px; height: 50px; padding: 15px 65px 6px 45px; voice-family: "\"}\""; voice-family:inherit; width: 200px; height: 29px; } #larchives h3 { display: none; } #larchives li { font: normal 10px arial, sans-serif; display: inline; padding-right: 6px; } #larchives li a { color: #443901; text-decoration: none; } #larchives li a:hover { color: #fff; text-decoration: underline; } #lresources { height: 74px; background: transparent url(bg-7.png) top right repeat-x; } #lresources h3 { width: 310px; height: 74px; float: right; background: transparent url(cr-br.png) top right no-repeat; margin: 0px; } #lresources h3 span { display: none; } #lresources ul { padding: 37px 0px 0px 25px; } #lresources li { display: inline; } #lresources li a { color: #fff; font-size: 9px; font-weight: bold; text-decoration: none; text-transform: lowercase; padding-right: 5px; } #lresources li a:hover { text-decoration: underline; } /* Extra elements */ #extraDiv1 { position: absolute; top: 0px; left: 0px; width: 750px; height: 118px; background: transparent url(mnemonic.gif) top left no-repeat; } #extraDiv2 { width: 90px; height: 18px; position: absolute; top: 112px; left: 156px; background: transparent url(ani1.gif) top left no-repeat; } #extraDiv3 span { width: 61px; height: 51px; position: absolute; top: 13px; left: 315px; background: transparent url(ani2.gif) top left no-repeat; } #extraDiv4 { width: 256px; height: 6px; position: absolute; top: 45px; left: 98px; background: transparent url(ani3.gif) top left no-repeat; } #extraDiv5 { width: 100%; position: relative; top: -21px; } #extraDiv5 span { float: right; width: 209px; height: 2px; background: transparent url(ani4.gif) top left no-repeat; margin-right: 40px; } /* **** Beginning of Advanced Effects **** */ #lselect ul>li { width: 100px; line-height: 10px; } #lselect ul>li a {display: block;} #lselect ul>li a.c {display: inline;} #lselect ul>li {position: relative; left: -14px;} #lselect ul>li+li {position: relative; left: -12px;} #lselect ul>li+li+li {position: relative; left: -10px;} #lselect ul>li+li+li+li {position: relative; left: -8px;} #lselect ul>li+li+li+li+li {position: relative; left: 98px; top: -11em;} #lselect ul>li+li+li+li+li+li {position: relative; left: 100px; top: -11em;} #lselect ul>li+li+li+li+li+li+li {position: relative; left: 102px; top: -11em;} #lselect ul>li+li+li+li+li+li+li+li {position: relative; left: 104px; top: -11em;} #larchives ul>li a[accesskey="p"] { display: block; width: 37px; height: 0; overflow: hidden; padding-top: 18px; background: transparent url(archive-b1a.gif) top left no-repeat; position: absolute; top: 16px; left: 70px; color: #958500; } #larchives ul>li a[accesskey="p"]:hover { background: transparent url(archive-b1b.gif) top left no-repeat; } #larchives ul>li a[accesskey="n"] { display: block; width: 31px; height: 0; overflow: hidden; padding-top: 18px; background: transparent url(archive-b2a.gif) top left no-repeat; position: absolute; top: 16px; left: 108px; color: #958500; } #larchives ul>li a[accesskey="n"]:hover { background: transparent url(archive-b2b.gif) top left no-repeat; } #larchives ul>li+li a[accesskey="w"] { display: block; width: 35px; height: 0; overflow: hidden; padding-top: 18px; background: transparent url(archive-b3a.gif) top left no-repeat; position: absolute; top: 16px; left: 170px; color: #958500; } #larchives ul>li+li a[accesskey="w"]:hover { background: transparent url(archive-b3b.gif) top left no-repeat; } #supportingText>div#footer { background: none; } div#footer>a:link, div#footer>a:visited { display: block; width: 46px; height: 45px; padding: 13px 0px 0px 0px; background: transparent url(bg-5.png) top left no-repeat; position: absolute; top: 0px; left: 0px; } div#footer>a:hover { background: transparent url(bg-5a.png) top left no-repeat; } div#footer>a+a:link, div#footer>a+a:visited {left: 53px;} div#footer>a+a+a:link, div#footer>a+a+a:visited {left: 106px;} div#footer>a+a+a+a:link, div#footer>a+a+a+a:visited {left: 159px;} div#footer>a+a+a+a+a:link, div#footer>a+a+a+a+a:visited {left: 212px;} #extraDiv3 { background: transparent url(bg-5a.png) top left no-repeat; }/* css Zen Garden submission 026 - 'Zunflower' by Radu Darvas - http://www.homelesspixel.de/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Radu Darvas */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font: 12px/16px arial, helvetica, verdana, sans-serif; color: #555; background: url(bg_left.gif) repeat-y #fff; margin: 0; padding: 0; } a { text-decoration: none; font-weight: bold; color: #655; } a:hover { text-decoration: none; font-weight: bold; color: #e60; } acronym { border: 0 none; } #container { margin: 0; padding: 0; } #quickSummary p, #preamble p { margin: 0; padding: 8px 30px 4px 18px; } #quickSummary .p1 { font-weight: bold; color: #777; } #intro { margin: 0; padding: 0; width: 303px; } h1 { margin: 0; padding: 0; width: 303px; height: 198px; background: url(h1.jpg) no-repeat transparent; } h1 span { display: none; } h2 { margin: 0 0 9px 0; padding: 0; width: 303px; height: 37px; background: url(h2.gif) no-repeat transparent; } h2 span { display: none; } #preamble h3 { margin: 5px 0 0; padding: 0; width: 303px; height: 36px; background: url(the_road.jpg) no-repeat transparent; } #preamble h3 span { display: none; } #supportingText { position: absolute; top: 70px; left: 303px; width: 320px; margin: 0; padding: 0; background: url(support_bg.gif) repeat-y top right transparent; } #supportingText h3, #supportingText p { margin: 0; padding: 0 40px 10px 0px; } #supportingText h3 span { display: none; } #participation h3 { margin: 0 40px 5px 0px; padding: 0; height: 34px; background: url(parti.gif) no-repeat transparent; border-bottom: 1px solid #ccc; } #benefits h3 { margin: 0 40px 5px 0px; padding: 0; height: 34px; background: url(bene.gif) no-repeat transparent; border-bottom: 1px solid #ccc; } #requirements h3 { margin: 0 40px 5px 0px; padding: 0; height: 34px; background: url(req.gif) no-repeat transparent; border-bottom: 1px solid #ccc; } #requirements p.p5 { border-top: 1px solid #ccc; margin: 10px 40px 5px 0; padding: 10px 0 0; } #preamble h3 span { display: none; } #explanation { background: url(so_what_bg.gif) no-repeat top right transparent; } #explanation h3 { margin: 0 15px 20px 0; padding: 0; height: 36px; background: url(so_what.jpg) no-repeat transparent; } #explanation h3 span { display: none; } #linkList { position: absolute; top: 130px; left: 608px; margin: 0; padding: 0; width: 200px; } #linkList h3.select { margin: 0; padding: 0; background: url(select.jpg) no-repeat transparent; height: 26px; } #linkList h3.archives { margin: 0; padding: 0; background: url(archives.jpg) no-repeat transparent; height: 26px; } #linkList h3.resources { margin: 0; padding: 0; background: url(resources.jpg) no-repeat transparent; height: 26px; } #linkList h3 span { display: none; } #linkList #lselect a { text-decoration: underline; color: #766; display: block; } #linkList #lselect a:visited { text-decoration: underline; color: #aaa; } #linkList #lselect a:hover { text-decoration: underline; color: #e60; } #linkList #lselect a.c { display: inline; text-decoration: none; color: #888; } #linkList #lselect a.c:visited { text-decoration: none; color: #999; } #linkList #lselect a.c:hover { text-decoration: none; color: #e60; } #footer { position: relative; margin: 25px 15px 0 -14px; padding: 3px 0 0 20px; background: url(foot.jpg) no-repeat; height: 23px; } #footer a { color: #fff; vertical-align: middle; } ul { margin: 7px 0 7px 20px; padding: 0; } li { margin: 0 0 5px; padding: 0; list-style-type: none; } /* css Zen Garden submission 027 - 'Gothica' by Patrick H. Lauke aka redux - http://redux.deviantart.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Patrick H. Lauke */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Based on the "Gothica" CSS design example for the SitePoint CSS design contest */ /* decorative icons/patterns adapted from http://www.squidfingers.com/ */ /* basic stuff */ body { font: 0.65em/1.3em Verdana, Arial, Helvetica, sans-serif ; font-style: normal; font-weight: normal; font-variant: normal; background: #eee url(background.png) fixed; color: #000; text-align: center; padding: 0; margin: 0; height: 100%; } h3 { width: 100%; /* needed for IE5+ */ font-family: Times, serif; font-size: 100%; text-transform: uppercase; letter-spacing: 0.3em; word-spacing: 0.3em; border-bottom: #888 1px solid; } html > body h3 { /* redefinition of the border to dotted, hidden from IE - because the dashed line that IE uses instead of dots looks a bit too crude in my opinion */ border-bottom: #000 1px dotted; } acronym { /* in this case, I can live with IE's dashed line */ border-bottom: #000 1px dotted; } a, a:link { color: #900; background: transparent; text-decoration: none; } a:visited { color: #933; background: transparent } a:hover { color: #966; background: transparent } a:active { color: #988; background: transparent } /* let's start with the whole page container */ #container { position: relative; margin: 10px auto; width: 750px; padding: 5px; text-align: left; background: #f5f5f5 url(pattern.png) no-repeat center; border: #000 1px solid; color: inherit; } /* and now the specific divs */ #pageHeader { padding: 5px; height: 160px; margin: 5px; border: #000 solid 1px; text-align: left; background: #fff url(tophead.png) no-repeat top left; color: inherit; } #pageHeader h1, #pageHeader h2 { display: none; } #quickSummary { border: 1px #000 dotted; background: #fff; color: inherit; font-size: 0.85em; } #quickSummary, #preamble, #supportingText { text-align: left; margin: 1em 170px 1em 25px; padding: 5px; } #quickSummary a, #preamble a, #supportingText a { text-decoration: none; font-weight: bold; } #explanation { /* a little inelegant, but gets the job done */ margin-top: -3em; } #linkList { position: absolute; top: 180px; right: 0; padding: 25px 5px 5px 5px; margin: 0; width: 150px; background: url(spikes.png) no-repeat center top; } #lselect ul, #lresources ul, #larchives ul { margin: 0 0 0.5em 0; padding: 0; } #lselect ul li, #lresources ul li, #larchives ul li{ list-style-type: none; border: #000 1px solid; padding: 2px; margin: 2px; text-align: left; background: #fff; color: inherit; } /* there seems to be an issue in Opera with the hover on the lselect... any clues to a solution would be appreciated ;) */ #lselect ul li:hover, #lresources ul li:hover, #larchives ul li:hover { background: #900; color: #fff; } #lselect ul li:hover a, #lresources ul li:hover a, #larchives ul li:hover a { background: inherit; color: #eee; } #lselect ul a:hover, #lresources ul a:hover, #larchives ul a:hover { /* this style is there to make up for IE's inability to apply :hover pseudo to an li. of course, it won't look the same as having the whole li turn red, but it should be an acceptable compromise */ background: #900; color: #eee; } #lresources, #larchives { padding: 25px 5px 5px 5px; background: url(spikes.png) no-repeat center top; } #footer { margin: 0; padding: 5px; /* again, I can live with IE's dashed line */ border: 1px #000 dotted; background: #fff; color: inherit; text-align: center; } #footer a { margin-right: 20px; padding-left: 18px; background: url(bullet.png) no-repeat left center; } /* and now for the big caps for each paragraph in supportingText this is again hidden from IE, as it tends to crash otherwise and I really can't be bothered to work around its flaws...consider it icing on the cake for non-IE users */ body > div#supportingText p:first-letter { font: 2em Times, Helvetica, serif; float: left; text-transform: uppercase; margin: 0 3px 3px 0; padding: 0; } /* the following two rules may be just a minor detail, but i think it's worth it. they add a little download icon in front of the sample CSS and HTML download links. the first one works in all 5+ browsers, whereas the second one is only for CSS2 compliant ones. also, use of the |= selector may be "unorthodox", but it was the best I could come up with since the two download links in the "participation" div are not especially marked up with a class, AND there are other links in that div ("CSS Resource Guide", "Send us a link" and "contact me") that do not need the little icon...hence the rule could not be applied to "#participation a" */ #quickSummary a { padding-left: 15px; background: url(download.png) no-repeat left center; } #participation a[href|=zengarden] { /* CSS2-compliant only */ padding-left: 15px; background: url(download.png) no-repeat left center; } /* no need for extras...they're just not displayed */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; }/* css Zen Garden submission 028 - 'Atlantis' by Kevin Davis, http://alazanto.org/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Kevin Davis */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* for more work by the author, see http://alazanto.org */ /* have a great day! :) */ /******************************************************************* primary elements */ body { background-color: #000; color: #ccc; margin: 0px; padding: 0px; text-align: center; } p { font: 11pt/16pt georgia,palatino,times,serif; text-align: left; } /******************************************************************* primary hyperlink styling */ a:link { font-weight: normal; text-decoration: none; background-color: transparent; color: #bcf; } a:visited { font-weight: normal; text-decoration: none; background-color: transparent; color: #bde; } a:hover, a:active { text-decoration: underline; background-color: transparent; color: #fff; } /******************************************************************* body content */ #container { position: relative; margin-top: 0px; margin-left: auto; margin-bottom: 0px; margin-right: auto; padding: 1px; /* messy method of overcoming a rendering bug in mozilla 1.4, maybe others */ font: 8pt/12pt georgia,palatino,times,serif; color: #ddd; background: #000 url(backdrop.title.jpg) no-repeat top left; width: 749px; voice-family: "\"}\""; voice-family:inherit; width: 750px; } #pageHeader { display: none; } #pageHeader h1 { display: none; } #pageHeader h1 span { display: none; } #pageHeader h2 { display: none; } #pageHeader h2 span { display: none; } #intro { position: relative; margin-top: 225px; margin-left: 218px; margin-bottom: 10px; margin-right: 39px; padding-top: 10px; padding-left: 10px; padding-bottom: 0px; padding-right: 10px; border: 1px dashed #fff; } #quickSummary { float: left; clear:both; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 7px; width: 165px; voice-family: "\"}\""; voice-family:inherit; width: 175px; } #quickSummary p { font: italic 10pt/22pt georgia,palatino,times,serif; text-align:center; margin: 4px; padding: 0px; } #preamble { clear: right; padding-top: 0px; padding-left: 0px; padding-bottom: 0px; padding-right: 0px; } #intro h3 { margin-top: 0px; margin-left: 0px; margin-bottom: 15px; margin-right: 0px; padding-top: 1px; padding-left: 0px; padding-bottom: 3px; padding-right: 0px; background-color: transparent; font: 14pt georgia,palatino,times,serif; font-weight: normal; text-align: left; color: #fff; } #supportingText { margin-top: 0px; margin-left: 218px; margin-bottom: 10px; margin-right: 39px; padding: 0px; } #supportingText h3 { margin-top: 15px; margin-left: 0px; margin-bottom: 15px; margin-right: 0px; padding-top: 1px; padding-left: 0px; padding-bottom: 3px; padding-right: 0px; font: 14pt georgia,palatino,times,serif; font-weight: normal; text-align: left; background-color: transparent; color: #fff; border-top: 1px solid #fff; border-bottom: 1px solid #fff; } #footer { margin-top: 30px; margin-left: 0px; margin-bottom: 30px; margin-right: 0px; text-align: center; background-color: transparent; color: #fff; border-top: 1px solid #fff; border-bottom: 1px solid #fff; } #footer a:link, #footer a:visited { background-color: transparent; margin-left: 10px; margin-right: 10px; } /******************************************************************* link list */ #linkList { position: absolute; margin: 0px; padding: 0px; top: 435px; left: 50px; width: 150px; text-align: left; } #linkList h3.select { background: transparent url(linkhead-select.jpg) no-repeat top left; margin: 0px 0px 0px 0px; width: 150px; height: 21px; } #linkList h3.select span { display: none; } #linkList h3.favorites { background: transparent url(linkhead-favorites.jpg) no-repeat top left; margin: 10px 0px 0px 0px; width: 150px; height: 21px; } #linkList h3.favorites span { display: none; } #linkList h3.archives { background: transparent url(linkhead-archives.jpg) no-repeat top left; margin: 10px 0px 0px 0px; width: 150px; height: 21px; } #linkList h3.archives span { display: none; } #linkList h3.resources { background: transparent url(linkhead-resources.jpg) no-repeat top left; margin: 10px 0px 0px 0px; width: 150px; height: 21px; } #linkList h3.resources span { display: none; } #linkList ul { margin-top: 0px; margin-bottom: 10px; margin-left: 10px; margin-right: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; background: transparent url(cr1.gif) no-repeat top center; display: block; padding-top: 5px; margin-bottom: 5px; } #lselect li, #lfavorites li { background: url(docbullet.gif) no-repeat 0px 7px; padding-left: 11px; } #lselect a, #lfavorites a { display:block; text-transform:lowercase; } #lselect a.c, #lfavorites a.c {display:inline; text-transform: none; }/* css Zen Garden submission 029 - 'Backyard' by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Ray Henry */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { background: #fff url(main_bg.gif) repeat-x top left; margin: 0; padding: 0; text-align:left; height:100%; width:100%; } p { margin-top: 0px; text-align: left; } a:link { font-weight: bold; text-decoration: underline; color: #616157; } a:visited { font-weight: bold; text-decoration: underline; color: #616157; } a:hover, a:active { text-decoration: underline; color: #811610; } /* specific divs */ #container { background:transparent; padding: 0px; margin: 0px; width:770px; } #intro { background: transparent url(quicksum_bg.gif) no-repeat top left; width:770px; margin-top:28px; margin-bottom:0; } #pageHeader { margin: 0; padding:0; width:770px; height:72px; voice-family: "\"}\""; voice-family:inherit; margin-bottom:22px; } #pageHeader h1 { background: transparent url(intro_bg.jpg) no-repeat top left; margin-top: 0; width: 403px; height: 72px; float: left; } #pageHeader h2 { background: transparent url(intro_bg2.jpg) no-repeat top left; margin: 0; width: 367px; height: 72px; float: right; } #pageHeader h1 span, #pageHeader h2 span { display:none } #quickSummary { background:transparent; float:left; clear:both; padding-top:10px; padding: 10px; border-top:1px dashed #999; width: 200px; font-family:georgia, serif; font-size: 12px; line-height:30px; color:#616157; voice-family: "\"}\""; voice-family:inherit; margin-top:-1.8em; width:180px; } #quickSummary p.p1:first-letter { padding-right:5px; font-size: 300%; color:#811610; } #preamble p.p1:first-letter { padding-right:5px; font-size: 300%; color:#811610; } #quickSummary p.p2 { line-height:18px; font-family:verdana, arial, sans serif; font-size:11px; } #preamble { background:transparent; clear:both; padding: 10px; width: 200px; font-family:georgia, serif; font-size: 12px; line-height:30px; color:#616157; z-index:5; voice-family: "\"}\""; voice-family:inherit; width:180px; } #preamble h3{ line-height:16px; font-size:15px; padding-bottom:10px; padding-top:10px; border-top:1px solid #811610; border-bottom:1px solid #811610; } #supportingText { background:#F7F7F2; position:absolute; top:100px; padding: 10px; margin-left:200px; border-top:1px solid #999; border-left:1px solid #999; border-bottom:1px solid #999; border-right:1px solid #999; width:366px; height:auto; font-family:georgia, serif; font-size:13px; line-height:19px; color:#616157; voice-family: "\"}\""; voice-family:inherit; margin-left:200px; width:344px; top:100px; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin-bottom:10px; width:300px; height:15px; border-bottom:1px dashed #999; } #explanation h3 { background: transparent url(sup_h3_a.gif) no-repeat; } #participation h3 { background: transparent url(sup_h3_b.gif) no-repeat; } #benefits h3 { background: transparent url(sup_h3_c.gif) no-repeat; } #requirements h3 { background: transparent url(sup_h3_d.gif) no-repeat; } #supportingText h3 span{ display:none; } #footer { text-align: center; border-top:1px solid #CBCBC2; font-family:verdana, arial, sans serif; font-size:10px; } #footer a:link, #footer a:visited { margin: 5px; font-weight: normal; } #linkList { background: url(linklist_bg.gif) no-repeat top left; margin-left: 566px; position: absolute; top: 100px; height:100%; voice-family: "\"}\""; voice-family:inherit; margin-left:566px; } #linkList2 { font: 10px verdana, sans-serif; padding: 10px; width: 204px; } #linkList h3.select, #linkList h3.archives, #linkList h3.resources{ width:180px; height: 20px; } #linkList h3.select { background: transparent url(linklist_a.gif) no-repeat top left; margin: 25px 0px 5px 0px; } #linkList h3.archives { background: transparent url(linklist_b.gif) no-repeat bottom left; margin: 25px 0px 10px 0px; border-top:1px dashed #ccc; padding-top:5px; } #linkList h3.resources { background: transparent url(linklist_c.gif) no-repeat bottom left; margin: 25px 0px 10px 0px; border-top:1px dashed #ccc; padding-top:5px; } #linkList h3.select span, #linkList h3.archives span, #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; color:#555; } #linkList li { list-style-type: none; background: transparent; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #555; } #linkList li a:visited { color: #555; } #linkList li a:hover, #linkList li a:active { color:#811610; } a.c:link, a.c:visited, a.c:hover, a.c:active { font-weight:normal; } #extraDiv1, #extraDiv2 { display:none; }/* css Zen Garden submission 030 - 'Entomology' by Jon Hicks, http://exp.hicksdesign.co.uk/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jon Hicks */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { background: #B61E3D url(bkgd.jpg); font: 12px/16px Georgia, "Times New Roman", Times, serif; color: #390404; margin: 0px; } p { margin-top: -0.8em; } p+p { text-indent: 15px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.3em; margin-top: 2em; } a:link, a:visited { font-style: italic; text-decoration: none; color: #039; } a:visited { font-style: normal; } a:hover, a:active { background: #ffe699; } /* main text divs */ #container { background: #ffc url(mid.jpg) repeat-y center; position: absolute; left: 50%; width: 760px; margin-left: -380px; } #intro { margin: 0px; background: url(top.jpg) no-repeat center top; padding-top: 186px; } #pageHeader h1 span, #pageHeader h2 span { display:none } #quickSummary p.p1:first-line { text-transform: uppercase; } #quickSummary { margin-top: 30px; } #quickSummary p { font-size: 13px; line-height: 22px; } #quickSummary, #preamble, #supportingText { margin-right: 80px; margin-left: 300px; } #supportingText p.p5{ background: url(line.jpg) no-repeat center bottom; margin-right: -80px; margin-left: -300px; margin-top: 30px; height: 30px; text-align: center; } #footer { background: url(bot.jpg) no-repeat center bottom; margin-right: -80px; margin-left: -300px; height: 110px; text-align: center; } #footer a:link, #footer a:visited { font-size: 15px; color: #390404; } /* sidelinks styles */ #linkList { background: url(b5.jpg) no-repeat center bottom; padding-bottom: 150px; width: 195px; position: absolute; left: 90px; top: 200px; border-right: 1px dotted #930; } #linkList h3 { text-align: center; font-style: italic; text-transform: lowercase; letter-spacing: 0.1em; } #linkList h3.select { background: url(b1.jpg) no-repeat center top; padding-top: 110px; font-style: italic; text-transform: lowercase; margin-top: 0px; } linkList h3.favorites { margin-top: 30px; background: url(b2.jpg) no-repeat center top; padding-top: 110px; } #linkList h3.archives { margin-top: 30px; background: url(b3.jpg) no-repeat center top; padding-top: 110px; } #linkList h3.resources { margin-top: 30px; background: url(b4.jpg) no-repeat center top; padding-top: 105px; } #linkList ul { margin: -0.5em 0 0 0; padding: 0px; list-style-type: none; text-align: center; } #linkList li { background: url(listline.gif) no-repeat center bottom; padding-bottom: 15px; } #linkList #lselect a { display: block; font-style: normal; text-transform: uppercase; letter-spacing: 0.1em; } #linkList #lselect a.c{ display: inline; margin-bottom: -1em; font-style: italic; text-transform: none; letter-spacing: 0em; } #linkList #lselect li{ font-style: italic; } /* CSS 2 pseudo elements - not essential but nice in browsers that support it */ h3:first-letter { font-size: 16px; } #linkList h3 :before { content: "("; } #linkList h3 :after { content: ")"; } #footer a:before { content: "{ "; } #footer a:after { content: " }"; } /* css Zen Garden submission 031 - 'Hedges' by Kev Mears, http://www.mearso.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Kev Mears */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* structure --------------------------------- */ body { margin: 0; padding: 0; background: #FFF url("bg_tree.gif") repeat-x left top; color: #888; text-align: center; } #container { position: relative; padding:0; width: 732px; margin: 0 auto; text-align: left; } /* hidden text --------------------------------- */ h1, h2, h3 { margin: 0; background-repeat: no-repeat; background-position: left top; } h1 span, h2 span,h3 span, #quickSummary p.p span { display: none; } /* header and summary --------------------------------- */ #pageHeader h1 { height: 200px; background: url("nutitle.gif") no-repeat; padding:0; } #quickSummary p.p1 { position: absolute; top: 12em; right: 15px; width: 120px; margin: 75px 0 0 580px; font-size: 80%; text-align: right; } #quickSummary p.p2 { position: absolute; top: 25em; right: 15px; width: 120px; margin: 0; font-size: 93%; text-align: center; padding-bottom: 90px; background: url("barrow.gif") no-repeat bottom; background-repeat: no-repeat; } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited { white-space: nowrap; font: bold 92%/1.3em Verdana,Arial,Sans-serif; text-transform: uppercase; } /* preamble --------------------------------- */ #preamble { position: relative; left: 195px; padding-bottom: 0px; width: 400px; } #preamble h3 { height: 70px; background-image: url("road.gif"); } #preamble p { width: 350px; } /* supporting text --------------------------------- */ #supportingText { position: relative; left: 195px; padding-bottom: 0px; border-bottom: 2px solid #363; width: 400px; } #supportingText p { line-height: 1.5em; } #supportingText h3 { height: 70px; } #explanation h3 { background-image: url("what.gif"); } #participation h3 { background-image: url("participation.gif"); } #benefits h3 { background-image: url("benefits.gif"); } #requirements h3 { background-image: url("requirements.gif"); } /* link list --------------------------------- */ #linkList { position: absolute; top: 200px; left: 0; width: 190px; } #linkList h3 { height: 41px; } #lselect h3 { background-image: url("select.gif"); } #larchives h3 { background-image: url("archives.gif"); } #lresources h3 { background-image: url("resources.gif"); } #linkList ul { margin: 1em 0 1em; padding: 0; font-size: 90%; list-style: none; text-align: left; } #larchives li, #lresources li { text-transform: lowercase; } #linkList ul li { margin: 0 0 .5em; line-height: 1em; } #linkList li a:link, #linkList li a:visited { font-family: Verdana,Arial,Sans-serif; font-size: 90%; } #linkList #lselect a:link, #linkList #lselect a:visited { display: block; } #linkList #lselect a.c:link, #linkList #lselect a.c:visited { display: inline; font-family: Georgia,Serif; font-weight: normal; background-color: transparent; text-transform: lowercase; } /* footer --------------------------------- */ #footer { background: #D9D98B; color: #fff; padding: 10px 20px; border-top: 1px solid #363; font: 85% Verdana,Arial,Sans-serif; text-align: center; } #footer a:link, #footer a:visited { padding: 0 5px; font-weight: normal; } /* links --------------------------------- */ a:link, a:visited { color: #090; background-color: transparent; font-weight: bold; text-decoration: none; } a:hover { color: #663; background-color: transparent; text-decoration: underline; } /* misc --------------------------------- */ acronym { border-width: 0; } /* css Zen Garden submission 032 - 'Crab Apple' by Jai Brinkofski - http://www.jaiandbecky.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jai Brinkofski */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* hide this stuff */ #pageHeader h1 span, #pageHeader h2 span, #pageHeader, #quickSummary p.p1, #preamble h3 span, #explanation h3, #participation h3, #benefits h3, #requirements h3, #lselect h3, #larchives h3, #lresources h3 {display: none} /* show this stuff */ body {background-color: #D0D1D0; background-image: url(banner.jpg); background-repeat: no-repeat; left: 0px; top: 0px; width: 770px} acronym {border-bottom-width: 1px; border-bottom-style: dashed; cursor: help} #container {background-image: url(t.jpg); background-repeat: no-repeat; left: 0px; top: 0px; background-position: 0px 99px; position: absolute; width: 770px; padding-bottom: 5px} #intro {position: relative; left: 133px; top: 207px; padding-bottom: 50px; z-index: 2} #quickSummary {top: -57px; position: absolute; left: 291px; z-index: 2} #quickSummary p.p2 {color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: bold} #quickSummary p.p2 a:link {color: maroon; font-weight: bold; font-size: 12px; text-decoration: none} #quickSummary p.p2 a:visited {color: maroon; font-weight: bold; font-size: 12px; text-decoration: none} #quickSummary p.p2 a:hover {color: yellow; font-weight: bold; font-size: 12px; text-decoration: none; background-color: #333333} #quickSummary p.p2 a:active {color: maroon; font-weight: bold; font-size: 12px; text-decoration: none} #preamble {width: 614px; position:relative; left: 7px; top: -40px; overflow: visible; z-index: 1; padding-right: 3px} #preamble p {padding-right: 20px; padding-left: 5px; font-family: Arial, Helvetica, sans-seri; font-size: 10px; color: #333333} #preamble p.p1 {padding-top: 28px} #supportingText {font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #333333; width: 614px; position:relative; left:141px; margin-top: 30px; top: 100px; z-index: 1; border-width:1px;border-color:#c2c2c2; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; padding-right: 3px; margin-bottom: 100px} #supportingText p {padding-right: 20px; padding-left: 5px} #supportingText a:link {color: #FF0000; font-weight: normal; text-decoration: none} #supportingText a:visited {color: #990000; text-decoration: underline;} #supportingText a:hover {color: #FFFFFF; background-color: #666666; text-decoration: none} #supportingText a:active {color: #FF0000; text-decoration: underline overline; background-color: #FFFFFF} #explanation {background-image: url(sowhatisthisabout.jpg); background-repeat: no-repeat; padding-top: 23px; padding-right: 3px} #participation {background-image: url(participation.jpg); background-repeat: no-repeat; left: 0px; top: 153px; z-index: 1; padding-top: 23px} #benefits {background-image: url(benefits.jpg); background-repeat: no-repeat; left: 0px; top: 366px; z-index: 1; padding-top: 23px} #requirements {background-image: url(requirements.jpg); background-repeat: no-repeat; left: 0px; top: 466px; z-index: 1; padding-top: 23px} #footer {padding-left: 10px;} #footer a:link {font-family: Arial, Helvetica, sans-serif; color: #FFFFFF; font-weight: bold; font-size: 12px} #footer a:hover {font-family: Arial, Helvetica, sans-serif; color: yellow; font-weight: bold; font-size: 12px; background-color: #333333} #linkList {position: absolute; left: 9px; top: 0px; width: 121px; font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #333333; z-index: 2; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-color: #c2c2c2; border-bottom-color: #c2c2c2; border-left-color: #c2c2c2; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; margin-top: 208px; bottom: 5px} #linkList a:link {color: #003366; font-weight: normal; text-decoration: none} #linkList a:visited {color: #000033; font-weight: normal; text-decoration: none} #linkList a:hover {color: #FFFFFF; font-weight: normal; text-decoration: none; background-color: #666666} #linkList a:active {color: #FF0000; text-decoration: underline overline; background-color: #FFFFFF} #lselect {width: 121px; left: 0px; top: -1px; z-index: 1; padding-top: 23px} #larchives {background-image: url(archives.jpg); background-repeat: no-repeat; left: 0px; width: 121px; z-index: 1; padding-top: 23px; background-position: -9px 0px} li {list-style-position: outside; list-style: url(li.jpg); margin: 0px 10px 0px -10px; padding-top: 7px} #lresources {background-image: url(resources.jpg); background-repeat: no-repeat; left: 0px; width: 121px; z-index: 1; padding-top: 23px; background-position: -9px 0px}/* css Zen Garden submission 033 - 'Fleur-de-lys' by Claire Campbell, http://www.tanfa.co.uk/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Claire Campbell */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font: 100% verdana, helvetica, arial, sans-serif; margin: 0; padding: 0; background: #f0e7d7; color: #000; text-align: center; min-width: 760px; } p, ul, #footer {font-size: 0.8em;} h1, h2, h3 { font-family: georgia, serif; letter-spacing: 0.1cm; } a:link, a:visited, a:active { color: #800000; background: transparent; font-weight: bold; font-size: 0.9em; text-decoration: none; } a:hover { color: #aaab9c; background: transparent; text-decoration: underline; } #intro {clear: both;} #container { width: 760px; background: #f0e7d7 url(bodybg.jpg) repeat-y 0% 0%; color: #000; padding: 0; margin: 0 auto; } #pageHeader { position: relative; float: right; width: 230px; padding: 0; margin: 0; margin-left: -3px; background: #f0e7d7; color: #000; } #pageHeader h1 { background: #f0e7d7 url(zenhead.jpg) no-repeat 0% 0%; color: #800000; height: 174px; padding: 0; margin: 0; } #pageHeader h2 { padding: 0; margin: 0; display: none; } #pageHeader h1 span {display: none;} #quickSummary { position: relative; width: 230px; float: right; clear: right; background: transparent url(summarybg.gif) no-repeat bottom left; color: #000; margin: 0; padding: 0 0 20px 0; } #quickSummary p { font-family: georgia, serif; margin: 0; padding: 10px 10px 10px 20px; text-align: right; } #preamble { width: 530px; background: #fff url(lilybg.jpg) no-repeat 0% 0%; color: #000; margin: 0; padding: 50px 0 0 0; } #preamble h3 { width: 350px; height: 40px; padding: 0; margin: 0 0 0 170px; } #preamble h3 span {display: none;} #preamble p { padding: 0; margin: 0; padding: 20px 30px 0px 0px; text-align: justify; } #preamble p.p3 { padding-bottom: 20px; } #preamble p:first-letter { color: #800000; background: transparent; font-size: 16px; font-weight: bold; vertical-align: baseline; } #preamble p.p1 {margin-left: 200px;} #preamble p.p2 {margin-left: 180px;} #preamble p.p3 {margin-left: 80px;} #supportingText { float: left; clear: left; text-align: justify; background: #fff url(supportbg.gif) no-repeat top right; color: #000; padding-bottom: 20px; padding-top: 23px; border-right: 10px solid #800000; width: 530px; \width: 540px; w\idth: 530px; } #supportingText h3 { padding: 5px 30px 6px 0; margin: 10px 0 0 0; border-top: 1px solid #aaab9c; font-size: 0.9em; text-align: right; background: #fff url(suph3bg.jpg) no-repeat bottom right; color: #aaab9c; } #supportingText h3 span {} #supportingText p {padding: 15px 20px 0 50px; margin: 0;} #supportingText p:first-letter { color: #800000; background: transparent; font-size: 16px; font-weight: bold; vertical-align: baseline; } #explanation { background: #fff url(sowhatbg.jpg) no-repeat 0% 0%; color: #000; } #explanation h3 {visibility: hidden;} #explanation h3 span {} #explanation p.p1 {padding-top: 30px;} #requirements p.p5 { text-align: right; padding-bottom: 0; margin-bottom: -180px; } #linkList { margin: 0; padding: 0; margin-left: 530px; padding: 30px 15px 20px 0px; } #linkList h3 { padding: 5px 0 6px 30px; margin: 0; border-top: 1px solid #aaab9c; border-right: 1px solid #aaab9c; font-size: 0.9em; text-align: right; background: #f0e7d7 url(listh3bg.jpg) no-repeat bottom left; color: #aaab9c; text-align: left; } #linkList ul { margin: 0; padding: 0 0 10px 0; color: #aaab9c; background: transparent; border-right: 1px solid #aaab9c; } #linkList li { list-style-type: none; display: block; padding: 0; margin: 0; padding: 0; } #linkList #lselect li {padding: 1px 0; margin: 3px 0;} #linkList #larchives li, #linkList #lresources li { padding: 1px 0; margin: 0; text-align: right; } #larchives, #lresources { margin-top: 30px; text-align: left; } #lselect a, #larchives a, #lresources a { display:block; text-transform: lowercase; font-family: georgia, serif; font-size: 0.9em; font-weight: 700; padding: 10px 0 3px 0; } #lselect a { letter-spacing: 0.1em; background: #f0e7d7 url(linkbg.jpg) no-repeat 50% 0%; color: #800000; } #larchives a, #lresources a { font-family: verdana, helvetica, arial, sans-serif; background: #f0e7d7; padding: 3px 30px 3px 0; margin: 0; background: #f0e7d7 url(link2bg.jpg) no-repeat 100% 50%; color: #800000; } #lselect a.c { display:inline; text-transform: none; border-width: 0px; letter-spacing: 0; font-family: verdana, helvetica, sans-serif; background: #f0e7d7; color: #aaab9c; padding: 0; } #footer { margin: 0; padding: 0; position: relative; top: 0px; left: 630px; width: 6em; text-align: center; padding-bottom: 10px; } #footer a { display: block; width: 100%; background: #f7f2ea url(linkfootbg.jpg) no-repeat 0% 0%; color: #aaab9c; padding: 5px 0; border-width: 1px; border-color: #ffe #aaab9c #ccc #ffe; border-style: solid; text-decoration: none; } #footer a:hover { color: #800000; background: #f0e7d7 url(linkbg.jpg) no-repeat 0% 0%; border-color: #aaab9c #ffe #ffe #ccc; } #extraDiv1 { clear:both; display: block; position: relative; z-index: 10; padding: 0; margin: 0 auto; margin-top: -10px; background: #fff url(bottombg.jpg) no-repeat 109px 0; color: #000; height: 17px; width: 760px; } #extraDiv span #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display: none;} /* css Zen Garden submission 034 - 'zengrounds' by Andrea Piernock, http://www.snooble.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Andrea Piernock */ /* Style based on newgrounds.com, adapted with permission */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { margin: 0; padding: 0; background: #222 url(bg_main.gif) top left repeat-x; color: #fff; font-family: Verdana, Helvetica, Arial, sans-serif; } a { background: transparent; text-decoration: none; } a:link { color: #fc3; } a:visited { color: #f90; } a:active { color: #fff; } a:hover { color: #ff3; } acronym { cursor: help; border-bottom: 1px dotted #fff; } a acronym { cursor: help; border-bottom: 1px dotted #fc3; } #container { position: relative; top: 0; left: 50%; width: 750px; margin: 0 0 0 -375px; padding: 0; background: #222; } #container #intro { margin: 0 215px 0 0; padding: 10px 0 0 0; border-right: 10px solid #4E441B; } #container #intro #pageHeader { width: 500px; height: 105px; margin: 0 10px; padding: 10px 0 0 0; background: url(csszen.gif) top left no-repeat; } #container #intro #pageHeader h1, #container #intro #pageHeader h2 { display: none; } #container #intro #quickSummary { margin: 0 20px; padding: 0 0 10px 0; } #container #intro #quickSummary p.p1 { height: 75px; margin: 0; padding: 0; background: url(demo.gif) top left no-repeat; } #container #intro #quickSummary p.p1 span { display: none; } #container #intro #quickSummary p.p2 { margin: 10 0 0 0; padding: 0; font-size: 0.7em; font-weight: bold; text-align: center; } #container #intro #preamble { width: 500px; margin: 0 10px 15px 10px; padding: 0 0 15px 0; background: url(bottomRoad.gif) bottom left no-repeat; } #container #intro #preamble h3 { height: 15px; margin: 0; padding: 0; background: url(road.gif) top left no-repeat; } #container #intro #preamble h3 span { display: none; } #container #intro #preamble p { margin: 0; padding: 5px 10px; background: url(tileRoad.gif) top left repeat-y; font-size: 0.8em; } #container #supportingText { margin: 0 215px 0 0; padding: 0; border-right: 10px solid #4E441B; } #container #supportingText div { width: 500px; margin: 0 10px 15px 10px; padding: 0; background: url(textBoxBg.gif) bottom left repeat-y; } #container #supportingText h3 { height: 65px; margin: 0; padding: 0; } #container #supportingText h3 span { display: none; } #container #supportingText #explanation h3 { background: url(textBoxHeadExplain.gif) top left no-repeat; } #container #supportingText #participation h3 { background: url(textBoxHeadPart.gif) top left no-repeat; } #container #supportingText #benefits h3 { background: url(textBoxHeadBenefits.gif) top left no-repeat; } #container #supportingText #requirements h3 { background: url(textBoxHeadRequir.gif) top left no-repeat; } #container #supportingText p { margin: 0; padding: 0 10px 10px 15px; font-size: 0.8em; } #container #supportingText p.p1 { margin-top: -35px; padding-right: 75px; } #container #supportingText #explanation p.p2, #container #supportingText #participation p.p4, #container #supportingText #benefits p.p1, #container #supportingText #requirements p.p5 { padding-bottom: 25px; background: url(textBoxBottom.gif) bottom left no-repeat; } #container #supportingText #footer { margin: 0; padding: 0 0 25px 0; background: none; font-size: 0.7em; font-weight: bold; text-align: center; } #container #supportingText #footer a { margin: 0; padding: 0 10px; border-left: 5px solid #666; border-right: 5px solid #666; } #container #supportingText #footer a:hover { background: #444; color: #fff; } #container #linkList { position: absolute; top: 0; right: 0; width: 225px; margin: 0; padding: 5px 0 0 0; background: url(linkTile.gif) top right repeat-y; } #container #linkList #linkList2 div h3 span { display: none; } #container #linkList #linkList2 #lselect a { display: block; width: 100%; } #container #linkList #linkList2 #lselect a.c { display: inline; width: auto; } #container #linkList #linkList2 #lselect { margin: 0 0 10px 0; padding: 0 0 20px 0; background: url(styleBottom.gif) bottom right no-repeat; } #container #linkList #linkList2 #lfavorites, #container #linkList #linkList2 #larchives, #container #linkList #linkList2 #lresources { margin: 0 0 10px 0; padding: 0 0 15px 0; background: url(boxBottom.gif) bottom right no-repeat; } #container #linkList #linkList2 #lselect h3.select, #container #linkList #linkList2 #lfavorites h3.favorites, #container #linkList #linkList2 #larchives h3.archives, #container #linkList #linkList2 #lresources h3.resources { height: 40px; margin: 0; padding: 0; } #container #linkList #linkList2 #lselect h3.select { background: url(headStyle.gif) top right no-repeat; } #container #linkList #linkList2 #lfavorites h3.favorites { background: url(faves.gif) top right no-repeat; } #container #linkList #linkList2 #larchives h3.archives { background: url(arcs.gif) top right no-repeat; } #container #linkList #linkList2 #lresources h3.resources { background: url(res.gif) top right no-repeat; } #container #linkList #linkList2 #lselect ul { list-style: none; margin: 0 10px 0 0; padding: 0 10px 5px 80px; background: url(tileStyle.gif) top right repeat-y; } #container #linkList #linkList2 #lfavorites ul, #container #linkList #linkList2 #larchives ul, #container #linkList #linkList2 #lresources ul { list-style: none; margin: 0 10px 0 0; padding: 0 10px 5px 40px; background: url(tile.gif) top right repeat-y; } #container #linkList #linkList2 #lselect li, #container #linkList #linkList2 #lfavorites li, #container #linkList #linkList2 #larchives li, #container #linkList #linkList2 #lresources li { margin: 0; padding: 0; font-size: 0.7em; }/* css Zen Garden submission 035 - 'Release One' by Didier Hilhorst, http://www.nundroo.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Didier Hilhorst */ /* Added in 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Overall Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ body { background: #d8d8d8 url(bg.gif) repeat-y top left; font-family: 'Lucida Grande','Lucida Sans Unicode',arial,verdana,sans-serif; margin: 0; padding: 0; color: #666; } /* Layout Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #container { background: transparent url(bg_rel-one.gif) no-repeat bottom right; margin: 0; padding: 0; } #intro { background: transparent url(bg_pattern.gif) repeat top left; margin: 0; padding: 0; border-bottom: 2px solid #fff } #supportingText { background: transparent url(bg_left.gif) repeat-y top left; margin: 0; padding: 0; } #pageHeader { background: #9bec37 url(bg_header.gif) repeat-y top left; color: #666; height: 180px; margin: 0; border-bottom: 2px solid #fff; } #pageHeader h1 { display: none; } #pageHeader h2 { display: none; } #quickSummary { height: 166px; width: 735px; background: #100b0a url(bg_sub_header.jpg) no-repeat top right; color: #fff; border-bottom: 2px solid #fff; margin: 0; } #quickSummary p.p1 { padding: 14px; margin: 0; width: 188px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 160px; /* Actual value for conformant browsers */ } html>#quickSummary p.p1 { width: 160px; /* Be nice to Opera */ } #quickSummary p.p2 { padding: 0px 14px 14px 14px; margin: 0; width: 158px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 130px; /* Actual value for conformant browsers */ } html>#quickSummary p.p2 { width: 130px; /* Be nice to Opera */ } #preamble { margin-left: 233px; background: #f90 url(bg_preamble.gif) no-repeat top right; color: #fff; border-right: 2px solid #fff; padding-bottom: 16px; width: 502px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 500px; /* Actual value for conformant browsers */ } html>#preamble { width: 500px; /* Be nice to Opera */ } #explanation, #participation, #benefits { margin-left: 233px; border: 1px solid #bbb; background: #f5f5f5; color: #666; margin-bottom: 2px; width: 500px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 498px; /* Actual value for conformant browsers */ } html>#explanation, #participation, #benefits { width: 498px; /* Be nice to Opera */ } #requirements { margin-left: 233px; border: 1px solid #bbb; background: #f5f5f5; color: #666; margin-bottom: 0; padding-bottom: 16px; width: 500px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 498px; /* Actual value for conformant browsers */ } html>#requirements { width: 498px; /* Be nice to Opera */ } #footer { border-top: 2px solid #fff; background: #9bec37 url(bg_footer.gif) no-repeat top left; color: #fff; padding: 14px 0 8px 252px; height: 36px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; height: 12px; /* Actual value for conformant browsers (IE6 needs a height value to display the background correctly. Don't even start...) */ } html>#footer { height: 12px; /* Be nice to Opera */ } #linkList { position: absolute; background: #b5b5b5; color: #666; top: 350px; padding: 12px; border-right: 2px solid #fff; width: 231px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 207px; /* Actual value for conformant browsers */ } html>#linkList { width: 207px; /* Be nice to Opera */ } #larchives, #lfavorites, #lresources { background: #dfdfdf; color: #666; border: 2px solid #fff; padding: 12px; margin: 0 0 12px 0; } #lselect { background: #dfdfdf url(bg_lselect.gif) no-repeat top right; color: #666; border: 2px solid #fff; padding: 12px; margin: 0 0 12px 0; } /* Text Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ p { font-size: 11px; text-align: justify; } #preamble p, #quickSummary p.p2 { line-height: 1.5; color: #fff; background: transparent; } #preamble p { font-size: 10px; width: 250px; text-align: justify; } #preamble p.p1 { margin: 16px 18px 10px 18px; } #preamble p.p2 { margin: 0 18px 10px 18px; } #preamble p.p3 { padding: 0; margin: 0 18px 0 18px; } /* First Paragraphs */ #explanation p.p1, #participation p.p1, #requirements p.p1 { padding: 0; margin: 16px 18px 12px 18px; } /* Intermediate Paragraphs */ #participation p.p2, #participation p.p3, #requirements p.p2, #requirements p.p3, #requirements p.p4 { padding: 0; margin: 12px 18px 12px 18px; } /* Last Paragraphs */ #explanation p.p2, #participation p.p4 { padding: 0; margin: 0px 18px 16px 18px; } #requirements p.p5 { margin: 0px 18px 0px 18px; padding: 0; } /* One Paragraph */ #benefits p.p1 { margin: 16px 18px 16px 18px; } #supportingText p { line-height: 1.5; } #quickSummary p.p1 { font-size: 9px; background: transparent; color: #999; text-align: left; } #quickSummary p.p2 { font-size: 9px; color: #999; text-align: left; } #footer { font-size: 9px; font-family: 'Arial', Helvetica, sans-serif; /* Looks slightly better */ } /* Lists Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #linkList ul { font-size: 10px; list-style:none; margin: 0; padding: 0; } #linkList ul li { background: url(bullet_gen.gif) no-repeat 2px 3px; margin: 0; padding: 0 0 5px 15px; line-height: 12px; color: #999; } #linkList #lselect li { background: url(bullet_design.gif) no-repeat 2px 3px; font-size: 9px; } #linkList #lfavorites li { background: url(bullet_fav.gif) no-repeat; font-size: 9px; } #linkList #lselect a:link, #linkList #lselect a:visited, #linkList #lfavorites a:link, #linkList #lfavorites a:visited { display: block; } #linkList #lselect a.c:link, #linkList #lselect a.c:visited, #linkList #lfavorites a.c:link, #linkList #lfavorites a.c:visited { display:inline; } #larchives li, #lresources li { text-transform: lowercase; } /* Links Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ a, a:link, a:visited { background: transparent; color: #333; text-decoration: underline; } a:hover { background: transparent; color: #333; text-decoration: none; } #quickSummary a, #quickSummary a:link, #quickSummary a:visited { background: transparent url(download.gif) no-repeat 0 4px; color: #fff; text-transform: uppercase; text-decoration: none; padding-left: 8px; } #quickSummary a:hover { text-decoration: underline; } #linkList a, #linkList a:link, #linkList a:visited { background: transparent; color: #444; text-decoration: none; } #linkList a:hover { background: transparent; color: #333; text-decoration: underline; } #linkList a.c, #linkList a.c:link, #linkList a.c:visited { background: transparent; color: #666; text-decoration: none; } #linkList a.c:hover { background: transparent; color: #333; text-decoration: underline; } #linkList #lselect a { font-size: 10px; } #linkList #lselect a.c { font-size: 9px; text-transform: lowercase; } #footer a, #footer a:link, #footer a:visited { background: transparent url(arrow_footer.gif) no-repeat 0 2px; color: #fff; text-decoration: none; text-transform: uppercase; padding-left: 8px; } #footer a:hover { text-decoration: underline; } /* Headings Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ h3 { margin-bottom: 0px; } h3 span { display: none; } #linkList h3 { width: 150px; height: 20px; margin-top: 20px; } #preamble h3 { background: transparent url(title_road.gif) no-repeat top left; width: 500px; height: 34px; border-bottom: 2px solid #fff; margin: 0; height: 36px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; height: 34px; /* Actual value for conformant browsers */ } html>#preamble h3 { height: 34px; /* Be nice to Opera */ } #explanation h3, #participation h3, #benefits h3, #requirements h3 { width: 498px; height: 30px; margin: 0; } #explanation h3 { background: transparent url(title_about.gif) no-repeat top left; } #participation h3 { background: transparent url(title_partici.gif) no-repeat top left; } #benefits h3 { background: transparent url(title_benef.gif) no-repeat top left; } #requirements h3 { background: transparent url(title_req.gif) no-repeat top left; } #lselect h3, #lfavorites h3, #larchives h3, #lresources h3 { height: 28px; width: 100%; margin: 0; } #lselect h3 { background: transparent url(bg_select_des.gif) no-repeat top left; } #lfavorites h3 { background: transparent url(bg_select_fav.gif) no-repeat top left; } #larchives h3 { background: transparent url(bg_select_arc.gif) no-repeat top left; } #lresources h3 { background: transparent url(bg_select_res.gif) no-repeat top left; } /* Other Definitions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ acronym { cursor: help; } #preamble acronym { border-bottom: 1px dotted #ffe0b3; } #lresources acronym { border-bottom: 1px dotted #999; } #supportingText acronym { background: transparent url(acro.gif) no-repeat center right; padding-right: 11px; margin-right: 1px; cursor: help; border: 0; } #participation a acronym { background: transparent; padding: 0; margin: 0; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; /* I was tempted at times though... */ } img { display: none; }/* css Zen Garden submission 036 - 'White Lily' by Jens Kristensen, http://j-k.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jens Kristensen */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* You may use this file as a foundation for any new work, but you may find it easier to start from scratch. */ /* Not all elements are defined in this file, so you'll most likely want to refer to the xhtml as well. */ /* basic elements */ /*---------------------------------------------------*/ body, html, div { margin: 0; padding: 0; } body { font: 8pt/16pt verdana, geneva, arial, sans serif; color: #000; background: #fff url(lbg.gif) repeat-y; } /* specific divs */ /* container keeps it all together */ /*---------------------------------------------------*/ #container{ border-top:1px solid #230; border-right: 1px solid #230; width:760px; margin: 0px; padding: 0px; background: transparent url(topbg.gif) repeat-x; } /* intro div and its content */ /*---------------------------------------------------*/ #intro { margin:0; padding:0; margin-top:20px; width:760px; background: transparent url(lsh.gif) no-repeat 687px 231px; } #pageHeader { position:absolute; left:0; width: 355px; height:201px } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(centerpiece.jpg) no-repeat; margin-top: 0px; width: 355px; height: 201px; float: left; } #pageHeader h1 span,#pageHeader h2,#pageHeader h2 span { display:none; } #quickSummary{ margin: 0 0 0 355px; width:332px; height: 200px; background: #ABBC47 url(quicksumbg.gif); border-right:1px solid #ABBC47; border-top:1px solid #ABBC47; } #quickSummary p.p1 { font: bold 11px/14px arial,verdana, sans serif; color:#fff; padding:100px 30px 2px 30px; } #quickSummary p.p2{ position:absolute; left:0; top:230px; font: 10px verdana, arial, sans serif; color:#fff; margin:0 30px; } /* visually footer is moved up to be with the intro stuff */ #footer{ position:absolute; left:0; top:230px; font: 10px verdana, arial, sans serif; color:#fff; margin:0 30px 0 400px; width:340px; text-align:right; } #quickSummary p.p2 a, #footer a{ color:#fff; } #quickSummary p.p2 a:hover, #footer a:hover{ color:#230; background-color:#fff; text-decoration:none; } /* visually we now move into the main area of the page /*---------------------------------------------------*/ #preamble{ padding:50px 30px 30px 30px; margin:30px 0 0 355px; border-width:0 0 1px 1px; border-color:#fff #ddd; border-style:solid; text-align:left; background: transparent url(endsection.gif) no-repeat bottom center; width:343px; } #preamble p, #explanation p, #benefits p, #participation p, #requirements p{ text-align:justify; } #preamble h3{ background: transparent url(h3preamble.gif) no-repeat bottom left; margin: 0px; width: 270px; height: 36px; border-bottom:1px solid #ddd; } #preamble h3 span{ display:none } #preamble p.p1{ width: 270px; } #supportingText{ border-width:0 0 1px 1px; border-color:#fff #ddd; border-style:solid; margin:0px 0px 0px 355px; padding:50px 30px 0 30px; width:405px; voice-family: "\"}\""; voice-family: inherit; width:343px; } #explanation, #benefits, #participation, #requirements { padding:0 0 20px 0; margin-bottom:20px; text-align:left; background: transparent url(endsection.gif) no-repeat bottom center; } p{ padding-left: 8px; padding-right: 8px; } .p1{ margin-top:26px; } #quickSummary .p1{ margin-top:0; } /* use images to display headers */ #explanation h3{ background: transparent url(h3explanation.gif) no-repeat bottom left; } #benefits h3{ background: transparent url(h3benefits.gif) no-repeat bottom left; } #participation h3{ background: transparent url(h3participation.gif) no-repeat bottom left; } #requirements h3{ background: transparent url(h3requirements.gif) no-repeat bottom left; } #explanation h3, #benefits h3, #participation h3, #requirements h3 { margin: 0px; min-width: 200px; height: 36px; border-bottom:1px solid #ddd; } #explanation h3 span, #benefits h3 span, #participation h3 span, #requirements h3 span { display:none } /* and finally we place the list of links */ /*---------------------------------------------------*/ #linkList{ position:absolute; left:0px; top:252px; width:355px; padding:50px 30px 0 130px; background: transparent url(lsh.gif) no-repeat top left; voice-family: "\"}\""; voice-family: inherit; width:195px; } #linkList2{ padding:0; } /* use images for headers */ h3.select{ background: transparent url(h3select.gif) no-repeat bottom left; } h3.archives{ background: transparent url(h3archives.gif) no-repeat bottom left; } h3.resources{ background: transparent url(h3resources.gif) no-repeat bottom left; } h3.select, h3.archives, h3.resources { margin: 0px; min-width: 200px; height: 36px; border-bottom:1px solid #ddd; } h3.select span, h3.archives span, h3.resources span{ display:none } /* put some style on the lists */ /* first the list of designs */ #lselect ul { margin: 10px 0 0 0; padding: 10px; } #lselect li { line-height: 2.5ex; list-style-type: none; display: block; padding: 5px 0px 5px 25px; margin: 5px 0; border-bottom:1px solid #eee; background: transparent url(bullet.gif) no-repeat 0px 7px; } #lselect li a{ white-space:nowrap; display:block; font-weight:bold; } #lselect li a.c{ text-decoration:none; display:inline; font-weight:normal; } #lselect li a.c:hover{ text-decoration:underline; } /* then the lists of general info etc */ #larchives ul, #lresources ul { margin: 10px 0 0 0; padding: 10px; } #larchives li, #lresources li { list-style-type: none; display: block; padding: 0px; padding: 0px 0px 0px 25px; margin: 0; background: transparent url(bullet2.gif) no-repeat 2px 7px; } /* some generic stuff */ /*---------------------------------------------------*/ a { color:#230; } a:visited { color:#672; } a:hover { color:#ABBC47; } /* and finally we use one of the extra divs available */ /*---------------------------------------------------*/ #extraDiv1{ width:3px; height:18px; position:absolute; left:354px; top:252px; background: transparent url(ltop.gif) no-repeat; } /* css Zen Garden submission 037 - 'pret-a-porter' by Minz Meyer - www.minzweb.de */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All other graphics copyright 2003, Minz Meyer */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Well, though I know that web is not print, I wanted to try a visual concept that I designed for a printed brochure and see what happens when brought to screen. According to the printed object, which is heavily landscape format, I had to try the horizontal scrolling. (-- Didn't reinvent the wheel, Mike Pick already did this with his "What lies Beneath" design.) All in all I wanted to give it a look of a modern lifestyle and fashion magazine. The Photograph was shot by Thomas Moeller */ body { width: 2048px; margin: 0; padding: 0; color: #888398; background-color: #fff; background-image: url(bg_body.jpg); background-position: right; background-repeat: repeat-y; font: 11px/1.5 Arial, Verdana, sans-serif; } /* Different behaviour of the lady. Just a compromise for IE */ div#extraDiv2 { background-image: url(bg_face_ie.jpg); background-repeat: no-repeat; background-position: left bottom; position: absolute; left: 0; bottom: 0; height: 600px; width: 265px; } /* And now the cool stuff, hiding from IE with child-selectors */ body#css-zen-garden>div#extraDiv2 { background-image: url(bg_face.jpg); background-repeat: no-repeat; background-position: left bottom; position: fixed; left: 0; bottom: 0; height: 594px; width: 205px; z-index: 2; } /* Using Geckos capability of PNG transparency to create the smooth scrolling border, when the screen is scrolled and the content vanishes to the left */ body#css-zen-garden>div#extraDiv3 { position: fixed; left: 0; top: 0; height: 100%; z-index: 1; background-image: url(bg_white.png); width: 225px; } /* The Header, using the "old":)) FIR-method */ div#pageHeader { position: relative; left: 220px; width: 1828px; } div#pageHeader h1 { width: 493px; height: 83px; margin: 20px 0 0; background-image: url(csszengarden.jpg); } div#pageHeader h1 span { display: none; } div#pageHeader h2 { width: 1826px; height: 27px; background-image: url(thebeautyofcssdesign.jpg); background-position: right; background-repeat: no-repeat; margin-top: -10px; } div#pageHeader h2 span { display: none; } div#quickSummary { position: absolute; width: 1300px; left: 228px; top: 98px; letter-spacing: 0.1em; color: #A5A3B5; background-color: transparent; } /* Have the summary displayed in a single line */ div#quickSummary p.p2, div#quickSummary p.p1 { display: inline; margin: 0; } div#extraDiv1 { /*adding a border */ position: absolute; left: 225px; top: 90px; height: 1px; width: 1823px; background-color: #A5A3B5; color: inherit; } /* The main content. All positioned absolutely ----------------------------------------------- The text-links */ a:link, a:visited { color: #A52A2A; background-color: transparent; font-weight: bold; text-decoration: none; } a:hover { text-decoration: underline; } /* The Preamble */ div#preamble { position: absolute; left: 375px; top: 160px; width: 200px; text-align: justify; } div#preamble h3 { width: 200px; height: 25px; background-image: url(theroad.jpg); margin: 0 0 0.5em; } div#preamble h3 span { display: none; } div#preamble p { margin: 0 0.5em 0.5em; } /* Supporting Text --------------------------------------*/ div#explanation { position: absolute; left: 625px; top: 160px; width: 200px; text-align: justify; } div#explanation h3 { width: 200px; height: 25px; background-image: url(sowhatisthisabout.jpg); margin: 0 0 0.5em; } div#explanation h3 span { display: none; } div#explanation p { margin: 0 0.5em 0.5em; } div#participation { position: absolute; left: 875px; top: 160px; width: 200px; text-align: justify; } div#participation h3 { width: 200px; height: 25px; background-image: url(participation.jpg); margin: 0 0 0.5em; } div#participation h3 span { display: none; } div#participation p { margin: 0 0.5em 0.5em; } div#benefits { position: absolute; left: 1125px; top: 160px; width: 200px; text-align: justify; } div#benefits h3 { width: 200px; height: 25px; background-image: url(benefits.jpg); margin: 0 0 0.5em; } div#benefits h3 span { display: none; } div#benefits p { margin: 0 0.5em 0.5em; } div#requirements { position: absolute; left: 1375px; top: 160px; width: 400px; text-align: justify; } div#requirements h3 { width: 400px; height: 25px; background-image: url(requirements.jpg); margin: 0 0 0.5em; } div#requirements h3 span { display: none; } div#requirements p { margin: 0 0.5em 0.5em; } /* The Navigation ---------------------------------------*/ div#linkList { position: absolute; left: 1828px; top: 160px; width: 220px; background-color: transparent; color: inherit; background-image: url(bg_linklist.jpg); background-repeat: repeat-y; text-transform: lowercase; } div#linkList div#lselect li a:link, div#linkList div#lselect li a:visited { display: block; margin-left: -10px; padding-left: 26px; color: #8B879E; background-color: transparent; border-top: 1px solid #C6C6D2; background-image: url(linklistlink.jpg); background-repeat: no-repeat; } div#linkList li a:link, div#linkList div#lselect li a.c:link, div#linkList li a:visited, div#linkList div#lselect li a.c:visited { display: inline; background-image: none; color: #A52A2A; background-color: transparent; padding-left: 0; margin-left: 0; border: none; } div#linkList ul { list-style: none; margin: 0 0 0 25px; padding-left: 0; } div#linkList li { padding-left: 10px; } div#lselect h3 { float:left; margin-top: 0; width: 25px; height: 200px; background-image: url(selectadesign.jpg); background-repeat: no-repeat; } div#lselect h3 span { display: none; } div#larchives { clear:left; margin-top: 0; border-top: 10px solid #D9D6E7; } div#larchives h3 { float:left; margin-top: 0; width: 25px; height: 81px; background-image: url(archives.jpg); background-repeat: no-repeat; } div#larchives h3 span { display: none; } div#lresources { clear:left; margin-top: 0; border-top: 10px solid #D9D6E7; } div#lresources h3 { float:left; margin-top: 0; width: 25px; height: 95px; background-image: url(ressources.jpg); background-repeat: no-repeat; } div#lresources h3 span { display: none; } /* ...and the footer --------------------------------------*/ div#footer { position: absolute; left: 1828px; top: 3px; width: 220px; height: 20px; text-align: center; word-spacing: 0.1em; overflow: hidden; } div#footer a:link, div#footer a:visited { color: #B2AFC0; background-color: transparent; } /* and extra artwork */ div#extraDiv4 { position: absolute; left: 1828px; top: 20px; width: 214px; height: 65px; color: inherit; background-color: #D9D6E7; background-image: url(transition.jpg); background-repeat: no-repeat; }/* css Zen Garden submission 038 - 'Creepy Crawly' by Luke Redpath - www.sonicdeath.co.uk */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All other graphics copyright 2003, Luke Redpath */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Define main areas */ body { margin: 0; padding: 0; background: #97B661 url(body_bground.gif) repeat-y; } #container { width: 760px; background-color: #6E7F71; } /* Main Headers */ #pageHeader h1 { width: 760px; height: 150px; margin: 0; padding: 0; text-indent: -100em; overflow: hidden; background-image: url(h1_mainheader.jpg); } #pageHeader h2 { width: 760px; height: 123px; margin: 0; padding: 0; text-indent: -100em; overflow: hidden; background-image: url(h2_mainheader.jpg); } /* Main content */ #quickSummary { margin-left: 289px; background-image: url(summary_background.jpg); background-repeat: no-repeat; } #preamble, #supportingText { margin-left: 289px; } #quickSummary p, #preamble p, #supportingText p { margin: 0 30px 20px 20px;; padding: 0; font-family: Georgia, serif; font-size: 12px; line-height: 1.6; color: #DCEBDF; } /* Paragraph headers */ #preamble h3 { height: 36px; padding: 0; margin: 0 0 10px 0; text-indent: -100em; overflow: hidden; background: url(headers/preamble.gif) no-repeat; } #explanation h3 { height: 36px; padding: 0; margin: 0 0 10px 0; text-indent: -100em; overflow: hidden; background: url(headers/explanation.gif) no-repeat; } #participation h3 { height: 36px; padding: 0; margin: 0 0 10px 0; text-indent: -100em; overflow: hidden; background: url(headers/participation.gif) no-repeat; } #benefits h3 { height: 36px; padding: 0; margin: 0 0 10px 0; text-indent: -100em; overflow: hidden; background: url(headers/benefits.gif) no-repeat; } #requirements h3 { height: 36px; padding: 0; margin: 0 0 10px 0; text-indent: -100em; overflow: hidden; background: url(headers/requirements.gif) no-repeat; } /* Links */ #linkList { position: absolute; top: 273px; left: 0; width: 289px; margin: 0; padding: 0 0 0 32px; background-image: url(linklist_background.jpg); background-repeat: no-repeat; } #linkList2 { margin-right: 38px; } #linkList h3 { font-family: Georgia, serif; font-size: 15px; color: #DCEBDF; padding: 0; margin: 0 0 20px 0; } #linkList ul { margin: 0 0 20px 0; padding: 0 32px 0 0; list-style-type: none; font-family: Georgia, serif; font-size: 12px; color: #DCEBDF; } #linkList li { margin: 0 0 5px 0; padding: 0 0 20px 0; background: url(list_divider.gif) no-repeat; background-position: bottom center; text-align: center; } #lselect li a { display: block; text-transform: uppercase; } #lselect li a.c { display: inline; text-transform: none; } /* Link styles */ a:link { color: #E9EEDD; } a:hover { color: #FFF; } a:visited { color: #AAA; } /* Site footer */ #footer { text-align: right; padding: 40px 20px 20px 0; font-size: 11px; }/* css Zen Garden submission 039 - 'Erratic Blue' by Ian Main, http://www.e-lusion.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Ian Main */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Font resizing has been locked down. I didn't want it to come to this but it mangles my layout. */ /* basic elements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ body { margin: 0px; padding: 0px; font-family: verdana, arial, helvetica, sans-serif; color: #000; background: #ebebeb url(bg-grid.gif); height: 100%; text-align: center; } html { height: 100%; margin: 0px; padding: 0px; } p, h3 { margin: 0; padding: 0 0px 5px 0; } ul { margin: 0; padding: 2px 0 5px 0; } li { line-height: 1.6; } /* Old-School! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ acronym { cursor: help; } a acronym { cursor: help; } /* End Old-School! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ a:link { font-weight: 900; color: #777; text-decoration: none; } a:visited { font-weight: 900; color: #999; text-decoration: none; } a:hover, a:active { font-weight: 900; color: #555; } /* Layout */ #container { position: relative; width: 712px; padding: 0px; margin-left: auto; margin-right: auto; border: 1px solid #000; border-top: 0px; border-bottom: 0px; text-align: left; /* Could not get the right column to stretch heigh: 100% of window view. So I cheated and had to create a background image to fake the 100% column. */ background: #A1D9FC url(bg-full.gif) repeat-y; } html>body #container { width: 712px; /* ie5win fudge ends */ } #pageHeader h1{ left: 209px; width: 712px; height: 163px; background: transparent url(intro_bg.jpg) no-repeat; /* border-bottom: 3px solid #CCEDFF; Added to bevel lower edge. Layer orders were failing causing this to break. */ margin-top: 0; margin-bottom: 25px; } #pageHeader h1 span, #pageHeader h2 span, #extradiv1, #extradiv3, #extradiv4, #extradiv5, #extradiv6 { margin: 0; padding: 0; display: none; } /* Extra Divs - OverView, Footer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* An overview title for quickSummary. Great idea but couldn't get to work. It would have sat at the top of the right column. Oh well, next time maybe! */ /* #extraDiv1 { position: relative; margin-left: auto; margin-right: auto; background: transparent url(list_4.png) no-repeat; height: 57px; } */ #extraDiv2 { position: relative; margin-left: auto; margin-right: auto; margin-bottom: -20px; width: 712px; height: 25px; background: transparent url(foot-bg.gif); border-left: 1px solid #000; border-right: 1px solid #000; } /* Extra Divs Finish Here ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ #quickSummary p.p1 { position: relative; margin-left: 465px; width: 235px; font-size: 10px; color: #b9b9b9; line-height: 20px; z-index: 1; padding: 0 5px 5px 5px; } #quickSummary p.p2 { position: absolute; top: 147px; margin-left: 10px; font-size: 11px; font-family: verdana, sans-serif; color: #777; } /* #linkList2 { left: 0px; background: transparent url(list_4.png) no-repeat; height: 57px; } */ #linkList { position: absolute; top: 160px; /*top: 10em; Dave suggested this but if I change the font size through the browser it pulls the whole right coloum up!!*/ margin-left: 458px; margin-top: 3px; background: transparent url(bg-side.gif) repeat-y; width: 254px; padding: 10px; } #linkList h3.select { background: transparent url(list_1.gif) no-repeat; margin-top: 130px; height: 57px; margin-left: 5px; } #linkList h3.archives { background: transparent url(list_2.gif) no-repeat; height: 57px; margin-top: 20px; margin-left: 5px; } #linkList h3.resources { background: transparent url(list_3.gif) no-repeat; height: 57px; margin-top: 20px; margin-left: 5px; } #linkList h3.select span, #linkList h3.archives span, #linkList h3.resources span { display:none } #linkList ul { margin: 10px; padding: 0px; } #linkList li { list-style-type: none; background: transparent; display: block; font-size: 10px; font-family: verdana, sans-serif; color: #b9b9b9; } #linkList li a:link, a:visited { color: #b9b9b9; text-decoration: none; } #linkList li a:hover, #linkList li a:active{ color: #777; text-decoration: none; } a.c:link, a.c:visited, a.c:hover, a.c:active { font-weight: normal; } #preamble { padding: 10px; width: 450px; margin-top: -110px; font-family: verdana, sans-serif; font-size: 13px; color: #0F7FD0; background: transparent url(text-bg.gif) top left repeat-y; } #preamble h3 { margin-top: 10px; font-family: verdana, sans-serif; margin-bottom: 20px; padding: 5px; text-align: center; font-weight: bold; color: #fff; background: #86CDF9; border: 1px solid #5FBEF9; width: 428px; font-size: 18px; } #supportingText { padding: 10px; width: 450px; font-family: verdana, sans-serif; font-size: 13px; color: #0F7FD0; voice-family: "\"}\""; voice-family: inherit; width: 440px; } #supportingText a:link, #supportingText a:visited { color: #3B92C9; text-decoration: none; } #supportingText a:hover, #supportingText a:active { color: #fff; border-bottom: 1px solid #fff; text-decoration: none; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin-top: 10px; font-family: verdana, sans-serif; margin-bottom: 20px; padding: 5px; text-align: center; font-weight: bold; color: #fff; background: #86CDF9; border: 1px solid #5FBEF9; width: 428px; font-size: 18px; } #requirements { } #requirements p.p5 { margin-top: 20px; padding: 5px; text-align: center; font-weight: bold; color: #fff; background: #86CDF9; border: 1px solid #5FBEF9; } #footer { position: absolute; top: 146px; color: #777; font-size: 12px; margin-left: 470px; width: 230px; } #footer a:link, #footer a:visited { margin: 5px; font-weight: normal; color: #777; text-decoration: none; } #footer a:hover, #footer a:active { color: #333; text-decoration: none; } #extraDiv1, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; }/* css Zen Garden submission 040 - 'The Question Why' by Diane Clayton, http://www.schisma.net/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Diane Clayton */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements ---------------------------------------------------------------*/ body { background: #030409 url(bg_darkblue.gif) repeat; /* stupid browser color shifts */ color: #030409; font-family: Arial, sans-serif; font-size: 12px; margin: 0; } #extraDiv1 { z-index: 0; background: #030409 url(bg_body.jpg) no-repeat top left; position: absolute; top: 0; left: 0; width: 990px; height: 980px; } #preamble p, #supportingText p { font-family: 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif; line-height: 18px; text-align: justify; margin: 0; padding: 0px 20px 10px 20px; } #preamble p, #supportingText p { background: #8B95A8 url(bg_lightblue.gif) repeat; /* stupid browser color shifts */ } h3 { margin: 0; padding: 0; border: 0; } h3 span { display: none; } a:link, a:visited { font-weight: bold; text-decoration: none; color: #FFFF99; } a:hover, a:active { text-decoration: underline; } /* structuring and main content ---------------------------------------------------------------*/ #container { z-index: 1; position: absolute; top: 0; left: 0; width: 975px; margin: 0; } #intro { z-index: 1; position: absolute; left: 710px; width: 235px; margin: 0; padding: 0; } #pageHeader h1 span, #pageHeader h2 span, #quickSummary p.p1 span { display: none; } #quickSummary { position: absolute; top: 150px; right: 20px; width: 175px; color: #DBE0E6; font-family: Arial, sans-serif; font-size: 13px; letter-spacing: 1px; text-align: right; } #quickSummary p { padding: 0; margin: 0; border: 0; } #preamble { background: transparent url(bg_preamble.gif) no-repeat left bottom; position: absolute; top: 327px; left: 0px; width: 235px; padding-bottom: 70px; overflow: hidden; } #preamble h3 { background: transparent url(bg_preambleh3.gif) no-repeat left top; height: 60px; } #supportingText, #explanation, #participation, #benefits, #requirements { margin: 0; padding: 0; } #supportingText { z-index: 1; position: absolute; top: 327px; left: 285px; } #explanation { background: transparent url(bg_explanation.gif) no-repeat left bottom; color: #030409; width: 400px; padding-bottom: 25px; margin-bottom: 10px; } #explanation h3 { background: transparent url(bg_explanationh3.gif) no-repeat left top; height: 40px; } #participation { background: transparent url(bg_participation.gif) no-repeat left bottom; color: #030409; width: 400px; padding-bottom: 30px; margin-bottom: 10px; } #participation h3 { background: transparent url(bg_participationh3.gif) no-repeat left top; height: 50px; } #benefits { background: transparent url(bg_benefits.gif) no-repeat left bottom; color: #030409; width: 400px; padding-bottom: 25px; margin-bottom: 20px; } #benefits h3 { background: transparent url(bg_benefitsh3.gif) no-repeat left top; height: 45px; } #requirements { background: transparent url(bg_requirements.gif) no-repeat left bottom; color: #030409; width: 400px; padding-bottom: 20px; margin-bottom: 30px; } #requirements h3 { background: transparent url(bg_requirementsh3.gif) no-repeat left top; height: 35px; } #footer { background: transparent url(bg_footer.gif) no-repeat center top; width: 400px; height: 20px; margin-bottom: 50px; text-align: center; } /* link list ---------------------------------------------------------------*/ #linkList { z-index:1; position: absolute; left: 25px; top: 335px; width: 235px; } #linkList ul { background: #8B95A8 url(bg_lightblue.gif) repeat; margin: 0; padding: 0; border: 0; list-style: none; } #linkList ul li { line-height: 18px; margin: 0; margin-left: 20px; padding: 0; padding-left: 25px; padding-bottom: 10px; } #linkList #lselect ul li, #linkList #lfavorites ul li { background: transparent url(zenbullet.gif) no-repeat top left; } #linkList #larchives ul li, #linkList #lresources ul li { background: url(bullet.gif) no-repeat top left; } #lselect, larchives, #lresources, #lfavorites { padding: 0; margin: 0; } #lselect { background: transparent url(bg_lselect.gif) no-repeat bottom left; color: #030409; width: 235px; padding-bottom: 50px; margin-bottom: 10px; } #lselect h3 { background: transparent url(bg_lselecth3.gif) no-repeat top left; height:45px; } #lselect a:link, #lselect a:visited, #lfavorites a:link, #lfavorites a:visited { display: block; font-size: 13px; letter-spacing: 1px; } #lselect a.c:link, #lselect a.c:visited, #lfavorites a.c:link, #lfavorites a.c:visited { display: inline; font-weight: normal; color: #DBE0E6; text-transform: lowercase; padding-left: 3px; } #larchives { background: transparent url(bg_larchives.gif) no-repeat bottom left; color: #030409; width: 235px; padding-bottom: 20px; margin-bottom: 25px; } #larchives h3 { background: transparent url(bg_larchivesh3.gif) no-repeat top left; height: 40px; } #larchives li, #lresources li { text-transform: lowercase; } #larchives a:link, #larchives a:visited, #lresources a:link, #lresources a:visited { font-size: 13px; letter-spacing: 1px; } #lresources { background: transparent url(bg_lresources.gif) no-repeat bottom left; color: #030409; width: 235px; padding-bottom: 50px; margin-bottom: 10px; } #lresources h3 { background: transparent url(bg_lresourcesh3.gif) no-repeat top left; height: 35px; } /* just in case... ---------------------------------------------------------------*/ #lfavorites { background: transparent url(bg_lfavorites.gif) no-repeat bottom left; color: #030409; width: 235px; padding-bottom: 20px; margin-bottom: 20px; } #lfavorites h3 { background: transparent url(bg_lfavoritesh3.gif) no-repeat top left; height: 35px; } /* extras ---------------------------------------------------------------*/ acronym { border-width:0; }/* css Zen Garden submission 041 - 'door to my garden' by Patrick Lauke, http://redux.deviantart.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Patrick Lauke */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* general stuff */ body { font: 0.7em/1.2em Times, serif ; background: #000 url(background.png) -30px 0px no-repeat fixed; color: #999; padding: 0 0 0 470px; margin: 0; } * { text-transform: lowercase; /* could apply this to the body, but IE seems to ignore it there */ padding:0; margin:0; } p { margin: 1em 0 0 0; padding: 0 0 1em 0; } p.p1:first-line { font-weight: bold; } p.p2, p.p3, p.p4 { /* originally used p + p, but IE doesn't play ball with that...so this is a rather ugly kludge */ text-indent: 1em; margin-top: -0.8em; } h3 { font-size: 1.2em; } ul { list-style: none url(dot.png); padding: 1em 0 0 0; margin-left: 3em } li { margin-bottom: 0.3em; } a { color: #eee; background: transparent; text-decoration: none; } acronym { /* override Mozilla and co.'s standard dotted line under acronyms for a better look (at the detriment of accessibility, unfortunately) */ border: none; } /* more specific rules */ #container { background: #000 url(bottom_corner.png) no-repeat bottom right; color: inherit; width: 300px; } #pageHeader { background: url(header.png) no-repeat top left; width: 300px; height: 170px; } #pageHeader span { display: none; } #preamble, #supportingText div { padding: 0 35px 0 35px; text-align: justify; } /* admittedly graphics intensive, but each of the following divs has its own distincitve bracket (left or right) with its own different texture of dirt */ #preamble { background: url(bracket-l1.png) no-repeat top left; } #participation { background: url(bracket-l2.png) no-repeat top left; } #requirements { background: url(bracket-l3.png) no-repeat top left; } #benefits { background: url(bracket-r1.png) no-repeat top right; } #explanation { background: url(bracket-r2.png) no-repeat top right; } /* old-style borders for the window-frame look of the menu */ #linkList { position: absolute; top: 145px; left: 215px; background: url(menu-top.png) no-repeat top right; width: 248px; height: 50px; } #linkList2 { margin-top: 30px; background: url(menu-body.png) #000; color: inherit; } #lselect, #larchives, #lresources { padding: 0 15px 0 15px; } #linkList2>#lselect { /* slight kludge ? sure...but it adds nice eye candy. hidden from IE through the child selector, and we make up for it later with extraDiv1 */ background: url(flower.png) no-repeat top left; margin-left: -65px; padding-left: 80px; min-height: 150px; } #lresources { background: url(menu-bottom.png) no-repeat bottom right; padding-bottom: 2.5em; } /* static version of what was originally a flyout menu...but didn't work in Netscape 7 */ #container>#linkList { background: url(menu-top.png) no-repeat top right; } #linkList #linkList2{ visibility: visible; } /*just to tidy up the bottom end a bit */ #container { padding-bottom: 50px; margin-bottom: -2em; } /* a bit of useless visual whimsy...*/ p:hover { color: #aaa; background: transparent; } p:hover a { color: #fff; background: transparent; } /* and now...the extras */ #extraDiv1 { /* this one makes up for the screwy handling of the flower background on #lselect in IE */ position: absolute; top: 165px; left: 142px; background: url(flower.png) no-repeat top left; width: 115px; height: 150px; } body>#extraDiv1 { /* and this reverses the previous rule for those browsers (i.e. non IE ones) that already showed the flower background correctly as it was applied to #lselect */ display: none; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; }/* css Zen Garden submission 042 - 'Stone Washed' by Andrew Hayward, http://www.mooncalf.me.uk/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Andrew Hayward */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* ---[ General Stuff ]------------------------------ */ body { margin: 0px; padding: 0px; background: #e6e6dc url('outer_shadow.gif') 0px 0px repeat-x; color: #999; font-family: tahoma, arial, helvetica, sans-serif; } h1, h2, h3, h4 { margin: 0; padding: 0; } p { padding-left: 10px; padding-right: 10px; text-align: justify; font-size: 0.8em; } a:link, a:visited { color: #567b9b; text-decoration: none; } a:hover, a:active { background: #ddeeff; } /* ---[ End General Stuff ]-------------------------- */ /* ---[ Container ]---------------------------------- */ #container { background: transparent url('side.gif') 100% 0px repeat-y; } /* ---[ Intro ]---------------------------------- */ #intro { margin: 100px 275px 0px 100px; background: #fff url('inner_shadow.gif') 0px 0px repeat-x; padding: 30px 10px 10px 10px; border-left: solid 1px #ccc; } /* ---[ Page Header ]------------------------ */ #pageHeader { color: #fff; height: 100px; width: 100%; top: 0px; left: 0px; right: 0px; position: absolute; background: transparent url('top.gif') 0px 0px repeat-x; z-index: 10; } #pageHeader h1 { height: 130px; } #pageHeader h1 span { font-size: 1.5em; background-color: transparent; text-decoration: none; text-transform: lowercase; display: none; font-weight: normal; position: absolute; right: 20px; bottom: 3px; color: #fff; } #pageHeader h2 { position: absolute; top: 0px; left: 0px; height: 115px; width: 400px; background: transparent url('top.title.gif') 0px 0px no-repeat; } #pageHeader h2 span { display: none; } /* ---[ End Page Header ]-------------------- */ /* ---[ Quick Summary ]---------------------- */ #quickSummary { width: 270px; float: left; border-top: solid 1px #ddd; border-right: solid 1px #ddd; /* border-bottom: solid 1px #999; */ border-left: solid 1px #ddd; background: #e5e5e5 url('demo.bg.gif') 100% 100% no-repeat; margin: 0px 15px 10px 0px; padding: 0px 0px 3px 0px; font-size: 1em; } #quickSummary p, #quickSummary p:first-letter { text-align: center; color: #666; font-weight: normal; } #quickSummary .p1 { background: #fff url('demo.p1.gif') 0% 0% no-repeat; /* padding-bottom: 60px; */ height: 176px; padding: 0px 0px 0px 0px; margin: 0px; } #quickSummary .p1 span { display: none; } #quickSummary .p2 { position: relative; bottom: 0px; text-align: right; padding-bottom: 15px; } #quickSummary>.p2 { padding-bottom: 0px; } #quickSummary .p2 span { visibility: hidden; font-size: 0px; } #quickSummary .p2 span a { margin-left: 75px; font-size: 10pt; visibility: visible; display: block; position: relative; left: 0px; background: none; background: transparent url('file.gif') 100% 50% no-repeat; padding-right: 18px; color: #aaa; font-variant: small-caps; text-transform: capitalize; } #quickSummary .p2 span a:hover { background: transparent url('file2.gif') 100% 50% no-repeat; color: #819bb2; } /* ---[ End Quick Summary ]------------------ */ /* ---[ Preamble ]--------------------------- */ #preamble h3 { display: none; } #preamble p { font-size: 0.9em; color: #819bb2; padding-left: 300px; } /* ---[ End Preamble ]----------------------- */ /* ---[ End Intro ]------------------------------ */ /* ---[ Supporting Text ]------------------------ */ #supportingText { margin: 0px 275px 0px 100px; background: #fff; padding: 10px 0px 10px 0px; border-left: solid 1px #ccc; } #supportingText div { clear: both; } #supportingText h3 { padding-top: 30px; height: 25px; border-bottom: solid 1px #819bb2; } #supportingText h3 span { display: none; } /* ---[ Explanation ]------------------------ */ #explanation { padding-left: 10px; padding-right: 10px; } #explanation h3 { background: #fff url('h3.explanation.gif') 100% 100% no-repeat; } #explanation p.p1 { width: 45%; float: left; } #explanation p.p2 { width: 45%; float: right; } /* ---[ End Explanation ]-------------------- */ /* ---[ Participation ]---------------------- */ #participation { background: #fff url('stone.circle.jpg') 50% 100% no-repeat; padding-left: 10px; padding-right: 10px; } #participation h3 { background: #fff url('h3.participation.gif') 100% 100% no-repeat; /* border-top: solid 1px #ccc; */ } #participation p.p2 { width: 45%; float: left; } #participation p.p3 { width: 45%; float: right; } #participation p.p4 { clear: both; } /* ---[ End Participation ]------------------ */ /* ---[ Benefits ]--------------------------- */ #benefits { padding-left: 10px; padding-right: 10px; } #benefits h3 { background: #fff url('h3.benefits.gif') 100% 100% no-repeat; /* border-top: solid 1px #ccc; */ } /* ---[ End Benefits ]----------------------- */ /* ---[ Requirements ]----------------------- */ #requirements { background: #fff url('bamboo.leaf.jpg') 100% 100% no-repeat; padding-left: 10px; padding-right: 10px; } #requirements h3 { background: #fff url('h3.requirements.gif') 100% 100% no-repeat; /* border-top: solid 1px #ccc; */ } #requirements p.p2 { width: 45%; float: left; } #requirements p.p3, #requirements p.p4 { width: 45%; float: right; } #requirements p.p5 { clear: both; } /* ---[ End Requirements ]------------------- */ /* ---[ Footer ]----------------------------- */ #footer { margin-top: 15px; padding-top: 40px; padding-bottom: 20px; font-size: 0.8em; clear: both; text-align: center; background: #fff url('bamboo2.gif') 10px 0px repeat-x; } #footer a:link, #footer a:visited { text-decoration: none; color: #999; } #footer a:hover, #footer a:active { background: none; text-decoration: underline; } /* ---[ End Footer ]------------------------- */ /* ---[ End Supporting Text ]-------------------- */ /* ---[ Link List ]------------------------------ */ #linkList { z-index: 2; background: transparent url('pawn.jpg') 50% 100% no-repeat; position: absolute; top: 100px; right: 100px; float: right; width: 175px; } #linkList h3 { border: none; margin-top: 5px; margin-bottom: 10px; height: 30px; } #linkList h3 span { display: none; } /* ---[ Link List 2 ]------------------------ */ #linkList2 { padding-top: 20px; color: #666; } #linkList2 a:link, #linkList2 a:visited { color: #819bb2; text-decoration: none; } #linkList2 a:hover, #linkList2 a:active { background: none; text-decoration: underline; } #linkList2 div { font-size: 0.7em; padding: 8px 8px 10px 8px; background: transparent url('sidesplit.gif') 0px 100% repeat-x; } #linkList2 ul { list-style-type: none; margin: 0px; padding-left: 15px; } #linkList2 ul li { /* background: url('bullet.gif') 0px 3px no-repeat; */ list-style-image: url('bullet.gif'); padding: 0px 0px 0px 0px; margin: 0px 0px 10px 0px; } /* ---[ L Select ]----------------------- */ #lselect h3 { background: #e5e5e5 url('h3.side.select.gif') 50% 0% no-repeat; } #lselect a { display: block; } #lselect a.c { display: inline; } /* ---[ End L Select ]------------------- */ /* ---[ L Favorites ]-------------------- */ #lfavorites h3 { background: #e5e5e5 url('h3.side.favourites.gif') 50% 0% no-repeat; } #lfavorites a { display: block; } #lfavorites a.c { display: inline; } /* ---[ End L Favorites ]---------------- */ /* ---[ L Archives ]--------------------- */ #larchives h3 { background: #e5e5e5 url('h3.side.archives.gif') 50% 0% no-repeat; } /* ---[ End L Archives ]----------------- */ /* ---[ L Resources ]-------------------- */ #lresources { margin-bottom: 150px; } #lresources h3 { background: #e5e5e5 url('h3.side.resources.gif') 50% 0% no-repeat; } /* ---[ End L Resources ]---------------- */ /* ---[ End Link List 2 ]-------------------- */ /* ---[ End Link List ]-------------------------- */ /* ---[ End Container ]------------------------------ */ /* ---[ Extra Div 1 ]-------------------------------- */ #extraDiv1 { position: absolute; top: 0px; right: 0px; width: 275px; height: 130px; background: transparent url('top.rip.gif') 0% 100% no-repeat; z-index: 20; } /* ---[ End Extra Div 1 ]---------------------------- */ /* ---[ Extra Div 2 ]-------------------------------- */ #extraDiv2 { position: absolute; top: 125px; left: 105px; width: 30px; height: 30px; background: transparent url('corner1.gif') 0% 0% no-repeat; z-index: 20; } /* ---[ End Extra Div 2 ]---------------------------- */ /* ---[ Extra Div 3 ]-------------------------------- */ #extraDiv3 { position: absolute; top: 125px; left: 359px; width: 30px; height: 30px; background: transparent url('corner2.gif') 0% 100% no-repeat; z-index: 20; } /* ---[ End Extra Div 3 ]---------------------------- */ /* css Zen Garden submission 043 - 'Burning' by Kevin & Ethel Davis, http://etheldavisgallery.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Kevin & Ethel Davis */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without both the designer's and artist's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* CSS by Kevin Davis */ /* For more work by the author, see http://alazanto.org */ /* Artwork by Ethel Davis */ /* For more work by the artist, see http://etheldavisgallery.com */ /* have a great day! :) */ /******************************************************************* primary elements */ body { background: #444 url(body.gif) top left repeat-y; margin: 0px; padding: 0px; text-align: left; color: #fff; } /******************************************************************* primary hyperlink styling */ #supportingText a:link { font-weight: normal; text-decoration: none; background: transparent; color: #D1E8CC; border-bottom: 1px solid #D1E8CC; } #supportingText a:visited { font-weight: normal; text-decoration: none; background: transparent; color: #BBD9BA; border-bottom: 1px solid #BBD9BA; } #supportingText a:hover, a:active { text-decoration: none; background: transparent; color: #fff; border-bottom: 1px solid #fff; } /***********************************************/ #linkList a:link { font-weight: normal; text-decoration: none; background: transparent; color: #bcf; } #linkList a:visited { font-weight: normal; text-decoration: none; background: transparent; color: #bde; } #linkList a:hover, a:active { text-decoration: underline; background: transparent; color: #fff; } /***********************************************/ #intro #quickSummary a:link { font-weight: normal; text-decoration: none; background: transparent; color: #ccc; border-bottom: 1px solid #555; } #intro #quickSummary a:visited { font-weight: normal; text-decoration: none; background: transparent; color: #ccc; border-bottom: 1px solid #555; } #intro #quickSummary a:hover, a:active { text-decoration: none; background: transparent; color: #fff; border-bottom: 1px solid #555; } /******************************************************************* body content */ #container { margin-top: 33px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; padding: 1px; background: transparent url(container-back.gif) top left no-repeat; width: 751px; voice-family: "\"}\""; voice-family:inherit; width:750px; } html>body #container { width: 750px; } #extraDiv1 { position: absolute; height: 33px; width: 100%; top: 0px; left: 0px; background: transparent url(top-bar.gif) top left repeat-x; } #extraDiv2 { position: relative; height: 33px; width: 100%; bottom: 0px; left: 0px; background: transparent url(bottom-bar.gif) top left repeat-x; } #extraDiv3 { position: absolute; top: 33px; left: 750px; right: 0px; color: #fff; background: #38332F url(back-top2.gif) top left repeat-y; border-bottom: 2px solid #29281C; height: 480px; voice-family: "\"}\""; voice-family:inherit; height:478px; } html>body #extraDiv3 { height: 478px; } #extraDiv3 span { position: absolute; top: 0px; left: 0px; right: 0px; margin-bottom: 471px; color: #fff; background: #38332F url(back-top2-span.gif) top left repeat-x; height: 7px; voice-family: "\"}\""; voice-family:inherit; height:7px; } html>body #extraDiv3 span { height: 7px; } #pageHeader { position: absolute; top: 33px; left: 0px; width: 0px; hegith: 0px; margin: 0px; padding: 0px; overflow: hidden; text-indent: -100em; } /******************************************************************* intro section */ #intro { margin-top: 243px; margin-left: 58px; margin-right: 242px; margin-bottom: 0px; padding: 15px; border-bottom: 1px solid #394A38; } #intro acronym, #linkList acronym { cursor: help; border: 0px; letter-spacing: 0.1em; } #quickSummary p.p2 { position: absolute; top: 255px; left: 5px; margin: 0px; width: 240px; padding-top: 0px; padding-left: 0px; padding-bottom: 0px; padding-right: 0px; border: 0px solid #333; font-family: "Verdana", serif; font-size: 9px; font-weight: normal; text-align: right; color: #bbb; background: transparent; } #intro p { margin-top: 0px; margin-bottom: 8px; font-family: "Times", "Times New Roman", Serif; font-size: 14px; font-weight: normal; word-spacing: 0.05em; letter-spacing: 0.05em; line-height: 1.4em; text-align: left; color: #fff; background: transparent; } /* Thanks Mike! http://phark.typepad.com */ #intro h3 { width: 100%; height: 30px; margin-top: 10px; margin-left: -2px; margin-bottom: 5px; margin-right: 0px; padding: 0px; color: #fff; border-bottom: 1px solid #5F705E; background: transparent url(header-enlighten.gif) no-repeat top left; } #intro h3 span {display: none;} /******************************************************************* supportingtext section */ #supportingText { margin-top: 0px; margin-left: 58px; margin-right: 242px; padding: 15px; } #supportingText acronym { cursor: help; background: transparent url(acronym.gif) top left no-repeat; padding-left: 15px; border-bottom: 0px dotted #fff; } #supportingText p { margin-top: 0px; margin-left: 0px; margin-right: 0px; margin-bottom: 8px; font-family: "Times", "Times New Roman", Serif; font-size: 14px; font-weight: normal; word-spacing: 0.05em; letter-spacing: 0.05em; line-height: 1.4em; text-align: left; color: #fff; background: transparent; } #supportingText h3 { width: 100%; height: 30px; margin-top: 10px; margin-left: -2px; margin-bottom: 5px; margin-right: 0px; border-bottom: 1px solid #5F705E; } #supportingText h3 span {display: none;} #explanation h3 { background: transparent url(header-sowhat.gif) no-repeat top left; } #participation h3 { background: transparent url(header-participation.gif) no-repeat top left; } #benefits h3 { background: transparent url(header-benefits.gif) no-repeat top left; } #requirements h3 { background: transparent url(header-requirements.gif) no-repeat top left; } /******************************************************************* footer section */ #footer { margin-top: 30px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px; padding: 6px; font-family: "Verdana", serif; font-size: 11px; font-weight: normal; font-style: italic; color: #fff; text-align: center; background-color: #697A68; border: 1px solid #899A88; } #footer a:link, #footer a:visited { margin-left: 5px; margin-right: 5px; padding-left: 5px; padding-right: 5px; border-bottom: 0px; border-left: 1px solid #899A88; border-right: 1px solid #899A88; } /******************************************************************* link list */ #linkList { position: absolute; top: 0px; left: 0px; margin-top: 276px; margin-left: 509px; padding-top: 251px; padding-left: 20px; padding-right: 0px; text-align: left; background: transparent url(linklist-back.gif) top left no-repeat; width: 242px; voice-family: "\"}\""; voice-family:inherit; width:222px; } html>body #linkList { width: 222px; } #lselect, #lfavorites, #larchives, #lresources { margin-top: 0px; margin-left: 0px; margin-bottom: 10px; margin-right: 10px; padding: 4px; border: double #878BA6; /*background-color: #4A5269;*/ } #linkList h3 { font-family: "Verdana", serif; font-size: 10px; font-weight: normal; margin: 0px; padding: 0px; border-bottom: 1px solid #878BA6; } h3.select { text-align: left; width: 100%; height: 14px; background: transparent url(header-select.gif) no-repeat top left; } #linkList h3.select span {display:none;} h3.favorites { text-align: left; width: 100%; height: 14px; background: transparent url(header-favorites.gif) no-repeat top left; } #linkList h3.favorites span {display:none;} h3.archives { text-align: left; width: 100%; height: 14px; background: transparent url(header-archives.gif) no-repeat top left; } #linkList h3.archives span {display:none;} #larchives ul>li { margin-bottom: 0px; margin-left: -10px; text-align: left; padding-left: 9px; padding-bottom: 0px; border-left: 1px solid #878BA6; border-right: 1px solid #878BA6; border-bottom: 0px solid #878BA6; } #larchives ul>li+li { margin-bottom: 0px; margin-left: -10px; text-align: left; padding-left: 9px; padding-bottom: 5px; border-left: 1px solid #878BA6; border-right: 1px solid #878BA6; border-bottom: 1px solid #878BA6; } #larchives ul>li+li+li { margin-top: 5px; margin-bottom: 0px; margin-left: 0px; text-align: left; padding-left: 0px; padding-bottom: 0px; border-left: 0px; border-right: 0px; border-bottom: 0px; } h3.resources { text-align: left; width: 100%; height: 14px; background: transparent url(header-resources.gif) no-repeat top left; } #linkList h3.resources span {display:none;} #linkList ul { margin-top: 0px; margin-bottom: 20px; margin-left: 10px; margin-right: 0px; padding: 0px; } #linkList li { font-family: "Verdana", serif; font-size: 11px; font-weight: normal; color: #fff; background: transparent; line-height: 13px; list-style-type: none; display: block; padding-top: 4px; margin-bottom: 2px; } #larchives li { padding-top: 4px; margin-bottom: 0px; } #lselect li, #lfavorites li { background: url(docbullet.gif) no-repeat 0px 7px; padding-left: 11px; } #lselect a, #lfavorites a { display:block; text-transform:lowercase; } #lselect a.c, #lfavorites a.c {display:inline; text-transform: none; }/* css Zen Garden submission 044 - 'si6' by Shaun Inman, http://www.shauninman.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Shaun Inman */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Lomo Credit: http://andreas.lunde.info/ | 09.05.03 :: 09.09.03 */ /* Via: http://sxc.hu/ */ body { background: url(bg_top.jpg) no-repeat #FFF; margin: 0px; font: 9px/16px Geneva,Arial,Tahoma,sans-serif; color: #97999C; } p { position: relative; top: 0px; text-align: justify; margin: 0px 0px 0px 35px; padding: 0px 0px 16px 302px; width: 573px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 271px; /* Actual value for conformant browsers */ } html>p { width: 271px; /* Be nice to Opera */ } @media ScReEn { /* HIDE THIS NONSENSE FROM SAFARI */ p span { position: relative; top: -1px; padding-bottom: 2px; } } /* MORE NONSENSE JUST FOR IE */ * html p span { position: relative; top: -1px; } p.p1 { background: url(p1.gif) no-repeat; } p.p2 { background: url(p2.gif) no-repeat; } p.p3 { background: url(p3.gif) no-repeat; } p.p4 { background: url(p4.gif) no-repeat; } p.p5 { background: url(p5.gif) no-repeat; } a, a:visited { color: #717375; text-decoration: none; border-bottom: 2px solid #FFFC00; } a:hover { color: #A1A3A5; text-decoration: none; border-bottom: 2px solid #FFFE66; } h3 { margin: 0px; padding: 0px; } acronym { font-style: normal; text-decoration: none; border-width: 0px; } #container { width: 744px; } #pageHeader { z-index: 5000; } #pageHeader h1 { position: absolute; top: 84px; left: 88px; background: url(css_zen_garden.gif) no-repeat; width: 205px; height: 35px; padding: 0px; margin: 0px; } #pageHeader h2 { position: absolute; top: 132px; left: 91px; background: url(beauty_of.gif) no-repeat; width: 149px; height: 23px; padding: 0px; margin: 0px; } #pageHeader h1 span, #pageHeader h2 span, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #lselect h3 span, #lfavorites h3 span, #larchives h3 span, #lresources h3 span { display: none; } #quickSummary p { color: #828200; } #quickSummary a, #quickSummary a:visited { color: #626200; text-decoration: none; border-bottom: 2px solid #979600; } #quickSummary a:hover { color: #A2A200; border-bottom: 2px solid #C7C600; } #quickSummary { margin-top: 144px; width: 608px; } #quickSummary p.p1 { background: url(p1_on_yellow.gif) no-repeat; } #quickSummary p.p2 { background: url(p2_on_yellow.gif) no-repeat; padding-bottom: 0px; margin-bottom: 16px; } #preamble, #explanation, #participation, #benefits, #requirements, #footer { position: relative; } #preamble h3 { position: absolute; top: -11px; left: 88px; background: url(the_road.gif) no-repeat; width: 169px; height: 22px; } /* TARGETING IE6 PC, KEEP COMMENT OPEN AS FAR AS IE5 MAC IS CONCERNED \*/ * html*#preamble h3 { left: 53px; } /* GOTTA WAKE UP IE5 MAC! */ #preamble p.p1 { background: url(p1_cropped.gif) no-repeat; } #preamble p.p2 { background: url(p2_cropped.gif) no-repeat; } #preamble p.p3 { background: url(p3_unlabeled.gif) no-repeat; padding-bottom: 0px; margin-bottom: 16px; } #explanation h3 { position: absolute; top: -12px; left: 89px; background: url(so_what.gif) no-repeat; width: 131px; height: 23px; } /* TARGETING IE6 PC, KEEP COMMENT OPEN AS FAR AS IE5 MAC IS CONCERNED \*/ * html*#explanation h3 { left: 54px; } /* GOTTA WAKE UP IE5 MAC! */ #explanation p.p1 { background: url(p1_unlabeled.gif) no-repeat; } #explanation p.p2 { padding-bottom: 0px; margin-bottom: 16px; } #participation h3 { position: absolute; top: -11px; left: 86px; background: url(participation.gif) no-repeat; width: 131px; height: 22px; } /* TARGETING IE6 PC, KEEP COMMENT OPEN AS FAR AS IE5 MAC IS CONCERNED \*/ * html*#participation h3 { left: 51px; } /* GOTTA WAKE UP IE5 MAC! */ #participation p.p4 { padding-bottom: 0px; margin-bottom: 16px; } #benefits h3 { position: absolute; top: -11px; left: 88px; background: url(benefits.gif) no-repeat; width: 131px; height: 22px; } /* TARGETING IE6 PC, KEEP COMMENT OPEN AS FAR AS IE5 MAC IS CONCERNED \*/ * html*#benefits h3 { left: 53px; } /* GOTTA WAKE UP IE5 MAC! */ #benefits p.p1 { padding-bottom: 0px; margin-bottom: 16px; } #requirements h3 { position: absolute; top: -11px; left: 89px; background: url(requirements.gif) no-repeat; width: 131px; height: 22px; } /* TARGETING IE6 PC, KEEP COMMENT OPEN AS FAR AS IE5 MAC IS CONCERNED \*/ * html*#requirements h3 { left: 54px; } /* GOTTA WAKE UP IE5 MAC! */ #requirements p.p4 { background: url(p4_on_blue.gif) no-repeat; } #requirements p.p5 { background: url(p5_unlabeled.gif) no-repeat; padding-bottom: 0px; margin-bottom: 16px; } #linkList { position: absolute; top: 63px; left: 626px; width: 116px; } #linkList ul, #linkList li { list-style: none; padding: 0px; margin: 0px; line-height: 12px; } #linkList a, #linkList a:visited { color: #5E5F61; border: none; } #linkList a:hover { color: #C1C3C5; } #lselect li, #lfavorites li { margin-top: 8px; } #lselect li a, #lselect li a:visited, #lfavorites li a, #lfavorites li a:visited { display: block; } #lselect li a.c, #lselect li a.c:visited, #lfavorites li a.c, #lfavorites li a.c:visited { color: #717375; display: inline; } #lselect li a.c:hover, #lfavorites li a.c:hover { color: #C1C3C5; } #lselect h3.select { background: url(select_a_design.gif) no-repeat; width: 112px; height: 44px; } #lselect ul { margin-top: -1px; } @media ScReEn { /* HIDE THIS NONSENSE FROM SAFARI */ #lselect ul { margin-top: -2px; } } /* MORE NONSENSE JUST FOR IE */ * html #lselect ul { margin-top: -2px; } #lfavorites h3.favorites { background: url(favorites.gif) no-repeat; width: 112px; height: 44px; margin-top: 6px; } #lfavorites ul { margin-top: -2px; } #larchives h3.archives { background: url(archives.gif) no-repeat; width: 112px; height: 44px; margin-top: 5px; } #larchives ul { margin-top: 6px; } #lresources h3.resources { background: url(resources.gif) no-repeat; width: 112px; height: 44px; margin-top: 10px; } #lresources ul { margin-top: 6px; } #footer { display: block; text-align: right; padding: 9px 430px 0px 0px; margin: 0px 0px 36px 35px; width: 688px; voice-family: "\"}\""; voice-family:inherit; width: 258px; } html>#footer { width: 258px; } #footer a { padding-bottom: 9px; } @media ScReEn { /* HIDE THIS NONSENSE FROM SAFARI */ #footer a { position: relative; top: -1px; } } /* MORE NONSENSE JUST FOR IE */ * html #footer a { position: relative; top: -1px; } #footer,#requirements { z-index: 2; } #extraDiv1 { position: relative; height: 1px; z-index: 1; } #extraDiv1 span { position: absolute; bottom: -33px; left: 0px; background: url(bg_bottom.jpg) no-repeat; width: 100%; height: 508px; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* * { border: 1px solid #DDD; } *//* css Zen Garden submission 045 - 'I Dream in Colour' by Jeff Bilen - http://www.scribblersclub.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jeff Bilen */ /* Added: September 26th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { background: #ffffff url(bottom_right.jpg) bottom right no-repeat; font: 8pt/11pt "Times New Roman", serif, georgia; color: #555753; margin: 0px; padding: 0px; } p { font: 8pt/11pt "Times New Roman", serif, georgia; margin-top: 0px; text-align: left; margin-left: 10px; } acronym { border: none; } a:link { font-weight: bold; text-decoration: none; color: #333333; } a:visited { font-weight: bold; text-decoration: none; color: #555555; } a:hover, a:active { text-decoration: underline; color: #555555; } /* specific divs */ #container { background: transparent url(top_left.jpg) top left no-repeat; padding: 0px; margin: 0px; width: 760px; padding-bottom: 100px; } #intro { background: transparent url(intro_back.jpg) top left no-repeat; margin-top: 133px; width: 253px; float: left; } #pageHeader h1 span { display:none } #pageHeader h2 span { display:none } #quickSummary { width: 210px; margin-left: 15px; margin-top: 20px; } #quickSummary p { font: bold italic 8pt/11pt "Times New Roman", serif, georgia; color: #000000; text-align: center; } #preamble { width: 210px; margin-left: 15px; margin-top: 25px; } #preamble h3 { background: transparent url(en_hdr.gif) top center no-repeat; width: 210px; height: 19px; margin-left: 5px; } #preamble h3 span { display: none; } #preamble p { padding-left: 5px; font: 8pt/14pt "Times New Roman", serif, georgia; } #supportingText { background: transparent url(main_back.jpg) top left no-repeat; position: relative; margin-left: 258px; top: 58px; width: 376px; padding-left: 25px; padding-top: 25px; } #explanation h3 { background: transparent url(what_hdr.gif) top left no-repeat; height: 11px; text-align: left; } #explanation h3 span { display: none; } #supportingText p { width: 315px; text-align: left; } #explanation h3 { background: transparent url(what_hdr.gif) top left no-repeat; height: 11px; } #explanation { padding-bottom: 10px; } #participation { padding-bottom: 10px; } #benefits { padding-bottom: 10px; } #requirements { padding-bottom: 10px; } #participation h3 { background: transparent url(part_hdr.gif) top left no-repeat; height: 11px; } #participation h3 span { display: none; } #benefits h3 { background: transparent url(ben_hdr.gif) top left no-repeat; height: 11px; } #benefits h3 span { display: none; } #requirements h3 { background: transparent url(req_hdr.gif) top left no-repeat; height: 13px; } #requirements h3 span { display: none; } #footer { text-align: center; border-top: 1px solid #cccccc; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList { margin-left: 645px; width: 125px; position: absolute; top: 110px; } #linkList ul { margin-left: 10px; padding: 0px; } #lselect h3 { background: transparent url(sel_des.gif) top left no-repeat; height: 21px; } #lselect h3 span { display: none; } #larchives h3 { background: transparent url(archives.gif) top left no-repeat; height: 18px; } #larchives h3 span { display: none; } #lresources h3 { background: transparent url(resource.gif) top left no-repeat; height: 11px; } #lresources h3 span { display: none; } #lfavorites h3 { background: transparent url(favorites.gif) top left no-repeat; height: 21px; } #lfavorites h3 span { display: none; } #linkList li { line-height: 2.5ex; list-style-type: none; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #555555; } #linkList li a:visited { color: #777777; } /* css Zen Garden submission 046 - 'sub:lime' by Andy Budd, http://www.andybudd.com/blog/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Andy Budd */ /* Added: September 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* CSS Document */ body{ background: #e3dfdc; margin: 0px; padding: 0px; font: 72%/1.6em Verdana, Arial, Helvetica, sans-serif; color: #FFFFFF; text-align: center; } a:link { color: #5a6635; text-decoration: none; } a:visited { color: #5a6635; text-decoration: none; } a:hover { color: #2b351c; } #container { position: relative; width: 715px; margin: 0 auto; background: #FFFFFF url(container.gif) repeat-y; padding-right: 25px; padding-left: 25px; text-align: left; voice-family: "\"}\""; voice-family:inherit; width: 665px; } html>body #container { width: 665px; } /* page header stuff */ #pageHeader { margin-bottom: 5px; } #pageHeader h1 { width: 665px; height: 38px; background: url(logo.gif) no-repeat; margin: 0px; padding: 0px; } #pageHeader span { display: none; } #pageHeader h2 { display: none; } /* quickSummary stuff */ #quickSummary { background: url(limes.gif) no-repeat; width: 665px; } #quickSummary .p1 { background: url(callout.gif) no-repeat right; height: 160px; margin: 0px; padding: 0px; } #quickSummary .p1 span { display: none; } #quickSummary .p2 { height: 27px; background: #97a25e; margin: 5px 0 5px 0; padding: 5px 0 0 10px; vertical-align: bottom; voice-family: "\"}\""; voice-family:inherit; height: 22px; } html>body #quickSummary .p2 { height: 22px; } /* preamble stuff */ #preamble { margin: 0 0 0 225px; background: #a5b77a; padding: 15px; } #preamble h3 { background: url(enlightenment.gif) no-repeat; height: 19px; margin: 0px; padding: 0px; } #preamble h3 span{ display: none; } /* supportingText stuff */ #supportingText { margin: 0 0 0 225px; background: #a5b77a; padding: 0 15px 1px 15px; /* this is wierd. Origionally this div had no bottom padding. When I positioned the footer absolutly, a gap of about 8px appeared at the bottom of the page where the bg image of container wasn't getting displayed. Adding a nominal amount of bottom padding (1px) to supportingText fixed this problem. However I have no idea why the problem exhibited in the first place or why this fixed it. */ } #explanation h3 { background: url(about.gif) no-repeat; height: 19px; margin: 0px; padding: 0px; } #participation h3 { background: url(participation.gif) no-repeat; height: 15px; } #benefits h3 { background: url(benefits.gif) no-repeat; height: 18px; } #requirements h3 { background: url(requirements.gif) no-repeat; height: 15px; } #supportingText h3 span{ display: none; } #footer /*#requirements .p5*/ { position: absolute; margin: 0; padding: 0; top: 213px; right: 35px; text-align: right; } /* bit of a nasty use of an extraDiv and a bg image to produce the bottom yellow bar */ #extraDiv1 { height: 40px; width: 715px; margin: 0 auto; background: #FFFFFF url(bandwidth.gif); text-align: left; } /* bit of a hack topositiuon the bandwidth text */ #requirements .p5 { position: absolute; margin: 0; padding: 0; bottom: -30px; left: 35px; text-align: left; z-index: 10; } /* linkList stuff */ #linkList { width: 220px; position: absolute; top: 240px; left: 25px; background: #c5d19b; } #linkList2 { padding: 15px 10px 10px 10px; } #linkList h3 { margin: 0px; padding: 0px; } #linkList h3 span { display: none; } #linkList ul { margin: 12px 0 15px 15px; padding: 0px; } #linkList li { list-style: none; margin: 0; padding: 0px; } #lselect li { margin: 0 0 10px 0; } #lselect li a { display: block; } #lselect li .c { display: inline; } #lselect h3 { background: url(select.gif) no-repeat; height: 22px; } #larchives h3 { background: url(archive.gif) no-repeat; height: 15px; } #lresources h3 { background: url(resources.gif) no-repeat; height: 14px; } /* css Zen Garden submission 047 - 'dusk' by Jon Hicks, http://exp.hicksdesign.co.uk/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Jon Hicks */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { background: #fff url(border.gif) repeat-y 20px 0px; margin: 0; padding: 0; font: 10px/1.4em Arial, Helvetica, sans-serif; color: #666; letter-spacing: 0.01em; } p { margin: 0 0 0.5em 0; } ul { list-style: none; margin: 0; padding: 0; } a, a:link a:active { color: #690; text-decoration:none; } a:visited { color: #666; } a:hover { background-color: #690; color: #fff; } /* main divs - in order of appearance */ /* ------------------------------------------------------------ */ /* big grey stripe */ #extraDiv1 { background: #666 url(end_block.gif) no-repeat right top; position: absolute; left: 10px; top: 30px; width: 780px; height: 230px; z-index: 1; } /* top left corner image of big grey stripe */ #extraDiv1 span{ display: block; background: url(corner.gif) no-repeat left top; width: 360px; height: 60px; } #container { margin-left: 358px; margin-top: 260px; width: 550px; } #pageHeader { background: transparent url(logo.gif) no-repeat left top; position: absolute; left: 10px; top: 137px; height: 229px; width: 730px; text-indent: -1000em; z-index: 2; } #preamble { color: #eee; position: absolute; height: 190px; width: 380px; left: 357px; top: 70px; padding-right: 20px; z-index: 2; overflow: auto; } #preamble h3 { background: url(road.gif) no-repeat left top; height: 19px; width: 216px; margin: 0 0 8px 0; } #preamble h3 span { display: none; } #quickSummary { position: absolute; left: 52px; top: 365px; height: 200px; width: 230px; color: #666; z-index: 2; line-height: 2em; } #quickSummary p.p2{ padding-top: 10px; } /* This is the bit that screws up in Opera 6 */ #supportingText { width: 375px; height: 150px; overflow: auto; padding: 0 20px 30px 5px; z-index: 10; border-left: solid 1px #999; } #supportingText h3 { font-size: 13px; color: #7fbb09; border-bottom: 1px solid #ccc; margin: 1.6em 0 0.8em 0; } #supportingText h3 span { border-bottom: 5px solid #ccc; } #footer { padding-bottom: 10px; padding-top: 10px; } /* links lists */ #linkList { width: 550px; } #linkList li{ padding-left: 2px; } #linkList h3 { text-indent: -1000em; margin-bottom: 3px; width: 116px; height: 18px; } /* links titles */ h3.select {background: url(select.gif) no-repeat left top;} h3.archives {background: url(archives.gif) no-repeat left top;} h3.favourites {background: url(favourites.gif) no-repeat left top;} h3.resources {background: url(resources.gif) no-repeat left top;} div#lselect, div#lfavorites, div#larchives, div#lresources { float: left; border-left: solid 1px #999; margin-right: 20px; padding-top: 20px; } /* css Zen Garden submission 048 - 'HoriZental' by Clment 'fastclemmy' Hardouin, http://www.fastclemmy.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Clment Hardouin */ /* Added: October 18th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { background-image:url("fond_body.gif"); background-repeat:repeat-x; background-position:top left; background-color:#fff; color:#666; font-family:Trebuchet MS,Verdana,Arial,Helvetica,sans-serif; margin:0; padding:0; height:550px; width:4000px; } html > body { border-bottom:1px solid black; } h1, h2, h3, h4 { margin:0; padding:0; } div#intro { background-image:url("header.jpg"); background-repeat:no-repeat; background-position:left top; height:550px; } div#intro p { width:350px; } h1 span, h3 span, #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none; } #explanation h3 span, #preamble h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display:block; font-family:Century Gothic, AvantGarde, Verdana, Arial, sans-serif; font-weight:normal; font-size:1.5em; color:#c9380b; } h2 { color:#ccc; padding-top:325px; font-size:0.8em; font-weight:normal; letter-spacing:0.4em; padding-left:3em; } div#quickSummary { margin-left:0.8em; } div#quickSummary a, div#footer a, p a { color:#c9380b; text-decoration:none; font-weight:bold; } div#quickSummary a:hover, p a:hover, div#footer a:hover { text-decoration:underline; } div#linkList2, div#lresources { background-image:url("fond_bande_milieu.gif"); background-repeat:repeat-y; width:255px; height:550px; position:absolute; top:0px; left:375px; } div#lresources { background-image:url("fond_bande_droite.gif"); width:298px; left:3200px; } h3.select { background-image:url("selectadesign.gif"); background-repeat:no-repeat; width:255px; height:145px; } h3.resources { background-image:url("browseresources.gif"); background-repeat:no-repeat; width:298px; height:138px; } div#lselect ul, div#larchives ul, div#lresources ul { color:#000; font-size:0.9em; margin:0px; padding:0px; width:90%; padding-left:35px; } div#lresources ul { padding-left:50px; } div#lselect li, div#larchives li, div#lresources li { background-image: url("puce_blanche.gif"); background-repeat: no-repeat; background-position: left center; list-style-type: none; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 15px; width: 90%; font-size:0.8em; } div#lselect a, div#larchives a, div#lresources a { color:#666; text-decoration:none; font-weight:bold; } div#lselect a.c { color:#fff; font-weight:normal; } div#lselect a:hover, div#larchives a:hover, div#lresources a:hover { text-decoration:underline; } h3.archives { margin-top:70px; background-image:url("viewarchives.gif"); background-repeat:no-repeat; width:255px; height:100px; } div#preamble, div#explanation, div#participation, div#benefits, div#requirements { position:absolute; background-repeat:no-repeat; top:0px; font-size:75%; height:550px; } div#preamble { left:628px; background-image:url("theroad.jpg"); width:379px; } div#preamble h3, div#requirements h3, div#participation h3 { padding-top:280px; } div#preamble p, div#requirements p, div#participation p, div#explanation p, div#benefits p, div#preamble h3, div#requirements h3, div#participation h3, div#explanation h3, div#benefits h3, div#requirements p, div#requirements h3 { padding-left:8px; padding-right:8px; text-align:justify; } div#explanation { left:1007px; background-image:url("sowhat.jpg"); width:398px; } div#explanation h3, div#benefits h3 { padding-top:15px; } div#participation { left:1405px; background-image:url("participation.jpg"); width:656px; } div#benefits { left:2061px; background-image:url("benefits.jpg"); width:390px; } div#requirements { left:2451px; width:1050px; } div#footer { position:absolute; top:470px; left:0.8em; } div#footer a:before { content: url("puce_rouge.gif"); } p { font-size:0.9em; } #requirements .p5 { margin-top:15px; color:#ccc; }/* css Zen Garden default style - 'Tranquille' by Dave Shea - http://www.mezzoblue.com/ */ /* css released under Zen Garden License - http://www.mezzoblue.com/zengarden/license/ */ /* All associated graphics copyright 2003, Dave Shea */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* Please view the Zen Garden License for more information. http://www.mezzoblue.com/zengarden/license/ */ /* The Zen Garden default was the first I put together, and almost didn't make the cut. I briefly flirted with using 'Salmon Cream Cheese' as the main style for the Garden, but switched back to this one before launch. All graphics in this design were illustrated by me in Photoshop. Google Image Search provided inspiration for some of the elements. I did a bit of research on Kanji to come up with the characters on the top left. Anyone who can read that will most likely tell you it makes no sense, but the best I could do was putting together the characters for 'beginning' 'complete' and 'skill' to roughly say something like 'we're breaking fresh ground.' It's a stretch. */ /* basic elements */ html { margin: 0px; padding: 0px; } body { font: 11px/14px Verdana, Geneva, Arial, Helvetica, sans-serif; color: #999; margin: 0px; padding: 0px; text-align: left; background: #fff url(bg.gif) repeat-y; } p { font: 11px/14px Verdana, Geneva, Arial, Helvetica, sans-serif; margin: 0px; margin-top: 10px; padding:0px; } a:link { font-weight: bold; text-decoration: none; color: #FFCC00; } a:visited { font-weight: bold; text-decoration: none; color: #666; } a:hover, a:active { text-decoration: none; color: #666; } acronym { border-bottom: none; } /* specific divs */ #container { padding: 0px; margin: 0px; } #intro{ width: 760px; position:absolute; top:0px; left:0px; } #intro{ width: 760px; } #pageHeader { background: transparent url(headerbg2.gif) no-repeat top left; height: 83px; } #pageHeader h1 { background: transparent url(title.gif) no-repeat top left; margin: 0px; width: 760px; height: 43px; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(sub.gif) no-repeat top right; width: 760px; height: 42px; margin: 0px; padding:0px; } #pageHeader h2 span { display:none } #quickSummary p.p1{ margin:0px; margin-left: 199px; padding: 20px; text-align:justify; background: transparent url(hordot.gif) repeat-x bottom; } #quickSummary p.p2{ margin:0px; margin-left: 199px; padding: 20px; width: 520px; background: transparent url(hordot.gif) repeat-x bottom; } #preamble{ margin-left: 199px; padding-left: 20px ; padding-right: 20px; padding-bottom: 4px; width: 520px; background:transparent url(hordot.gif) repeat-x bottom; } #supportingText { position: absolute; top:390px; left: 199px; width: 560px; padding-bottom: 20px; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3{ margin:20px 0px 10px 0px; width:200px; height:19px; } #preamble h3{ background: transparent url(preh3.gif) no-repeat top left; } #explanation h3{ background: transparent url(exph3.gif) no-repeat top left; } #participation h3{ background: transparent url(parth3.gif) no-repeat top left; } #benefits h3, #requirements h3{ background: transparent url(benh3.gif) no-repeat top left; } #requirements h3{ background: transparent url(reqh3.gif) no-repeat top left; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #lselect h3 span, #lfavorites h3 span, #larchives h3 span, #lresources h3 span{ display:none; } #preamble p.p3, #explanation p.p2, #participation p.p4, #benefits p.p1, #requirements p.p5 { padding-bottom: 20px; margin:0px; } #preamble, #explanation, #participation, #benefits, #requirements { padding-left: 20px ; padding-right: 20px; padding-bottom: 4px; background:transparent url(hordot.gif) repeat-x bottom; } #linkList{ position: absolute; top:260px; left: 0px; padding:0px; margin:0px; width: 180px; } #lselect h3{ padding:0px; margin:0px; width:199px; height:21px; } #lfavorites h3, #larchives h3, #lresources h3{ padding:0px; margin:0px; width:199px; height:21px; } #lselect h3{ background: transparent url(select.gif) no-repeat top left; } #lfavorites h3{ background: transparent url(fav.gif) no-repeat top left; } #larchives h3{ background: transparent url(arc.gif) no-repeat top left; } #lresources h3{ background: transparent url(res.gif) no-repeat top left; } #lselect ul, #lfavorites ul, #larchives ul, #lresources ul{ margin: 0; padding: 0; margin-top:20px; margin-bottom: 20px; list-style-type: none; } #lselect li, #lfavorites li, #larchives li, #lresources li { padding-left: 12px; margin-top: 10px; margin-bottom: 10px; } #lselect a, #lfavorites a { background: transparent url(bul2.gif) no-repeat 0px 2px; padding-left:18px; display:block; } #lselect a:hover, #lfavorites a:hover { background: transparent url(bul1.gif) no-repeat 0px 2px; padding-left:18px; display:block; } #lselect a.c, #lfavorites a.c { font: 11px/14px Verdana, Geneva, Arial, Helvetica, sans-serif; color: #999; font-weight: normal; text-decoration:none; background: transparent; padding-left:0px; display:inline; } #lselect a.c:hover, #lfavorites a.c:hover { background: transparent; padding-left:0px; display:inline; } #footer{ width: 520px; padding-left: 20px ; padding-right: 20px; padding-bottom: 4px; background: #efefef url(hordot.gif) repeat-x bottom;; } #extraDiv1{ width:196px; height:177px; top: 63px; left:1px; position:absolute; background: transparent url(buda.jpg) no-repeat; } /* css Zen Garden submission 050 - 'First Summary' by Cornelia Lange, http://www.clkm.de/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Cornelia Lange */ /* Added: October 17th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* elements */ body { color: #000; background: #545D64; font: 90% Verdana, Arial, Helvetica, sans-serif; text-align: center; } body, html, h1, h2, h3, p, ul, li, div, span { margin: 0; padding: 0; } a { color: #fff; font-weight: normal; background: transparent; } a:visited { color: #000; background: transparent; } a:hover { text-decoration: underline; color: #900; background: transparent; } ul, li { display: block; list-style: none; } a acronym { border: 0 none; } /* divs and related classes */ #container { position: relative; display: block; width: 737px; margin: 30px auto 0 auto; text-align: left; color: #000; background: transparent url(zengarden.jpg) top left no-repeat; border-left: 1px solid #545D64; } #intro { padding-top: 330px; } #pageHeader h1 { display: none; } #pageHeader h2 { display: none; } #quickSummary { position: absolute; top: 0; left: 560px; display: block; width: 180px; height: 330px; color: #000; background: transparent; } #quickSummary p { font-size: .78em; width: 120px; } #quickSummary .p1 { display: none; } #quickSummary .p2 { position: absolute; top: 230px; left: -330px; display: block; width: 90px; font-family: Arial, Helvetica, sans-serif; } #preamble { display: block; width: 626px; margin-left: 110px; color: #fff; background: #B5BB7D url(enlightenment_default.gif) 100% 3em no-repeat; } #preamble h3 { display: none; } #preamble p { font-size: 0.8em; line-height: 140%; width: 440px; color: #000; background: #B5BB7D; } #preamble .p1, #preamble .p2, #preamble .p3 { width: 290px; margin: 0 0 0 110px; padding: 10px 20px 5px 20px; color: #fff; background: #537E53; } #preamble .p1 { padding-top: 4em; } #preamble .p2 { margin-top: -2px; } #preamble .p3 { margin-top: -2px; padding-bottom: 20px; } #supportingText { display: block; width: 736px; color: #000; background: #B5BB7D url(main_bg.gif); border-bottom: 20px solid #B62814; } #explanation, #participation, #benefits, #requirements { margin-left: 110px; width: 626px; } #explanation { color: #000; background: #FFFFCD url(about.gif) 100% 20px no-repeat; } #participation { color: #000; background: #FAC46C url(participation.gif) 100% 20px no-repeat; } #benefits { color: #000; background: #FFFFCD url(benefits.gif) 100% 20px no-repeat; } #requirements { color: #000; background: #FAC46C url(requirements.gif) 100% 20px no-repeat; } #explanation p, #benefits p, #requirements p, #participation p { width: 440px; font-size: 0.8em; line-height: 140%; } #explanation h3 { display: none; } #explanation p { color: #000; background: #FAC46C; } #explanation .p1 { border-top: 4px solid #B52814; width: 340px; padding: 25px 20px 5px 80px; } #explanation .p2 { width: 340px; padding: 10px 20px 20px 80px; margin-top: -2px; } #participation h3 span { display: none; } #participation p { color: #000; background: #B5BB7D; } #participation .p1 { width: 340px; padding: 25px 20px 5px 80px; } #participation .p2 { width: 340px; padding: 10px 20px 5px 80px; margin-top: -2px; } #participation .p3 { width: 340px; padding: 10px 20px 5px 80px; margin-top: -2px; } #participation .p4 { width: 340px; padding: 10px 20px 20px 80px; margin-top: -2px; } #benefits h3 { display: none; } #benefits p { color: #000; background: #FAC46C; } #benefits .p1 { width: 340px; padding: 25px 20px 20px 80px; } #requirements h3 { display: none; } #requirements p { color: #000; background: #B5BB7D; } #requirements .p1 { width: 340px; padding: 25px 20px 5px 80px; } #requirements .p2 { width: 340px; padding: 10px 20px 5px 80px; margin-top: -2px; } #requirements .p3 { width: 340px; padding: 10px 20px 5px 80px; margin-top: -2px; } #requirements .p4 { width: 340px; padding: 10px 20px 5px 80px; margin-top: -2px; } #requirements .p5 { width: 340px; padding: 10px 20px 20px 80px; margin-top: -2px; } /* The Tan-Hack for IE 5.0 */ * html #preamble .p1, * html #preamble .p2, * html #preamble .p3 { width: 330px; w\idth: 290px; } * html #supportingText .p1, * html #supportingText .p2, * html #supportingText .p3, * html #supportingText .p4, * html #supportingText .p5 { width: 440px; w\idth: 340px; } #footer { position: absolute; top: 115px; left: 115px; display: block; height: 110px; width: 110px; margin: 0; padding: 0; } #footer a { font: 0.78em Arial, Helvetica, sans-serif; } #footer a:link, #footer a:visited { color: #fff; background: transparent; } #footer a:hover, #footer a:active { color: #f60; background: transparent; } /* left Menu */ #linkList2 { display: block; position: absolute; top: 330px; left: 0; text-align: left; } #lselect { position: relative; top: 0; left: 0; color: #000; background: #D28B6B; width: 110px; text-align: center; } #lselect h3 { display: none; } #lselect ul { list-style: none; margin: 0; padding: 0 0 10px 0; } #lselect li { display: block; width: 100px; background: transparent; margin: 0 5px; padding: 5px 0 5px 0; font-size: 0.78em; } #lselect a { display: block; width: 100px; color: #fff; background: #D28B6B url(anim.gif) bottom center no-repeat; margin: 0 0 5px 0; padding-bottom: 10px; text-decoration: none; } #lselect a:link, #lselect a:visited { color: #fff; background: #D28B6B url(punkte.gif) bottom center no-repeat; } #lselect a:hover, #lselect a:active { color: #fff; background: #D28B6B url(anim.gif) bottom center no-repeat; text-decoration: underline; } #lselect a.c, #lselect a:link.c , #lselect a:visited.c{ color: #000; background: transparent; display: inline; } #lselect a:hover.c, #lselect a:active.c { display: inline; } #lfavorites { position: relative; top: 10px; left: 0; width: 110px; color: #000; background: #D28B6B url(favorites.gif) top left no-repeat; text-align: center; } #lfavorites h3 { display: none; } #lfavorites ul { list-style: none; margin: 0; padding: 30px 0 10px 0; } #lfavorites li { display: block; width: 100px; background: transparent; margin: 0 5px; padding: 5px 0 5px 0; font-size: 0.78em; } #lfavorites a { color: #fff; background: #D28B6B url(anim.gif) bottom center no-repeat; margin: 0 0 5px 0; display: block; width: 100px; padding-bottom: 10px; text-decoration: none; } #lfavorites a:link, #lfavorites a:visited { color: #fff; background: #D28B6B url(punkte.gif) bottom center no-repeat; } #lfavorites a:hover, #lfavorites a:active { color: #fff; background: #D28B6B url(anim.gif) bottom center no-repeat; text-decoration: underline; } #lfavorites a.c, #lfavorites a:link.c , #lfavorites a:visited.c{ color: #000; background: transparent; display: inline; } #lfavorites a:hover.c, #lfavorites a:active.c { display: inline; } #larchives { position: relative; left: 0; top: 10px; display: block; width: 7.65em; height: 7.65em; color: #fff; background: transparent url(archives3.gif) top left no-repeat; } #larchives h3 { display: none; } #larchives h3 span { display: none; } #larchives ul { list-style: none; margin: 0; padding: 40px 0 0 0; } #larchives li { display: inline; font-size: 0.78em; padding: 0; margin: 0; } #larchives a { display: block; color: #fff; background: transparent url(point.gif) left no-repeat; text-decoration: none; padding-left: 10px; margin-left: 5px; } #larchives a .accesskey { color: #fff; background: transparent; } #lresources { position: absolute; top: 0; left: 110px; color: #fff; background: #B62814; display: block; width: 626px; height: 1.3em; padding: 1px 0; } #lresources h3 { display: none; } #lresources ul { list-style: none; margin: 0 0 0 5px; padding: 0; display: inline; } #lresources li { display: inline; font-size: 0.78em; } #lresources a { font-size: 0.80em; padding: 0 5px 0 8px; color: #fff; background: transparent url(pointanim.gif) left no-repeat; text-decoration: none; } #lresources a:link, #lresources a:visited { color: #fff; background: transparent url(point.gif) left no-repeat; } #lresources a:hover, #lresources a:active { color: #fff; background: transparent url(pointanim.gif) left no-repeat; } /* css Zen Garden submission 051 - 'Commercial Drive' by Wendy Foster, http://www.transgression.ca/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Wendy Foster */ /* Added: October 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Support the Open Source Initiative - http://www.opensource.org/ */ /* basic elements */ body { background: #79000E url("girl.jpg") no-repeat fixed top left; font: 10px verdana, sans-serif; color: #000000; margin: 0px 0px 0px 0px; } p { font: 10px verdana, sans-serif; margin-top: 0px; text-align: justify; } /* font resizing hack. Allows for an absolute value to be specified in the main p tag, as well as resolves resizing and rendering issues cross-browser. For a detailed explanation see: Mark Pilgrim's "Relative Font Sizing HOWTO : http://diveintoaccessibility.org/examples/fontsize.html */ /*/*/a{} body, body p { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body, html>body p { font-size: small; } /* */ h3 { font: 10px verdana, sans-serif; letter-spacing: 1px; margin-bottom: 0px; background: none; color: #7D775C; } a:link { font-weight: bold; text-decoration: none; background:none; color: #79000e; cursor: help; } a:visited { font-weight: bold; text-decoration: none; background: none; color: #7099A6; cursor: help; } a:active { font-weight:bold; text-decoration: none; background: none; color: #5f3a79; cursor: help; } a:hover { font-weight: bold; text-decoration: none; border: 1px solid #000000; background: #c2c4c6; color:#003058; cursor: help; } /* specific divs */ #container { background: #CED41E; color: #000000; padding: 5px 5px 5px 5px; margin: 0px; width:300px; position:absolute; top:0px; left:493px; border-right: 5px solid #000000; border-left: 5px solid #000000; } #intro { min-width: 300px; } #pageHeader { margin-bottom: 20px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url("garden.gif") no-repeat top left; color:#000000; width: 250px; height: 80px; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url("design.gif") no-repeat top left; color:#000000; width: 250px; height: 25px; position:absolute; left:35px; top:82px; } #pageHeader h2 span { display:none; } #quickSummary { clear:both; margin: 20px 20px 10px 10px; padding:20px 5px 5px 5px; width: 250px; background: #d6d894 url("summarybg.gif"); color: #000000; border-right: 5px solid #000000; border-left: 5px solid #000000; border-bottom: 5px solid #000000; } #quickSummary p { font: 10px verdana, sans-serif; text-align:center; } /*/*/a{} body #quickSummary p { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #quickSummary, html>body #quickSummary p { font-size: small; } /* */ #preamble { padding:5px 5px 5px 5px; } #preamble h3 { background: transparent url("enlightenment.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #preamble h3 span { display:none; } #supportingText { padding:5px 5px 5px 5px; margin-bottom: 20px; } #explanation h3 { background: transparent url("about.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #explanation h3 span { display:none; } #participation h3 { background: transparent url("participation.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #participation h3 span { display:none; } #benefits h3 { background: transparent url("benefits.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #benefits h3 span { display:none; } #requirements h3 { background: transparent url("requirements.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #requirements h3 span { display:none; } #favorites h3 { background: transparent url("favorites.gif") no-repeat top left; text-align:center; color:#000000; width: 250px; height: 25px; } #favorites h3 span { display:none; } #footer { text-align: center; padding: 5px 5px 5px 5px; border-left: 5px solid #000000; border-right: 5px solid #000000; border-bottom: 5px solid #000000; background:#D9DE4B url("footerbg.gif"); color:#000000; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList2 { background:#CED41E url("linklistbg.gif"); color:#000000; font: 10px verdana, sans-serif; padding: 5px 5px 5px 5px; border-top: 5px solid #000000; border-bottom: 5px solid #000000; position:absolute; top:27px; left:-230px; height:125px; width:220px; overflow:auto; } /*/*/a{} body #linkList2 { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList2 { font-size: small; } /* */ #linkList h3.select { background: transparent url(select.gif) no-repeat top left; color:#000000; margin: 10px 0px 5px 0px; width: 100px; height: 20px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(favorites.gif) no-repeat top left; color:#000000; margin: 25px 0px 5px 0px; width: 100px; height: 20px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.gif) no-repeat top left; color:#000000; margin: 25px 0px 5px 0px; width:100px; height: 20px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.gif) no-repeat top left; color:#000000; margin: 25px 0px 5px 0px; width:100px; height: 20px; } #linkList h3.resources span { display:none } #linkList ul { font:10px verdana, sans-serif; margin: 0px; padding-left: 15px; list-style-type: circle; list-style-image: url("bullet.gif"); } /*/*/a{} body #linkList ul { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList ul { font-size: small; } /* */ #linkList li { font: 10px verdana, sans-serif; padding-top: 5px; margin-bottom: 5px; } /*/*/a{} body #linkList li { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList li { font-size: small; } /* */ #linkList li a:link { font: 10px verdana, sans-serif; font-weight:bold; background:none; color: #79000e; text-decoration:none; cursor: help; } /*/*/a{} body #linkList li a:link{ font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList li a:link { font-size: small; } /* */ #linkList li a:visited { font: 10px verdana, sans-serif; font-weight:bold; background:none; color: #7099A6; text-decoration:none; cursor: help; } /*/*/a{} body #linkList li a:visited{ font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList li a:visited { font-size: small; } /* */ #linkList li a:active { font: 10px verdana, sans-serif; font-weight:bold; background:none; color: #5f3a79; text-decoration:none; cursor: help; } /*/*/a{} body #linkList li a:active{ font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList li a:active { font-size: small; } /* */ #linkList li a:hover { font: 10px verdana, sans-serif; font-weight:bold; border: 1px solid #000000; background: #c2c4c6; color:#003058; text-decoration:none; cursor: help; } /*/*/a{} body #linkList li a:hover{ font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body #linkList li a:hover { font-size: small; } /* */ /* css Zen Garden submission 052 - 'Postage Paid' by Mike Stenhouse, http://www.donotremove.co.uk */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Mike Stenhouse */ /* Added: October 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ html { background-color: #BDB7BD; color: black; } body { margin:0 0 0 0; padding:0 0 0 0; font-family:arial, helvetica, sans-serif; font-size:11px; letter-spacing:0.01em; color:black; /*overflow: hidden;*/ /* hack to stop IE/Mac adding masses of space under the page - caused by IE/Mac rendering space for the invisible content of overflow:auto */ } p { margin:0; padding-top:0; padding-bottom:11px; line-height:130%; } acronym { text-decoration:none; font-style: none; border-bottom:0px dotted black; } /* LINK STYLES */ a, a:link a:active { color:black; background-color:white; text-decoration:none; font-weight:normal; } a:visited { color:#666; } a:hover { background-color:black; color:white; } div#intro a, div#intro a:link div#intro a:active { color:black; text-decoration:none; font-weight:normal; } div#intro a:visited { color:#666; } div#intro a:hover { background-color:#FE7996; color: white; } div#supportingText a, div#supportingText a:link div#supportingText a:active { background-color: white; color: black; text-decoration:none; font-weight:normal; } div#supportingText a:visited { color:#666; } div#supportingText a:hover { background-color: black; color: white; } div#supportingText div#footer a, div#supportingText div#footer a:link div#supportingText div#footer a:active { background-color:transparent; color:black; text-decoration:none; font-weight:bold; } div#supportingText div#footer a:visited { color:black; } div#supportingText div#footer a:hover { background-color: black; color: white; } div#linkList a, div#linkList a:link div#linkList a:active { background-color:white; color:black; text-decoration:none; font-weight:normal; } div#linkList a:visited { color:#666; text-decoration: line-through; } div#linkList div#larchives a:visited, div#linkList div#lresources a:visited { text-decoration: none; } div#linkList a:hover { background-color: #FE7996; color: white; } /* END LINK STYLES */ /* CONTAINER */ div#container { z-index:1; width:780px; padding-bottom:100px; background: url("card_bottom.jpg") no-repeat left bottom; } /* END CONTAINER */ /* INTRO */ div#intro { position:relative; top:0; left:0; width:780px; height:100px; padding-top:0; margin-top:0; padding:167px 0 27px 27px; background: url("card.jpg") repeat-y left top; } html>body div#intro { height:auto; } div#intro h1 { z-index:10; position:absolute; top:50px; left:0; height: 101px; width: 307px; margin:0; padding:0; background: url(logo.jpg) no-repeat left top; } div#intro h1 span { display: none; } div#intro h2 { z-index:10; position:absolute; top:119px; left:174px; width: 205px; height: 32px; margin:0; padding:0; background: url(tagline.jpg) no-repeat left top; } div#intro h2 span { display: none; } div#intro div#pageHeader { z-index:2; position:absolute; top:0; left:0; width:780px; height:150px; background: url("card_top.jpg") no-repeat left top; } div#intro div#quickSummary { z-index:10; position:absolute; top:37px; left:427px; width:301px; background: white url("rounded_top.jpg") no-repeat left top; } div#intro div#quickSummary p { padding-left:100px; padding-right:15px; } div#intro div#quickSummary p.p1 { height:107px; margin-top:26px; margin-bottom:11px; padding-bottom:0; background: url("a_demonstration_of.gif") no-repeat 100px 22px; } div#intro div#quickSummary p.p1 span { display:none; } div#intro div#quickSummary p.p2 { padding-bottom:20px; color:#aaa; background: url("rounded_bottom.jpg") no-repeat bottom left; } div#intro div#preamble { z-index:10; position:relative; width:198px; margin:0; padding:0; color:white; background: #071969 url("blue_top.gif") no-repeat top left; } div#intro div#preamble h3 { position:absolute; top:15px; right:15px; width: 32px; height: 244px; margin:0; padding:0; background: url(the_road_to_enlightenment2.gif) no-repeat left top; } div#intro div#preamble h3 span { display:none; } div#intro div#preamble p { padding-left:15px; padding-right:15px; margin-left:0px; margin-right:30px; } div#intro div#preamble p.p1 { padding-top:65px; margin-top:0; } div#intro div#preamble p.p3 { padding-bottom:30px; margin-bottom:0; background: url("blue_bottom.gif") no-repeat bottom left; } /* END INTRO */ /* SUPPORTINGTEXT */ div#supportingText { position:absolute; z-index:10; left:240px; top:329px; padding:0 0 0 0; width:335px; height:300px; overflow:auto; background-color:#A5D2AA; border-width: 2px 2px 2px 2px; border-style:solid; border-color:white; } div#supportingText p { padding-left:35px; padding-right:15px; /*margin-right:35px;*/ /*to sort ie/mac horiz scrollbar*/ } div#supportingText div#explanation { background: url("do_not_duplicate.gif") no-repeat 5px 14px; } div#supportingText div#explanation h3 { width: 166px; height: 15px; margin:10px 0 6px 34px; display:block; background: url(so_what_is_this_about.gif) no-repeat left top; } div#supportingText div#explanation h3 span { display:none; } div#supportingText div#participation h3 { width: 166px; height: 18px; margin:0px 0 3px 34px; background: url(participation.gif) no-repeat left top; } div#supportingText div#participation h3 span { display:none; } div#supportingText div#benefits h3 { width: 166px; height: 15px; margin:0px 0 6px 34px; background: url(benefits.gif) no-repeat left top; } div#supportingText div#benefits h3 span { display:none; } div#supportingText div#requirements h3 { width: 166px; height: 18px; margin:0px 0 3px 34px; background: url(requirements.gif) no-repeat left top; } div#supportingText div#requirements h3 span { display:none; } div#supportingText div#footer { padding:0 15px 17px 35px; background: url("footer.gif") no-repeat bottom left; } /* END SUPPORTINGTEXT */ /* LINKLIST */ div#linkList { z-index:10; position:absolute; top:247px; left:594px; width:160px; color:#aaa; background: white url("rounded2_top.jpg") no-repeat top left; } div#linkList ul { margin:0; padding:0 15px 6px 15px; list-style:none; } div#linkList ul li { margin:0; padding:0; } div#linkList div#lselect h3 { width:112px; height:12px; margin:40px 0 6px 15px; padding:0; background: url("select_a_design2.gif") no-repeat top left; } div#linkList div#lselect h3 span { display:none; } div#linkList div#lselect li { margin-bottom:2px; } div#linkList div#larchives h3 { margin:0 0 0 0; } div#linkList div#larchives h3 span { display:none; } div#linkList div#larchives a { font-weight:bold; } div#linkList div#lresources h3 { width:81px; height:11px; margin:6px 0 6px 15px; padding:0; background: url("resources2.gif") no-repeat top left; } div#linkList div#lresources h3 span { display:none; } div#linkList div#lresources ul { padding-bottom:20px; background: url("rounded2_bottom.jpg") no-repeat bottom left; } div#linkList div#lresources li { margin-bottom:2px; } /* END LINKLIST */ /* EXTRAS */ div#extraDiv1 { z-index:11; position:absolute; top:68px; left:381px; width:134px; height:119px; background: url("stamp.jpg") no-repeat top left; } div#extraDiv2 { z-index:11; position:absolute; top:260px; left:240px; width:335px; height:69px; background: white url("barcode.gif") no-repeat top left; border-width: 2px 2px 0 2px; border-style:solid; border-color:white; } div#extraDiv3 { z-index:2; position:absolute; top:265px; left:609px; width:171px; height:356px; background: url("bent.jpg") no-repeat top left; } /* END EXTRAS */ /* css Zen Garden submission 053 - 'untitled' by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Ray Henry */ /* Added: October 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { font-family:verdana, arial, sans serif; color:#65625B; background:#fff url(main2_bg.gif); margin:0; padding:0; } #container { width:auto; margin:22px 0 0 0; padding:7px 0 0 0; height:471px; } acronym { cursor: help; } /*-- intro section --*/ #intro { background:#fff url(intro_bg.jpg) no-repeat top left; width:339px; height:471px; padding:0 0 0 201px; margin:0; } #pageHeader { background:#fff url(pageHead_bg.gif) no-repeat top left; width:302px; height:51px; margin:0; padding:0; border-bottom:1px dotted #c8c8c8; } #quickSummary, #preamble { font-size:11px; margin:0 0 0 100px; width:202px; } #quickSummary p, #preamble p { margin-bottom:10px; line-height:16px; } #preamble h3 { background:#fff url(preamble_h3_bg.gif) no-repeat top left; width:142px; height:13px; margin-top:20px; } /*-- supportingText section --*/ #supportingText { background:transparent; font-size:11px; width:auto; } #explanation { position:absolute; top:80px; left:520px; clear:both; background:#fff url(graySec_bg.gif) repeat-x top left; width:344px; margin:0; padding:10px 0 0 0; height:410px; } #explanation h3 { background:#F4F4F3 url(explan_h3_bg.gif) no-repeat top left; width:137px; height:13px; margin:30px 10px 10px 10px; } #explanation p { margin:10px; line-height:16px; } /*-- participation section --*/ #participation { position:absolute; top:80px; left:868px; background:#fff url(explan_bg.gif) no-repeat top left; width:344px; margin:0; padding:10px 0 0 3px; height:410px; } #participation h3 { background:#fff url(part_h3_bg.gif) no-repeat top left; width:73px; height:13px; margin:30px 10px 10px 10px; } #participation p { margin:10px; line-height:16px; } /*-- benefits section --*/ #benefits { position:absolute; top:80px; left:1216px; background:#fff url(graySec_bg.gif) repeat-x top left; width:344px; margin:0; padding:10px 0 0 3px; height:410px; } #benefits h3 { background:#F4F4F3 url(ben_h3_bg.gif) no-repeat top left; width:45px; height:13px; margin:30px 10px 10px 10px; } #benefits p { margin:10px; line-height:16px; } /*-- requirements section --*/ #requirements { position:absolute; top:80px; left:1564px; background:#fff url(explan_bg.gif) repeat-x top left; width:560px; margin:0; padding:10px 0 0 3px; height:410px; } #requirements h3 { background:#fff url(req_h3_bg.gif) no-repeat top left; width:73px; height:13px; margin:30px 10px 10px 10px; } #requirements p { margin:10px; line-height:16px; } /*-- footer section --*/ #footer { position:absolute; top:80px; left:2546px; background:#fff url(graySec_bg.gif) repeat-x top left; width:40px; padding:45px 0 0 10px; height:375px; margin:0px 50px 0 0; line-height:20px; } /*-- lselect section --*/ #lselect { position:absolute; background:#fff url(lselect_arrow_bg.gif) no-repeat top left; top:30px; left:520px; height:51px; width:2100px; margin:0; padding:0; border-left:1px dotted #c8c8c8; border-bottom:1px dotted #c8c8c8; font-size:11px; } #lselect h3 { background:#fff url(lselect_bg.gif) no-repeat top left; width:83px; height:13px; margin:10px 10px 9px 10px; } #lselect ul { margin:0 0 0 80px; padding:0; } #lselect li { font-size:10px; margin-right:8px; padding:6px; display: inline; list-style-type: none; border-left:1px solid #ccc; border-top:1px solid #ccc; border-right:1px solid #ccc; } #lselect a:link, #lselect a:visited, #lselect a:active { font-size:10px; color:#65625B; } #lselect li:hover{ background: #f5f5f5 url(tab_bg.gif) repeat-x top left; color:#434039; } /*-- larchives section --*/ #larchives { position:absolute; top:80px; left:2131px; background:#F4F4F3 url(explan_bg.gif) repeat-x top left; width:200px; margin:0; padding:10px 0 0 3px; height:410px; } #larchives h3 { background:#F4F4F3 url(arch_h3_bg.gif) no-repeat top left; width:49px; height:13px; margin:30px 10px 10px 10px; } #larchives ul { list-style-type: none; font-size:11px; margin:0 0 0 20px; padding:0; line-height:20px; } /*-- larchives section --*/ #lresources { position:absolute; top:80px; left:2338px; background:#fff url(explan_bg.gif) repeat-x top left; width:200px; margin:0; padding:10px 0 0 3px; height:410px; } #lresources h3 { background:#fff url(res_h3_bg.gif) no-repeat top left; width:60px; height:13px; margin:30px 10px 10px 10px; } #lresources ul { list-style-type: none; font-size:11px; margin:0 0 0 20px; padding:0; line-height:20px; } /*-- LINKS --*/ #quickSummary a:link, #quickSummary a:visited, #quickSummary a:active, #supportingText a:link, #supportingText a:visited, #supportingText a:active, #larchives a:link, #larchives a:visited, #larchives a:active, #lresources a:link, #lresources a:visited, #lresources a:active { color:#65625B; } #quickSummary a:hover, #supportingText a:hover, #larchives a:hover, #lresources a:hover{ color:#434039; } /*-- hidden --*/ #pageHeader h1, #pageHeader h2, #preamble h3 span, #preamble p.p3, #participation p.p4, #explanation h3 span, #participation h3 span, #benefits h3 span, #supportingText h3 span, #lselect h3 span, #larchives h3 span, #lresources h3 span, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none; }/* css Zen Garden submission 054 - 'Gecko's Eye' by Sandra Greco, http://www.magritte.it/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Sandra Greco */ /* Added: October 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { color: #fff; background: #9E9E9E; margin: 0; background-image: url(bg.gif); background-position: top left; background-repeat:no-repeat; } p { font: 8pt/15pt Verdana, Arial, Helvetica, sans-serif; margin-top: 4px; text-align: left; margin-right:5px; } .p1, .p2 { background-image: url(separator.gif); background-position: left bottom; background-repeat:no-repeat; padding-bottom:15px; margin-left:10px; } .p3 { padding-bottom:12px; margin-left:10px; } .p4 { background-image: url(separator.gif); background-position: left bottom; background-repeat:no-repeat; padding-bottom:10px; } h3 { FONT: 11pt times, Verdana, Arial, Helvetica, sans-serif; COLOR: #EEE9E0; text-decoration: none; font-weight:bold; height:10px; line-height:17px; letter-spacing:0.04em; } a:link { font-weight: bold; text-decoration: underline; color: #ffffff; } a:visited { font-weight: bold; text-decoration: underline; color: #ffffff; } a:hover, a:active { text-decoration: none; color: #ffffff; } #container { background-image: url(geco_garden.gif); background-position: 221px 0px; background-repeat:no-repeat; margin: 0; height:80%; } #explanation { BACKGROUND:#880622 url(eye.gif) 0 10px no-repeat; width:520px; padding-bottom:35px; border-top: solid 1px #5F0116; border-right: solid 1px #5F0116; } #participation, #benefits, #requirements { BACKGROUND:#880622 url(eye.gif) 0 10px no-repeat; width:520px; padding-bottom:35px; margin-top:-35px; border-right: solid 1px #5F0116; } #explanation p, #participation p, #benefits p, #requirements p { width:490px; margin-left:10px; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin-left:55px; padding-top:30px; color: #d3f580; } #footer { font: 11px Verdana, Arial, Helvetica, sans-serif; BACKGROUND:#C6C4C4; width:520px; text-align:center; border-right: solid 1px #880622; border-bottom: solid 1px #880622; border-left: solid 1px #880622; padding-bottom: 2px; } #footer a:link, #footer a:visited { margin-right: 10px; color:#000000; } #footer a:hover { color:#880622; } #intro { min-width: 200px; } #extraDiv1 { background:#9E9E9E url(garden_css.gif) top left no-repeat; position: absolute; top: 145px; left: 520px; width:251px; height: 152px; border-bottom: solid 1px #EEE9E0; border-left: solid 1px #EEE9E0; border-top: solid 1px #EEE9E0; } #extraDiv2 { position: absolute; top: 0; left: 195px; background-position: top left; background-repeat:no-repeat; width:25px; height:220px; } #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none; } #quickSummary { position:absolute; top: 0; left: 520px; background:#0B4D69 url(sfondo_top.gif) no-repeat top left; font: 8pt/12pt Verdana, Arial, Helvetica, sans-serif; border-right: solid 1px #EEE9E0; border-left: solid 1px #EEE9E0; width:250px; z-index:1 } #quickSummary p { font: 8pt/12pt Verdana, Arial, Helvetica, sans-serif; text-align: left; margin-left:5px; width: 240px; } p:first-letter { COLOR: #EEE9E0; font-size: 150%; font-weight: bold; margin: 0px 2px 0px 0px; } #preamble { BACKGROUND:#497c89; width:221px; border-right: solid 1px #EEE9E0; margin-top:0; padding-bottom:1px; padding-top:1px; } #preamble h3 { color: #d3f580; padding-bottom:5px; margin-left:10px; padding-top:10px; } #pageHeader h1, #pageHeader h1 span, #pageHeader h2, #pageHeader h2 span { display:none } #linkList { margin-left: 250px; margin-top:110px; padding-left:7px; position: absolute; top: 40px; left: 270px; border-left: solid 1px #EEE9E0; border-right: solid 1px #EEE9E0; border-bottom: solid 1px #EEE9E0; padding-bottom:30px; width:200px; } #linkList2 { font: 10px Verdana, Arial, Helvetica, sans-serif; padding-left:10px; margin-top: 150px; width: 165px; } #linkList h3.select { text-align: center; } #linkList h3.select span { font: 12px/18px Verdana, Arial, Helvetica, sans-serif; font-weight:bold; letter-spacing:0.03em; margin: 30px 0px 5px 0px; height: 20px; } #linkList h3.favorites, #linkList h3.favorites span { display:none; } #larchives li { margin-bottom:5px; margin-top:6px; } #larchives a { background: url(arrow.gif) no-repeat top left; } #larchives a:hover, #larchives a:active #larchives a:visited{ background-color: #9E9E9E; text-decoration: none; } #lresources li { margin-bottom:5px; margin-top:6px; } #lselect a:link { text-decoration: none; background: url(circle.gif) top left no-repeat; } #lselect a:hover, #lselect a:active { text-decoration: none; } #lresources a { background-color: #9E9E9E; background: url(arrow.gif) no-repeat top left; } #lresources a:link { background-color: #9E9E9E; } #lresources a:hover, #lresources a:active { background-color: #9E9E9E; text-decoration: none; } #lresources a:visited{ background-color: #9E9E9E; text-decoration: none; background: url(arrow.gif) no-repeat top left; } #linkList h3.archives, #linkList h3.resources { font: 12px Verdana, Arial, Helvetica, sans-serif; letter-spacing:0.03em; margin: 15px 0px 5px 0px; height: 60px; width: 140px; background:url(decoration.gif) no-repeat top center; text-align: center; } #linkList h3.archives span, #linkList h3.resources span { letter-spacing:0.03em; font: 12px Verdana, Arial, Helvetica, sans-serif; font-weight:bold; text-align: center; width:140px; margin-top:40px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; } #linkList li a:link { color: #880622; text-decoration: none; padding-right:2px; padding-left:10px; padding-bottom:3px; padding-top:1px; height:18px; } #linkList li a:hover { color: #EEE9E0; text-decoration: none; padding-right:2px; padding-left:10px; padding-bottom:3px; padding-top:1px; } #linkList li a:visited { color: #880622; text-decoration: none; padding-right:2px; padding-left:10px; padding-bottom:3px; padding-top:1px; } #linkList li a:active { color: #880622; text-decoration: none; padding-right:2px; padding-left:10px; padding-bottom:3px; padding-top:1px; } #lselect{ display: block; font-weight: normal; text-decoration: none; } #lselect a.c { font-weight: normal; text-decoration: none; display: block; background: url(arrow1.gif) no-repeat top left; } #lselect a:hover.c { display: block; font-weight: normal; color:#EEE9E0; text-decoration: none; } .c { color: #880622; text-decoration: none; } .c:hover { color: #880622; text-decoration: underline; } /* css Zen Garden submission 056 - 'zenlightenment' by Lance Leonard, http://www.solarfrog.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Lance Leonard */ /* Added: October 29th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ html { text-align: center; } body { background: #369 url(bg.gif) repeat-x top; margin: 0 auto; padding: 0; color: #fff; font-family: verdana, arial, helvetica, sans-serif; width: 760px; font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } div#container { float: left; margin: 160px auto 0 auto; padding: 0; background: url(bg_container.gif) repeat-y top center; width: 760px; /* False value for IE4-5.x/Win */ text-align: left; } div#intro { position: relative; background: #369; border: solid 1px #000; margin: 0; padding: 5px; z-index: 1; width: 760px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 748px; /* Actual value for conformant browsers */ } div#pageHeader { position: absolute; top: -151px; left: 41px; background: url(head.jpg) no-repeat top left; width: 676px; height: 150px; } div#pageHeader h1, div#pageHeader h2 { display: none; } div#quickSummary { float: left; clear: both; margin: 0 0 0 5px; padding: 10px 0 0 0 ; width: 169px; /* False value for IE4-5.x/Win */ height: 169px; } div#quickSummary p.p1 { background: url("quickSum.gif") no-repeat top left; width: 159px; height: 139px; } div#quickSummary p.p1 span { display: none; } div#quickSummary p.p2 { position: absolute; top: 165px; font-size: 10px; width: 169px; } div#quickSummary a { color: #fff; font-weight: bold; } div#preamble { margin: 0 0 0 175px; padding: 5px 10px; background: #69c; min-height: 200px; width: 555px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 545px; /* Actual value for conformant browsers */ } div#preamble h3 { margin: 0 0 10px 0; padding: 0; height: 26px; background: url(road.gif) no-repeat top left; } div#preamble h3 span { display: none; } div#preamble p { margin: 8px 0 0 0; line-height: 1.5em; } div#supportingText { float: left; margin: 0; padding: 20px 20px 0 66px; background: url(bg_supportingText.gif) no-repeat top left; width: 496px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 410px; /* Actual value for conformant browsers */ } div#supportingText h3 { margin: 25px 0 0 0; padding: 0; width: 409px; height: 26px; } div#supportingText h3 span { display: none; } div#explanation h3 { margin-top: 0; background: url(what.gif) no-repeat top left; } div#participation h3 { background: url(part.gif) no-repeat top left; } div#benefits h3 { background: url(bene.gif) no-repeat top left; } div#requirements h3 { background: url(requ.gif) no-repeat top left; } div#supportingText p { margin: 15px 0 0 0; letter-spacing: .1em; line-height: 1.2em; } div#supportingText a { color: #036; } div#linkList { margin-left: 496px; padding: 20px; background: url(bg_linkList.gif) no-repeat top left; } div#linkList h3 { margin: 25px 0 0 0; padding: 0; width: 182px; height: 26px; } div#linkList h3 span { display: none; } div#lselect h3 { margin-top: 0px; background: url(selectadesign.gif) no-repeat top left; } div#larchives h3 { background: url(archives.gif) no-repeat top left; } div#lresources h3 { background: url(resources.gif) no-repeat top left; } div#linkList a { color: #369; text-decoration: none; font-size: small; font-weight: normal; } div#linkList a:hover { color: #036; } #linkList ul { margin: 12px 0 15px 15px; padding: 0px; } #linkList li { list-style: none; margin: 0; padding: 0px; } #lselect li { margin: 0 0 10px 0; } div#lselect li a { display: block; } div#lselect li .c { display: inline; } div#footer { border-top: solid 4px #eee; background: #69c; margin: 20px -22px 0 -22px; padding: 10px 20px; width: 450px; /* False value for IE4-5.x/Win */ voice-family: "\"}\""; voice-family:inherit; width: 410px; /* Actual value for conformant browsers */ } div#footer a { color: #fff; } /* --------- standalone --------- */ body { font: 11px/1.3 Tahoma, sans-serif; margin: 0; margin-left: 31px; padding: 0; background: #ddd url(bg.gif) repeat-y left; } #container { text-align: left; background-color: #eee; padding-bottom: 125px; width: 735px; height: 100%; } p { padding: 0 10px 0px 10px; } /* sections */ #intro { text-align: left; height: 223px; padding: 130px 0 0 0; margin: 0; background: #ddd url(top.gif) repeat-x top; voice-family: "\"}\""; voice-family:inherit; height: 97px; } #pageHeader { height: 65px; padding: 0; margin: 0; background: #fff url(mid.gif) no-repeat; } #pageHeader h1 { display: none; } #pageHeader h2 { display: none; } #quickSummary { height: 37px; width: 735px; padding-bottom: 4px; margin: 0; text-align: left; background: #eee url(bottom.gif) no-repeat top; voice-family: "\"}\""; voice-family:inherit; height: 28px; } #quickSummary p { display: none; } #quickSummary p.p2 { padding-left: 5px; color: #555; font: 9px Verdana, Arial, Sans-Serif; font-weight: bold; display: inline; } #quickSummary p.p2 a, a { color: #777; text-decoration: none; } #quickSummary p.p2 a:hover, a:hover { color: #36c; } #preamble { text-align: justify; position: absolute; margin: 0 0 0 0; width: 735px; color: #555; height: 130px; overflow: auto; padding: 0px 0px 0px 234px; background: #ddd url(road.jpg) no-repeat left top; voice-family: "\"}\""; voice-family:inherit; width: 501px; } #preamble h3 { height: 20px; padding: 0; margin: 0; background: #ddd url(1.gif) no-repeat left top; } #preamble p.p3 { padding: 0 10px 10px 10px; } #supportingText { position: absolute; margin-top: 139px; width: 510px; color: #555; voice-family: "\"}\""; voice-family:inherit; width: 510px; } #preamble h3 span, #supportingText h3 span, #explanation h3 span { display: none; } #explanation { text-align: justify; margin: 0 0 0 225px; width: 510px; color: #555; background: #ddd url(r2.jpg) no-repeat left bottom; padding-left: 234px; voice-family: "\"}\""; voice-family:inherit; width: 276px; } #explanation h3 { height: 20px; padding: 0; margin: 0; background: #ddd url(2.gif) no-repeat left top; } #explanation p.p2 { padding: 0 10px 10px 10px; } #participation, #benefits, #requirements { text-align: justify; margin: 0 0 0 225px; width: 510px; color: #555; padding: 10px; voice-family: "\"}\""; voice-family:inherit; width: 490px; } #participation h3, #benefits h3, #requirements h3 { display: block; width: 300px; height: 20px; margin-left: 45px; } #participation h3 { background: transparent url(3.gif) no-repeat; } #benefits h3 { background: transparent url(4.gif) no-repeat; } #requirements h3 { background: transparent url(5.gif) no-repeat; } #requirements, #benefits, #participation { background: #ddd url(corner.gif) no-repeat top left; margin-top: 15px; } /* sidelink items */ #linkList { width: 225px; position: absolute; background-color: #ddd; font: 10px Tahoma, sans-serif; margin-top: 139px; color: #aaa; border-right: 9px solid #eee; text-align: center; voice-family: "\"}\""; voice-family:inherit; width: 216px; } #lselect, #lfavorites, #larchives { border-bottom: 9px solid #eee; background: #ddd url(backc.gif) no-repeat bottom right; } #lresources { border-bottom: 9px solid #eee; background: #ddd url(backc.gif) no-repeat bottom right; } #lselect h3 { background: #ddd url(selectd.gif) no-repeat; padding: 0; margin: 0; height: 20px; } #lselect h3 span, #lfavorites h3 span, #larchives h3 span, #lresources h3 span { display: none; } #lfavorites h3 { background: #ddd url(selectf.gif) no-repeat; padding: 0; margin: 0; height: 20px; } #larchives h3 { background: #ddd url(selecta.gif) no-repeat; padding: 0; margin: 0; height: 20px; } #lresources h3 { background: #ddd url(selectr.gif) no-repeat; padding: 0; margin: 0; height: 20px; } #linkList ul { list-style: none; padding: 5px 0 5px 0; margin: 0; } #linkList li { line-height: 2em; display: block; } #linkList li a { margin: 0 2px 0 2px; font-weight: bold; padding: 3px; border: 1px solid #ddd; } #linkList li a:hover { background: #eee url(llist.gif); border: 1px solid #aaa; } /* Footer */ #footer { padding: 15px; } #footer a { margin: 1px; padding: 5px; } #footer a:hover { background-color: #ddd; } /* And that's the end, let's do it again! */ /* css Zen Garden submission 057 - 'This is Cereal' by Shaun Inman, http://www.shauninman.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Shaun Inman */ /* Added: November 4th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Photography Bradley Mason http://www.sxc.hu/browse.phtml?f=profile&l=bradleym */ #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* Warning message styles for browsers that don't support CSS attribute selectors... */ #extraDiv1 { position: absolute; top: 112px; left: 292px; width: 340px; height: 166px; background: url(txt_upgrade.gif) no-repeat; z-index: 10; } #container { padding: 296px 0 0 294px; z-index: 99; } /* Clear the warning styles for those that do... */ div[id="extraDiv1"] { display: none; } div[id="container"] { padding: 226px 0 0 294px !important; } /* Spoon graphic and pull-quote */ #extraDiv2 { position: absolute; top: 1200px; left: 0px; width: 229px; height: 580px; background: url(spoon_flake.png) no-repeat; z-index: 0; } div[id="extraDiv2"] { top: 712px !important; } /* Coffee graphic */ #extraDiv3 { display: block !important; position: relative; margin-left: 496px; height: 0; z-index: 0; } #extraDiv3 span { position: absolute; bottom: -33px; width: 100%; height: 596px; background: url(coffee.jpg) no-repeat; } /* Small logo */ div[id="extraDiv4"] { display: block !important; position: relative; margin-left: 64px; width: 168px; height: 0; z-index: 3; } div[id="extraDiv4"]>span { position: absolute; bottom: -33px; width: 100%; height: 98px; background: url(logo_small.gif) no-repeat; } /* div[id="extraDiv4"] span:active { background: url(logo_small_over.gif) no-repeat; } */ /* Photo Credit */ div[id="extraDiv5"] { display: block !important; position: relative; margin-left: 4px; height: 0; z-index: 0; } div[id="extraDiv5"]>span { position: absolute; bottom: -33px; width: 100%; height: 336px; background: url(txt_credit.gif) no-repeat; } /* Quality text and SI logo */ div[id="extraDiv6"] { display: block !important; position: absolute; top: 476px; left: 103px; width: 146px; height: 77px; background: url(txt_quality.gif) no-repeat; z-index: 0; } body { margin: 0; padding: 0; background: url(bg_header.jpg) no-repeat #FFF; } #quickSummary, #preamble, #supportingText { width: 336px; z-index: 1; } p { text-align: justify; font-family: Georgia,"Times New Roman",Times,serif; font-size: 11px; line-height: 17px; margin-top: 0; color: #707070; } p acronym { font-style: italic; } acronym { border-style: none; } p a, #footer a { color: #866F5B; text-decoration: none; border-bottom: 1px dotted #866F5B; } p a:hover, #footer a:hover { color: #A51A0A; border-style: none; } div[id="footer"]>a { border-style: none !important; } #preamble { margin-bottom: 2em; } #preamble p.p2 { background: url(head_enlightenment.gif) no-repeat; padding-top: 2.4em; } div[id="preamble"]>p.p2 { background: url(head_enlightenment.png) no-repeat !important; } #explanation, #participation, #benefits, #requirements { padding-top: 1.8em; margin-bottom: 2em; } @media tty { /* Mid pass to square away some IE 5 PC hinkyness. */ i{content:"\";/*" "*/}} #explanation p.p1,#participation p.p1,#benefits p.p1,#requirements p.p1 { padding-top: 1.8em; } /*";} }/* */ #explanation { background: url(head_explanation.gif) no-repeat; } #participation { background: url(head_participation.gif) no-repeat; } #benefits { background: url(head_benefits.gif) no-repeat; } #requirements { position: relative; background: url(head_requirements.gif) no-repeat; z-index: 1; } #quickSummary { margin-bottom: 2em; } div[id="quickSummary"] { margin-bottom: 0 !important; } #quickSummary>p[class="p1"] { position: absolute; top: 230px; left: 108px; background: url(txt_demo.jpg) no-repeat; width: 143px; height: 0; padding-top: 57px; overflow: hidden; } #quickSummary>p[class="p2"] { position: absolute; top: 328px; left: 105px; background: url(txt_download.gif) 5px 5px; background-repeat: no-repeat; width: 107px; height: 29px; z-index: 15; margin: 0; color: #FFF; font-size: 1px; padding-top: 36px; } #quickSummary>p[class="p2"] a[href="zengarden-sample.html"] { position: absolute; top: 17px; left: 5px; width: 35px; height: 0px; padding-top:9px; overflow: hidden; } #quickSummary>p[class="p2"] a[href="zengarden-sample.html"]:hover { background: url(button_html_over.gif) no-repeat; } #quickSummary>p[class="p2"] a[href="zengarden-sample.css"] { position: absolute; top: 17px; left: 63px; width: 31px; height: 0px; padding-top:9px; overflow: hidden; } #quickSummary>p[class="p2"] a[href="zengarden-sample.css"]:hover { background: url(button_css_over.gif) no-repeat; } div[id="quickSummary"] a { border-style: none; } /**/ /**/ #lselect { position: absolute; top: 324px; left: 105px; } #lresources { position: absolute; top: 714px; left: 105px; } #larchives { position: absolute; top: 902px; left: 105px; } #lfavorites { position: absolute; top: 1030px; left: 105px; } /**/ div[id="lselect"] { top: 292px !important; left: 105px !important; background: url(button_select_design.gif) no-repeat; width: 149px; height: 37px; z-index: 300; } div[id="lresources"] { top: 358px !important; left: 105px !important; background: url(button_resources.gif) no-repeat; width: 149px; height: 37px; z-index: 200; } div[id="lfavorites"] { top: 443px !important; left: 105px !important; background: url(button_favorites.gif) no-repeat; width: 149px; height: 37px; z-index: 150; } /**/ #lselect h3, #lresources h3, #larchives h3, #lfavorites h3 { position: absolute; top: -28px; left: 0px; background: url(bg_menu_thin_top.gif) no-repeat; width: 149px; height: 28px; line-height: 28px; padding-top: 5px; overflow: hidden; margin: 0; padding: 0 18px; color: #333; font-family: "Lucida Grande","Lucida Sans Unicode",geneva,arial,verdana,sans-serif; font-size: 9px; } /**/ div[id="lselect"]>h3, div[id="lresources"]>h3, div[id="larchives"]>h3, div[id="lfavorites"]>h3 { top: -1000px !important; left: -1000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; } #lselect:hover h3, #lresources:hover h3, #lfavorites:hover h3 { position: absolute; top: 5px !important; left: 5px !important; background: url(bg_menu_top.png) no-repeat; width: 203px !important; height: 0px !important; padding-top: 5px; margin: 0; } /**/ #lselect ul, #lresources ul, #larchives ul, #lfavorites ul { background: url(bg_menu_thin.gif) left bottom no-repeat; margin: 0; padding: 0 0 5px; list-style: none; voice-family: "\"}\""; voice-family:inherit; width: 149px; } /**/ div[id="lselect"]>ul, div[id="lresources"]>ul, div[id="lfavorites"]>ul { position: absolute; top: -1000px; left: -1000px; width: 203px !important; background: url(bg_menu.png) left bottom no-repeat !important; } #lselect:hover ul, #lresources:hover ul, #lfavorites:hover ul { position: absolute; top: 10px; left: 5px; } /**/ #lselect li, #lresources li, #larchives li, #lfavorites li { font-size: 9px; color: #8B8C8C; background: url(bg_menu_separator_thin.gif) no-repeat; padding: 8px 18px; } @media tty { /* Mid pass to square away some IE 5 PC hinkyness. */ i{content:"\";/*" "*/}} #lselect li,#lresources li,#larchives li,#lfavorites li { width: 149px; padding: 6px 18px; } /*";} }/* */ /**/ div[id="lselect"]>ul>li, div[id="lresources"]>ul>li, div[id="lfavorites"]>ul>li { background: url(bg_menu_separator.png) no-repeat !important; } div[id="lselect"]>ul>li:first-child, div[id="lresources"]>ul>li:first-child , div[id="lfavorites"]>ul>li:first-child { padding-top: 5px; background: url(o.gif) no-repeat !important; } #lselect li:hover, #lresources li:hover, #lfavorites li:hover { background: url(bg_menu_over.png) no-repeat !important; } div[id="larchives"] { position: absolute; top: 400px !important; left: 100px !important; background: url(well_design_archives.gif) 5px 0px no-repeat; width: 164px !important; height: 44px; z-index: 100; } div[id="larchives"]>ul, div[id="larchives"]>ul>li { margin: 0; padding: 0; list-style: none; background: url(o.gif) no-repeat !important; } #larchives a[accesskey="n"] { background: url(button_next.gif) no-repeat; position: absolute; top: 14px; left: 50px; width: 45px; height: 0px; padding-top: 21px; overflow: hidden; z-index: 1; } #larchives a[accesskey="p"] { background: url(button_prev.gif) no-repeat; position: absolute; top: 14px; left: 7px; width: 44px; height: 0px; padding-top: 21px; overflow: hidden; z-index: 2; } #larchives a[accesskey="w"] { background: url(button_view_all.gif) no-repeat; position: absolute; top: 14px; left: 99px; width: 53px; height: 0px; padding-top: 21px; overflow: hidden; } #larchives a[accesskey="n"]:hover { background: url(button_next_over.gif) no-repeat; } #larchives a[accesskey="p"]:hover { background: url(button_prev_over.gif) no-repeat; } #larchives a[accesskey="w"]:hover { background: url(button_view_all_over.gif) no-repeat; } /**/ #lselect a, #lfavorites a { display: block; } #lselect a.c, #lfavorites a.c { display:inline; font-size: 9px; text-transform: lowercase; } #linkList { font-family: "Lucida Grande","Lucida Sans Unicode",geneva,arial,verdana,sans-serif; font-size: 9px; } #linkList a, #linkList a:link, #linkList a:visited { font-size: 10px; color: #444; text-decoration: none; } #linkList a:hover { color: #A51A0A; } #linkList a.c, #linkList a.c:link, #linkList a.c:visited { color: #8B8C8C;} #linkList a.c:hover { color: #A51A0A; } /**/ #footer { font-family: geneva,arial,verdana,sans-serif; font-size: 9px; } #footer a { color: #866F5B; text-decoration: none; } #footer a:hover { color: #A51A0A; } /**/ div[id="footer"] { position: relative; top: -5px; left: -5px; width: 327px; height: 48px; background: url(txt_footer.gif) 5px 5px no-repeat; z-index: 1; } /* xhtml */ #footer a[href="http://validator.w3.org/check/referer"] { position: absolute; top: 17px; left: 105px; width: 33px; height: 0px; padding-top:9px; overflow: hidden; } #footer a[href="http://validator.w3.org/check/referer"]:hover { background: url(button_xhtml_over.gif) no-repeat; } /* css */ #footer a[href="http://jigsaw.w3.org/css-validator/check/referer"] { position: absolute; top: 17px; left: 145px; width: 18px; height: 0px; padding-top:9px; overflow: hidden; } #footer a[href="http://jigsaw.w3.org/css-validator/check/referer"]:hover { background: url(button_css_footer_over.gif) no-repeat; } /* cc */ #footer a[href="http://creativecommons.org/licenses/sa/1.0/"] { position: absolute; top: 17px; left: 170px; width: 13px; height: 0px; padding-top:9px; overflow: hidden; } #footer a[href="http://creativecommons.org/licenses/sa/1.0/"]:hover { background: url(button_cc_over.gif) no-repeat; } /* 508 */ #footer a[title="Check the accessibility of this site according to U.S. Section 508"] { position: absolute; top: 17px; left: 189px; width: 15px; height: 0px; padding-top:9px; overflow: hidden; } #footer a[title="Check the accessibility of this site according to U.S. Section 508"]:hover { background: url(button_508_over.gif) no-repeat; } /* aaa */ #footer a[title="Check the accessibility of this site according to WAI Content Accessibility Guidelines 1"] { position: absolute; top: 17px; left: 228px; width: 20px; height: 0px; padding-top:9px; overflow: hidden; } #footer a[title="Check the accessibility of this site according to WAI Content Accessibility Guidelines 1"]:hover { background: url(button_aaa_over.gif) no-repeat; } /* Move this junk out of the way */ #pageHeader, #preamble h3, #supportingText h3 { position: absolute; top: -1000px; left: -1000px; width: 1px; height: 1px; overflow: hidden; } /* css Zen Garden submission 058 - 'Radio Zen' by Marc LA van den Heuvel, http://www.mlavdh.nl/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Marc LA van den Heuvel */ /* Added: November 9th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font-family: georgia, Arial, Helvetica, sans-serif; font-size: 10px; background: url(schaal.jpg); background-color: #F8F8EE; background-repeat: no-repeat; background-position: top; background-attachment: fixed; margin: 0px; text-decoration: none; } acronym { border-bottom: none; } #intro { position: absolute; width: 1590px; font-style: italic; line-height: normal; font-variant: normal; text-transform: capitalize; z-index: 1; } #pageHeader H1 { position: absolute; top: 278px; left: 720px; color: #E8E9CF; font-size: 70px; } #pageHeader H2 { position: absolute; top: 330px; left: 1280px; color: #E8E9CF; font-size: 30px; } #quickSummary { position: absolute; right: 0px; text-align: left; width: 165px; height: 340px; top: 95px; padding-top: 40px;} #quickSummary P { margin-top: 3px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; color: #555F44; } #quickSummary a:link, #quickSummary a:visited { color: #744646; text-decoration: none; border-bottom: 1px dashed #744646; } #quickSummary a:hover, #quickSummary a:active { color: #000000; text-decoration: underline; } #preamble { position: absolute; left: 10px; text-align: right; width: 165px; top: 95px; } #preamble P { margin-top: 3px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; color: #555F44; } #preamble h3 { margin: 0px; font-size: 14px; font-family: Arial, Helvetica, sans-serif; color: #555F44; text-decoration: none; font-style: normal; font-weight: bold; margin-left: 8px; margin-right: 8px; } #supportingText { position: absolute; width: 1230px; padding-left: 185px; padding-top: 95px; text-align: justify; background: url(naald.gif); background-repeat: no-repeat; background-position: top; z-index: 3; } #supportingText a:link, #supportingText a:visited { color: #744646; text-decoration: none; border-bottom: 1px dashed #744646; } #supportingText a:hover, #supportingText a:active { color: #000000; text-decoration: underline; } #supportingText P { margin-top: 3px; margin-bottom: 8px; margin-left: 8px; margin-right: 8px; color: #353638; } #supportingText h3 { margin: 0px; font-family: Arial, Helvetica, sans-serif; color: #422222; text-decoration: none; font-size: 8pt; font-style: normal; font-weight: bold; margin-left: 3px; margin-right: 8px; background: url(klein.jpg); } #explanation { float: left; width: 290px; } #participation { float: left; width: 290px; } #benefits { float: left; width: 150px;} #requirements { float: left; width: 500px;} #footer { float: right; padding-right: 50px; top: 0px; } #footer a:link, #footer a:visited { color: #E8E9CF; text-decoration: none; border-bottom: 0px dashed #744646; font-size: 12px; font-style: normal; font-weight: bold; font-family: Arial, Helvetica, sans-serif; } #footer a:hover, #footer a:active { color: #000000; text-decoration: underline; } #linkList{ position: absolute; padding-top: 480px; text-align: justify; z-index: 1;} #lselect{ position: absolute; width: 1590px; top: 46em; text-align: left; padding: 5px; font-family: Arial, Helvetica, sans-serif; background-color: #E8E9CF; } #lselect ul { margin: 0px; padding: 0px; } #lselect h3 { margin: 0px; margin-right: 10px; color: #555F44; font-size: 8pt; float: left; font-weight: bold; } #lselect li { color:#000000; list-style-type: none; float: left; border-left: 4px solid #F8F8EE; padding-left: 5px; padding-right: 5px; } #lselect a:link, #lselect a:visited { color: #744646; text-decoration: none; font-size: 8pt; font-style: normal; font-weight: bold; } #lselect a:hover, #lselect a:active { color: #000000; text-decoration: underline; } #lselect a.c, #lselect a:link.c , #lselect a:visited.c{ color: #422222; font-weight: normal; } #lselect a:hover.c, #lselect a:active.c { display: inline; } #larchives{ position: absolute; padding-top: 490px; text-align: justify; } #larchives{ position: absolute; width: 300px; top: 49em; left: 75px; text-align: left; padding: 5px; font-family: Arial, Helvetica, sans-serif; } #larchives ul { margin: 0px; padding: 0px; } #larchives h3 { margin: 0px; margin-right: 10px; color: #555F44; font-size: 9px; float: left; font-weight: normal; } #larchives li { color:#555F44; list-style-type: none; float: left; padding-left: 10px; padding-right: 10px; } #larchives a:link, #larchives a:visited { color: #555F44; text-decoration: none; font-size: 9px; font-style: normal; font-weight: normal; } #larchives a:hover, #larchives a:active { color: #000000; text-decoration: underline; } #larchives a.c, #larchives a:link.c , #larchivest a:visited.c{ color: #006633; } #larchives a:hover.c, #larchives a:active.c { display: inline; } #lresources{ position: absolute; width: 800px; left: 400px; top: 49em; text-align: left; padding: 5px; font-family: Arial, Helvetica, sans-serif; } #lresources ul { margin: 0px; padding: 0px; } #lresources h3 { margin: 0px; margin-right: 10px; color: #555F44; font-size: 9px; float: left; font-weight: normal; } #lresources li { color:#555F44; list-style-type: none; float: left; padding-left: 10px; padding-right: 10px; } #lresources a:link, #lresources a:visited { color: #555F44; text-decoration: none; font-size: 9px; font-style: normal; font-weight: normal; } #lresources a:hover, #lresources a:active { color: #000000; text-decoration: underline; } #lresources a.c, #lresources a:link.c , #lresources a:visited.c{ color: 422222; } #lresources a:hover.c, #lresources a:active.c { display: inline; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #explanation h3 { background: transparent url(sowhat.gif) no-repeat top left; margin-top: 10px; width: 250px; height: 32px; float: left; } #explanation h3 span { display:none } #participation h3 { background: transparent url(part.gif) no-repeat top left; margin-top: 10px; width: 250px; height: 32px; float: left; } #participation h3 span { display:none } #benefits h3 { background: transparent url(ben.gif) no-repeat top left; margin-top: 10px; width: 120px; height: 32px; float: left; } #benefits h3 span { display:none } #requirements h3 { background: transparent url(rec.gif) no-repeat top left; margin-top: 10px; width: 470px; height: 32px; float: left; } #requirements h3 span { display:none } #preamble h3 { background: transparent url(road.gif) no-repeat top right; margin-top: 10px; width: 140px; height: 32px; float: left; } #preamble h3 span { display:none } #pageHeader h1 { background: transparent url(zen.gif) no-repeat top right; margin-top: 10px; width: 600px; height: 180px; float: left; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(tune.jpg) no-repeat top right; margin: 0px; width: 321px; height: 194px; float: left; } #pageHeader h2 span { display:none } #extraDiv1 { position: absolute; width: 1600px; height: 400px; top: 83px; text-align: justify; background: url(bgrnd.gif); background-position: top; z-index: 0; } #extraDiv2 { position: absolute; width: 321px; height: 194px; left: 160px; top: 330px; text-align: justify; background: url(radio.jpg); background-position: top; z-index: 0; } /* css Zen Garden submission 059 - 'Dune Temple' by Greg Reimer, http://www.drpeterjones.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Greg Reimer */ /* Added: November 9th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* For overview, the method of this sheet is to superimpose textual elements on top of fancy background graphics via CSS positioning. No FIR was used in the making of this sheet. */ body{ margin:0px; padding:0px; background:#d18f00 url(decosides.gif) no-repeat 50% 0%; color:#946500; font-family:arial,helvetica,sans-serif; font-size:12px; text-align:center; /* so the container div centers itself in IE5/win */ } a:link{ color:#EFD396; text-decoration:none; } a:visited{ color:#EFD396; text-decoration:none; } a:hover{ color:#EFD396; text-decoration:underline; } a:active{ color:#EFD396; text-decoration:none; } acronym{ border:none; cursor:help; font-family:georgia,serif; } div#container{ width:732px; margin:auto; /* ignored by IE5/win */ background:url(main_top.png) no-repeat 0% 0%; position:relative; } div#pageHeader{ text-align:center; margin-bottom:156px; height:13px; } div#pageHeader h1,div#pageHeader h2{ text-transform:lowercase; margin:0px; font-family:arial,helvetica,sans-serif; /* being verbose because font shorthand caused IE5/win to botch */ font-size:10px; font-weight:normal; letter-spacing:8px; display:inline; } div#pageHeader h1:after{ content:":"; /* ignored by IE */ } div#quickSummary,div#preamble,div#explanation,div#participation,div#benefits,div#requirements,div#footer{ color:#CFA343; padding:0px 325px 0px 27px; text-align:justify; } div#container p,div#container h3{ margin:10px 0px; } div#container div#intro h3,div#container div#supportingText h3{ color:#EFD396; font:bold 12px verdana,sans-serif; } div#container div#intro h3{ padding:2px 5px 3px 5px; background:url(headerbg.png) no-repeat right top; } html>body div#container div#supportingText h3{ /* IE/win bug workaround */ padding:2px 5px 3px 5px; background:url(headerbg.png) no-repeat right top; } div#quickSummary{ margin:0px 325px 0px 27px; padding:0px 38px; text-align:center; color:#E8B74B; background:url(sides.png) no-repeat 50% 0%; min-height:82px; } div#quickSummary p{ margin: 0px 0px 10px 0px; } div#quickSummary p.p1{ font-weight:bold; } div#quickSummary p.p2{ text-transform:lowercase; margin-bottom:0px; padding-bottom:10px; } div#quickSummary p:before{ content:"::: "; font-family:verdana,sans-serif; color:#B68F3B; font-weight:bold; } div#quickSummary p:after{ content:" :::"; font-family:verdana,sans-serif; color:#B68F3B; font-weight:bold; } div#preamble{ padding:0px; margin:0px 310px 0px 27px; height:259px; overflow:auto; voice-family: "\"}\""; voice-family: inherit; margin-right:325px; } html>body div#preamble{ margin-right:325px; } div#supportingText{ background:url(main_middle.png) repeat-y; } div#footer{ padding-top:50px; padding-bottom:320px; background:#d18f00 url(main_bottom.png) no-repeat; text-align:center; } div#footer a{font:bold 12px verdana,sans-serif;} div#footer a:after,div#footer a:before{color:#b68f3b;content:":";} div#lselect{ position:absolute; left: 424px; top: 155px; width:293px; } div#lselect h3{ position:absolute; left:70px; top:12px; color:#7A5300; background:transparent; font-size:14px; height:14px; margin:0px; } div#lselect ul{ list-style:none; padding: 0px 0px 71px 0px; margin: 59px 0px 0px 0px; background:url(list_bottom.png) no-repeat 100% 100%; voice-family: "\"}\""; voice-family: inherit; padding-bottom:74px; } html>body div#lselect ul{ padding-bottom:74px; } div#lselect ul li{ text-align:right; background:url(listitem.png) no-repeat 100% 0%; color:#fc0; font:normal 9px arial,helvetica,sans-serif; display:block; height:25px; padding: 6px 5px 5px 5px; margin-top:2px; voice-family: "\"}\""; voice-family: inherit; height:14px; padding: 6px 5px 5px 5px; margin-top:5px; } html>body div#lselect ul li{ height:14px; padding: 6px 5px 5px 5px; margin-top:5px; } div#lselect ul a:link{ color:#EFD396; text-decoration:underline; } div#lselect ul a:visited{ color:#C89D40; text-decoration:underline; } div#lselect ul a:hover{ color:#EFD396; text-decoration:none; } div#lselect ul a:active{ color:#ff0; text-decoration:underline; } div#larchives{ text-align:left; position:absolute; left:438px; top:534px; width:279px; } div#lresources{ text-align:left; position:absolute; left:438px; top:658px; width:279px; } div#lfavorites{ text-align:left; position:absolute; left:438px; top:843px; width:279px; z-index:100; } div#larchives h3,div#lresources h3,div#lfavorites h3{ margin:0px; text-align:right; padding:0px 7px 17px 0px; background:url(list_top.png) no-repeat 100% 100%; color:#cfa343; font-size:14px; } div#larchives ul,div#lresources ul,div#lfavorites ul{ list-style:none; padding:0px; margin:0px; padding-bottom:8px; background:url(list_bottom2.png) no-repeat 100% 100%; } div#larchives li,div#lresources li,div#lfavorites li{ display:block; text-align:right; background:url(listitem.png) no-repeat 100% 0%; padding: 5px 9px 5px 5px; margin-bottom:2px; color:#fc0; font:bold 11px arial,helvetica,sans-serif; voice-family: "\"}\""; voice-family: inherit; margin:0px 0px 5px 0px; } html>body div#larchives li,html>body div#lresources li,html>body div#lfavorites li{ height:15px; margin-bottom:5px; margin-top:0px; } div#larchives ul a:link,div#lresources ul a:link,div#lfavorites ul a:link{ color:#EFD396; text-decoration:underline; } div#larchives ul a:visited,div#lresources ul a:visited,div#lfavorites ul a:visited{ color:#C89D40; text-decoration:underline; } div#larchives ul a:hover,div#lresources ul a:hover,div#lfavorites ul a:hover{ color:#EFD396; text-decoration:none; } div#larchives ul a:active,div#lresources ul a:active,div#lfavorites ul a:active{ color:#ff0; text-decoration:underline; } div#lfavorites ul{ padding-bottom:69px; background:url(list_bottom.png) no-repeat 100% 100%; }/* css Zen Garden submission 060 - 'Extreme Limits' by Richard Chatfield, http://www.engagecommerce.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Richard Chatfield */ /* Added: November 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { font: 11px arial, verdana, sans-serif; color: #fff; background: #000 url(contentbg.jpg) repeat-y; margin: 0px; } p { font: 11pxt/16pt arial, verdana, sans-serif ; margin-top: 0px; text-align: justify; } h3 { font: italic 16px arial, verdana, sans-serif; letter-spacing: 1px; margin: 15px 0px 0px 0px; color: #FFFF00; font-weight: bolder; } h5 { font: italic 14px sans-serif, arial, verdana; letter-spacing: 1px; margin: 15px 0px 0px 10px; color: #fff; font-weight: bolder; } a:link { font-weight: bold; text-decoration: none; color: #FFFF00; } a:visited { font-weight: bold; text-decoration: none; color: #FFFF00; } a:hover, a:active { text-decoration: underline; color: #FFFF00; } /* specific divs */ #container { padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; width: 780px; } #intro { } #pageHeader { margin-top: 0px; margin-bottom: 0px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: url(topbg.jpg) no-repeat top left; margin-top: 0px; margin-bottom: 0px; width: 780px; height: 255px; } #pageHeader h1 span { display: none; } #pageHeader h2 { background: url(zengardentitle.gif) no-repeat top left; margin-top: -74px; margin-left: 254px; width: 393px; height: 45px; } #pageHeader h2 span { display:none; } #quickSummary { clear:both; margin: -78px 0px 0px 5px; width: 160px; } #quickSummary p { width: 240px; font: 10px; text-align:center; line-height: 12px; } #preamble { background: url(road2enlinghtenbg.jpg) no-repeat; margin: 18px 5px 5px 3px; width: 249px; height: 500px; float: left; } #preamble h3 { margin: 20px 10px 0px 15px; width: 200px; } #preamble p { margin: 10px 10px 0px 15px; width: 210px; } #supportingText { margin: 25px 145px 0px 255px; text-align: left; width: 370px; } #explanation p.p1 { margin-right: 140px; text-align: left; } #explanation p.p2 { margin-right: 20px; text-align: left; } #footer { position: absolute; top: 162px; left: 275px; width: 345px; clear: both; } #footer a:link, #footer a:visited { margin: 0px 40px 0px 0px; } #linkList { background: url(road2enlinghtenbg.jpg) no-repeat; position: absolute; top: 580px; text-align: left; margin: 18px 5px 5px 5px; width: 249px; padding: 5px 0px 0px 10px; } #linkList2 { font: 10px verdana; width: 226px; } #linkList h3.select { height: 30px; } #linkList h3.select span { font: 16px arial, verdana, sans-serif; letter-spacing: 1px; font-weight: bolder; color: #CCD8F8; text-decoration: underline; } #linkList h3.favorites { height: 30px; } #linkList h3.favorites span { font-style: normal; text-decoration : underline; color: #CCD8F8; } #linkList h3.archives { height: 30px; } #linkList h3.archives span { font-style: normal; text-decoration : underline; color: #CCD8F8; } #linkList h3.resources { height: 30px; } #linkList h3.resources span { font-style: normal; text-decoration : underline; color: #CCD8F8; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; background: transparent url(cr1.gif) no-repeat top center; display: block; margin-bottom: 2px; } #linkList li a:link { color: #10184A; } #linkList li a:hover { color: #FFFF00; } #linkList li a:visited { color: #10184A; } #extraDiv1 { position: absolute; top: 10px; left: 490px; background: url(guyflying.gif) no-repeat; width: 285px; height: 483px; } #extraDiv2 { position: absolute; top: 1000px; left: 0px; background: url(flyerdude.jpg) no-repeat; width: 255px; height: 339px; } /* css Zen Garden submission 061 - 'Sky' by Stefan Petre, http://www.eyecon.ro/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Stefan Petre */ /* Added: November 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font: 10px Arial, Helvetica, sans-serif; margin: 0px; padding: 0px; text-align: center; background-position : center; background-image : url(page_fill.jpg) ; background-repeat : repeat-y; } a:link { color: #00f; } a:visited { color: #99f; } a:hover, a:active { text-decoration: none; } acronym { border-bottom: 1px dotted #eee; cursor : help; } #container { width: 700px; margin: 0px auto; text-align : left; background-image : url(right_fill.jpg); background-repeat : repeat-y; clear : both; background-color : #ff; } #intro { width: 700px; height: 246px; overflow: hidden; background-image : url(header_intro.jpg); background-position : bottom; background-repeat : no-repeat; text-align : right; color : #fff; clear : both; } #pageHeader { width: 700px; height : 36px; overflow : hidden; background-image : url(header_title.jpg); } #pageHeader h1 { display : none; } #pageHeader h2 { display : none; } #quickSummary { float: right; width: 400px; margin : 0px 3px; height: 40px; overflow: auto; } #quickSummary p { margin: 0px; } #quickSummary a{ color: #eee; } #preamble { float: left; width: 400px; margin : 0px 3px; text-align : left; height: 142px; overflow: auto; } #preamble p { margin: 0px; } #preamble h3{ margin: 8px 0px; font-size: 18px; } #supportingText { width : 440px; text-align : left; float : right; } #linkList { background-image : url(right_fill.jpg); width : 250px; text-align : left; background-position : left; min-height : 1140px; padding-bottom: 20px; } #linkList2 { background-image : url(right_start.jpg); background-position : top; background-repeat : no-repeat; padding-top: 20px; } #lselect h3{ background-image : url(label_select.jpg); background-repeat : no-repeat; margin : 4px 0px 4px 20px; height : 16px; } #lfavorites h3{ background-image : url(label_favorites.jpg); background-repeat : no-repeat; margin : 4px 0px 4px 20px; height : 16px; } #larchives h3{ background-image : url(label_archives.jpg); background-repeat : no-repeat; margin : 4px 0px 4px 20px; height : 16px; } #lresources h3{ background-image : url(label_resources.jpg); background-repeat : no-repeat; margin : 4px 0px 4px 20px; height : 16px; } #linkList2 h3 span{ display : none; } #linkList2 ul{ list-style-type : none; margin-bottom: 30px; } #linkList2 li{ margin: 4px; } #lselect a{ display : block; color: #ffd; font-size: 13px; } #linkList2 a{ color: #ffd; font-size: 13px; } #linkList2 a.c{ display : inline; font-size: 11px; color: #ddd; } #explanation h3{ background-image : url(label_about.jpg); } #participation h3{ background-image : url(label_participation.jpg); } #benefits h3{ background-image : url(label_benefits.jpg); } #requirements h3{ background-image : url(label_requirements.jpg); } #supportingText h3 span{ display : none; } #supportingText h3 { margin: 0px; background-repeat : no-repeat; height : 37px; width : 237px; background-position : left; } #supportingText p{ margin: 10px 6px 6px 70px; text-align : justify; } #extraDiv1{ clear: both; } #explanation, #participation , #benefits, #requirements { margin-bottom: 20px; padding-bottom: 20px; background-image : url(paragraf_back.jpg); background-position: bottom; background-repeat: no-repeat; } #footer { text-align: center; } #footer a:link, #footer a:visited { margin-right: 20px; }/* css Zen Garden submission 062 - 'Gemination' by Egor Kloos, http://www.dutchcelt.nl/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Egor Kloos */ /* Added: November 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* Internet Explorer */ /* basic elements */ body { margin: 0 0 0 0; text-align: center; background: #600 none; } p { font: normal 11px/12px arial, sans-serif; } ul, li { font: bold 11px/19px arial, sans-serif; list-style-type: none; } h3 { margin: 0; padding: 0; font: bold 10px/10px arial, sans-serif;} a:link { color: #f90; } a:visited { color: #f90; } a:hover, a:active { color: #fff; } /* specific divs */ #container { position: relative; margin: 0 auto 0 auto; border-right: 3px solid #fff; border-left: 3px solid #fff; padding: 0 20px 0 20px; width: 706px; background: url(contentback.gif); voice-family: "\"}\""; voice-family:inherit; width: 666px; } html>body #container { width:666px; } #intro { margin: 0; padding: 0; width: 660px; height: 80px; background: transparent url(introkop.gif) no-repeat right top; } #pageHeader h1 { margin: 0; padding: 0; width: 660px; height: 80px; background: transparent url(ietitle.gif) no-repeat left top; } #pageHeader h1 span { display:none; } #pageHeader h2 span { display:none; } #quickSummary { position: absolute; top: 80px; left: 380px; margin: 0 0 20px 0; padding: 275px 0 0 0; width: 300px; background: transparent url(boxmodel.jpg) no-repeat top left; } #quickSummary p { margin: 0; padding: 0 0 10px 0; color: #D9BC91; font: bold 12px/15px arial; text-align: left; background: transparent; } #preamble { position: absolute; top: 80px; left: 20px; display: block; margin: 0; padding: 0 0 0 0; width: 333px; height: 258px; background: #513125 url(iebulb.jpg) no-repeat top left; } #preamble p { margin: 0; padding: 0 20px 8px 20px; color: #fff; font: normal 11px/15px Georgia, serif; } #preamble h3 { margin: 0; border-top: 5px solid #3D2117; padding: 0; width: 333px; height: 40px; background: transparent url(ietheroad.gif) no-repeat top center; } #preamble h3 span { display:none; } #supportingText { float: left; margin: 245px 0 0 0; border-top: 5px solid #3D2117; padding: 0 0 30px 0; width: 333px; text-align: left; background: #fff; } /* commented backslash hack v2 \*/ #supportingText { float: left; margin: 260px 0 0 0; border-top: 5px solid #3D2117; padding: 0 0 30px 0; width: 333px; text-align: left; background: #fff; } /* end hack */ #supportingText p { clear: right; padding: 0 20px 0 20px; font: normal 12px/15px arial, sans-serif; } #supportingText a:link, #supportingText a:visited { color: #900; } #supportingText a:hover, #supportingText a:active { color: #30c; } #explanation h3 { margin: 0 0 0 20px; padding: 0; width: 280px; height: 40px; background: transparent url(iezentext1.gif) no-repeat bottom left; } #explanation h3 span { display: none; } #explanation p.p1 { font: bold 12px/15px arial, sans-serif; } #participation h3 { margin: 0 0 0 20px; width: 290px; height: 25px; background: transparent url(iezentext2.gif) no-repeat left top; } #participation h3 span { display: none; } #benefits h3 { margin: 0 0 0 20px; width: 290px; height: 25px; background: transparent url(iezentext3.gif) no-repeat left top; } #benefits h3 span { display: none; } #requirements h3 { margin: 0 0 0 20px; width: 290px; height: 25px; background: transparent url(iezentext4.gif) no-repeat left top; } #requirements h3 span { display: none; } #footer { border-top: 1px dotted #444; padding: 15px 0 30px 0; text-align: center; } #footer a:link, #footer a:visited { font: bold 12px/15px Georgia, serif; color: #600; background: transparent; } #linkList { clear: both; } #linkList2 { position: absolute; top: 450px; left: 380px; width: 300px; text-align: left; } #lselect h3.select { padding: 0 0 0 0; width: 280px; height: 40px; background: transparent url(ienavtext1.gif) no-repeat left top; } #lselect h3 span { display: none; } #larchives h3.archives { padding: 0 0 0 0; width: 280px; height: 40px; background: transparent url(ienavtext2.gif) no-repeat left top; } #larchives h3 span { display: none; } #lresources h3.resources { padding: 0 0 0 0; width: 280px; height: 40px; background: transparent url(ienavtext3.gif) no-repeat left top; } #lresources h3 span { display: none; } #lselect ul { margin: 0; padding: 0 0 60px 0; } #larchives { margin: 0; padding: 180px 0 0 0; width: 300px; vertical-align: bottom; background: transparent url(ieboxes.gif) no-repeat right top; } #larchives ul { margin: 0; padding: 0 0 30px 0; } #lresources ul { margin: 0; padding: 0;} #lselect li a { display: inline; } #linkList li a:link { color: #f90; } #linkList li a:visited { color: #f90; } #lselect li a.c { display: inline; } #lselect li a.c:link { color: #fff; } #lselect li a.c:visited { color: #fff; } #linkList li a:hover, #linkList li a:active { color: #6CF; } #lselect li a.c:hover, #linkList li a.c:active { color: #6CF; } #extraDiv1 { } /* Mozilla - Safari - Opera */ /* basic elements */ /* Background pattern design by Travis Beckham. www.squidfingers.com */ body[id=css-zen-garden] { margin: 100px 0 0 0; padding: 0; text-align: center; background: transparent url(squidback.gif); } body[id=css-zen-garden] p { font: normal 11px/12px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] ul, body[id=css-zen-garden] li { font: bold 9px/10px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; list-style-type: none; color: #fff; background: transparent; } body[id=css-zen-garden] h3 { margin: 0; padding: 0; font: bold 13px/15px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] a:link { color: #f90; } body[id=css-zen-garden] a:visited { color: #f90; } body[id=css-zen-garden] a:hover, body[id=css-zen-garden] a:active { color: #fff; } /* specific divs */ body[id=css-zen-garden] #container { position: relative; margin: 0 0 0 0; border-top: 5px solid #fff; border-right: 0; border-bottom: 5px solid #fff; border-left: 0; padding: 0 0 0 0; width: 100%; height: 350px; background: url(longgarden.gif) repeat-x center right; } body[id=css-zen-garden] #intro { position: absolute; top: 0; left: 0; float: none; margin: 0; width: 100%; height: 350px; background: none; } body[id=css-zen-garden] #pageHeader { position: absolute; top: -103px; left: 0; margin: 0;} body[id=css-zen-garden] #pageHeader h1 { background: transparent url(zentitle.png) no-repeat top left; margin-top: 20px; width: 470px; height: 90px; float: left; } body[id=css-zen-garden] #pageHeader h1 span { display: none; } body[id=css-zen-garden] #pageHeader h2 span { display: none; } body[id=css-zen-garden] #quickSummary { position: absolute; top: 370px; left: 0; padding: 0; width: 100%; height: 100px; background: transparent url(starlogo.png) no-repeat bottom center; } body[id=css-zen-garden] #quickSummary p { margin: 0; padding: 0 0 0 20px; color: #D9BC91; font: normal 11px/14px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; text-align: left; background: transparent; } body[id=css-zen-garden] #preamble { position: absolute; top: 30px; left: 20px; display: block; margin: 0; border: 1px dotted #fff; padding: 0;width: 196px; height: 290px; background: transparent url(blk35.png) repeat; overflow: hidden; } body[id=css-zen-garden] #preamble p { margin: 0; padding: 0px 10px 5px 10px; color: #fff; font: normal 10px/13px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] #preamble h3 { border: 0; width: 196px; height: 40px; background: transparent url(theroad.png) no-repeat top left; } body[id=css-zen-garden] #preamble h3 span { display: none; } body[id=css-zen-garden] #supportingText { position: absolute; top: 0; left: 465px; margin: 0; border: 0; padding: 0 20px 30px 20px; width: 325px; height: 320px; text-align: left; background: transparent url(maintext.png) repeat-y left top; overflow: auto; } body[id=css-zen-garden] #supportingText p { padding: 0; font: normal 12px/15px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] #supportingText a:link, body[id=css-zen-garden] #supportingText a:visited { color: #900; } body[id=css-zen-garden] #supportingText a:hover, body[id=css-zen-garden] #supportingText a:active { color: #30c; } body[id=css-zen-garden] #explanation h3 { float: left; margin: 0; padding: 0 0 5px 0; width: 300px; height: 25px; background: transparent url(zentext1.png) no-repeat left top; } body[id=css-zen-garden] #explanation h3 span { display: none; } body[id=css-zen-garden] #explanation p.p1 { font: bold 12px/15px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] #participation h3 { float: left; margin: 0; width: 300px; height: 25px; background: transparent url(zentext2.png) no-repeat top left; } body[id=css-zen-garden] #participation h3 span { display: none; } body[id=css-zen-garden] #benefits h3 { float: left; margin: 0; width: 300px; height: 25px; background: transparent url(zentext3.png) no-repeat top left; } body[id=css-zen-garden] #benefits h3 span { display: none; } body[id=css-zen-garden] #requirements h3 { float: left; margin: 0; width: 300px; height: 25px; background: transparent url(zentext4.png) no-repeat top left; } body[id=css-zen-garden] #requirements h3 span { display:none; } body[id=css-zen-garden] #footer { border-top: 1px dotted #444; padding: 15px 0 30px 0; text-align: center; } body[id=css-zen-garden] #footer a:link, body[id=css-zen-garden] #footer a:visited { margin-right: 20px; } body[id=css-zen-garden] #linkList { position: absolute; top: 0; left: 830px; width: 150px; height: 350px; text-align: left; overflow: hidden; } body[id=css-zen-garden] #linkList2 { position: absolute; top: 0; left: 0px; width: 150px; height: 350px; } body[id=css-zen-garden] #lselect { position: absolute; top: 0; left: 0; width: 150px; height: 126px; z-index: 300; } body[id=css-zen-garden] #lselect ul { position: absolute; top: 0; left: 0px; margin: 0; padding: 10px 0 12px 0; width: 135px; height: 328px; background: transparent url(grass.jpg) left top; } body[id=css-zen-garden] #lselect li { margin: 0; padding: 0 10px 10px 10px; } body[id=css-zen-garden] #larchives { position: absolute; top: 131px; left: 0; padding: 0; width: 150px; height: 72px; background: none; z-index: 200; } body[id=css-zen-garden] #larchives ul { position: absolute; top: -131px; left: 0px; margin: 0; padding: 10px 0 12px 0; width: 135px; height: 328px; background: transparent url(grass.jpg) left top; } body[id=css-zen-garden] #larchives li { margin: 0; padding: 0 10px 8px 10px; } body[id=css-zen-garden] #lresources { position: absolute; top: 208px; left: 0; height: 92px; z-index: 100; } body[id=css-zen-garden] #lresources ul { position: absolute; top: -208px; left: 0px; margin: 0; padding: 10px 0 12px 0; width: 135px; height: 328px; background: transparent url(grass.jpg) left top; } body[id=css-zen-garden] #lresources li { margin: 0; padding: 0 10px 8px 10px; } body[id=css-zen-garden] #lselect h3.select { padding: 0 0 0 0; width: 150px; height: 126px; background: transparent url(zentab1.png) no-repeat 135px 0px; } body[id=css-zen-garden] #lselect h3 span { display: none; } body[id=css-zen-garden] #larchives h3.archives { padding: 0 0 0 0; width: 150px; height: 72px; background: transparent url(zentab2.png) no-repeat 135px 0px; } body[id=css-zen-garden] #larchives h3 span { display: none; } body[id=css-zen-garden] #lresources h3.resources { padding: 0 0 0 0; width: 150px; height: 92px; background: transparent url(zentab3.png) no-repeat 135px 0px; } body[id=css-zen-garden] #lresources h3 span { display: none; } body[id=css-zen-garden] #lselect:hover, body[id=css-zen-garden] #lselect h3:hover { background: transparent url(zentab1.png) no-repeat 135px -126px; z-index: 300; } body[id=css-zen-garden] #larchives:hover, body[id=css-zen-garden] #larchives h3:hover { background: transparent url(zentab2.png) no-repeat 135px -72px; z-index: 300; } body[id=css-zen-garden] #lresources:hover, body[id=css-zen-garden] #lresources h3:hover { background: transparent url(zentab3.png) no-repeat 135px -92px; z-index: 300; } body[id=css-zen-garden] #linkList2 li>a { font: bold 11px/13px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif;} body[id=css-zen-garden] #lselect li>a { display:block; padding: 0 0 2px 0; font: bold 11px/13px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif;} body[id=css-zen-garden] #lselect li>a.c { display:inline; font: bold 9px/10px "Lucida Grande","Lucida Sans Unicode", helvetica, arial, sans-serif; } body[id=css-zen-garden] #lselect li>a.c:link { color: #fff; } body[id=css-zen-garden] #lselect li>a.c:visited { color: #fff; } body[id=css-zen-garden] #lselect li>a.c:hover, body[id=css-zen-garden] #lselect li>a.c:active { color: #6CF; } body[id=css-zen-garden] #linkList li a:link { color: #f90; } body[id=css-zen-garden] #linkList li a:visited { color: #f90; } body[id=css-zen-garden] #linkList li a:hover, body[id=css-zen-garden] #linkList li a:active { color: #6CF; } body[id=css-zen-garden] #extraDiv1 { position: absolute; top: 105px; left: 200px; width: 250px; height: 350px; background: url(intro.png) no-repeat left top; }/* css Zen Garden submission 063 - 'Elastic Lawn' by Patrick Griffiths, http://htmldog.com/ptg/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Patrick Griffiths */ /* Added: December 5th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { font-family: arial, Helvetica, sans-serif; font-size: 77%; /* initially set to percentage so that ems work without producing miniscule text in IE */ text-align: center; /* needed to center the container in IE5.x because it doesn't like 'margin: 0 auto' */ color: #dfd; background: #1b890e url(grass.jpg); /* defines the colour as well as the background image so that an average colour is shown while the image loads */ padding: 0 0 6em 0; margin: 0; } #container { width: 48em; text-align: left; /* resets the text alignment */ margin: 0 auto; /* centers the container */ } p { padding: 0; margin: 0; } p span { display: block; padding: 0 4em 1em 4em; } a { color: #fe6; background: url(underline1light.gif) bottom repeat-x; text-decoration: none; } a:hover { background-image: url(underline2light.gif); } acronym { border: 0; } /*------------Hidden elements------------*/ h1 span, h2, #intro h3 span, #supportingText h3 span, #linkList h3.xselect { /* The equivalent of 'display: none' but leaves the elements readable by some screen readers */ position: absolute; overflow: hidden; clip: rect(0,0,0,0);/* because 'height: 0' doesn't have any fun in IE5.5 */ height: 0;/* because clip doesn't have any fun in IE6 */ } /*------------Main heading and Quick Summary------------*/ #intro #pageHeader { padding: 0; } h1 { position: relative; top: 19px; left: -24px; height: 8em; font-size: 1em; background: url(logo.gif) bottom left no-repeat; padding: 0; margin: 0; } #quickSummary { height: 8.1em; /* ensures that the linkList top fits directly below */ background: #fc3 url(yellowdiagonal.gif); } #quickSummary p span { color: #030; margin: 0; } #quickSummary .p1 span { font-weight: bold; background: url(curve.gif) top right no-repeat; padding: 2.2em 15em 1em 3em; } #quickSummary .p2 span { position: absolute; top: 10.3em; left: 50%; width: 22em; text-align: center; padding: 0 0 0 11em; voice-family: "\"}\""; voice-family: inherit; width: 11em; } html>#quickSummary .p2 { width: 11em; } #quickSummary a { color: #070; background-image: url(underline1dark.gif); } #quickSummary a:hover { background-image: url(underline2dark.gif); } /*------------Preamble, Supprting Text and Footer------------*/ #preamble, #supportingText { width: 32em; background: #0d4407 url(grassdark.jpg); margin-left: 16em; voice-family: "\"}\""; voice-family:inherit; margin: 0 0 0 auto; } html>#preamble, html>#supportingText { margin: 0 0 0 auto; } #benefits p { /* because otherwise IE 6 goes crazy */ voice-family: "\"}\""; voice-family:inherit; position: relative; top: -1.5em; margin: 1.5em 0 -1.5em 0; } #benefits>p { top: 0; margin: 0; } #preamble , #supportingText div { padding: 0 0 2.5em 0; } #explanation, #benefits { color: #030; background: #fc3 url(yellowdiagonal.gif); margin: 0 2em; } #preamble .p1, #participation .p1, #requirements .p1 { position: relative; top: -15px; background: url(corner_yelongreen_br.gif) top right no-repeat; margin: 0 2em -15px 2em; } #preamble .p1 { margin: 0 0 -15px 0; } #participation .p1 span, #requirements .p1 span { display: block; background: url(corner_yelongreen_bl.gif) top left no-repeat; padding-top: 4em; padding-right: 2em; padding-left: 2em; } #preamble .p1 span { display: block; padding-top: 4em; } #explanation .p1, #benefits .p1 { background: url(corner_yelongreen_tl.gif) top left no-repeat; } #explanation .p1 span, #benefits .p1 span { display: block; background: url(corner_yelongreen_tr.gif) top right no-repeat; padding-top: 3em; } #intro h3, #supportingText h3 { position: relative; top: -13px; height: 13px; background: url(enlightenment.gif) bottom center no-repeat; padding: 0; margin: 0 0 -13px 0; } #explanation h3 { background-image: url(about.gif); } #participation h3 { background-image: url(participation.gif); } #benefits h3 { background-image: url(benefits.gif); } #requirements h3 { background-image: url(requirements.gif); } #footer { text-align: center; background: url(corner_grassdarkongrass_bl.gif) bottom left no-repeat; padding: 4em 0; } #extraDiv1 { position: relative; top: -15px; width: 48em; height: 15px; background: url(corner_grassdarkongrass_br.gif) bottom right no-repeat; margin: 0 auto; } /*------------Link List------------*/ #linkList { position: absolute; top: 16.1em; width: 16em; margin: 0; } #linkList2 { background: #5b460b url(grassbrown.jpg); padding: 0; } #linkList h3 { font-family: "Trebuchet MS", arial, Helvetica, sans-serif; font-size: 1.2em; text-transform: uppercase; text-align: center; color: #fc3; margin: 0; } #linkList h3.select { position: relative; top: -15px; width: 13.3333em; background: url(corner_yelonbrown_bl.gif) top left no-repeat; padding: 0; margin-bottom: -15px; } h3.select span { display: block; position: relative; left: 15px; background: url(twirl.gif) top right no-repeat; padding-right: 15px; padding-top: 2.5em; margin-left: -15px; } #linkList a { color: #efe; background-image: url(underline1yellow.gif); } #linkList a:hover { background-image: url(underline2yellow.gif); } ul { list-style: none; padding: 1em 1.5em; margin: 0; } li { padding-left: 1.5em; margin-bottom: 1em; } li/* */ { background: url(bullet.gif) left no-repeat; } #lselect ul a { display: block; font-family: "Trebuchet MS", arial, Helvetica, sans-serif; font-weight: bold; } #lselect ul a.c { display: inline; font-family: arial, Helvetica, sans-serif; font-weight: normal; } #lresources { position: relative; top: 15px; background: url(curvebl2.gif) bottom right no-repeat; padding-bottom: 15px; margin-top: -15px; } #lresources ul { background: url(curvebl.gif) bottom left no-repeat; }/* css Zen Garden submission 064 - 'Night Drive' by Dave Shea, http://www.mezzoblue.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Dave Shea */ /* Added: December 6th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ html { margin: 0; padding: 0; } body { color: #A05B00; background: #000 url(bg1.gif) repeat; text-align: center; font: 11px/18px helvetica, arial, sans-serif; text-transform: lowercase; margin: 0; padding: 0; } a:link { color: #FFC000; text-decoration: none; } a:visited { color: #D79900; text-decoration: underline; } a:hover { color: #FF0; text-decoration: underline; } p { padding: 0 0 0.3em 14px; } h3 { font-size: 12px; color: #CA7400; margin-bottom: 0; padding-left: 14px; background: transparent url(w1.gif) 0 2px no-repeat; } h3 + p { margin-top: 0; } acronym { font-style: normal; border-bottom: none; } /* structure */ #container { background-color: #000; width: 770px; text-align: left; margin-left: auto; margin-right: auto; border-left: double 3px #332511; border-right: double 3px #332511; } /* header */ h1 span, h2 span { display: none; } h1 { width: 770px; height: 166px; margin: 0; background: #000 url(bg2.gif) top left no-repeat; } h2 { width: 244px; height: 42px; background: #000 url(h1.gif) top left no-repeat; position: absolute; top: 120px; margin: 0; margin-left: 495px; } /* content */ #quickSummary, #preamble, #supportingText { margin: 0 0 0 400px; padding: 1px 0; /*1px 10px 1px 10px;*/ background: transparent url(bg4.gif) top left repeat-y; width: 342px; } #quickSummary h3, #preamble h3, #supportingText h3 { margin: 0 10px; } #quickSummary p, #preamble p, #supportingText p { margin: 0 0 10px 10px; } #quickSummary { border-top: solid 1px #332511; padding-top: 10px; } /* sidebar */ #linkList { position: absolute; top: 166px; width: 400px; height: 633px; color: #132F5B; /*#742500;*/ background: transparent url(bg3.gif) top left repeat-x; border-top: solid 1px #332511; line-height: 12px; padding-top: 20px; } #linkList ul { margin: 0; padding: 0; } #linkList li { list-style-type: none; padding: 0; margin-bottom: 0.5em; } #lselect li { padding: 3px 3px 3px 16px; background: transparent url(w2.gif) 3px 3px no-repeat; } #lselect li a:link, #lselect li a:visited { display: block; } #linkList h3 { padding-left: 0; background-image: none; } #linkList h3 span { display: none; } #linkList a, #linkList a:link { color: #AF4F0A; font-weight: bold; } #linkList li a.c:link, #linkList li a.c:visited { color: #742500; font-weight: normal; display: inline; text-decoration: none; } #linkList a.c:hover { text-decoration: underline; } #linkList h3.select { width: 160px; height: 12px; background: transparent url(h-select.gif) top left no-repeat; margin-bottom: 0.5em; } #linkList h3.archives { width: 180px; height: 12px; background: transparent url(h-archives.gif) top left no-repeat; margin-bottom: 0.5em; } #linkList h3.resources { width: 180px; height: 12px; background: transparent url(h-resources.gif) top left no-repeat; margin-bottom: 0.5em; } #lselect { width: 160px; float: left; padding-left: 50px; } /* CSS MOSe hovers */ * > #lselect li { margin-top: -7px; padding: 5px 5px 5px 18px; background-position: 5px 5px; margin-right: 10px; border: solid 1px transparent; } #lselect li:hover { background: #2A1812; border-color: #452310; } #lselect li:hover a { color: #FF9D14; } #lselect li:hover a.c { color: #E84900; } #larchives { padding-top: 1px; } #larchives, #lresources { padding-left: 200px; } #footer { text-align: right; padding: 5px 10px 100px 15px; background: url(skyline.jpg) bottom left repeat-x; position: relative; left: 3px; width: 342px; margin: 0; } /* extra bits */ #extraDiv1 { position: absolute; top: 41px; left: 0; text-align: center; width: 100%; } #extraDiv1 span { width: 400px; height: 123px; background: transparent url(granville.jpg) top left no-repeat; display: block; margin-left: auto; margin-right: auto; padding-right: 370px; width: 770px; voice-family: "\"}\""; voice-family:inherit; width: 400px; } html>body #extraDiv1 span { width: 400px; } #extraDiv2 { position: absolute; top: 41px; left: 0; text-align: center; width: 100%; } #extraDiv2 span { height: 70px; background: transparent url(falsecreek.jpg) top right no-repeat; display: block; margin-left: auto; margin-right: auto; padding-left: 402px; width: 769px; voice-family: "\"}\""; voice-family:inherit; width: 367px; } html>body #extraDiv2 span { width: 367px; } #extraDiv3 { position: absolute; top: 0; left: 0; width: 100%; text-align: center; } #extraDiv3 span { text-align: left; width: 770px; height: 38px; background: transparent url(bg5.gif) top left repeat-x; display: block; margin-left: auto; margin-right: auto; } #extraDiv4 { position: absolute; top: 0; left: 0; width: 100%; text-align: center; } /* IE doesn't support PNG transparency. No soup for you. */ html>body #extraDiv4 span { width: 790px; height: 94px; background: transparent url(seal.png) top right no-repeat; display: block; margin-left: auto; margin-right: auto; }/* css Zen Garden submission 065 - 'New Groove' by Martin Neumann, http://www.rushmedia.de/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Martin Neumann */ /* Added: December 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* ----- General styles ----- */ body { margin:0 0 10px 0; padding:0; background:#EFF4F4 url("stripes_bg.jpg") repeat-y 750px 0px; color:#000000; font-size:76%; line-height:1.3em; text-decoration:none; font-family:"Trebuchet MS",Verdana,Sans-Serif; text-align:justify; } acronym { border:none; } h1, h2, h3 { margin:0; } a, a:visited, a:active, a:visited { font-weight:bold; text-decoration:none; color:#4A3D7C; } a:hover { color:#D84E7B; } /* ----- Structural elements ----- */ #pageHeader { position:relative; margin:0; padding:0; width:100%; height:260px; background:url("arrow.gif") repeat-x 25px 217px; } #pageHeader h1 { height:260px; background:url("csszengarden_logo.gif") no-repeat left bottom; z-index:15; } #pageHeader h1 span, h2 span { display:none; } #quickSummary { position:absolute; top:165px; left:380px; width:300px; font-family:Arial,Sans-Serif; font-size:1.1em; z-index:10; } #quickSummary .p1 { display:none; } #quickSummary p { margin:0; } #preamble { position:relative; float:left; padding-bottom:10px; top:70px; left:15px; width:250px; background:#E4EDDE url("bottom_preamble.gif") no-repeat left bottom; } #preamble p { margin:0; padding:5px 20px; } #preamble h3 { height:70px; background:url("header_preamble.gif") no-repeat left top; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display:none; } #supportingText { position:relative; top:20px; text-align:left; margin:0 0 30px 290px; padding-bottom:5px; width:430px; background:#D5D8E7 url("bottom_supportingText.gif") no-repeat left bottom; z-index:1; } #supportingText p { margin:0; padding:5px 10px; } #supportingText a { font-style:italic; } #explanation h3 { height:80px; background:url("header_supportingText.gif") no-repeat left top; } #explanation p { margin-top:-5px; } #participation h3 { height:19px; margin:15px 0 10px 0; background:url("header_participation.gif") no-repeat 30px 0px; } #benefits h3 { height:16px; margin:15px 0 10px 0; background:url("header_benefits.gif") no-repeat 30px 0px; } #requirements h3 { height:19px; margin:15px 0 10px 0; background:url("header_requirements.gif") no-repeat 30px 0px; } #footer { text-align:center; margin:10px; background:url("grad_line.gif") no-repeat bottom center; } #footer a { font-style:normal; } /* ----- Linklists ----- */ #linkList { position:absolute; top:60em; left:15px; width:250px; padding-bottom:20px; background:#E4EDDE url("bottom_preamble.gif") no-repeat left bottom; } #linkList ul { margin:0; padding:0; list-style:none; } #lselect li, #lfavorites li { padding:0; margin:0 10px; text-align:right; background:url("lselect_seperator.gif") no-repeat bottom center; } #lselect a, #lfavorites a { margin-top:2px; padding:1px 0 0 27px; font-style:normal; font-size:1.1em; font-weight:bold; display:block; text-align:left; height:17px; margin-top:1px; } #lselect a:hover, #lfavorites a:hover { background:#D8EDCA url("lselect_hover.gif") no-repeat left top; } #lselect a.c, #lfavorites a.c { padding:0; margin-right:15px; color:#6150A4; font-style:italic; font-size:1em; font-weight:normal; display:inline; } #lselect a.c:hover, #lfavorites a.c:hover { color:#D84E7B; background:none; } #lselect h3 { height:50px; margin-bottom:10px; background:url("header_select.gif") no-repeat left top; } #lfavorites h3 { height:15px; margin:20px 0 15px 0; background:url("header_favorites.gif") no-repeat 40px 0; } #lselect h3 span, #lfavorites h3 span { display:none; } #larchives h3 { height:15px; margin:30px 0 10px 0; background:url("header_archives.gif") no-repeat 50px 0; } #lresources h3 { height:15px; margin:30px 0 10px 0; background:url("header_resources.gif") no-repeat 30px 0; } #larchives li, #lresources li { text-align:center; } #larchives h3 span, #lresources h3 span { display:none; } #larchives a, #lresources a { font-size:1.1em; line-height:1.5em; } /* ----- Extra images ----- */ #extraDiv1 { position:absolute; top:220px; left:320px; width:446px; height:23px; background:url("new_groove.gif") no-repeat left top; z-index:10; } #extraDiv2 { position:relative; display:block; height:0px; } #extraDiv2 span{ position:absolute; bottom:20px; right:10%; width:253px; height:404px; background:url("listening.gif") no-repeat; z-index:0; } #extraDiv3 { position:absolute; top:0px; left:0px; width:716px; height:193px; background:url("lounge_bg.jpg") no-repeat left top; z-index:0; } #extraDiv4 { position:relative; display:block; height:0px; } #extraDiv4 span { position:absolute; bottom:200px; right:0px; width:54px; height:552px; background:url("garden_lounge_vert.gif") no-repeat left top; z-index:0; }/* css Zen Garden submission 066 - 'Focus & Shoot' by Colectivo YTW (Julio Beamonte, Beatriz Martinez, Gustavo Gavan, Franck Scipion), http://www.yatienesweb.info/corporativo/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, YTW */ /* Main Photo - Copyright 2003, Cristobal Lucas Gomez, cristoballucas@hotmail.com, all rights reserved*/ /* Added: December 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* General*/ body { background-image:url(bg.jpg); background-color:#fff; font-family:arial, sans serif; font-size:11px; line-height:15px; color:#fff; margin:0px; } /* Positioning*/ #container { margin-left:0px; margin-top:0px; padding:0px; width:950px; z-index:1; } #intro { width:275px; position:absolute; left:45px; top:15px; z-index:2; } #supportingText { width:5px; position:absolute; left:45px; top:15px; z-index:2; } #participation { width:325px; position:absolute; left:575px; top:820px; z-index:2; } #benefits { width:435px; position:absolute; left:0px; top:820px; z-index:2; } #footer{ width:250px; position:absolute; left:600px; top:360px; z-index:2; } #requirements { width:900px; position:absolute; left:0px; top:1250px; z-index:2; } #linkList2 { width:275px; position:absolute; left:345px; top:87px; z-index:2; } #explanation { width:305px; position:absolute; left:600px; top:0px; z-index:2; } /* Cosmetics */ #extraDiv1 { background-image:url(background.jpg); background-repeat:no-repeat; position:absolute; left:2px; top:2px; width:1000px; height:1515px; z-index:1; } #explanation, #participation, #requirements, #benefits, #footer, #quickSummary, #preamble, #lselect, #lfavorites, #lresources, #larchives { padding:7px; margin:5px; border-left:1px solid #aaa; border-top:1px solid #aaa; border-right:1px solid #333; border-bottom:1px solid #333; } #requirements { background-image:url(End_Section.gif); background-repeat:no-repeat; background-position:bottom center; } #explanation, #participation, #benefits, #quickSummary, #preamble, #lselect, #lfavorites, #lresources, #larchives { background-image:url(End_Section2.gif); background-repeat:no-repeat; background-position:bottom center; } #pageHeader { display:none; } h3 { font-family:arial, sans serif; text-transform: uppercase; color:#fff; font-size:11px; font-weight:bold; margin-top:3px; margin-bottom:3px; border-bottom: #fff 1px solid } h3 span { border-bottom: #c00 5px solid } #explanation h3, #participation h3, #requirements h3, #benefits h3, #quickSummary h3, #preamble h3, #lselect h3, #lfavorites, #lresources h3, #larchives h3 { background-image:url(h3.gif); background-repeat:no-repeat; background-position:bottom right; } p { margin:6px; } #requirements p.p5 { color:#c00; font-weight:bold; } acronym { border-bottom: dotted 1px #fff; cursor: help; } /* Links */ a { color:#e2e2e2; text-decoration:underline; } a:link { color:#e2e2e2; text-decoration:underline; } a:hover { color:#fff; font-weight:bold; text-decoration:underline; } a:visited { color:#e2e2e2; text-decoration:underline; } #footer a { text-transform: uppercase; color:#fff; text-decoration:underline; background: url(bullet_single.gif) no-repeat 5px 2px; padding-left: 15px; } #footer a:link { text-transform: uppercase; color:#fff; text-decoration:underline; background: url(bullet_single.gif) no-repeat 5px 2px; padding-left: 15px; } #footer a:hover { text-transform: uppercase; color:#fff; font-weight:bold; text-decoration:underline; } #footer a:visited { text-transform: uppercase; color:#c00; text-decoration:underline; } #lselect a { color:#fff; text-decoration:underline; } #lselect a:link { color:#fff; text-decoration:underline; } #lselect a:hover { color:#fff; font-weight:bold; text-decoration:underline; } #lselect a:visited { color:#e2e2e2; text-decoration:underline; } #lselect a.c:hover { color:#c00; background-color:#fff; font-weight:bold; } /* Lists */ #linkList ul { margin: 0px 0px 5px 0px; padding: 0px; } #linkList li { list-style-type: none; } #linkList #lselect li { background: url(bullet_double.gif) no-repeat 5px 2px; padding-left: 15px; } #lselect li a.c{ text-decoration:none; display:inline; font-size:9px; text-transform: uppercase; } #linkList #larchives li, #linkList #lresources li { background: url(arrow.gif) no-repeat 0px 5px; padding-left: 10px; display: inline; } /* css Zen Garden submission 067 - 'A Silent Strength' by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Ray Henry */ /* Added: December 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { background: #ADB58D url(main_bg_pattern.gif); margin:0; padding:0; text-align:center; } p { font: 11px verdana; text-align: left; } h1, h2, h3, h4 { margin:0; padding:0; } a:link { text-decoration:underline; color: #5a682e; } a:visited { text-decoration:underline; color: #38460c; } a:hover, a:active { text-decoration: underline; color: #380000; } acronym { border-bottom:1px dotted #38460c; cursor:help; } a acronym {bottom-border:0;} ul { padding:0; margin:0; } /* header images */ h1, h2 { margin: 0 40px 0 335px; padding:0; width: 395px; } h1 { background:#f4f5f0 url(intro_bg_a.jpg) no-repeat top left; height:110px; } h2 { background:#f4f5f0 url(intro_bg_b.jpg) no-repeat top left; height:106px; } h1 span, h2 span {display:none;} /* specific divs */ #container { background:#fff url(container_bg.jpg) repeat-y top left; width:770px; text-align:left; margin-left:auto; margin-right:auto; } #quickSummary, #preamble, #explanation, #participation, #benefits, #requirements { margin: 0 40px 0 335px; padding:0 15px; width: 365px; border-bottom:1px solid #e3e4e0; } #quickSummary { background:transparent url(quicksum_title.gif) no-repeat top left; padding-top:30px; } #preamble { background:transparent url(theroad_title.gif) no-repeat top left; padding-top:30px; } #explanation { background:transparent url(explain_title.gif) no-repeat top left; padding-top:30px; } #participation { background:transparent url(participate_title.gif) no-repeat top left; padding-top:30px; } #benefits { background:transparent url(benefit_title.gif) no-repeat top left; padding-top:30px; } #requirements { background:transparent url(req_title.gif) no-repeat top left; padding-top:30px; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 {display:none;} #quickSummary p, #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin:10px 5px; line-height:16px; color:#38460c; } /* footer */ #footer { text-align:center; margin: 10px 40px 0 335px; padding-bottom:10px; width: 365px; font: 10px verdana; } /* main navigation */ #linkList { background:#fff url(intro_title.jpg) no-repeat top left; position: absolute; top: 0px; padding:110px 0 0 0; margin:0 0 0 58px; width:277px; height:100%;; } #linkList ul { margin: 0; padding: 0; } #lselect { background:transparent url(select_nav_title.gif) no-repeat top left; padding-top:30px; } #lselect h3 {display:none} #lselect ul { margin:0 0 0 -15px; padding:0; width:235px; voice-family: "\"}\""; voice-family:inherit; margin:0; } #lselect li { font:11px verdana; width:235px; padding:5px 10px 15px 10px; height:auto; list-style-type: none; margin:0 0 -3px 20px; background:#dee1d3 url(li_bg_tab.gif) no-repeat bottom left; voice-family: "\"}\""; voice-family:inherit; width:215px; } div[id="lselect"]>li { margin:0 0 0 20px; !important; } #lselect li a:link, #lselect li a:visited { font-weight:bold; color:#39470D; display: block; margin:0; } #linkList li a.c:link, #linkList li a.c:visited { color: #929B70; padding:0; font-weight: normal; display: inline; text-decoration: underline; } #linkList a.c:hover { text-decoration: underline; } #larchives { background: #fff url(archive_title.gif) no-repeat top left; padding-top:30px; } #larchives h3 {display:none;} #larchives ul, #lresources ul { margin:0; padding:0; width:235px; } #larchives li, #lresources li { font:11px verdana; width:215px; padding: 5px 5px 0 5px; list-style-type: none; margin:0 0 0 20px; } #larchives a:link, #larchives a:visited, #lresources a:link, #lresources a:visited { color:#929B70; text-decoration:underline; } #larchives a:hover, #lresources a:hover { color:#818a60; } #lresources { background:#fff url(res_title.gif) no-repeat top left; padding-top:47px; } #lresources h3 {display:none;} /* extra divs */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none;}/* css Zen Garden submission 068 - 'Ballade' by Charlotte Lambert, http://charlotte.flibuste.net/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Charlotte Lambert */ /* Added: December 14th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ body { margin: 0px; padding: 0px; font-family: geneva, arial, helvetica, sans-serif; color: #000; background: #000; height: 100%; text-align: center; } html { height: 100%; margin: 0px; padding: 0px; } a:link { color: #e5a250; text-decoration: none; } a:visited { color: #b2906d; text-decoration: none; } a:hover, a:active { color:#99d0dd; text-decoration: none; } acronym { cursor: help; } a acronym { cursor: help; } p { font-size: 80%; } #container { position: relative; width: 800px; padding: 0px; margin-left: auto; margin-right: auto; text-align: left; background: #fff url(fond.jpg) top left repeat-y; border: 0px; } html>body #container { width: 800px; /* ie5win fudge ends */ } /* __________CHAPEAU__________ */ /*==CHAPEAU--pageHeader==*/ #pageHeader { margin-bottom: 5px; text-align: right; } #pageHeader h1 { width: 800px; height: 216px; background: transparent url(zen.jpg) top right no-repeat; margin: 0px; padding: 0px; } #pageHeader span, #pageHeader h2 { display: none; } /*==CHAPEAU--quickSummary==*/ #quickSummary { background: transparent; color: #fff; text-align: center; margin: 20px 80px 40px 295px; } #quickSummary a, #quickSummary a:visited { color: #99d0dd; } #quickSummary a:hover, #quickSummary a:active { color: #e5a250; } /*_________________TEXTE____________*/ /*==TEXTE--chapitres==*/ #preamble { margin: 0 29px 0 235px; background: #fff url(fond1.jpg) repeat-y; padding: 0px; width: 536px; padding-bottom: 30px; } #explanation, #benefits, #requirements, #participation { margin: 0px 29px 0px 235px; padding: 0px; border: 0px; width: 536px; } #explanation { background: #FFF url(fond2.jpg) top left repeat-y; } #participation { background: #fff url(fond3.jpg) top left repeat-y; } #benefits { background: #fff url(fond4.jpg) top left repeat-y; padding-bottom: 40px; } #requirements { background: #fff url(fond5.jpg) top left repeat-y; padding-bottom: 20px; } /*==TEXTE--p==*/ #explanation p, #participation p, #benefits p, #requirements p, #preamble p{ text-align: justify; } #preamble p, #participation p, #requirements p{ margin: 5px 120px 0px 20px; } #explanation p, #benefits p{ margin: 5px 20px 0px 120px; } /*==TEXTE--h3==*/ #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 0px; border: 0px; width: 536px; } #supportingText h3 span, #preamble h3 span { display: none; } #preamble h3 { background: url(road.jpg) top left no-repeat; height: 106px; } #explanation h3 { background: url(about.jpg) top left no-repeat; height: 168px; } #participation h3 { background: url(particip.jpg) top left no-repeat; height: 154px; width: 565px; } #benefits h3 { background: url(benef.jpg) top left no-repeat; height: 171px; } #requirements h3 { background: url(req.jpg) top left no-repeat; height: 125px; } /*_____________PIED__________________*/ #footer{ margin: 0 29px 0 235px; padding: 0px; background: transparent url(fin.jpg) top left no-repeat; width: 536px; height: 223px; text-decoration: underline; color: #fff; } #footer a { position: relative; top: 120px; left: 40px; padding: 0px; color: #99d0dd; } #footer a:hover, #footer a:active { color: #e5a250; text-decoration: none; } #extraDiv1 { height: 119px; width: 800px; margin: 0 auto 30px auto; background: #b2906d url(bas.jpg) no-repeat top left; text-align: left; } /*__________________MENU__________________*/ #linkList { position: absolute; top: 0; left: 0; width: 215px; margin: 0px; padding: 150px 0px 0px 0px; background: url(chat.jpg) top left no-repeat; font-size: 80%; color: #e5a250; } /*==MENU--h3==*/ #linkList h3 { margin: 40px 0px 20px 0px; width: 185px; height: 76px; } #linkList h3 span { display:none; } #linkList h3.select{ background: transparent url(select.jpg) no-repeat top left; } #linkList h3.archives { background: transparent url(archiv.jpg) no-repeat top left; } #linkList h3.resources { background: transparent url(resou.jpg) no-repeat top left; } /*==MENU--liste==*/ #linkList ul { margin: 0px 30px 0px 20px; padding: 7px 2px 5px 2px; background: #000; border: 2px solid #b2906d; } #linkList li { list-style: none; margin: 0px; padding: 0px; } #linkList a { color: #e5a250; text-decoration: none; font-size: small; } div#linkList a:hover { color: #99d0dd; } /*==MENU--select==*/ #lselect li { margin: 0 0 10px 0; } #lselect li a { display: block; } #lselect li .c { display: inline; } /*------------------------------------------------------*/ #lselect a { text-transform:uppercase; margin: 0px; padding-left: 30px; border: 0px; background: transparent; color: #b2906d; } #lselect a:hover { background: url(puce.jpg) no-repeat 0px -3px; color: #99d0dd; } #lselect a:visited { color: #964; } /*---------------------------------------------------*/ #lselect a.c { text-transform:none; margin: 0px; padding-left: 10px; border: 0px; background: transparent; color: #e5a250; } #lselect a.c:hover { background: transparent; color: #99d0dd; } /*==MENU--archives==*/ #larchives li, #lresources li { margin: 0 0 15px 0; } #larchives a, #larchives a:visited { margin: 0px; padding: 10px 0px 0px 20px; border: 0px; background: transparent; } #larchives a:hover { background: url(puceherbe.jpg) no-repeat 0 4px; } /*==MENU--ressources--a==*/ #lresources a, #lresources a:visited { margin: 0px; padding: 5px 0px 5px 20px; border: 0px; background: transparent; } #lresources a:hover { background: url(puceparenth.jpg) center left no-repeat; } /* css Zen Garden submission 069 - 'Bonsai Sky' by Mike Davidson - http://www.mdavidson.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Mike Davidson */ /* Added: December 23rd, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body { color: #000; background-color: #fff; background-image: url(bg_garden2.jpg); background-position: top right; background-repeat: no-repeat; font: normal 11px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; padding: 0; margin: 0; } acronym { border: 0; } h3 { font: bold 16px Georgia, "Times New Roman", Times, serif; color: #003300; background-image: url(bonsai.gif); background-repeat: no-repeat; padding-left: 28px; height: 23px; margin-top: 14px; margin-bottom: -5px; } h3 span { border-bottom: 1px dotted #000000; padding-bottom: 3px; } p { line-height: 165%; } ul { list-style: none; padding: 0 0 0 13px; margin: 10px 0 0 0; } li { line-height: 16px; padding-bottom: 8px; } a:link, a:visited, a:hover, a:active { color: #003300; font-weight: bold; } #linkList a:link, #linkList a:visited { color: #FFFFFF; font-size: 12px; font-style: normal; text-decoration: none; font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; text-shadow: 0 0 3px #000000; font-weight: bold; display: block; } #linkList a:hover, #linkList a:active { color: #FFFFFF; font-size: 12px; font-style: normal; text-decoration: underline; font-family: "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; text-shadow: 0 0 3px #000000; font-weight: bold; } #linkList { position: absolute; width: 200px; top: 300px; right: 7%; color: #FFFFFF; font-style: italic; font-size: 9px; font-family: Georgia, "Times New Roman", Times, serif; text-shadow: 0 0 3px #000000; } #linkList h3 { font: bold 12px Georgia, "Times New Roman", Times, serif; padding: 0; text-align: center; text-transform: lowercase; color: #FFFFFF; background-image: none; height: auto; } #linkList h3 span { background-color: #000000; padding: 4px 20px 4px 20px; position: relative; top: -7px; } #lselect, #larchives, #lresources { background-image: url(bg_black.gif); margin-bottom: 25px; padding-bottom: 3px; } #quickSummary { font-style: italic; font-family: Georgia, "Times New Roman", Times, serif; width: 380px; border-left: 1px dotted #000000; padding-left: 8px; } #pageHeader { top: 29px; position: absolute; height: 116px; text-align: center; width: 92%; background-image: url(header.gif); background-position: center; background-repeat: no-repeat; } #pageHeader h1 { font: normal 85px Georgia, "Times New Roman", Times, serif; text-shadow: 0 0 7px #000000; text-transform: lowercase; margin: 0; padding: 0; color: #111133; display: none; } #pageHeader h2 { font: bold 12px Georgia, "Times New Roman", Times, serif; text-transform: lowercase; position: relative; left: -143px; top: -20px; color: #000000; padding-top: 6px; display: none; } #pageHeader h2 span { border-top: 1px dotted #000000; padding-top: 3px; } #container { width: 92%; margin-left: 40px; padding-bottom: 40px; } #intro { padding-top: 162px; } #explanation, #participation, #benefits, #requirements, #preamble { width: 53%; } #lselect a:link.c , #lselect a:visited.c { color:#EBE2A8; text-decoration: none; display: inline; } #lselect a:hover.c, #lselect a:active.c { text-decoration: underline; display: inline; } #extraDiv1 { background-image: url(platform.png); position: fixed; top: 270px; right: 85px; width: 85px; height: 184px; margin: -85px; } #extraDiv2 { background-image: url(edge_bottom_black.gif); background-repeat: repeat-x; position: fixed; bottom: 0; left: 100%; width: 100%; height: 20px; margin-left: -100%; } #extraDiv3 { background-image: url(edge_top_black.gif); background-repeat: repeat-x; position: fixed; top: 0; left: 100%; width: 100%; height: 20px; margin-left: -100%; } #extraDiv4 { background-image: url(edge_left_black.gif); background-repeat: repeat-y; position: fixed; top: 0; left: 0; width: 20px; height: 100%; margin: 0; } #extraDiv5 { background-image: url(edge_right_black.gif); background-repeat: repeat-y; position: fixed; top: 0; right: 0; width: 20px; height: 100%; margin: 0; }/* css Zen Garden submission 070 - 'CS(S) Monk' by Cedric Savarese - http://www.4213miles.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2003, Cedric Savarese */ /* Added: January 2nd, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* basic elements */ body { color: #000000; background: #fff url(BGTile.jpg) repeat left top; margin: 0; padding: 0; font-style:normal; font-variant:normal; font-weight:normal; line-height:normal; font-size: small; font-family:Georgia, "Times New Roman", Times, serif; text-align:center; } a:link { padding: 0 0 1px 0; text-decoration: none; color: #CC3300; background-image: url(underline.gif); background-repeat: repeat-x; background-position: bottom left; } a:visited { text-decoration: none; color: #666666; padding: 0 0 2px 0; background-image: url(underline.gif); background-repeat: no-repeat; background-position: bottom left; } a:hover, a:active { text-decoration: none; color: #FF0000; background-image: none; } acronym { border-bottom: none; } /* specific divs */ #container { background: url(ContentBG.gif) repeat-y left top; margin:0px auto; text-align:left; width: 780px; padding: 0px; border-bottom: 1px solid #000; } #intro { position: relative; } #pageHeader { background-image: url(CSZenLogo.gif); background-repeat: no-repeat; background-position: left; height: 444px; z-index:99; } #pageHeader h1 { display: none; } #pageHeader h2 { display: none; } #preamble { background-image: url(RoadToEnlightmentBG_2.gif); background-repeat: no-repeat; background-position: right bottom; width: 405px; position: absolute; left: 410px; top: 15px; margin: 0; padding: 0; font-size: x-small; font-style: italic; letter-spacing: 2px; } #preamble h3 { display: none; } #preamble p { padding: 8px 70px 0px 70px; margin: 0; } #preamble .p1 { background-image: url(RoadToEnlightmentBG_1.gif); background-repeat: no-repeat; background-position: right top; padding-top: 10px; } #preamble .p3 { padding-bottom: 20px; } #quickSummary { position: absolute; font-size: x-small; left: 38px; top: 515px; width: 250px; z-index: 5; text-align: right; letter-spacing: 2px; } #explanation { background-image: url(SoWhatIsThisAbout.gif); background-position: left top; background-repeat: no-repeat; margin: 40px 0px 0px 30px ; } #explanation h3 { display: none; } #explanation p { margin: 0px 50px 0px 280px ; } #participation { background-image: url(Participation.gif); background-position: left top; background-repeat: no-repeat; margin: 20px 0px 0px 150px ; } #participation h3 { display: none; } #participation p { margin: 0px 50px 0px 160px ; } #benefits { background-image: url(Benefits.gif); background-position: left top; background-repeat: no-repeat; margin: 40px 0px 0px 195px ; } #benefits h3 { display: none; } #benefits p { margin: 0px 50px 0px 115px ; } #requirements { background-image: url(Requirements.gif); background-position: left top; background-repeat: no-repeat; margin: 40px 0px 0px 140px ; } #requirements h3 { display: none; } #requirements p { margin: 0px 50px 0px 170px ; } #linkList { margin: 40px auto; padding: 0px; background-image: url(NavBG.gif); background-repeat: no-repeat; background-position: left bottom; width: 729px; font-size: xx-small; } #linkList2 { background-image: url(NavBG_top.gif); background-repeat: no-repeat; background-position: left top; width: 729px; padding: 5px 0px; } #linkList ul { display: block; padding: 0px 60px 0px 120px; margin: 0; line-height: 20px; } #linkList li { display: inline; list-style-image: none; } #linkList li:after {content:url(Bullet.gif); } #lselect { background-image: url(SelectADesign.gif); background-position: left center; background-repeat: no-repeat; margin: 0 0 0 20px; } #lselect h3 { display: none; } #larchives { background-image: url(Archive.gif); background-position: left top; background-repeat: no-repeat; margin: 10px 0 10px 20px; padding: 8px 0; } #larchives h3 { display: none; } #lresources { background-image: url(Resources.gif); background-position: left top; background-repeat: no-repeat; margin: 10px 0 10px 20px; padding: 8px 0; } #lresources h3 { display: none; } #extraDiv1 { position: relative; top: -225px; left: -360px; margin: 0 auto; width: 96px; height: 206px; background-image: url(Dragon.gif); background-position: left top; background-repeat: no-repeat; } .p5 { padding-top: 30px; font-size: 10px; } #footer { padding-left: 160px; font-size: x-small; margin-top: -13px; } /* css Zen Garden submission 071 - 'Garden Party' by Bobby van der Sluis, http://www.bobbyvandersluis.com */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Bobby van der Sluis */ /* Added: January 2nd, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Page layout: positioning and backgrounds */ body { margin: 0; border-top: 15px solid #000; border-bottom: 15px solid #000; padding: 0; background: #fff url(background.gif) center top repeat-y; text-align: center; } #container { position: relative; margin: 0 auto; width: 750px; } #intro { background: #00c2ec url(lines.gif) left top repeat-y; } #pageHeader { padding: 20px 95px 0 395px; } #pageHeader h1 { position: absolute; top: 0; left: 0; background: transparent url(logo.gif) left top no-repeat; width: 375px; height: 270px; } #pageHeader h1 span { display: none; } #pageHeader h2 { padding: 0; } #quickSummary { padding: 0 95px 0 395px; } #preamble { background: transparent url(crossing.gif) left bottom no-repeat; padding: 0 95px 230px 395px; } #supportingText { position: relative; background: #10a2c5 url(lines2.gif) left top repeat-y; width: 750px; } #explanation { padding: 0 395px 0 95px; } #participation { padding: 0 395px 180px 95px; background: transparent url(wave.gif) left bottom no-repeat; } #benefits { position: absolute; top: 0; left: 395px; padding: 0 95px 0 0; } #requirements { position: absolute; top: 18.5%; left: 395px; padding: 0 95px 0 0; } #footer { padding: 0 95px 5px 395px; background: transparent url(lines3.gif) left top repeat-y; } #linkList { position: absolute; top: 270px; left: 0px; margin: 0 95px; width: 260px; } #larchives { padding: 2em 0 1em 0; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* Content styling: fonts & text replacement */ body { font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; font-weight: bold; text-transform: uppercase; } h1, h2, h3, p { margin: 0; } p { padding: 0 0 1em 0; } a { color: #fff; text-decoration: none; } a:hover { text-decoration: overline; } #container { text-align: left; } #pageHeader h2 { background: transparent url(quickSummary.gif) no-repeat top left; width: 260px; height: 44px; } #preamble h3 { background: transparent url(preamble.gif) no-repeat top left; width: 260px; height: 44px; } #explanation h3 { background: transparent url(explanation.gif) no-repeat top left; width: 260px; height: 44px; } #participation h3 { background: transparent url(participation.gif) no-repeat top left; width: 260px; height: 44px; } #benefits h3 { background: transparent url(benefits.gif) no-repeat top left; width: 260px; height: 44px; } #requirements h3 { background: transparent url(requirements.gif) no-repeat top left; width: 260px; height: 44px; } #pageHeader h2 span, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #linkList h3 { display: none; } #linkList ul { margin: 0; padding: 0; list-style-type: none; } #linkList li { margin: 0; } #linkList a { display: block; font-size: large; voice-family: "\"}\""; voice-family: inherit; font-size: x-large; } html>body #linkList a { font-size: x-large; } #linkList a.c { display: inline; color: #000; font-size: medium; voice-family: "\"}\""; voice-family: inherit; font-size: large; } html>body #linkList a.c { font-size: large; } #larchives a, #lresources a { display: inline; font-size: small; voice-family: "\"}\""; voice-family: inherit; font-size: medium; } html>body #larchives a, html>body #lresources a { font-size: medium; } #lresources li { background: url(bullet.gif) no-repeat 0 0.5em; padding: 0 0 0 12px; } /* css Zen Garden submission 072 - 'Outburst' by Chris Vincent - http://dris.webhop.org/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* Flower illustrations derived from a photograph by Seer of sxc.hu - http://www.sxc.hu/browse.phtml?f=profile&l=seer */ /* Added: January 3rd, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Overall Layout and Formatting */ body { font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 20px; margin: 0; padding: 0; text-align: justify; } #container { position: absolute; left: 0; top: 0; padding: 0 10px 0 10px; background: url(edgeBorder.gif) top right repeat-y rgb(236,149,3); width: 939px; voice-family: "\"}\""; voice-family: inherit; width: 919px; } #pageHeader { text-indent: -10000px; width: 800px; height: 388px; background: url(header.gif) no-repeat; margin: 10px 0 0 0; padding: 0; } h1, h2 { margin: 0; } /* Content Layout */ #quickSummary { background: white; padding: 10px 35px 10px 335px; margin: 10px 0 0 0; width: 800px; voice-family: "\"}\""; voice-family: inherit; width: 430px; } *>#quickSummary { float: right; width: 155px; padding: 0 20px 10px 17px; margin: 23px 154px 10px 20px; border: 3px double rgb(200,200,200); border-width: 0 0 3px 3px; } #quickSummary .p2 { padding-bottom: 10px; border-bottom: 3px double rgb(200,200,200); } *>#quickSummary .p2 { padding-bottom: 0; border-bottom: 0; } #preamble h3, #supportingText h3 { text-indent: -10000px; height: 38px; } #preamble { background: white; padding: 10px 35px 1px 335px; width: 800px; voice-family: "\"}\""; voice-family: inherit; width: 430px; } *>#preamble { margin-top: 8px; padding-top: 1px; } #preamble h3 { background: url(theRoadToEnlightenmentWide.gif) no-repeat; } *>#preamble h3 { background: url(theRoadToEnlightenmentWide.gif) no-repeat; width: 215px; margin-left: 0; margin-right: 0; clear: left; } #supportingText { background: white url(3dflower.jpg) bottom left no-repeat; margin-bottom: 10px; padding: 1px 35px 0 335px; width: 800px; voice-family: "\"}\""; voice-family: inherit; width: 430px; } #supportingText h3 { margin: 22px 0 10px 0; } #explanation h3 { background: url(soWhatIsThisAbout.gif) no-repeat; margin-top: 22px; } #participation h3 { background: url(participation.gif) no-repeat; } #benefits h3 { background: url(benefits.gif) no-repeat; } #requirements h3 { background: url(requirements.gif) no-repeat; } *>#explanation h3 { margin-top: 10px; } /* Sidebar Layout */ #linkList { position: absolute; left: 10px; top: 408px; width: 325px; padding: 1px 0 0 0; line-height: 14px; } #linkList h3 { color: rgb(255,210,50); padding: 5px 0 0 65px; margin: 10px 0 0 0; font-size: 9px; font-weight: normal; background: url(windowHead.gif) no-repeat rgb(236,149,3); width: 325px; height: 22px; voice-family: "\"}\""; voice-family: inherit; width: 260px; height: 17px; } *>#linkList h3 { padding-top: 6px; margin-bottom: -1px; } #lselect:hover h3, #larchives:hover h3, #lresources:hover h3 { background: url(flashingWindowHead.gif) no-repeat; } #linkList ul { background: url(windowBody.gif) repeat-y; margin: 0; padding: 10px 0 15px 40px; width: 325px; voice-family: "\"}\""; voice-family: inherit; width: 285px; } #linkList li { list-style: none; background: url(bullet.gif) no-repeat 0 3px; margin: 5px 20px 5px -16px; padding-left: 0px; width: 200px; text-indent: 16px; voice-family: "\"}\""; voice-family: inherit; padding-left: 16px; text-indent: 0; margin-left: 0; } #linkList li:hover { background: url(hoverBullet.gif) no-repeat 0 3px; } #lselect, #larchives, #lresources { width: 325px; padding-bottom: 11px; background: url(windowFoot.gif) no-repeat bottom; } #lselect { font-size: 11px; } #footer { text-align: center; padding: 3px 0; border-top: 3px double rgb(200,200,200); } /* Link Formatting */ a:link { color: black; text-decoration: none; border-bottom: 2px rgb(247,202,0) solid; } a:visited { color: black; text-decoration: none; border-bottom: 1px rgb(247,202,0) solid; } a:link:hover { border-bottom-width: 3px; } a:visited:hover { border-bottom-width: 2px; } a:active { border-bottom-width: 1px; } #linkList a:link, #linkList a:visited, #linkList a:hover, #linkList a:active { border: none; font-weight: bold; display: block; font-size: 12px; } #linkList a.c:link, #linkList a.c:visited, #linkList a.c:hover, #linkList a.c:active { font-weight: normal; text-decoration: underline; display: inline; font-size: 11px; } #larchives a:link, #larchives a:visited, #larchives a:hover, #larchives a:active, #lresources a:link, #lresources a:visited, #lresources a:hover, #lresources a:active { display: inline; font-size: 12px; }/* css Zen Garden submission 073 - 'Emmakade' by Alexander Christiaan Jacob (ACJ) - http://acjs.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, ACJ */ /* Added: January 18th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ :link, :visited { background-color: transparent; color: #9296A2; font-weight: bold; text-decoration: underline } [title] { border-bottom: 1px dotted; cursor: help } :link:hover, :visited:hover { background-color: #9296A2; color: #373B46; text-decoration: none } body { font: normal 70% Verdana, Georgia, Times, serif } body { background: #9296A2 url(a_img.gif) repeat; color: #000000; margin: 0em; padding: 0em } h1, h2, h3, h4 { margin: 0em; overflow: hidden; padding: 0em } h1 { background: #9296A2 url(h1_v2.jpg) no-repeat; height: 430px } h2 { background: #9296A2 url(h2.gif) no-repeat; height: 360px; margin-left: -62px; position: absolute; top: 0px; width: 60px } * > h2 { position: fixed } h3 span { margin-left: -2000px } p { color: #9296A2; margin: 0em; padding: 0em 0em 1em 0em } p:hover { color: #E7E7F1 } p * { color: #9296A2 } p:hover * { color: #E7E7F1 } ul { background-color: transparent; color: #9296A2; margin: 0em; padding: 0em; padding-bottom: 20px } ul li { list-style: square; margin: 0em 0em 0em 2em; padding: 0em } ul li a { font-weight: normal } #container { background: #373B46 url(container.jpg) bottom no-repeat; border: 2px solid #000; border-width: 0px 2px; color: #E7E7F1; margin-left: -321px; padding-bottom: 500px; position: absolute; left: 50%; width: 642px } #pageHeader { background-color: #373B46 } #pageHeader h1 span { margin-left: -2000px } #pageHeader h2 span { margin-left: -2000px } #quickSummary { margin-top: -10px } #quickSummary, #preamble { margin-left: 290px; text-align: justify; width: 270px } #preamble h3 { background: #373B46 url(h3_preamble.gif) no-repeat; height: 60px; width: 330px } #supportingText { margin-left: 24px; width: 440px } p { border-left: 1px dotted #9296A2; margin-left: 10px; padding-left: 10px; text-align: justify } #explanation h3 { background: #373B46 url(h3_explanation.gif) no-repeat; height: 60px; width: 330px } #participation h3 { background: #373B46 url(h3_participation.gif) no-repeat; height: 60px; width: 330px } #benefits h3 { background: #373B46 url(h3_benefits.gif) no-repeat; height: 60px; width: 330px } #requirements h3 { background: #373B46 url(h3_requirements.gif) no-repeat; height: 60px; width: 330px } #linkList { left: 12px; position: absolute; top: 400px; width: 256px } #linkList h3 { height: 30px; width: 200px } #linkList h3.select { background: #373B46 url(h3.select.gif) no-repeat } #linkList h3.favorites { background: #373B46 url(h3.favorites.gif) no-repeat } #linkList h3.archives { background: #373B46 url(h3.archives.gif) no-repeat } #linkList h3.resources { background: #373B46 url(h3.resources.gif) no-repeat } #footer { bottom: 400px; position: absolute; right: 36px; text-align: right } #extraDiv1 { background: #9296A2 url(thingy.gif) no-repeat; bottom: 0px; float: right; height: 36px; position: fixed; right: 0px; width: 36px }/* css Zen Garden submission 074 - 'Egyptian Dawn' by James Abbott - http://www.ja-consultancy.co.uk/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, James Abbott */ /* Added: January 18th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font-size: 8pt; font-family: verdana, sans-serif; font-style: italic; color: #6B441A; background: #BB8855 url(border.jpg) no-repeat top left; margin: 0px; } p { margin-top: 0px; } a:link { text-decoration: none; color: #995522; font-weight: bold; } a:visited { text-decoration: none; color: #995522; font-weight: bold; } a:hover, a:active { text-decoration: underline; color: #995522; font-weight: bold; } /* specific divs */ #container { position: absolute; top: 40px; left: 40px; height: 1900px; width: 1000px; border: 0px solid #000000; padding: 0px 0px 10px 0px; margin: 0px; background: url(container_bg.jpg) no-repeat top left; } #intro { position: relative; top: 130px; min-width: 400px; border: 0px solid #000000; width: 750px; padding: 0px 0px 0px 0px; margin: 0px; } #intro h3 { font-size: 10pt; font-family: verdana, sans-serif; color: #FFFB88; padding: 0px; margin: 10px 0px 10px 0px; border: 0px solid #000000; display: none; } #pageHeader { position: relative; left: 100px; top: 25px; padding: 0px; border: 0px solid #000000; margin: 0px; } #pageHeader h1 { margin: 0px; padding: 0px; } #pageHeader h1 span { display:none } #pageHeader h2 { width: 340px; height: 40px; padding: 0px; border: 0px solid #000000; margin: 0px; } #pageHeader h2 span { display:none; } #quickSummary { position: relative; top: 0px; left: 105px; width: 300px; border: 0px solid #000000; padding: 5px 5px 5px 5px; font-size: 8pt; font-family: verdana, sans-serif; font-weight: bold; font-style: italic; color: #8D663C; margin: 0px; } #preamble { background: url(preamble.gif) no-repeat top left; padding: 25px 5px 15px 5px; position: relative; top: 20px; left: 105px; width: 370px; margin: 0px 0px 0px 0px; border: 0px solid #000000; } #supportingText { position: relative; min-width: 350px; top: 160px; border: 0px solid #000000; margin: 0px; padding: 0px; } #supportingText h3 { font-size: 10pt; font-family: verdana, sans-serif; color: #FFFB88; padding: 0px; margin: 10px 0px 10px 0px; display: none; } #footer { position: relative; top: 20px; left: 100px; width: 370px; border: 0px solid #000000; margin: 0px; padding: 5px; text-align: center; } #explanation { background: url(explanation.gif) no-repeat top left; padding: 25px 5px 15px 5px; margin: 0px 0px 0px 0px; position: relative; top: 0px; left: 105px; width: 370px; border: 0px solid #000000; } #participation { background: url(participation.gif) no-repeat top left; padding: 25px 5px 15px 5px; position: relative; top: 10px; left: 105px; width: 370px; margin: 0px 0px 0px 0px; border: 0px solid #000000; } #benefits { background: url(benefits.gif) no-repeat top left; padding: 25px 5px 15px 5px; position: relative; top: 20px; left: 105px; width: 370px; margin: 0px 0px 0px 0px; border: 0px solid #000000; } #requirements { background: url(requirements.gif) no-repeat top left; padding: 25px 5px 15px 5px; position: relative; top: 30px; left: 105px; width: 370px; margin: 0px 0px 0px 0px; border: 0px solid #000000; } #footer a:link, #footer a:visited { margin-right: 20px; color: #6B441A; } #linkList { position: absolute; top: 420px; left: 515px; border: 0px solid #000000; width: 180px; margin: 0px; padding: 0px; background: url(listheader.gif) no-repeat top center; } #linkList2 { position: relative; font-size: 7pt; font-family: verdana, sans-serif; padding: 100px 20px 20px 20px; margin: 0px 0px 0px 0px; text-align: center; width: 140px; height: 750px; border: 0px solid #AA7744; } #lselect { border: 0px solid #000000; padding: 5px 5px 5px 5px; margin: 5px; } #lselect h3 { font-size: 9pt; font-family: verdana, sans-serif; color: #6B441A; font-weight: bold; margin: 0px; padding: 0px; } #lfavorites{ border: 0px solid #000000; padding: 5px 5px 5px 5px; margin: 5px; } #lfavorites h3 { font-size: 9pt; font-family: verdana, sans-serif; color: #6B441A; font-weight: bold; margin: 0px; padding: 0px; } #larchives { border: 0px solid #000000; padding: 5px 5px 5px 5px; margin: 5px; } #larchives h3 { font-size: 9pt; font-family: verdana, sans-serif; color: #6B441A; font-weight: bold; margin: 0px; padding: 0px; } #lresources { border: 0px solid #000000; padding: 5px 5px 5px 5px; margin: 5px; } #lresources h3 { font-size: 9pt; font-family: verdana, sans-serif; color: #6B441A; font-weight: bold; padding: 0px; margin: 0px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { font-size: 9pt; font-family: verdana, sans-serif; color: #995522; font-weight: bold; } #linkList li a:visited { font-size: 8pt; font-family: verdana, sans-serif; color: #995522; font-weight: bold; } /* css Zen Garden submission 075 - 'Lost HighWay' by Julien Roumagnac - http://www.j-roumagnac.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2003, Julien Roumagnac */ /* Added: January 18th, 2003 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements ----------------------------------------------------------------------------------------*/ body { background: #1D1D1D url(main_bg_pattern.gif) repeat center; margin: 0; padding: 0; text-align:center; } a:link { text-decoration: none; color: #C6C6C6; } a:visited { text-decoration: none; color: #C6C6C6; } a:hover, a:active { text-decoration: none; color: #FFFFFF; } acronym { border-bottom: 0px dotted; /* Override for netscape that still want to display a dotted underline */ cursor:help; font-weight: bold; } /* Content ----------------------------------------------------------------------------------------*/ /* Main Container */ #container { position: absolute; width: 638px; top: 18px; left: 50%; text-align: left; margin-left: -319px; background: url(container_bg.gif) repeat-y -4px; z-index: 0; } /* Main Container Cap */ #extraDiv2 { position: absolute; width: 638px; height: 18px; top: 0px; left: 50%; margin-left: -319px; background: url(container_top.gif) no-repeat -4px; z-index: 0; } /* Main CSS ZEN GARDEN Title */ #extraDiv1 { position: absolute; width: 50%; height: 301px; bottom: 15px; left: 0px; background: url(main_title.gif) no-repeat right bottom; margin-left: -317px; z-index: 1; } /* Hide titles : css Zen Garden, The Beauty of CSS Design, The Road to Enlightenment */ h1 span, h2 span, h3 span { display: none; } /* Photo Container */ #intro { position: absolute; width: 600px; height: 533px; top: 0px; left: 50%; margin-left: -304px; background: url(main_bg_photo.jpg) no-repeat; } /* A Demonstration ... Summary */ #quickSummary { font-size: 9px; font-family: Verdana; color: #E12525; width: 250px; margin-left: 14px; margin-top: 12px; } /* The Road Enlightenment Title */ #preamble { font-size: 12px; font-family: Verdana; color: #AFAFAF; width: 588px; height: 100px; font-style: italic; text-align: right; background: url(title_preamble.gif) no-repeat top right; padding-top: 35px; margin-top: 245px; } /* the 3 Paragraphs margin */ #preamble p.p1, #preamble p.p2, #preamble p.p3 { position: absolute; right: 10px; } /* "Stairs texte effect */ #preamble p.p1 { width: 370px; } #preamble p.p2 { width: 470px; margin-top: 60px; } #preamble p.p3 { width: 520px; margin-top: 120px; } /* Main 4 sections beginning */ #supportingText p { text-indent: 24px; } /* Links color */ #supportingText a:link, #supportingText a:visited { color: #FF2A2A; } #supportingText a:hover, #supportingText a:active { color: #FF5A5A; } /* Fonts settings */ #explanation , #participation, #benefits, #requirements { margin-left: 15px; width: 600px; font-size: 11px; font-family: Verdana; color: #AFAFAF; font-style: italic; } /* Interval for gif tiltes */ #explanation h3, #participation h3, #benefits h3, #requirements h3 { height: 22px; } /* Paragraphs Settings*/ #explanation p, #participation p, #benefits p, #requirements p { margin-left: 12px; width: 580px; margin-bottom: 12px; } /* Blocks and Titles positioning */ #explanation { margin-top: 533px; background: url(title_explanation.gif) no-repeat; } #participation { background: url(title_participation.gif) no-repeat; } #benefits { background: url(title_benefits.gif) no-repeat; } #requirements { background: url(title_requirements.gif) no-repeat; } #footer { margin-left: 15px; width: 600px; height: 15px; font-size: 9px; font-family: Verdana; text-align: center; word-spacing: 20px; background: #320000; padding-top: 2px; border-bottom: 1px solid #A12727; border-top: 1px solid #730000; } /* LISTS ----------------------------------------------------------------------------------------*/ /* List Select a Design **************************************************/ /* Main positioning and Gif Title */ #lselect { position: absolute; top: 16px; right: 23px; background: url(list_title_design.gif) no-repeat top right; z-index: 2; } /* Hide non Gif Title */ #lselect h3 {display:none} /* Background */ #lselect ul { width: 187px; height: 261px; background: url(list_bg_design.gif) no-repeat top right; margin: 19px 0px; padding-top: 5px; } /* Put a Fake Transparent dot to have the same line height in IE and NS */ /* Use a Background Dot to improve positioning possibility */ #lselect li { font-family: Verdana; font-size: 9px; color: #E12525; padding: 0px 0px 8px 33px; list-style: none url(list_fake_dot.gif); background: url(list_dot.gif) no-repeat 10px; } /* Force carriage return before 'by' */ #lselect li a:link, #lselect li a:visited {display: block;} #linkList li a.c:link, #linkList li a.c:visited {display: inline;} /* List Archives **************************************************/ /* Main positioning and Gif Title */ #larchives { position: absolute; top: 130px; left: 15px; background: url(list_title_archives.gif) no-repeat top left; z-index: 2; } /* Hide non Gif Title */ #larchives h3 {display:none} /* Background */ #larchives ul { width: 169px; height: 79px; background: url(list_bg_archives.gif) no-repeat top left; margin: 19px 0px 0px 0px; padding-top: 5px; padding-left: 0px; } /* Put a Fake Transparent dot to have the same line height in IE and NS */ #larchives li { font-family: Verdana; font-size: 9px; color: #E12525; padding: 0px 0px 6px 10px; list-style: none url(list_fake_dot.gif); } /* List Resources **************************************************/ /* Main positioning and Gif Title */ #lresources { position: absolute; top: 212px; left: 15px; background: url(list_title_resources.gif) no-repeat bottom left; z-index: 2; } /* Hide non Gif Title */ #lresources h3 {display:none} /* Background */ #lresources ul { width: 169px; height: 109px; background: url(list_bg_resources.gif) no-repeat top left; margin: 0px 0px 0px 0px; padding-top: 5px; padding-left: 0px; } /* Put a Fake Transparent dot to have the same line height in IE and NS */ #lresources li { font-family: Verdana; font-size: 9px; color: #E12525; padding: 0px 0px 6px 10px; list-style: none url(list_fake_dot.gif); }/* css Zen Garden submission 076 - 'Lotus' by Chika */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Chika */ /* Added: February 3rd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { margin: 0px; padding: 0px; background-color: #ffffff; font-size: 12px; line-height: 133%; color: #333333; font-family: arial, helvetica, sans-serif; text-align: center; } a { color: #996699; text-decoration: none; } a:hover, a:active { text-decoration: underline; } /* frame */ #container { background: transparent url(body_bg.gif) repeat-y top left; margin: 0px auto; padding: 0px; width: 752px; text-align: left; } /* header */ #pageHeader { margin: 0px 12px; padding: 107px 0px 0px 0px; } #pageHeader h1 { position: relative; background: transparent url(title.gif) no-repeat top left; margin: 0px; padding: 0px; width: 728px; height: 37px; z-index: 2; } #pageHeader h1 span { display: none; } #pageHeader h2 { position: absolute; background: transparent url(catch.gif) no-repeat top left; margin: 5px 0px 0px 9px; padding: 0px; width: 162px; height: 17px; z-index: 2; } #pageHeader h2 span { display: none; } #quickSummary { position: relative; margin: 6px 0px 0px 428px; width: 300px; height: 97px; z-index: 2; } #quickSummary p { margin: 0px; padding: 0px; font-size: 11px; line-height: 125%; } /* contents */ #preamble { position: relative; margin: 0px 0px 25px 262px; padding: 0px; width: 466px; z-index: 1; } #supportingText { background: transparent url(footer_bg.gif) no-repeat bottom left; margin: 0px 12px; padding: 0px; } #explanation, #participation, #benefits, #requirements { position: relative; margin: 0px 0px 0px 250px; padding: 0px 0px 20px 0px; width: 466px; z-index: 1; } #participation, #requirements { padding: 0px 0px 10px 0px; } #benefits { padding: 10px 0px 30px 0px; } #explanation { background: transparent url(contents_txt_bg_02.gif) no-repeat center center; } #participation { background: transparent url(contents_txt_bg_03.gif) no-repeat center center; } #benefits { background: transparent url(contents_txt_bg_04.gif) no-repeat center center; } #requirements { background: transparent url(contents_txt_bg_05.gif) no-repeat center center; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 0px; padding: 0px; } #preamble h3 { background: transparent url(head_preamble.gif) no-repeat top left; width: 202px; height: 35px; } #explanation h3 { background: transparent url(head_explanation.gif) no-repeat top left; width: 173px; height: 35px; } #participation h3 { background: transparent url(head_participation.gif) no-repeat top left; width: 95px; height: 35px; } #benefits h3 { background: transparent url(head_benefits.gif) no-repeat top left; width: 65px; height: 35px; } #requirements h3 { position: relative; background: transparent url(head_requirements.gif) no-repeat top left; width: 106px; height: 35px; bottom:10px; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display: none; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin: 0px; padding: 4px 0px; } #requirements p { position: relative; bottom:10px; } #footer { margin: 0px 0px 0px 250px; padding: 0px 0px 26px 0px; width: 466px; text-align: right; } #footer a { color: #666666; text-decoration: underline; } /* link */ #linkList { background: transparent url(link_bg.gif) no-repeat top left; position: absolute; margin: 0px 0px 0px 20px; top: 247px; width: 242px; z-index: 1; } #linkList2 { padding: 0px 0px 8px 0px; background: transparent url(link_footer_bg.gif) no-repeat bottom left; } #linkList ul { margin: 0px 6px; padding: 0px; list-style-type: none; } #linkList li { margin: 0px; padding: 1px 0px; } #lselect , #larchives , #lresources { margin: 9px 0px 0px 7px; padding: 0px 0px 12px 0px; width: 219px; } #lselect , #larchives { background: transparent url(link_line.gif) no-repeat bottom left; } #lselect h3, #larchives h3, #lresources h3 { margin: 0px 0px 1px 0px; padding: 0px; } #lselect h3 { background: transparent url(head_select.gif) no-repeat top left; width: 219px; height: 21px; } #larchives h3 { background: transparent url(head_archives.gif) no-repeat top left; width: 219px; height: 21px; } #lresources h3 { background: transparent url(head_resources.gif) no-repeat top left; width: 219px; height: 21px; } #lselect h3 span, #larchives h3 span, #lresources h3 span { display: none; } #lselect a { font-size: 11px; font-weight: bold; color: #336666; } #lselect a.c { font-weight: normal; color: #996699; } #larchives a , #lresources a { color: #333333; } /* images */ #extraDiv1 { position: absolute; top: 20px; left: 0px; text-align: center; width: 100%; z-index: 0; } #extraDiv1 span { background: transparent url(header_bg.jpg) no-repeat top left; margin: 0px auto; padding: 0px; width: 728px; height: 207px; display: block; } #extraDiv2 { position: absolute; top: 227px; left: 0px; text-align: center; width: 100%; z-index: 0; } #extraDiv2 span { background: transparent url(contents_bg.gif) no-repeat top left; margin: 0px auto; padding: 0px; width: 728px; height: 273px; display: block; } #sampleextraDiv3, #sampleextraDiv4, #sampleextraDiv5, #sampleextraDiv6 { display: none; }/* css Zen Garden submission 077 - 'Hop' by Guillaume L. */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Guillaume L. */ /* Added: February 3rd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ a:link { text-decoration: none; color: #8B008B; } a:visited { text-decoration: none; color: #2F4F4F; } a:hover, a:active { text-decoration: underline; color: #FF1493; } acronym { border-bottom: 0px dotted; cursor:help; font-weight: bold; } body { background: #F2C9FF url(fond.jpg) repeat-x; margin: 0 0 0 0; padding: 0 0 0; } h3 { font-family: Arial, sans-serif; font-size: 18px;color: #6E66A2; font-style: italic; } h1 span, h2 span{ display: none; } #container { position: absolute; width: 779px; top: 0px; left: 50%; text-align: left; margin-left: -380px; background-image: url(back.jpg); background-repeat: no-repeat; height: 808px; } #pageHeader { display: none; } #quickSummary { position: absolute; top: 12px; width: 500px; margin-left: 245px; margin-right: 0px; line-height: 10px;margin-bottom: 0px; padding-bottom: 0px; margin-top: 0px; padding-top: 0px; } #quickSummary p { margin-bottom: 0px; padding-bottom: 0px; margin-top: 0px; padding-top: 0px; text-align: right; color: #585959; font-size: 12px; line-height: 12px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; } #preamble { position: absolute; top: 235px; left: 40%; overflow: auto; height: 230px; width: 435px; margin-top: 0px; padding-top: 0px; text-align: justify; } #preamble h3 { margin-top: 18px; } #preamble p.p1 { line-height: 12px; font-size: 12px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #2F4F4F; font-style: italic; margin-bottom: 10px; padding-bottom: 0px; } #preamble p.p2 { font-size: 12px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #2F4F4F; font-style: italic; line-height: 12px; margin-bottom: 10px; margin-top: 0px; } #preamble p.p3 { font-size: 12px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; color: #2F4F4F; font-style: italic; text-align: center; line-height: 12px;margin-top: 0px; } #supportingText { position: absolute; top: 460px; left: 40%; overflow: auto; height: 270px; width: 450px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 0px; padding-bottom: 0px; margin-top: 0px; padding-top: 0px; padding-left: 0px; padding-right: 0px; margin-left: 0px; margin-right: 0px; border: 1px dashed #ECBFF6; } #explanation , #participation, #benefits, #requirements { width: 425px; font: medium; color: #666666; margin-top: 0px; margin-left: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px; margin-right: 0px; } #explanation p, #participation p, #benefits p, #requirements p { margin-left: 15px; margin-right: 15px; margin-top: 15px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; line-height: 16px; padding: 10px 10px 10px 10px; text-align: justify; } #requirements p { font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; } #benefits p{ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; } #explanation {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; text-align: left; } #participation {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; padding-top: 30px; text-align: right; padding-bottom: 0px; margin-top: 0px; margin-bottom: 0px; } #benefits {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; padding-top: 30px; text-align: left; } #requirements {font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; padding-top: 30px; margin-bottom: 40px; text-align: right; } #lselect { position: absolute; top: 360px; left: 60px; } #lselect h3 { font-family: sans-serif; font-size: small; color: #2F4F4F; margin: 0; padding-left: 0px; } #lselect ul { width: 200px; display: block; margin-left: 0px; list-style: none;margin-top: 0px; margin-bottom: 0px;padding-left: 0px; } #lselect li { font-family: Verdana; font-size: 10px; color: Black; text-align: left; line-height: 12px; margin: 0 20px 3px 5px; padding-left: 0px; } #lselect li a:link, #lselect li a:visited , #linkList li a.c:link, #linkList li a.c:visited {display: inline;} #larchives { position: absolute; top: 560px; left: 60px; } #larchives h3 { font-family: sans-serif; font-size: small; color: #2F4F4F; text-align: justify; margin: 0; padding-left: 0px; } #larchives ul { width: 220px; display: block; margin-left: 0px; list-style: none; margin-top: 0px; margin-bottom: 0px; padding-left: 0px; } #larchives li { font-family: Verdana; font-size: 10px; color: black; text-align: justify; line-height: 12px; margin: 0 20px 3px 5px; padding-left: 0px; } #lresources { position: absolute; top: 620px; left: 60px; } #lresources h3 { font-family: sans-serif; font-size: small; color: #2F4F4F; text-align: left; margin: 0; padding-left: 0px; } #lresources ul { width: 220px; display: block; margin-left: 0px; list-style: none;margin-top: 0px; margin-bottom: 0px;padding-left: 0px; } #lresources li { font-family: Verdana; font-size: 10px; color: Black; text-align: left; line-height: 12px; margin: 0 20px 3px 5px; padding-left: 0px; } #footer { width: 240px; text-align: center; font-family: Verdana; font-size: small; font-weight: bolder; margin-left: 100px; padding-bottom: 0px; margin-bottom: 0px; margin-top: 0px; background: url(bas-menu.jpg); z-index: 10; padding-top: 210px; } #extraDiv1 { display: none; }/* css Zen Garden submission 078 - 'Muto Verde' by Alex Taylor , http://www.alextaylor.org */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics and photos copyright 2004, Alex Taylor */ /* Added: February 15th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* HTML */ body { margin: 0 auto; padding: 0; font: 12px Arial,Sans-Serif; text-align: center; background: url(bg.jpg); voice-family: "\"}\""; voice-family:inherit; } h1, h2, h3 { margin: 0; } ul { margin: 0px; } li { /*list-style: square outside url(semicolon_bullet.jpg);*/ margin: 3px 0px 6px -20px; } p { line-height: 1.3; } a:link { color: #003300; } a:active{ color: #003300; } a:visited { color: #003300; } a:hover { color: #336633; } /* CLASSES */ /* IDs */ #container { position: relative; width: 760px; margin: 0 auto; text-align: left; } #intro { margin: 0; } #pageHeader { font: normal 12px Georgia,Serif; height: 135px; margin: 0; background: transparent url(csszen_header.jpg) no-repeat top right; } #pageHeader h1, h2 { margin: 0; display: none; } #quickSummary { font: italic 12px Georgia,Serif; padding: 3px; margin: 0; background: url(introbg.jpg) repeat-y 99px; } #quickSummary p.p1 { position: relative; left: 210px; width: 530px; margin: 0; } #quickSummary p.p2 { position: relative; left: 210px; width: 345px; padding: 4px 0px 0px 0px; margin: 0; } #supportingText { position: relative; width: 410px; height: auto; /*background: url(introbg.jpg) repeat-y 99px;*/ } #supportingText h3 { width: 758px; height: 25px; background: transparent url(header_explanation.png) no-repeat; } #supportingText h3 span { display: none; } #supportingText p { padding: 3px; position: relative; left: 210px; width: 345px; margin: 0; } #preamble { position: relative; width: 410px; height: auto; background: url(roadbg.jpg) repeat-y 227px; /* background-repeat: repeat-y;*/ text-align: justify; } #preamble h3 { width: 750px; height: 25px; background: transparent url(header_enlightenment.gif) no-repeat; } #preamble h3 span { display: none; } #preamble p { padding: 3px; position: relative; left: 335px; width: 410px; margin: 0; } #explanation { position: relative; width: 410px; height: auto; background: url(explanationbg.jpg) repeat-y 227px; background-repeat: repeat-y; text-align: justify; } #explanation h3 { width: 758px; height: 25px; background: transparent url(header_sowhatisthisabout.gif) no-repeat; } #explanation h3 span { display: none; } #explanation p { padding: 3px; position: relative; left: 335px; width: 410px; margin: 0; } #participation { position: relative; width: 410px; height: auto; background: url(dockbg.jpg) repeat-y 227px; background-repeat: repeat-y; text-align: justify; } #participation h3 { width: 758px; height: 25px; background: transparent url(header_participation.gif) no-repeat; } #participation h3 span { display: none; } #participation p { padding: 3px; position: relative; left: 335px; width: 410px; margin: 0; } #benefits { position: relative; width: 410px; height: auto; background: url(benefitsbg.jpg) repeat-y 227px; background-repeat: repeat-y; text-align: justify; } #benefits h3 { width: 758px; height: 25px; background: transparent url(header_benefits.gif) no-repeat; } #benefits h3 span { display: none; } #benefits p { padding: 3px; position: relative; left: 335px; width: 410px; margin: 0; } #requirements { position: relative; width: 410px; height: auto; background: url(lockbg.jpg) repeat-y 227px; background-repeat: repeat-y; text-align: justify; } #requirements h3 { width: 758px; height: 25px; background: transparent url(header_requirements.gif) no-repeat; } #requirements h3 span { display: none; } #requirements p { padding: 3px; position: relative; left: 335px; width: 410px; margin: 0; } #linkList { text-align: right; position: absolute; top: 196px; left: -10px; width: 220px; } #lselect h3 { margin: 8px 20px; width: 198px; height: 25px; background: transparent url(selectdesign.jpg) no-repeat; } #lselect h3 span { display: none; } #lselect li { font-size: 10px; padding: 0px 0px 5px 20px; list-style: none; /*background: url(semicolon_bullet.jpg) no-repeat 0px 50%;*/ background-repeat: no-repeat; } #lselect a { font-size: 12px; } #lselect a.c, #lselect a:link.c , #lselect a:visited.c{ font-size: 10px; font-weight: normal; } #larchives h3 { margin: 8px 20px; width: 198px; height: 25px; background: transparent url(archives.jpg) no-repeat; } #larchives h3 span { display: none; } #larchives li { padding: 0px 0px 2px 20px; list-style: none; /*background: url(arrow_bullet.jpg) no-repeat 2px 0%;*/ } #lresources h3 { margin: 8px 20px; width: 198px; height: 25px; background: transparent url(resources.jpg) no-repeat; } #lresources h3 span { display: none; } #lresources li { padding: 0px 0px 2px 20px; list-style: none; /*background: url(arrow_bullet.jpg) no-repeat 2px 0%;*/ } /*Thanks to Douglas Bowman of stopdesign.com for this little trick with the links*/ #linkList #lselect a:link, #linkList #lselect a:visited {display:block;} #linkList #lselect a.c:link, #linkList #lselect a.c:visited { display:inline;} #footer { position: relative; width: 758px; height: 50px; padding: 4px 40px 0px 0px; text-align: right; background: transparent url(header_footer.gif) no-repeat; } #footer a { font-weight: bold; }/* css Zen Garden submission 079 - 'Green Tea' by Amy Rae Som, http://www.avisualmind.com */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics and photos copyright 2004, Amy Rae Som */ /* Added: February 15th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ body {background:#a2c4a3 url(flower_bg.jpg) repeat-x;font-family:"Trebuchet MS", Arial, Geneva, sans-serif;font-size:70%;color:#030;} #pageHeader {position:absolute;left:20px;top:39px;width:222px;height:63px;background:url(cssZenGarden.gif) no-repeat;} #pageHeader span {margin-left:-1000px;} #quickSummary .p1 {position:absolute;left:0;top:114px;width:750px;height:16px;background:url(an_example.gif) no-repeat;} #quickSummary .p1 span {margin-left:-1000em;} #quickSummary .p2 {position:absolute;left:116px;top:528px;width:88px;height:42px;font-weight:bold;} #preamble {position:absolute;left:20px;top:145px;width:222px;height:298px;overflow:auto;} h3 {background:transparent;font:italic normal 1.4em "Times New Roman",Times,serif;margin:0;border-bottom:1px solid #a2c4a3;color:#603;} p {margin:0 0 6px 0; line-height:1.5em;} div {margin:0;} a {background:transparent;color:#060;} #supportingText {position:absolute;left:268px;top:145px;width:63%;height:297px;padding-right:4px;overflow:auto;} #linkList {position:absolute;left:268px;top:459px;width:63%;} #linkList a {color:#030;} #linkList a.c {text-decoration:none;} #linkList a.c:hover {text-decoration:underline;} #linkList h3 {background:transparent;font-size:1.3em;margin:0.6em 0 0;border-bottom:1px solid #82B084;} #linkList ul {margin:0;padding:0.2em 0;} #linkList li {list-style-type:none;display:inline;background:url(greenarrow.gif) 0% 50% no-repeat;margin:0;padding:0 0 0 1.3em;}/* css Zen Garden submission 080 - 'Zen Pool', by Clinton Barth http://www.516media.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Clinton Barth */ /* Added: February 15th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* common styles ----------------------------------------------- */ body { background: #474747; font-family: "Lucida Grande", "Lucida Sans Unicode", verdana, lucida, helvetica, sans-serif; margin: 0px; padding: 0px; color: #000; } /* layout ----------------------------------------------- */ #container { position: relative; background: #9cf; margin: 20px auto; padding: 0px; width: 700px; border: 5px solid #fff; } #quickSummary { position: absolute; top: 205px; left: 0px; width: 166px; border-bottom: 1px solid #fff; border-right: 1px solid #fff; } #preamble, #explanation, #participation, #benefits, #requirements { margin: 0px 0 0 192px; width: 480px; background: transparent; } #footer { margin: 25px 0 0 0; background: transparent url(footer.jpg) top left no-repeat; height: 1.5em; text-align: right; border-top: 1px solid #fff; } #linkList { position: absolute; width: 166px; top: 26em; left: 0px; border-top: 1px solid #fff; } /* header ----------------------------------------------- */ #pageHeader { background: url(header.jpg) top left no-repeat; height: 200px; margin: 0; border-bottom: 5px solid #fff; } #pageHeader h1 { display: none; } #pageHeader h2 { display: none; } /* text ----------------------------------------------- */ p { font-size: 12px; padding: 5px 5px 10px 5px; margin: 0; line-height: 16px; } #quickSummary p.p1 { margin: 0; padding: 40px 35px 25px 28px; font-size: 11px; } #quickSummary p.p2 { margin-top: 48em; padding: 30px 30px 20px 28px; font-size: 11px; } /* headings ----------------------------------------------- */ #quickSummary { background: transparent url(h3_quickSummary.gif) top left no-repeat; margin: 0px; } #intro h3 { margin: 10px 0 0 0; padding: 0; width: 480px; height: 35px; border: 1px solid #fff; } #supportingText h3 { margin: 10px 0 0 0; padding: 0; width: 480px; height: 25px; border: 1px solid #fff; } #linkList h3 { height: 25px; margin: 0px 0 0 0; padding: 0px; } h3 span { display: none; } #preamble h3 { background: transparent url(h3_preamble.jpg) no-repeat top left; } #explanation h3 { background: transparent url(h3_explanation.jpg) no-repeat top left; } #participation h3 { background: transparent url(h3_participation.jpg) no-repeat top left; } #benefits h3 { background: transparent url(h3_benefits.jpg) no-repeat top left; } #requirements h3 { background: transparent url(h3_requirements.jpg) no-repeat top left; } #lselect h3 { background: transparent url(h3_lselect.gif) no-repeat top left; margin: 15px 0 0 5px; } #lfavorites h3 { background: transparent url(h3_lfavorites.gif) no-repeat top left; margin: 15px 0 0 5px; } #larchives h3 { background: transparent url(h3_larchives.gif) no-repeat top left; margin: 15px 0 0 5px; } #lresources h3 { background: transparent url(h3_lresources.gif) no-repeat top left; margin: 15px 0 0 5px; } /* lists ----------------------------------------------- */ #linkList ul { font-size: 10px; list-style: none; margin: 2px 0 0 0px; padding: 0 0 0 0; } #linkList ul li { background: transparent; margin: 0; padding: 0 0 0 27px; line-height: 14px; color: #369; } #linkList #lselect { border-bottom: 1px solid #fff; padding-bottom: 25px; } #linkList #lfavorites { border-bottom: 1px solid #fff; padding-bottom: 25px; } #linkList #larchives { border-bottom: 1px solid #fff; padding-bottom: 25px; } #linkList #lresources { border-bottom: 1px solid #fff; padding-bottom: 25px; } #linkList #lselect a:link, #linkList #lselect a:visited { display: block; } #linkList #lselect a.c:link, #linkList #lselect a.c:visited { display:inline; } /* links ----------------------------------------------- */ a, a:link, a:visited { color: #369; text-decoration: underline; font-weight: normal; } a:hover { color: #fff; text-decoration: none; font-weight: normal; } #quickSummary a, #quickSummary a:link, #quickSummary a:visited { font-weight: bold; text-decoration: underline; color: #369; } #quickSummary a:hover { font-weight: bold; text-decoration: none; color: #fff; } #linkList a, #linkList a:link, #linkList a:visited { color: #000; text-decoration: none; } #linkList a:hover { text-decoration: none; color: #fff; } #linkList a.c, #linkList a.c:link, #linkList a.c:visited { color: #369; text-decoration: none; } #linkList a.c:hover { text-decoration: none; color: #fff; } #footer a, #footer a:link, #footer a:visited { text-decoration: none; color: #fff; font-size: 12px; padding: 0 20px 0 0; } #footer a:hover { text-decoration: none; color: #9cf; } /* css Zen Garden submission 081 - 'seashore', by Christine Kirchmeier, http://www.sightdesign.de/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Christine Kirchmeier */ /* Added: February 15th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Tag Definitions */ body { margin: 0; padding: 0; border: 0; text-align: left; background: #FFFFFF url(bg.gif); background-attachment:fixed; font: 11px Verdana, Arial,sans-serif; color: #233A54; } h3 { margin: 0; padding: 0; } acronym { border-bottom: 1px dotted #4C83AE; } a acronym { border: 0; } a:link { font-weight: 900; color: #4C83AE; text-decoration: none; } a:visited { font-weight: 900; color: #999999; text-decoration: none; } a:hover,a:active { font-weight: 900; color: #9B3F17; } /* ID Definitions */ #container { position: relative; top: 0; margin: 0 auto; padding: 0; text-align: left; border-left: 4px solid #FFFFFF; border-right: 4px solid #FFFFFF; border-bottom: 4px solid #000000; background-color: #EBEBEB; width: 750px; } /************** INTRO *************************/ #intro { background:#EBB692 url(summarybg.gif) repeat-x; width:749px; } #pageHeader { position: absolute; margin: 0; padding: 0px; top: 0px; left: 0px; display: block; width: 366px; height: 474px; background: transparent url(csszengarden.jpg) no-repeat; border-right: 1px dashed #000000; } #pageHeader h1,h2{ display:none; } #quickSummary { position: relative; top: 8px; left:378px; width: 364px; height:140px; margin: 0; padding: 30px; overflow: auto; background: transparent url(quicksumbg.gif) no-repeat; } #quickSummary p.p1 { position: relative; padding: 0px; margin: 0px; width: 300px; text-align: left; font: 11px Verdana, Arial, serif; color: #FFFFFF; line-height: 1.2; } #quickSummary p.p1:first-letter { font: bold 18px Verdana, Arial, sans-serif; color: #2F3F56; } #quickSummary p.p2 { position: relative; padding: 0; margin: 10px 0 0 0; width: 300px; text-align: left; font: 11px Verdana,Arial, sans-serif; color: #FFFFFF; } #quickSummary p.p2:first-letter { font: bold 18px Verdana, Arial, sans-serif; color: #2F3F56; } #preamble { position: absolute; top: 152px; left: 367px; width: 382px; height:300px; padding: 0 0 0 0; margin: 0 0 0 0; display: block; overflow: auto; background: transparent url(divbg.gif) repeat-x; color: #233A54; } #preamble h3 { background: transparent url(roadtoenlightenment.gif) no-repeat; width: 340px; height: 29px; padding:0px; margin: 20px 0px 0px 15px; display: block; } #preamble h3 span { display:none; } #preamble p { position: relative; top: 0; left: 15px; width: 340px; font: 11px/7px Verdana, Arial, sans-serif; line-height: 1.2; color: #233A54; text-align: justify; margin:15px 0 0 0; } /************** MAIN ************/ #supportingText { position: relative; top: 258px; left: 366px; width: 383px; margin: 0; padding: 0; padding-bottom:260px; /* opera fix */ } #supportingText p { font: x-small Verdana, Arial, sans-serif; color: #333333; text-align: justify; } #explanation { position: relative; top: 0; left: 0; width: 382px; padding: 0 0 20px 0; margin: 0; display: block; overflow: auto; background: #EBEBEB url(divbg.gif) repeat-x; color: #233A54; border-left:1px dashed #000000; } #explanation p { position: relative; top: 0; left: 15px; width: 340px; font: 11px/7px Verdana, Arial, sans-serif; line-height: 1.2; color: #233A54; margin:15px 0 0 0; } #explanation h3 { background: transparent url(sowhat.gif) no-repeat; width: 340px; height: 29px; padding:0; margin: 20px 0px 0px 15px; display: block; } #explanation h3 span{ display: none; } #participation { position: relative; top: 0; left: 0; width: 382px; padding: 0 0 20px 0; margin: 0; display: block; overflow: auto; background: #EBEBEB url(divbg.gif) repeat-x; color: #233A54; border-left:1px dashed #000000; } #participation p { position: relative; top: 0; left: 15px; width: 340px; font: 11px/7px Verdana, Arial, sans-serif; line-height: 1.2; color: #233A54; margin:15px 0 0 0; } #participation h3 { background: transparent url(participation.gif) no-repeat; width: 340px; height: 29px; padding:0px; margin: 20px 0px 0px 15px; display: block; } #participation h3 span{ display: none; } #benefits { position: relative; top: 0; left: 0; width: 382px; padding: 0 0 20px 0; margin: 0; display: block; overflow: auto; background: #EBEBEB url(divbg.gif) repeat-x; color: #233A54; border-left:1px dashed #000000; } #benefits h3 { background: transparent url(benefits.gif) no-repeat; width: 340px; height: 29px; padding: 0; margin: 20px 0px 0px 15px; display: block; } #benefits h3 span { display: none; } #benefits p { position: relative; top: 0; left: 15px; width: 340px; font: 11px/7px Verdana, Arial, sans-serif; line-height: 1.2; color: #233A54; margin:15px 0 0 0; } #requirements { position: relative; top: 0; left: 0; width: 382px; padding: 0 0 0 0; height: 520px; margin:0; display: block; overflow: auto; background: #EBEBEB url(divbg.gif) repeat-x; color: #233A54; border-left:1px dashed #000000; } #requirements h3 { background: transparent url(requirements.gif) no-repeat; width: 340px; height: 29px; padding: 0; margin: 20px 0px 0px 15px; display:block; } #requirements h3 span { display: none; } #requirements p { position: relative; margin: 0; padding: 0; top: 0; left: 15px; width: 340px; font: 11px/7px Verdana, Arial, sans-serif; line-height: 1.2; color: #233A54; margin:15px 0 0 0; } #footer { position: absolute; left: -360px; top: 550px; text-align: left; width: 350px; border-top: 1px dashed #FFF; border-bottom: 1px dashed #FFF; padding: 2px; text-align: center; } #footer a { font: 9px Verdana, sans-serif; font-weight: 900; color: #72AAD1; } /***************** Links and Subsections ********************/ #linkList { position: absolute; top: 260px; left: 40px; width: 240px; height: 66%; } #linkList div { padding-bottom: 10px; } #linkList ul { margin: 0 0 0 50px; list-style-type: none; color: #FFFFFF; border: 1px solid #FFFFFF; padding: 3px; } #linkList ul li { background: transparent url(listbg1.jpg); border: 1px solid #FFFFFF; margin-bottom: 2px; margin-top: 2px; padding: 2px; width: 176px; } #linkList ul li:hover { background: transparent url(listbg2.jpg); border: 1px solid #FFFFFF; margin-bottom: 2px; margin-top: 2px; padding: 2px; width: 176px; } #linkList ul li a:link { font-weight: 900; color: #FFFFFF; } #linkList ul li a:visited { font-weight: 900; color: #FFFFFF; } #linkList ul li a:hover, #linkList ul li a:active { font-weight: 900; color: #9B3F17; } #linkList ul li a.c { display: block; margin-bottom: -1px; } #linkList ul li a.c:link { font-weight: 900; color: #4C83AE; } #linkList ul li a.c:visited { font-weight: 900; color: #4C83AE; } #linkList ul li a.c:hover, #linkList ul li a.c:active { font-weight: 900; color: #9B3F17; } #lselect h3 { background: transparent url(select.gif) no-repeat; width: 340px; height: 40px; padding:0; margin: 20px 0 0 40px; display: block; } #larchives h3 { background: transparent url(archives.gif) no-repeat; width: 340px; height: 40px; padding: 0; margin: 20px 0 0 40px; } #lfavorites h3 { background: transparent url(archives.gif) no-repeat; } #lresources h3 { background: transparent url(resources.gif) no-repeat; width: 340px; height: 40px; padding: 0; margin: 20px 0 0 40px; } #lresources h3 span, #larchives h3 span, #lselect h3 span { display: none; } #extraDiv1 { position: relative; width: 300px; height: 89px; margin: 0 auto; left: 0; top: 0; background: transparent url(sub.gif) no-repeat; text-align: center; }/* css Zen Garden submission 082 - 'Miracle Cure' by Joseph Pearson, http://www.make-believe.org */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* Some associated graphics and photos copyright 2004, Joseph Pearson */ /* Added: February 15th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /*======================================================================== CSS Stylesheet - Miracle Cure. A MIRACLE CURE? This Zen Garden is based on old, turn of the century swap cards for advertising health potions. Everything from hair restoratives to laudanum. I got the idea when I stumbled across a hobbyist's collection at: http://www.antiquebottles.com/rl/tc/ ========================================================================*/ /*===================== basic elements =====================*/ body { font: 10.5pt Palatino, Georgia, Times New Roman, serif; color:#554; line-height:1.2em; font-weight:500; text-align:left; margin:0; padding:0; background-color:white; } p { padding:0; margin:0; padding-bottom:0.4em; text-indent:1em; text-align:center; } h3 { margin:0; text-align:center; } a:link, a:visited, a:hover, a:active { font-style:italic; color:black; font-weight:300; text-decoration:none; } acronym{ text-decoration:none; border-bottom:none; font-weight:bold; cursor:help; } /*=================== body elements ===================*/ #container { position:absolute; width:790px; left:50%; margin-left:-395px; } #pageHeader { background:url(banner.jpg) no-repeat top center; width:278px; height:185px; } #pageHeader h1, #pageHeader h2 { display:none; } #quickSummary { background:url(bg_header.gif) repeat-y; height:20px; } #quickSummary p{ display:none; } #preamble { width:600px; background:url(bg_repeater.gif) repeat-y; padding:25px 45px 0px 35px; voice-family: "\"}\""; voice-family:inherit; width:520px; } #preamble h3 { display:none; } #preamble h3 span { visibility:hidden; } #preamble p.p1 { padding-left:30px; padding-right:30px; line-height:1.2em; font-style:italic; font-size:14pt; font-family: Monotype Corsiva, Palatino, Georgia, Times New Roman, serif; } #preamble p.p2 { background:url(preamble.gif) no-repeat top center; padding-top:150px; } #supportingText{ width:600px; background:url(bg_repeater.gif) repeat-y; } #supportingText h3 { text-align:center; padding:0; margin:0; background:no-repeat center; height:25px; } #supportingText h3 span { visibility:hidden; } #explanation { padding-left:35px; padding-right:45px; } #explanation h3 { background-image:url(explanation.gif); } #participation { padding-left:35px; padding-right:45px; } #participation h3 { background-image:url(participation.gif); } #benefits { padding-left:35px; padding-right:45px; } #benefits h3 { background-image:url(benefits.gif); } #requirements { padding-left:35px; padding-right:45px; } #requirements h3 { background-image:url(requirements.gif); } #footer { width:600px; background:url(bg_footer.gif) no-repeat bottom; padding-top:12px; padding-bottom:70px; text-align:center; } #footer a:link, #footer a:visited { font-weight:500; font-size:8pt; } /*========================= linkList elements =========================*/ #linkList { position:absolute; top:300px; left:597px; width:180px; background-image:url(linklist_repeater.gif); } #linkList h3 { padding:10px 0 3px; color:#333; font-weight:500; font-size:10pt; font-style:italic; } #linkList2 { font-size: 8pt; } #linkList ul { margin:0; padding:0; text-align:left; line-height:1em; } #linkList li { margin:0; font-style:italic; } #linkList li a:link { color:black; font-style:normal; } #linkList li a:visited { color:gray; font-style:normal; } #linkList li a:hover, #linkList li a:active { color:#B8860B; } #lselect h3 { padding-top:55px; background:url(linklist_top.gif) no-repeat top center; } #lselect li { padding:5px 8px 5px 10px; margin:0; list-style:none; text-align:left; line-height:1.2em; } #lselect a, #lselect a:link, #lselect a:visited { padding-left:16px; background:url(listimg.gif) no-repeat center left; } #lselect a:hover, #lselect a:active { background-image:url(listimg_hvr.gif); } #lselect a:link.c, #lselect a:visited.c, #lselect a:hover.c, #lselect a:active.c { padding:0; background-image:none; } #lresources{ padding-bottom:55px; background:url(linklist_base.gif) no-repeat bottom center; } #lresources li, #larchives li { text-align:center; margin-left:0; list-style:none; } /*======================= Extra elements =======================*/ #extraDiv1 { position:absolute; font-size:10pt; top:0; left:50%; background:url(deco3.jpg) no-repeat; width:400px; height:160px; } #extraDiv2 { position:absolute; top:62em; left:50%; margin-left:161px; background:url(deco2.gif) no-repeat; width:175px; height:236px; }/* css Zen Garden submission 083 - 'Springtime', by Bor Attila */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Bor Attila */ /* Added: March 4th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 8pt/16pt georgia; color: #555753; background: #F5F7EC url(bg.jpg); margin: 0px; text-align: center; background-repeat: repeat-x; } p { font: 8pt/14pt verdana; margin-top: 0px; text-align: left; } h3 { font: italic normal 12pt georgia; letter-spacing: 1px; margin-bottom: 10px; color: #7D775C; text-align: left; } a:link { font: 11px verdana; font-weight: bold; text-decoration: underline; color: #8F9E28; } a:visited { font-weight: bold; text-decoration: underline; color: #C0C0C0; } a:hover, a:active { text-decoration: underline; color: #B8C271; } /* specific divs */ #container { background: url(footbg.jpg) no-repeat bottom left; width:650px; padding-bottom:80px; position:relative; margin: 0 auto; } #intro { min-width: 470px; } #pageHeader { margin-bottom: 20px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: url(head.gif) no-repeat top left; width: 678px; height: 213px; margin-top:0px; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(flwr.gif) no-repeat top left; width: 84px; height: 261px; float: right; margin-top:0px; position:absolute; top:163px; left:647px; } #pageHeader h2 span { display:none; } #quickSummary { background: transparent url(green.gif) no-repeat top left; clear:both; overflow:auto; width: 147px; height:201px; padding-top:10px; padding-left:15px; padding-right:15px; position:absolute; top:213px; left:0px; } #quickSummary p { font: 8pt/12pt verdana; color:#EFF2E5; text-align:left; } #quickSummary a { font: bold 8pt/12pt verdana; color:#EFF2E5; text-align:left; text-decoration:underline; } #quickSummary a:hover { font: bold 8pt/12pt verdana; color:#EFF2E5; text-align:left; text-decoration:none; } #preamble { padding-right:40px; padding-top:20px; padding-left:30px; overflow:auto; background: transparent url(whitebg.gif) no-repeat 0 0 !important; position:absolute; top:72px; left:177px; height:333px; width:400px; } #preamble h3 { background: transparent url(pretext.gif) no-repeat top left; font: 0pt/14pt verdana; color:#FFFFFF; text-align:right; height:40px; } #explanation h3, #benefits h3, #participation h3, #requirements h3 { display:none } #supportingText { background: transparent url(whitebg2.gif) repeat-y top left; float:left; padding-left: 10px; padding-right: 30px; padding-top:230px; padding-bottom:0px; margin-bottom: 0px; width:607px; } #explanation { background: transparent url(whatistext.gif) no-repeat top left; float:right; width:410px; padding-top:50px; padding-bottom:30px; } #participation { background: transparent url(parttext.gif) no-repeat top left; float:right; width:410px; padding-top:50px; padding-bottom:30px; } #benefits { background: transparent url(beneftxt.gif) no-repeat top left; float:right; padding-top:50px; padding-bottom:30px; width:580px; } #requirements { background: transparent url(reqtext.gif) no-repeat top left; float:right; padding-top:50px; padding-bottom:30px; width:580px; } #footer { background: transparent url(notext.gif) no-repeat top left; left:0px; text-align: center; padding-top:30px; padding-bottom:0px; float:right; width:580px; } #footer a:link, #footer a:visited { margin-left: 20px; } #linkList { background: transparent url(greenbg.gif) repeat-y top left; float:left; position: absolute; top: 424px; left: 0px; margin: 0px; width: 178px; text-align:left; padding: 0px; } #linkList2 { background: transparent url(fade.gif) no-repeat bottom left; font: 10px verdana, sans-serif; margin:0px; padding: 0px; padding-bottom:100px; width: 178px; float:left; } #linkList li { list-style-type: none; background:#C1C99A; padding: 8px; margin-bottom: 1px; margin-left:-39px; width:160px; } #linkList li:hover { background: #A6AE72; } #linkList li a { display:block; color:#6E7746; font: bold 11px verdana; text-decoration:underline; } #linkList li a:hover { display:block; color:#8F9E28; font: bold 11px verdana; text-decoration:underline; } #linkList li a.c { display:inline; color:#FFFFFF; font: 11px verdana; } #linkList li a.c:hover { display:inline; color:#6E7746; font: 11px verdana; } #lselect { background: transparent url(seltxt.gif) no-repeat top left; padding-top:30px; padding-bottom:0px; margin-bottom:-10px; float:left; } #larchives { background: transparent url(archtxt.gif) no-repeat top left; padding-top:30px; padding-bottom:0px; margin-bottom:-10px; float:left; } #lresources { background: transparent url(restxt.gif) no-repeat top left; padding-top:30px; padding-bottom:0px; margin-bottom:-10px; float:left; } #lselect h3 span, #larchives h3 span, #lresources h3 span {display:none;} #lselect h3, #larchives h3, #lresources h3 {display:none;} #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none;}/* css Zen Garden submission 084 - 'Start Listening!', by Liz Lubowitz, http://hiptobeasquare.com */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Liz Lubowitz */ /* Added: March 4th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* 1950s clip art courtesy of Tack-O-Rama http://anzwers.org/free/tackorama/index.html */ /* Background tile by Squidfingers http://squidfingers.com/patterns/ */ /* Fonts used are Cast Iron (source unkown) and Hot Burrito #3 by Dinc Type http://www.girlswhowearglasses.com */ /* Photoshop brushes by Anti-Brush http://www.jennithepirate.com/brushes/ */ /* BASIC STUFF */ body {margin:0px;padding:0px;font:0.7em verdana, tahoma, sans-serif;line-height:1.3em;color:#000000;background:#3D5464 url(bg.gif);} p {margin:0px;padding-top:2px;padding-bottom:5px;text-align:justify;} h3 {font:bold 0.8em verdana, tahoma, sans-serif;text-transform:uppercase;margin:0px;padding:0px;color:#000000;} a {color:#000000;font-weight:bold;text-decoration:none;} a:hover {color:#D0701A;font-weight:bold;text-decoration:none;text-decoration:none;} acronym {text-decoration:underline;border:0px;} /* DIVS THAT CONTAIN OTHER DIVS */ #container {z-index:0;position:absolute;left:0px;top:0px;margin:0px;padding:0px;width:725px;background:url(containerbg.gif) repeat-y top left;} #intro {width:560px;float:right;} #supportingText {width:560px;float:right;} #linkList {z-index:1;position:absolute;left:0px;top:320px;width:155px;font-size:0.8em;padding-left:10px;float:left;} /* STUFF CONTAINED WITHIN THE INTRO DIV */ #pageHeader {padding-top:0px;} #pageHeader h1 {width:355px;height:100px;} #pageHeader h1 span {display:none;} #pageHeader h2 {width:355px;height:120px;} #pageHeader h2 span {display:none;} #quickSummary {margin-left:100px;text-align:right;margin-right:10px;margin-top:5px;} #quickSummary p {text-align:right;} #preamble {padding:10px;padding-top:0px;margin:0px;clear:left;} #preamble h3 {background:url(enlightenment.gif) top left no-repeat;width:278px;height:36px;} #preamble h3 span {display:none;} /* STUFF CONTAINED WITHIN THE STUPPORTING TEXT DIV */ #explanation {padding:10px;} #explanation h3 {background:url(about.gif) top left no-repeat;width:278px;height:36px;margin-top:5px;} #explanation h3 span {display:none;} #participation {padding:10px;} #participation h3 {background:url(participation.gif) top left no-repeat;width:278px;height:36px;margin-top:5px;} #participation h3 span {display:none;} #benefits {padding:10px;} #benefits h3 {background:url(benefits.gif) top left no-repeat;width:278px;height:36px;margin-top:5px;} #benefits h3 span {display:none;} #requirements {padding:10px;} #requirements h3 {background:url(requirements.gif) top left no-repeat;width:278px;height:36px;margin-top:5px;} #requirements h3 span {display:none;} #footer {text-align:right;text-transform:uppercase;font-size:0.8em;line-height:1em;border-top:5px solid #000000;margin:0px;padding:10px;} /* STUFF CONTAINED WITHIN THE LINKLIST DIV */ #linkList h3.select {background:url(h3.gif) no-repeat bottom left;width:139px;height:39px;} #linkList h3.select span {display:none} #linkList h3.favorites {background:url(h4.gif) no-repeat bottom left;width:139px;height:39px;} #linkList h3.favorites span {display:none} #linkList h3.archives {background:url(h5.gif) no-repeat bottom left;width:139px;height:39px;} #linkList h3.archives span {display:none} #linkList h3.resources {background:url(h6.gif) no-repeat bottom left;width:139px;height:39px;} #linkList h3.resources span {display:none} #linkList ul {margin:0px;padding:0px;} #linkList li {list-style-type:none;display:block;padding:1px;margin:0px;} #linkList li a {color:#000000;} #linkList li a:hover {color:#D0701A;} #lselect a {display:block;} #lselect li a.c {display: inline;} #lselect li {margin-bottom:5px;} /* EXTRA STUFF LIKE IMAGES */ #extraDiv1 {z-index:1;position:absolute;left:0px;top:0px;width:168px;height:370px;background:url(notlistening1.gif) no-repeat top left;} #extraDiv2 {z-index:2;position:absolute;left:168px;top:0px;width:97px;height:312px;background:url(notlistening2.gif) no-repeat top left;} #extraDiv3 {z-index:3;position:absolute;left:265px;top:0px;width:100px;height:197px;background:url(notlistening3.gif) no-repeat top left;} #extraDiv4 {z-index:4;position:absolute;left:365px;top:0px;width:355px;height:133px;background:url(title1.gif) no-repeat top left;} #extraDiv5 {z-index:5;position:absolute;left:365px;top:133px;width:355px;height:118px;background:url(title2.gif) no-repeat top left;}/* css Zen Garden submission 085 - 'Oceans Apart', by Ryan Sims, http://www.justwatchthesky.com */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Ryan Sims */ /* Added: March 4th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Basic Elements */ body { font: 11px trebuchet ms, arial, helvetica, sans-serif; color: #9F927F; background: #E8E0D5 url(flora.gif) repeat-y center; margin: 0px; } p { font: 11px trebuchet ms, arial, helvetica, sans-serif; margin-top: 0px; text-align: left; } p.p5 { font-size: 9px; padding-top: 15px; } a:link { background: #EBEEF2; padding: 0 2px 0 2px; text-decoration: none; color: #4F6B8B; } a:visited { background: #EBEEF2; padding: 0 2px 0 2px; text-decoration: none; color: #4F6B8B; } a:hover, a:active { background: #F1EFE9; padding: 0 2px 0 2px; text-decoration: none; color: #384A5F; } h1, h2, h3 span {display:none} /* specific divs */ #container { display: block; position: relative; border: 11px #B9AA94 solid; margin: 0px; margin-left:auto; margin-right:auto; width: 527px; voice-family: "\"}\""; voice-family:inherit; width: 505px; } #intro { background: url(zensky.jpg) no-repeat top left; padding-top: 340px; } #pageHeader { background: url(cssdemo.gif) no-repeat top left; height: 67px; } #quickSummary { position: relative; left: 199px; padding: 14px 14px 0 14px; } #quickSummary p.p1 { display: none } #quickSummary p.p2 { font-size: 9px; } #preamble, #supportingText { position: relative; left: 199px; width: 306px; text-align: left; padding: 0 14px 0 14px; margin-bottom: 10px; voice-family: "\"}\""; voice-family:inherit; width: 278px; } #footer { text-align: left; padding-top: 15px; } #footer a:link, #footer a:visited { font-size: 9px; margin-right: 15px; } #linkList { position: absolute; top: 407px; } #linkList2 { font: 9px trebuchet ms, arial, helvetica, sans-serif; color: #9F927F; width: 188px; } #linkList h3 { margin: 0; width: 188px; height: 42px; } #linkList h3.select { background: transparent url(selectdesign.gif) top left no-repeat; } #linkList h3.archives { background: transparent url(archives.gif) top left no-repeat; margin-top: 15px; } #linkList h3.resources { background: transparent url(resources.gif) top left no-repeat; margin-top: 15px; } #linkList h3.select span, #linkList h3.archives span, #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { height: 48px; list-style-type: none; background: transparent url(liBG.gif) repeat-x top left; display: block; padding-left: 14px; } #linkList li a { display: block; width: auto; color: #4F6B8B; padding: 9px 0 0 0; background: none; color: #384A5F; font-size: 11px; } #linkList li a:hover { color: #746E50; } #linkList li a.c:link, #linkList li a.c:visited { color: #929B70; font-weight: normal; display: inline; font-size: 9px; padding: 0; } #linkList li a.c:hover { color: #746E50; } #linkList #larchives li, #linkList #lresources li { height: 25px; background: #F3F1EC; list-style-type: none; display: block; padding-left: 14px; border-bottom: 1px #DFDCD1 solid; } #linkList #larchives li a, #linkList #lresources li a { padding-top: 5px; padding-bottom: 3px; } /* header graphics */ #preamble { background:transparent url(road.gif) no-repeat top left; padding-top:30px; } #explanation { background:transparent url(allabout.gif) no-repeat top left; padding-top:30px; } #participation { background:transparent url(participation.gif) no-repeat top left; padding-top:30px; } #benefits { background:transparent url(benefits.gif) no-repeat top left; padding-top:30px; } #requirements { background:transparent url(requirements.gif) no-repeat top left; padding-top:30px; } /* extra divs */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none}/* css Zen Garden submission 086 - 'RedFrog', by Bernd Willenberg, http://www.willenberg.biz */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Bernd Willenberg */ /* Added: March 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* DISCLAIMER */ /*This CSS was tested in windows with IE 6.0, Netscape 7.02, Opera 7.11j, Mozilla Firebird 0.7 and Mozilla Firefox 0.8 - it works. */ /* ------------------------------------------------------------------------------------- */ /* common */ body { font: 12px/14px Arial; color: #612A20; background: #FFCA7F url(bodybg.gif) fixed; margin: 0; padding: 0; } a:link, a:visited { color: #612A20; font-weight: bold; text-decoration: none; } a:hover, a:active { color: #BD5F4E; text-decoration: underline; } acronym { font-style: italic; cursor: help; border-bottom: 0; } /* ------------------------------------------------------------------------------------- */ /* content-area */ #container { position: absolute; top: 0; left: 50%; width: 690px; margin: 0 0 0 -345px; padding: 0; z-index: 1; } #intro { width: 690px; margin: 0; padding: 0; background: url(head.jpg) no-repeat; } #supportingText { width: 690px; margin: 0; padding: 0; background: url(bg.jpg) repeat-y; } #extraDiv1 { position: absolute; top: 0; left: 50%; width: 690px; height: 1100px; margin: 0 0 0 -345px; padding: 0; background: url(bg.jpg) repeat-y; } /* ------------------------------------------------------------------------------------- */ /* hide headlines for image replacement */ #pageHeader { display: none; } /* ------------------------------------------------------------------------------------- */ /* A demonstration of ... */ #quickSummary { padding: 0; margin: 0; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { position: absolute; top: 140px; left: 235px; width: 400px; font: bold 12px Arial; color: #A25344; margin: 0; padding: 0; } #quickSummary a:link, #quickSummary a:visited { color: #64352D; } #quickSummary a:hover, #quickSummary a:active { color: #64352D; } /* ------------------------------------------------------------------------------------- */ /* content */ #preamble, #explanation, #participation, #benefits, #requirements { width: 690px; margin: 0; padding: 0; } #preamble { padding-top: 220px; } #requirements { padding-bottom: 100px; background: url(foot.gif) no-repeat bottom left; } #preamble h3 { font: bold 14px Arial; text-transform: uppercase; letter-spacing: 2px; color: #FFF; margin: 0 60px 20px 235px; padding: 5px 10px; background: #D4C5C2; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { font: bold 14px Arial; text-transform: uppercase; letter-spacing: 2px; color: #FFF; height: 82px; margin: 0; padding: 60px 0 0 235px; background: url(paragraph.gif) no-repeat; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin: 0; padding: 0 60px 15px 235px; } #explanation p.p1, #participation p.p1, #benefits p.p1, #requirements p.p1 { margin-top: -46px; } /* ------------------------------------------------------------------------------------- */ /* quicklinks */ #footer { position: absolute; top: 198px; left: 50%; width: 185px; font: bold 10px Arial; text-align: center; color: #FFC46F; margin: 0 0 0 -345px; padding: 0; } #footer a:link, #footer a:visited { color: #FFE0B4; } #footer a:hover, #footer a:active { color: #FFF; } /* ------------------------------------------------------------------------------------- */ /* lists */ #linkList { position: absolute; top: 250px; left: 13px; width: 140px; margin: 0; padding: 0; } #linkList a:link, #linkList a:visited { color: #FFF2E0; } #linkList a:hover, #linkList a:active { color: #FFF; } #lresources, #larchives, #lselect { margin: 0 0 25px 0; padding: 0; } #larchives h3, #lresources h3, #lselect h3 { font: bold 11px Verdana; text-transform: uppercase; text-align: center; color: #FFF; margin: 0 0 10px 0; padding: 3px; background: #AF908B; } #larchives ul, #lresources ul, #lselect ul { margin: 0; padding: 0; } #lselect li { font: 12px/14px; color: #612A20; margin: 0; padding: 0px 0px 8px 13px; list-style: none; background: url(dot.gif) no-repeat 0px 4px; } #lselect li a:link, #lselect li a:visited { display: block; } #linkList li a.c:link, #linkList li a.c:visited { display: inline; } #larchives li, #lresources li { font: 12px/14px; color: #612A20; margin: 0 0 5px 0; padding: 0; list-style: none; }/* css Zen Garden submission 087 - 'Maya', by Bernd Willenberg, http://www.willenberg.biz */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Bernd Willenberg */ /* Added: March 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* DISCLAIMER */ /*This CSS was tested in windows with IE 6.0, Netscape 7.02, Opera 7.11j, Mozilla Firebird 0.7 and Mozilla Firefox 0.8 - it works. */ /* ------------------------------------------------------------------------------------- */ /* common */ body { background: #686868 url(bg.gif) repeat-y; margin: 0; padding: 0; } a:link, a:visited { color: #FFF; font-weight: bold; text-decoration: none; } a:hover, a:active { color: #FFB855; text-decoration: underline; } acronym { border-bottom: 0px; cursor: help; font-weight: bold; } /* ------------------------------------------------------------------------------------- */ /* content-area */ #container { position: absolute; top: 0; left: 0; width: 800px; margin: 0; padding: 0; background: url(bottom.gif) no-repeat bottom right; z-index: 1; } #intro { width:540px; float:right; margin: 162px 0 0 0; padding: 0; } #supportingText { width:540px; float:right; margin: 0; padding: 0; } /* ------------------------------------------------------------------------------------- */ /* hide headlines for image replacement */ #pageHeader { display: none; } /* ------------------------------------------------------------------------------------- */ /* title: CSS Zengarden - the beauty of ... */ #extraDiv1 { position: absolute; top: 0; left: 265px; width: 499px; height: 158px; margin: 0; padding: 0; background: url(top.jpg) no-repeat; } /* ------------------------------------------------------------------------------------- */ /* maya-image */ #extraDiv2 { position: absolute; top: 0; left: 0; width: 266px; height: 413px; margin: 0; padding: 0; background: url(left.jpg) no-repeat; } /* ------------------------------------------------------------------------------------- */ /* text-area: A demonstration of ... */ #quickSummary { position: absolute; top: 196px; left: 525px; font: 10px/13px Verdana; color: #FFF; text-align: right; width: 180px; margin: 0; padding: 13px 17px 5px; border-right: 3px solid #F89B17; background-color: #827869; } #quickSummary p { margin: 0 0 10px; padding: 0; } #quickSummary p.p2 { padding: 0 0 0 50px; } #quickSummary a:link, #quickSummary a:visited { color: #F89B17; } #quickSummary a:hover, #quickSummary a:active { color: #FFF; } /* ------------------------------------------------------------------------------------- */ /* content */ #preamble, #explanation, #participation, #benefits, #requirements { font: 11px/14px Verdana; color: #FFE0B4; width: 470px; margin: 0 0 30px; padding: 0; } #preamble { background: url(headline1.gif) no-repeat; } #explanation { background: url(headline2.gif) no-repeat; } #participation { background: url(headline3.gif) no-repeat; } #benefits { background: url(headline4.gif) no-repeat; } #requirements { background: url(headline5.gif) no-repeat; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { font: bold 10px/10px Verdana; visibility: hidden; margin: 0 0 20px 0; padding: 0; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin: 0; padding: 0 0 15px 0; } #preamble p.p1, #preamble p.p2 { width: 235px; } #preamble a:link, #preamble a:visited, #supportingText a:link, #supportingText a:visited { color: #F89B17; font-weight: normal; } #preamble a:hover, #preamble a:active, #supportingText a:hover, #supportingText a:active { color: #FFF; } /* ------------------------------------------------------------------------------------- */ /* footer-linklist */ #footer { font: bold 12px Verdana ; width: 280px; text-align: center; background: #555655; margin: 70px 0 50px 57px; padding: 2px 10px 2px 10px; } #footer a:link, #footer a:visited { color: #FFE0B4; font-weight: bold; } #footer a:hover, #footer a:active { color: #FFF; text-decoration: none; } /* ------------------------------------------------------------------------------------- */ /* lists */ #linkList { position: absolute; top: 425px; left: 0; margin: 0; padding: 0; } #lselect, #larchives, #lresources { margin: 0 0 30px 60px; padding: 0; } #lselect { background: url(subheadl1.gif) no-repeat; } #larchives { background: url(subheadl2.gif) no-repeat ; } #lresources { background: url(subheadl3.gif) no-repeat; } #lselect h3, #larchives h3, #lresources h3 { font: bold 10px/10px Verdana; visibility: hidden; margin: 0 0 15px 0; padding: 0; } #lselect ul, #larchives ul, #lresources ul { width: 150px; margin: 0; padding: 0; } #lselect li { font: 10px/14px Verdana; color: #FFE0B4; margin: 0 0 6px 0; padding: 0 0 0 15px; list-style: none; background: url(dot.gif) no-repeat 0 4px; } #larchives li, #lresources li { font: 10px/14px Verdana; margin: 0 0 6px 0; padding: 0; color: #FFF; list-style: none; } #lselect li a:link, #lselect li a:visited { display: block; } #linkList li a.c:link, #linkList li a.c:visited { display: inline; }/* css Zen Garden submission 088 - 'Tulipe', by Eric Sheperd, http://www.arkitrave.com/log */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Eric Sheperd */ /* Added: March 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /********************* TYPOGRAPHY *********************/ body { font-family: tahoma, arial, helvetica, sans-serif; font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } html>body { font-size: small; } #quickSummary { color: #665; font-weight: bold; font-size: .8em; } #quickSummary p { padding: 0 15px; } acronym { cursor: help; } /********************* LINKS *********************/ a { white-space: nowrap; } a:link { font-weight: bold; text-decoration: none; border: 1px solid #f2f4ee; color: #776; padding: 0 1px; } a:visited { font-weight: bold; text-decoration: none; color: #998; } a:hover { background: url(link_background.gif) no-repeat; border: 1px solid #776; padding: 0 1px; } a:active { font-weight: bold; text-decoration: none; } /********************* ACCESSYPOO *********************/ span.accesskey { font-weight: bold; text-decoration: underline; } /************************** DO THE DIV - LAYOUT **************************/ /*basics*/ body { background: #F2F4EE url(background.gif) repeat fixed; /*thanks to squidfingers for the background image*/ margin: 0; padding: 0; } #container { position: relative; top: 0; left: 0; margin: 0; padding: 0; } /*intro stuff*/ #intro { position: relative; top: 0; left: 0; margin: 0; padding: 0; z-index: 1000; } #pageHeader { position: relative; top: 0; left: 0; margin: 0; padding: 0; background: #fff url(headerBack.jpg) repeat-x top left; /*this is the horizontal line bk*/ height: 126px; width: 2100px; } #pageHeader h1 { /*contains the zen text and flowery images*/ margin: 0; background: transparent url(header.jpg) no-repeat; /*thanks to dubstastic for brushes*/ height: 126px; } #pageHeader h1 span { /*get the text out of the way*/ display: none; } #pageHeader h2 { /*this text will be integrated into the pictoral header*/ display: none; } #quickSummary { /*runs along left side, includes flower and below*/ position: absolute; top: 126px; left: 0; background: transparent url(flower.jpg) no-repeat top left; /*photo (c)2004 Eric Shepherd*/ width: 352px; padding-top: 301px; z-index: 500; } /*graphic backgrounds are applied to head, paragraphs, and last paragraph*/ #preamble { /*first of boxes, but different in document tree so separate css*/ position: absolute; background: #f2f4ee; z-index: 1000; width: 257px; /*all text boxes are 257px*/ top: 126px; left: 370px; padding: 0; border: solid #998; /*only for IE, overridden later*/ border-width: 0px 1px 1px 1px; /*no top border*/ } html>head:first-child+body #preamble { /*gets out of the way for IE and opera 6*/ background: transparent url(sectionBack_head.png) no-repeat top right; /*TOP bk w.drop shadow*/ border: 0; /*need to override border in place*/ } #preamble h3 { background: transparent url(title_preamble.jpg) no-repeat; /*text with faded flower gradient*/ margin: 0; padding: 0; height: 86px; } #preamble h3 span { display: none; /*get text out of the way*/ } #preamble p { margin: 0; padding: 5px 20px; /*cant put background here or IE will see it*/ } html>head:first-child+body #preamble p { /*only seen by smart browsers that can do png transp*/ background: transparent url(sectionBack_main.png) repeat-y; /*thin repeated background*/ } #preamble p.p3 { margin: 0; padding: 5px 20px 25px 20px; } html>head:first-child+body #preamble p.p3 { /*selects last paragraph*/ background: transparent url(sectionBack_foot.png) no-repeat bottom right; /*footer background*/ } /*next four text boxes are under #supportingtext div*/ #supportingText { position: relative; top: 0; left: 0; margin: 0; padding: 0; background: #fff url(bodyBack.jpg) repeat-x; /*use it to get the faded pattern background positioned - again thanks to squidfingers for pattern*/ height: 301px; width: 2100px; /*same width as header*/ } #explanation, #participation, #benefits, #requirements { border: solid #998; /*border only for IE, will be overridden*/ border-width: 0 1px 1px 1px; background: #f2f4ee; position: absolute; z-index: 1000; width: 257px; top: 0; padding: 0; } html>head:first-child+body #explanation, html>head:first-child+body #participation, html>head:first-child+body #benefits, html>head:first-child+body #requirements { background: transparent url(sectionBack_head.png) no-repeat top right; /*override IE values*/ border: 0; } #explanation { left: 680px; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 0; padding: 0; height: 86px; /*headers need defined height because of image replacement*/ } #explanation h3 { background: transparent url(title_about.jpg) no-repeat; } #explanation h3 span, #participation h3 span, #requirements h3 span, #benefits h3 span { display: none; /*for some reason the negative margin didn't work here, so we will use this*/ } #explanation p, #participation p, #benefits p, #requirements p { margin: 0; padding: 5px 20px; /*need to apply to the p elements because of background image reqts*/ } html>head:first-child+body #explanation p, html>head:first-child+body #participation p, html>head:first-child+body #benefits p, html>head:first-child+body #requirements p { background: transparent url(sectionBack_main.png) repeat-y; /*middle background*/ } #explanation p.p2, #participation p.p4, #benefits p.p1, #requirements p.p5 { margin: 0; padding: 5px 20px 25px 20px; } html>head:first-child+body #explanation p.p2, html>head:first-child+body #participation p.p4, html>head:first-child+body #benefits p.p1, html>head:first-child+body #requirements p.p5 { background: transparent url(sectionBack_foot.png) no-repeat bottom right; /*last p gets bottom*/ } #participation { /*see above for comments*/ left: 980px; } #participation h3 { background: transparent url(title_participation.jpg) no-repeat; } #benefits { left: 1280px; } #benefits h3 { background: transparent url(title_benefits.jpg) no-repeat; } #requirements { left: 1580px; } #requirements h3 { background: transparent url(title_requirements.jpg) no-repeat; } /*footer stuff - footer will be on the side, floated, and consist of buttons for MOSE, boxes for IE*/ #footer { position: absolute; background: transparent; z-index: 5000; width: 43px; /*make sure floats go to next line*/ top: 0px; left: 1880px; padding: 0; margin-top: 5px; } div#footer a { display: block; /*for text positioning and link activation*/ background: url(link_background.gif) no-repeat; /*standard link bk for all just for IE*/ border: 1px solid #998; font-weight: normal; text-align: center; } html>head:first-child+body div#footer a { /*buttons only for MOSE*/ border: 0; padding-top: 15px; background: url(footer_back.png) no-repeat; height: 26px; } html>head:first-child+body div#footer a:hover { /*i'm lazy, i just used 2 images instead of pixy method*/ background: url(footer_back_hover.png) no-repeat; border: 0; } /***************************** link list...here we go... *****************************/ #linkList a:link, #linkList a:visited, #linkList a:hover, #linkList a:active { border: 0; padding: 0; margin: 0; } #linkList2 { position: absolute; top: 65px; left: 750px; z-index: 2000; height: 150px; margin: 0; padding: 0; width: 1350px; } #linkList2 a { border: 0; } #linkList2 #lselect li > a:first-child { display: block; } #linkList2 ul > li:last-child { border-bottom: 0; } #linkList2 { list-style-type: none; font-size: .7em; } #linkList2 a { white-space: normal; } #linkList2 a:first-child { font-size: 1.3em; } #linkList2 li:hover { background: url(link_background.gif) no-repeat; } #linkList2 li a:hover { text-decoration: underline; border: 0; background: transparent; } #linkList2 li { padding: 0 3px; border: 0; } html > body #linkList2 li { margin: 0; padding: 3px; border-bottom: 1px solid #887; } #lselect, #lfavorites, #larchives, #lresources { float: left; } #lselect h3, #lfavorites h3, #larchives h3, #lresources h3 { padding-top: 25px; float: left; display: block; height: 150px; } #lselect h3 span, #lfavorites h3 span, #larchives h3 span, #lresources h3 span { padding: 5px; position: relative; margin-bottom: 60px; top: -60px; color: #776; font-size: .5em; background: transparent url(drop_ieBack.gif) no-repeat right; border: 1px solid #776; padding-right: 25px; } #lselect ul, #lfavorites ul, #larchives ul, #lresources ul { float: left; position: relative; top: -45px; z-index: 3000; left: -15px; } html > body #lselect h3 { background: transparent url(drop_lselect.png) no-repeat; height: 36px; width: 153px; padding-top: 0; float: none; } html > body #lselect h3 span { display: none; } html > body #lselect ul { display: none; position: relative; top: 0; left: 0; } html > body #lselect:hover ul { float: none; display: block; background: url(drop_background.png) repeat; border: 1px solid #776; margin: 5px; padding: 5px; width: 128px; list-style-type: none; } html > body #lselect li { float: none; } #lselect ul { list-style-type: none; display: block; } html > body #lfavorites h3 { background: transparent url(drop_favorites.png) no-repeat; height: 36px; width: 153px; padding-top: 0; float: none; } html > body #lfavorites h3 span { display: none; } html > body #lfavorites ul { display: none; position: relative; top: 0; left: 0; } html > body #lfavorites:hover ul { float: none; display: block; background: url(drop_background.png) repeat; border: 1px solid #776; margin: 5px; padding: 5px; width: 128px; list-style-type: none; } html > body #lfavorites li { float: none; } #lfavorites ul { list-style-type: none; display: block; } html > body #larchives h3 { background: transparent url(drop_archives.png) no-repeat; height: 36px; width: 153px; padding-top: 0; float: none; } html > body #larchives h3 span { display: none; } html > body #larchives ul { display: none; position: relative; top: 0; left: 0; } html > body #larchives:hover ul { float: none; display: block; background: url(drop_background.png) repeat; border: 1px solid #776; margin: 5px; padding: 5px; width: 128px; list-style-type: none; } html > body #larchives li { float: none; display: block; } #larchives ul { list-style-type: none; } html > body #lresources h3 { background: transparent url(drop_resources.png) no-repeat; height: 36px; width: 153px; padding-top: 0; float: none; } html > body #lresources h3 span { display: none; } #lresources ul { display: block; } html > body #lresources ul { display: none; position: relative; top: 0; left: 0; } html > body #lresources:hover ul { float: none; display: block; background: url(drop_background.png) repeat; border: 1px solid #776; margin: 5px; padding: 5px; width: 128px; list-style-type: none; } html > body #lresources li { float: none; } #lresources ul { list-style-type: none; } #extraDiv1 { display: block; background: url(noStandards.gif) fixed no-repeat; position: absolute; top: 542px; left: 22px; width: 330px; height: 100px; } #extraDiv2 { } html>body div#extraDiv1 { display: none; } /*html > body #extraDiv1 span { display: none; } /* thank you very much. try the filet.*//* css Zen Garden submission 089 - 'Dark Industrial', by Ray Henry, http://www.reh3.com */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Ray Henry */ /* Added: March 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* This file based on 'GearWorx99' by Ray Henry */ /* http://www.reh3.com/ */ /* basic elements */ body { margin:0; padding:0; background:#273340 url(main_bg.jpg) no-repeat bottom fixed; text-align:center; width:100%; height:100%; font-family:verdana, arial, "sans-serif"; } h1, h2, h3, h4, h5 { padding:0; margin:0; } ul { margin:0; padding:0; } acronym { cursor:help; } acronym:hover { border-bottom:2px solid #919AA4; } /* structural elements */ #container { background:url(container_bg.gif) repeat-y; position:relative; margin:0 auto; padding:0 3px; width:600px; text-align:left; voice-family: "\"}\""; voice-family: inherit; width:594px; } #intro { padding:0; } #pageHeader { background:url(intro_bg.jpg) no-repeat top left; height:132px; } #pageHeader:hover { background-position: 0 -132px; } #supportingText { position:relative; left:0; width:359px; } #linkList { position:absolute; top:169px; right:2px; margin:0 0 0 359px; background:url(linkList_bg.gif) no-repeat top right; } /* intro */ #pageHeader h1, #pageHeader h2, #quickSummary p.p1 {display:none;} #preamble { position:relative; left:0; width:304px; padding:0 45px 0 0; margin:0; font-size:11px; } #preamble h3 { background:url(preamble_title.gif) no-repeat top left; margin:10px 0 0 0; text-indent:-5000px; height:22px; } #preamble p { color:#919AA4; margin:10px 0 15px 10px; padding:0; line-height:14px; } #quickSummary { position:absolute; top:132px; right:2px; background:url(quickSum_bg.gif) no-repeat top right; width:292px; height:47px; font-size:11px; color:#92A0AB; text-align:right; padding:0; margin:0; } #quickSummary p { margin:10px 20px 0 0; } #quickSummary a:link, #quickSummary a:active, #quickSummary a:visited { color:#92A0AB; text-decoration:none; border-bottom:2px solid #506067; } #quickSummary a:hover { color:#b4c2cd; text-decoration:none; border-bottom:2px solid #708089; } /* supportingText */ #supportingText p { color:#919AA4; margin:10px 0 15px 10px; padding:0; line-height:14px; font-size:11px; } #supportingText h3 { margin:10px 0 0 0; text-indent:-5000px; height:22px; } #explanation, #participation, #benefits, #requirements { padding:0 45px 0 0; } #explanation h3 { background:url(explain_title.gif) no-repeat top left; } #participation h3 { background:url(part_title.gif) no-repeat top left; } #benefits h3 { background:url(benefits_title.gif) no-repeat top left; } #requirements h3 { background:url(req_title.gif) no-repeat top left; } #supportingText a:link, #supportingText a:active, #supportingText a:visited { color:#919AA4; font-weight:bold; } #supportingText a:hover { color:#b3bcc6; } #explanation:hover, #participation:hover, #benefits:hover, #requirements:hover, #preamble:hover { background:url(contentHover_bg.gif) no-repeat 0 20px; } #footer { text-align:center; border-top:1px solid #68717A; padding:10px; background:#101C28; margin:0 2px 0 0; font-size:10px; font-weight:normal; } #footer a:link, #footer a:active, #footer a:visited { color:#5D6772; } #footer a:hover { color:#919AA4; } /* linkList */ #linkList ul { list-style:none; } #lselect { margin:10px 0 0 0; font-size:10px; } #lselect li { padding:7px 0 7px 15px; color:#909FB1; } #lselect a:link, #lselect a:active, #lselect a:visited { color:#909FB1; font-weight:bold; } #lselect a:hover { color:#f50; } #lselect a.c { font-weight:normal; text-decoration:none; } #lselect h3 { background:url(selectDesign_title.gif) no-repeat top left; height:38px; text-indent:-5000px; width:237px; } #larchives h3 { background:url(larchives_title.gif) no-repeat top left; height:29px; text-indent:-5000px; width:237px; margin:10px 0 0 0; } #larchives li { padding:7px 0 7px 15px; color:#909FB1; font-size:10px; } #larchives a:link, #larchives a:active, #larchives a:visited { color:#909FB1; } #larchives a:hover { color:#f50; } #lresources h3 { background:url(lresources_title.gif) no-repeat top left; height:29px; text-indent:-5000px; width:237px; margin:10px 0 0 0; } #lresources li { padding:7px 0 7px 15px; color:#909FB1; font-size:10px; } #lresources a:link, #lresources a:active, #lresources a:visited { color:#909FB1; } #lresources a:hover { color:#f50; }/* css Zen Garden submission 090 - 'Untitled', by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Ray Henry */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body#css-zen-garden { background:#A1B4CD; margin:0; padding:0; font-family:verdana, arial, sans-serif; font-size:11px; } acronym { cursor: help; } /* Container */ #container { width:100%; text-align:left; } /* Intro Section */ #intro { width:100%; height:276px; } html>body div#intro { position:fixed; bottom:0px; right:0; } html*#intro { border-bottom:3px solid #fff; position:fixed; bottom:-10px; } /* start IE5Mac Nav hack \*/ #intro { height:286px; voice-family: "\"}\""; voice-family: inherit; height:auto; } /* end IE5Mac Nav hack */ #pageHeader { background:url(pageHead_bg.jpg) no-repeat top left; width:332px; height:283px; position:absolute; right:0; top:0; } html>body #pageHeader { position:absolute; right:0; } #pageHeader h1, #pageHeader h2 {display:none;} #preamble { background:#A1B4CD url(preamble_bg.gif) repeat-y top right; height:283px; width:312px; margin:0; padding:0; position:absolute; left:0; top:0; } html>body #preamble { position:absolute; left:0; } #preamble h3 { background:url(preamble_h3_bg.gif) no-repeat top left; height:48px; width:auto; margin:0; padding:0; } #preamble h3 span {display:none;} #preamble p { color:#2E3C55; line-height:16px; margin:0 10px 10px 10px; } #quickSummary { background:url(quickSum_bg.gif) repeat-x top right; border-right:3px solid #fff; margin:0 332px 0 312px; padding:52px 0 0 0; height:283px; voice-family: "\"}\""; voice-family: inherit; height:231px; } #quickSummary p { margin:0 10px 10px 10px; color:#fff; } #quickSummary a:link, #quickSummary a:active, #quickSummary a:active { color:#fff; } #quickSummary a:hover { color:#ddd; } /* Supporting Text */ #supportingText { width:100%; float:left; margin-right:-332px; margin-top:-3px; } #supportingText h3 { margin:0; padding:0; } #supportingText p { margin:10px 10px 0 10px; line-height:16px; color:#2E3C55; max-width:525px; } #explanation, #participation, #benefits, #requirements { background:#E7F0FF; margin:0 332px 0 0; border-right:3px solid #fff; } #participation, #benefits, #requirements { padding-top:15px; } #requirements { padding-bottom:25px; } #explanation h3 { background:url(exp_h3_bg.gif) no-repeat top left; height:51px; } #participation h3 { background:url(part_h3_bg.gif) no-repeat top left; height:51px; } #benefits h3 { background:url(ben_h3_bg.gif) no-repeat top left; height:51px; } #requirements h3 { background:url(req_h3_bg.gif) no-repeat top left; height:51px; } #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span {display:none;} #supportingText a:link, #supportingText a:active, #supportingText a:visited { color:#4f5e77; } #supportingText a:hover { color:#0c1a33; } html>body #requirements { padding-bottom:300px; } #footer { background:#d6e0ee; margin:0 332px 0 0; border-right:3px solid #fff; border-top:3px solid #fff; border-bottom:3px solid #fff; padding:15px 0; text-align:center; } html>body #footer { background:transparent; position:fixed; right:0; bottom:261px; padding:0; margin:0 160px 0 0; border-right:0; border-top:0; border-bottom:0; text-align:left; } #footer a:link, #footer a:active, #footer a:visited { color:#1E2E43; } #footer a:hover { color:#fff; } /* Link List Section */ #linkList { background:#CBD6E5; width:180px; margin-right:149px; float:right; padding-bottom:453px; border-bottom:3px solid #fff; border-right:3px solid #fff; } html>body #linkList { padding-bottom:700px; } #linkList h3 { background:#bac5d4; font-size:12px; font-family: georgia, serif; color:#4f5e77; } h3.select { padding:10px 0 10px 10px; margin:0 0 5px 0; border-bottom:1px dotted #4f5e77; } h3.archives, h3.resources { border-top:1px dotted #4f5e77; padding:10px 0 10px 10px; margin:10px 0 5px 0; border-bottom:1px dotted #4f5e77; } #linkList h3:hover { background:#a9b4c3; color:#fff; } #linkList ul { margin:0 0 0 5px; padding:0; list-style-type:none; } #linkList ul li { padding:5px 0 5px 15px; color:#6f7f99; font-size:10px; } #linkList ul li:hover { background:url(listBullet.gif) no-repeat 5px 10px; } #linkList ul li a:link, #linkList ul li a:active, #linkList ul li a:visited { display:block; color:#4f5e77; font-weight:bold; font-size:11px; } #linkList ul li a:hover { color:#fff; } #linkList ul li a.c { display:inline; color:#6f7f99; font-weight:normal; font-size:10px; } /* Ugly Opera 7 Hacks Section */ @media all and (min-width: 0px){ div#intro { position: absolute; right:0; width:100%; height:283px; top:0; z-index: 0; border-bottom:3px solid #fff; } div#supportingText { margin-top:280px; } div#footer { position:absolute; right:0; top:12px; } div#linkList { margin-top:280px; } } /* extraDivs */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none;} /* css Zen Garden submission 091 - 'webZine', by Cent, http://www.20cent.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Cent */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin:0px; padding:0px; } /***********************************/ html, body { cursor:default; font-family:tahoma; font-size:0.83em; width:100%; background:#FFF url(img-paper.gif) no-repeat center top; } /***********************************/ acronym { cursor:help; border:0px; } a { text-decoration:none; white-space:nowrap; padding-bottom:4px; color:#000; background: transparent url(img-line.gif) repeat-x 100% 100%; } h3 { margin:6px; font-family:courier; font-size:1.2em; margin-top:14px; } p { margin:6px; letter-spacing:1px; text-align:justify; } h1 { padding:20px; padding-top:90px; } h1 span { display:none; } h2 { font-size:1em; letter-spacing:3px; font-family:courier; } ul { border:1px solid #BBB; padding-left:5px; padding-right:5px; padding-top:5px; padding-bottom:5px; list-style-type:lower-roman; } li { margin-left:25px; } /***********************************/ #container { position:absolute; left:50%; margin-left:-375px; width:750px; } #pageHeader, #quickSummary { text-align:center; } #quickSummary { margin-top:10em; margin-bottom:-20px; text-align:left; margin-left:6px; color:#666; font-family:courier; } #quickSummary p { margin:0px; padding:0px; font-style:italic; display:inline; } #quickSummary a { color:#666; } #preamble { border-top:3px double #DDD; margin-top:30px; width:100%; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { border-bottom:1px solid #888; } #benefits { background:transparent url(img-bonsai.gif) no-repeat bottom center; padding-bottom:148px; } #explanation { float:left; width:31%; } #participation { float:left; width:46%; border-left:2px solid #DDD; border-right:2px solid #DDD; margin-bottom:10px; } #participation .p4 { border:2px solid #DDD; padding-left:4px; padding-right:4px; margin-top:30px; } #participation .p4:first-letter { text-transform:capitalize; } #benefits { float:left; width:22%; } #requirements { clear:both; margin-bottom:20px; background:transparent url(img-pen.gif) no-repeat left bottom; padding-bottom:45px; } #requirements .p5 { margin-top:20px; text-align:right; border-right:1.1em solid #CCC; } #footer { text-align:center; font-size:0.9em; position:absolute; top:130px; width:100%; } #quickSummary .p1, #quickSummary .p2 { letter-spacing:0px; } #lselect { position:absolute; top:30px; left:5px; font-size:0.8em; } #larchives { position:absolute; top:30px; right:0px; width:170px; font-size:0.8em; } #lresources { position:absolute; top:11em; right:0px; width:170px; font-size:0.8em; } #lselect a, #larchives a, #lresources a, #footer a { background:none; color:#555; } #lselect a:hover, #larchives a:hover, #lresources a:hover, #footer a:hover { color:#000; } #footer a:hover { text-decoration:none; white-space:nowrap; padding-bottom:4px; color:#000; background: transparent url(img-diagonal.gif) repeat-x 100% 100%; } /* css Zen Garden submission 092 - 'Port of Call', by Jessica Dunn, http://vcdesignconcept.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Jessica Dunn */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 12px georgia; color: #231C1C; background: url(2.jpg) repeat-y #3D3131; margin: 0 0 0 0; padding: 0 0 0 6px; } p { font: 12px/1.5 arial, times new roman, helvetica; text-align: justify; } h3 { font: bold italic 12pt times new roman; letter-spacing: 1px; color: #000; } a:link, a:visited { font-weight: normal; text-decoration: none; color: #FFFFD6; } a:hover, a:active { border-bottom:1px dotted #FFFFD6; border-top:1px dotted #FFFFD6; color: #CF700B; } #container { width: 760px; } #intro { min-width: 0px; } #pageHeader h1 { background: transparent url(top-n.jpg) no-repeat; height: 284px; width: 504px; top: 0px; margin: 0 0 0 0; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(top-n2.jpg) no-repeat; height: 229px; width: 504px; margin: 0 0 0 0; top: 0px; } #pageHeader h2 span { display:none; } #quickSummary { background: transparent url(flr.jpg) center bottom no-repeat; clear:both; width: 288px; left: 408px; margin: 40px 0 0 120px; padding:0 70px 65px 120px; } #quickSummary p { font: italic 10pt/22pt georgia; text-align:center; padding:0 70px 0 30px; } #preamble { margin: 0 0 0 -60px; position: absolute; top: 30px; left: 520px; width: 260px; z-index: 2; color: #DBD7C5; padding: 0 0 0 0; } #preamble p { font-size: 11px; line-height: 15px; } #preamble h3 { display:none; } #supportingText { position: absolute; top: 525px; left: 40px; margin-left: 4px; float: left; width: 200px; } #participation { margin:20px 20px 20px 4px; width: 400px; } #benefits, #requirements { left: 40px; width: 400px; margin:20px 20px 20px 4px; } #footer { position: absolute; left: 4px; margin: 0 0 0 0; padding: 0 0 0 10px; width: 388px; text-align: center; } #linkList { background: repeat-y transparent; margin: 0 0 0 0; padding:10px 0 0 0; color: #AF610F; position: absolute; top:27em; left:510px; width: 170px; } #linkList h3.select, #linkList h3.select span { display: none; } #linkList h3.archives, #linkList h3.resources { padding: 10px 25px 8px 55px; margin: 0; color: #DDD1C5; letter-spacing: 2px; } #lresources, #larchives, #lselect { margin: 0 0 0 0; padding: 0; } #linkList a:link, #linkList a:visited { color: #F3B530; } #lselect li { font: 9pt/16pt arial, new times roman; color: #DBD7C5; margin:0; padding:0 0 8px 0; list-style: none; border-top: 1px dotted #000; } #lselect li a:link, #lselect li a:visited { color: #FEBD33; font: 9pt/16pt arial, new times roman; } #linkList li { background: transparent; padding: 0 0 5px 5px; line-height: 3.5ex; list-style-type: none; font: 9pt/16pt arial, new times roman; border-top: 1px dotted #000; } #linkList li a.c:link, #linkList li a.c:visited { color: #FEBD33; } #linkList li a:hover { color: #FFFFD6; border-bottom:1px dotted #978D8C; border-top:1px dotted #978D8C; } #linkList #larchives li , #linkList #lresources li , #linkList #lfavorites li { background: transparent; margin: 0 0 0 0; padding: 0 0 5px 2px; line-height: 3.5ex; } #linkList ul { width: 145px; margin: 0 0 0 10px; font: 9pt arial, times new roman, helvetica; } #extraDiv1 { background: transparent url(taba2c.jpg) top left no-repeat; position: absolute; top: 0px; left:510px; right: 0px; width: 259px; height: 284px; } /* css Zen Garden submission 093 - 'South of the Border', by Rob Shields, http://www.dotcat.org/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Rob Shields */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 83%/150%; color: #fff; background: #EDEDED url(background.gif) repeat-y fixed bottom center; margin: 0px; padding: 0px; } p { font: 83%/150% georgia, palatino, serif; margin-top: 0px; text-align: justify; } h3 { font: italic normal 83%/150%; letter-spacing: 1px; margin-bottom: 0px; color: #E79900; font-weight: bold; } body, p, h3 { font-family: "Trebuchet MS", "Bitstream Vera Sans", verdana, lucida, arial, helvetica, sans-serif } a:link, a:visited { text-decoration: none; color: #97ABC3; } a:hover, a:active { text-decoration: underline; color: #97ABC3; } /* specific divs */ #container { position: relative; background: url(bg-central.gif) repeat top left; margin: 0px auto 0px auto; width: 655px; } #intro { margin:0px; } #quickSummary { padding-top: 2px; border-bottom: 1px dashed #8095AF; font-style: italic; } #quickSummary, #preamble { margin: 0px 200px 0px 68px; } #pageHeader { /*display:none;*/ margin: 0px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { margin: 0px 0px 0px 0px; background: transparent url(top.gif) no-repeat top left; width: 655px; height: 206px; } #pageHeader h1 span { display: none; } #pageHeader h2 { display: none; } #quickSummary { margin-top: 10px; } #quickSummary p { } #preamble { border-bottom: 1px dashed #8095AF; } #preamble h3 { background: transparent url(ch1.gif) no-repeat top left; margin: 10px 0px 5px 0px; width: 388px; height: 44px; } #preamble h3 span { display:none } #supportingText { margin:0px 200px 0px 68px; } #explanation { border-bottom: 1px dashed #8095AF; } #explanation h3 { background: transparent url(ch2.gif) no-repeat top left; margin: 10px 0px 5px 0px; width: 388px; height: 44px; } #explanation h3 span { display:none } #participation { border-bottom: 1px dashed #8095AF; } #participation h3 { background: transparent url(ch3.gif) no-repeat top left; margin: 10px 0px 5px 0px; width: 388px; height: 44px; } #participation h3 span { display:none } #benefits { border-bottom: 1px dashed #8095AF; } #benefits h3 { background: transparent url(ch4.gif) no-repeat top left; margin: 10px 0px 5px 0px; width: 388px; height: 44px; } #benefits h3 span { display:none } #requirements { margin-bottom: -80px; } #requirements h3 { background: transparent url(ch5.gif) no-repeat top left; margin: 10px 0px 5px 0px; width: 388px; height: 44px; } #requirements h3 span { display:none } #footer { text-align: center; background: transparent url(bottom.gif) no-repeat top left; height: 37px; margin: 0px -200px 0px -68px; padding-top: 88px; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList { position: absolute; top: 207px; right: 6px; width: 181px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; background: transparent url(li-bg.gif) repeat top center; padding:8px 6px 8px 6px; margin:0px; border-top: 1px solid #5D4831; border-bottom: 1px solid #221609; display: block; } #linkList li a { color: #9E866B; } #linkList2 { font-size: 70%; color: #846645; } #lselect ul li a, #lfavorites ul li a { color: #97ABC3; font-size: 120%; display: block; width: auto; padding: 0px; } #lselect ul li a.c, #lfavorites ul li a.c { font-size: 100%; display:inline; color: #9E866B; } #linkList h3.select { background: transparent url(h3.gif) no-repeat top left; margin: 2px 0px 0px 0px; width:182px; height: 30px; } #linkList h3.select span { display:none } #lfavorites { padding-top: 10px; } #linkList h3.favorites { background: transparent url(h4.gif) no-repeat top left; margin: 0px; width:182px; height: 30px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(h5.gif) no-repeat top left; margin: 0px; width:182px; height: 30px; } #linkList h3.archives span { display:none } #larchives { padding-top: 10px; } #linkList h3.resources { background: transparent url(h6.gif) no-repeat top left; margin: 0px; width:182px; height: 30px; } #linkList h3.resources span { display:none } #lresources { padding-top: 10px; }/* css Zen Garden submission 094 - 'Deco', by Marc Trudel, http://www.marctrudel.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Marc Trudel */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { font: 10pt/16pt verdana; color: #333333; background: url(bg_blue1.gif) repeat-y left; margin: 0px; border: 0px; margin-top: 0em; margin-left: 0em; margin-bottom: 0em; margin-right: 0em; padding: 0em; } #container { background: url(bg.jpg) no-repeat scroll left top; margin: 0px; padding: 0px; position: absolute; height: 497px; width: 788px; visibility: inherit; left: 0px; top: 0px; right: 0px; bottom: 0px; } #intro { margin-top: 85px; margin-left: 172px; } #pageHeader { } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: url(csszengarden.gif) no-repeat left top; width: 620px; height: 103px; } #pageHeader h1 span { display:none } #pageHeader h2 { background: url(thebeauty.gif) no-repeat left top; width: 263px; height: 13px; } #pageHeader h2 span { display:none } #quickSummary { width: 300px; padding-bottom: 20px; padding-left: 10px; } #quickSummary p span { line-height: 17px; font-size: 11px; color: #FFFFFF; } #preamble { color: #666666; margin: 0px; width: 490px; bottom: 0px; } #preamble h3 { background: url(h1.gif) no-repeat left top; border: 0px; height: 39px; width: 537px; visibility: visible; position: static; margin: 0px; padding: 0px 0px 3px; } #preamble h3 span { display:none; padding: 0px; margin: 0px; width: 252px; } #preamble p span { position: relative; left: 27px; margin: 0px 0px 5px; padding: 0px; line-height: 17px; font-size: 11px; } #explanation { color: #666666; margin: 0px; width: 490px; } #explanation h3 { background: url(h2.gif) no-repeat 172px 5px; border: 0px; height: 55px; width: 709px; visibility: visible; position: static; margin: 0px; padding: 0px 0px 3px; } #explanation h3 span { display:none; padding: 0px; margin: 0px; width: 252px; } #explanation p span { position: relative; left: 197px; margin: 0px; padding: 0px; line-height: 17px; font-size: 11px; right: 732px; } a:link { font-weight: bold; color: #99CCFF; text-decoration: none; } a:visited { font-weight: bold; color: #99CCFF; text-decoration: none; } a:hover { font-weight: bold; color: #99CCFF; text-decoration: underline; } a:active { font-weight: bold; color: #99CCFF; } p { font-size: 8pt; line-height: 14pt; margin: 0px; padding: 3px 0px; } #participation { color: #666666; margin: 0px; width: 490px; } #participation h3 { background: url(h3.gif) no-repeat 172px 5px; border: 0px; height: 55px; width: 709px; visibility: visible; position: static; margin: 0px; padding: 0px 0px 3px; } #participation h3 span { display:none; padding: 0px; margin: 0px; width: 252px; } #participation p span { position: relative; left: 200px; margin: 0px; padding: 0px; line-height: 17px; font-size: 11px; right: 745px; } #participation a:link, #participation a:visited { color: #316DBD; } #benefits { color: #666666; margin: 0px; width: 490px; } #benefits h3 { background: url(h4.gif) no-repeat 172px 5px; border: 0px; height: 55px; width: 709px; visibility: visible; position: static; margin: 0px; padding: 0px 0px 3px; } #benefits h3 span { display:none; padding: 0px; margin: 0px; width: 252px; } #benefits p span { position: relative; left: 200px; margin: 0px; padding: 0px; line-height: 17px; font-size: 11px; right: 745px; } #requirements { color: #666666; margin: 0px; width: 490px; } #requirements h3 { background: url(h5.gif) no-repeat 172px 5px; border: 0px; height: 55px; width: 709px; visibility: visible; position: static; margin: 0px; padding: 0px 0px 3px; } #requirements h3 span { display:none; padding: 0px; margin: 0px; width: 252px; } #requirements p span { position: relative; left: 200px; margin: 0px; padding: 0px; line-height: 17px; font-size: 11px; right: 745px; } #requirements a:link, #requirements a:visited { color: #316DBD; } #footer { position: relative; left: 200px; margin: 0px; padding: 10px 10px 10px 0px; line-height: 15px; font-size: 9px; right: 745px; } #footer a:link, #footer a:visited { color: #316DBD; } #linkList { position: absolute; top: 0px; left: 0px; height: 0px; padding: 0px; width: 0px; margin: 0px; } #linkList2 { font: 10px verdana, sans-serif; padding: 0px; margin-top: 340px; width: 133px; height: 0px; top: 0px; left: 0px; right: 0px; bottom: 0px; position: absolute; } #linkList ul { margin: 0px; padding: 0px; background-image: url(lightblue.gif); background-repeat: repeat-y; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; margin-left: 0px; border-top-width: 1px; border-top-style: solid; border-top-color: #C5D2E6; border-right-color: #C5D2E6; border-bottom-color: #C5D2E6; border-left-color: #C5D2E6; padding-left: 15px; padding-bottom: 5px; padding-right: 12px; color: #99CCFF; } #linkList li a:link { color: #FFFFFF; font-weight: bold; background-position: 5px; } #linkList li a:visited { color: #99CCFF; font-weight: bold; } #linkList h3.select { background: transparent url(selectdesign.gif) no-repeat top left; margin: 0px 0px 5px 7px; width: 95px; height: 7px; } #linkList h3.select span { display:none } #linkList h3.archives { background: transparent url(archives.gif) no-repeat top left; margin: 30px 0px 5px 7px; width: 95px; height: 7px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.gif) no-repeat top left; margin: 30px 0px 5px 7px; width: 95px; height: 7px; } #linkList h3.resources span { display:none } /* css Zen Garden submission 095 - 'Corporate ZenWorks', by Derek Hansen, http://www.dejoha.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Derek Hansen */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* HTML Tags */ body { background: #999 url(bk.jpg) repeat-x fixed; margin: 0; padding: 0; color: #33140E; font-family: Georgia, Times, serif; font-size: 80%; } h1,h2,h3,h4,h5,h6 { border: 0; margin: 0; padding: 0; font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif; font-weight: normal; } h3 { text-transform: uppercase; font-size: 90%; word-spacing: 2px; letter-spacing: 2px; margin-left: -10px; font-weight: bold; } a { color: #5F524F; } acronym { font-style: italic; cursor: help; font-weight: bold; } /* Divisions */ #container { width: 750px; background: url(paper_mid.gif) repeat-y; margin: 50px 0 0 25px; padding-bottom: 20px; } #pageHeader { height: 100px; padding: 20px 0 20px 50px; } #pageHeader h1 { height: 90px; width: 340px; background: url(zen_logo.gif) no-repeat; } #pageHeader h2 span, #pageHeader h1 span { display: none; } #pageHeader h2 { background: url(paper_clip.gif) no-repeat; width: 320px; height: 262px; position: absolute; top: 250px; left: -6px; z-index: 5; } #linkList, #supportingText, #preamble { margin: 10px 100px 10px 200px; } #quickSummary { position: absolute; top: 50px; left: 450px; background: url(subtext.gif) no-repeat; height: 100px; width: 280px; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { padding: 78px 0 0 15px; font-size: 10px; font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; } #extraDiv1 { position: absolute; top: 10px; left: 23px; width: 750px; height: 50px; background: url(paper_top.gif) no-repeat; } #lfavorites ul, #lselect ul { list-style-type: none; } #lfavorites li, #lselect li { clear: both; border-bottom: 2px dotted #887972; color: #FFF; padding: 4px 0; background: url(doc.gif) no-repeat center center; } #lfavorites a, #lselect a { float: left; text-decoration: none; } #lfavorites a.c, #lselect a.c { float: right; text-decoration: none; font-style: italic; } #footer { position: absolute; top: 160px; left: 150px; font-size: 80%; border-top: 1px solid #6E512F; padding-top: 3px; width: 575px; text-transform: uppercase; text-decoration: none; font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; } #larchives { margin: 40px -50px 0 -150px; text-align: center; padding-top: 15px; border-top: 1px solid #6E512F; } #larchives h3 { display: none; } #larchives ul { list-style-type: none; margin: 0; padding: 0; } #larchives li { display: inline; padding: 0 10px; text-transform: uppercase; font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; font-size: 80%; } #lresources { position: absolute; top: 600px; left: 10px; width: 200px; height: 257px; background: url(sticky.gif) no-repeat; font-family: "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif; color: #000; } #lresources a { color: #000; } #lresources h3 { padding: 40px 10px 0 30px; } #lresources ul { font-size: 80%; } #lresources li { padding: 5px; } #extraDiv2 { position: absolute; top: 900px; left: 700px; background: url(pen.gif) no-repeat; width: 140px; height: 547px; } /* Classes */ .accesskey { font-weight: bold; text-decoration: underline; }/* css Zen Garden submission 096 - 'Japanese Garden', by Masanori Kawachi, http://www.jugglinglife.org/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Masanori Kawachi */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { width: 670px; margin: 0px; padding: 0px; background-color: #FFFFFF; background-image: url(main_bg.gif); background-repeat: repeat-y; background-position: left top; font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #666666; letter-spacing: 0px } a:link {color: #996600; text-decoration: none;} a:visited {color: #996600; text-decoration: none;} a:hover {color: #996600; text-decoration: underline;} a:active {color: #996600; text-decoration: none;} li { margin: 0px; width: auto; padding-top: 2px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; background-image: url(pointer.gif); background-repeat: no-repeat; background-position: left top; font-weight: bold; font-size: 12px; } #container { margin: 0px; padding: 0px 0px 20px 0px; font-size: 11px; line-height: 1.4; width: 661px; clear: both; background-image: url(rightside_bg.gif); background-repeat: no-repeat; background-position: 322px 0px; } #pageHeader { background-image: url(logo.gif); background-repeat: no-repeat; background-position: left top; margin: 0px; padding: 0px; height: 83px; width: 322px; float: left; } #pageHeader h1 { margin: 0px; padding: 0px; display:none } #pageHeader h2 { margin: 0px; padding: 0px; display:none } #quickSummary { margin: 10px 0px 0px; padding: 0px 0px 0px 22px; float: left; width: 301px; voice-family: "\"}\""; voice-family: inherit; width: 301px; } #quickSummary .p1 { margin: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; } #quickSummary .p2 { margin: 0px; padding-top: 2px; padding-right: 0px; padding-bottom: 2px; padding-left: 0px; font-size: 12px; font-weight: bold; } #preamble { margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; width: 661px; clear: both; } #preamble h3 { display: none; } #preamble .p1 { margin: 0px 0px 0px 345px; background-image: url(tit_01.gif); background-repeat: no-repeat; background-position: left top; padding: 48px 0px 0px; width: 301px; } #preamble .p2 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #preamble .p3 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #supportingText { margin: 0px; padding: 0px; width: 661px; } #explanation { margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; } #explanation h3 { display: none; } #explanation .p1 { margin: 0px 0px 0px 345px; background-image: url(tit_02.gif); background-repeat: no-repeat; background-position: left top; padding: 48px 0px 0px; width: 301px; } #explanation .p2 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #participation { margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; } #participation h3 { margin: 0px; padding: 0px; display: none; } #participation .p1 { margin: 0px 0px 0px 345px; background-image: url(tit_03.gif); background-repeat: no-repeat; background-position: left top; padding: 48px 0px 0px; width: 301px; } #participation .p2 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #participation .p3 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #benefits { margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; width: 301px; } #benefits h3 { display: none; } #benefits .p1 { margin: 0px 0px 0px 345px; background-image: url(tit_04.gif); background-repeat: no-repeat; background-position: left top; padding: 48px 0px 0px; width: 301px; } #requirements { margin: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px; width: 301px; } #requirements h3 { margin: 0px; padding: 0px; display: none; } #requirements .p1 { margin: 0px 0px 0px 345px; background-image: url(tit_05.gif); background-repeat: no-repeat; background-position: left top; padding: 48px 0px 0px; width: 301px; } #requirements .p2 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #requirements .p3 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #requirements .p4 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #requirements .p5 { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #linkList { position: absolute; top: 83px; right: 21px; left: 10px; width: 214px; background-image: url(leftside_bg.gif); background-repeat: no-repeat; background-position: left top; } #lselect { padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; margin: 0px; } #lselect h3 { margin: 0px; padding: 0px; display: none; } #lselect ul { width: auto; padding-right: 10px; padding-left: 10px; list-style-type: none; margin: 0px; padding-top: 30px; padding-bottom: 0px; } #larchives { background-image: url(stit_02.gif); background-repeat: no-repeat; background-position: left top; margin: 10px 0px 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; } #larchives h3 { margin: 0px; padding: 0px; display: none; } #larchives ul { width: auto; padding-right: 10px; padding-left: 10px; list-style-type: none; margin: 0px; padding-top: 20px; padding-bottom: 0px; } #lresources { background-image: url(stit_03.gif); background-repeat: no-repeat; background-position: left top; margin: 10px 0px 0px; padding-top: 0px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; } #lresources h3 { margin: 0px; padding: 0px; display: none; } #lresources ul { width: auto; padding-right: 10px; padding-left: 10px; list-style-type: none; margin: 0px; padding-top: 20px; padding-bottom: 0px; } #footer { margin: 0px 0px 0px 345px; padding-top: 3px; padding-right: 0px; padding-bottom: 3px; padding-left: 0px; width: 301px; } #extraDiv1 { background-image: url(bg_01.gif); background-repeat: no-repeat; background-position: left top; position: absolute; top: 83px; left: 0px; margin: 0px; padding: 0px; height: 208px; width: 10px; } #extraDiv2 { background-image: url(bg_02.gif); margin: 0px; padding: 0px; position: absolute; left: 224px; top: 83px; height: 423px; width: 98px; } /* css Zen Garden submission 097 - 'No Frontiers!', by Michal Mokrzycki, http://hyperreal.info/bhang/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michal Mokrzycki */ /* Added: April 9th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basics */ body { font: small "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #676767; margin: 0px; padding: 0px; background: #fbfbf2 url(page_back.gif) repeat-x fixed; } /* text styles */ p { font: 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; margin-top: 0px; text-align: justify; } acronym { font-weight: bold; color: #e18700; text-transform: uppercase; } #quickSummary acronym { color: #ffff99; font-weight: bold; } h3 { letter-spacing: 1px; margin-bottom: 0px; } a:link { font-weight: bold; text-decoration: none; color: #909528; } a:visited { font-weight: normal; text-decoration: none; color: #909528; } a:hover, a:active { text-decoration: underline; color: #646729; } /* structure, specific texts */ #container { padding: 0px; margin: 0px; background: transparent url(body_back.png) no-repeat top left; } #pageHeader { position: absolute; left: 0px; top: 190px; width: 291px; height: 159px; background: transparent url(green_top.gif) no-repeat top left; z-index: 3; } #pageHeader h1 { position: absolute; top: 59px; background-color: #bbbf58; border-right: 2px solid #fff; width: 289px; height: 150px; margin: 0; padding: 0; } #pageHeader h1 span { display: none; } #pageHeader h2 { position: absolute; top: 118px; background: transparent url(green_bottom.gif) no-repeat bottom left; width: 291px; height: 135px; margin: 0; padding: 0; } #pageHeader h2 span { display: none; } #quickSummary { position: absolute; top: 270px; left: 20px; width: 245px; line-height: 2; z-index: 3; } #quickSummary p { color: #fff; font-size: 11px; line-height: 1.5; font-family: Verdana, Arial, Helvetica, sans-serif; } #preamble { position: absolute; width: 291px; top: 455px; margin: 0; z-index: 3; } #preamble h3 { background: transparent url(enlightment.gif) no-repeat top left; width: 291px; height: 37px; margin-bottom: 10px; padding: 0; } #preamble h3 span { display: none; } #preamble p { color: #7A7D55; font-size: 11px; line-height: 1.5; padding: 0 20px 10px 20px; font-family: Verdana, Arial, Helvetica, sans-serif; } #preamble p.p3 { padding-bottom: 300px; background: transparent url(leftback.gif) 17px 110px no-repeat; } #supportingText { border-left: 2px solid white; border-right: 2px solid white; position: relative; top: 0; margin: 0 170px 0px 300px; background: #fff url(content_back.gif) repeat-x; min-width: 315px; z-index: 2; } #explanation { background: transparent url(zengarden.gif) no-repeat top right; padding-top: 185px; } #explanation h3 { position: relative; top: 15px; width: 305px; height: 41px; background: transparent url(heading_1.gif) no-repeat top left; margin-top: 0; margin-bottom: 10px; } #explanation h3 span { display: none; } #explanation p, #participation p, #benefits p, #requirements p { margin-left: 11px; margin-right: 20px; padding: 10px; } #participation h3 { position: relative; top: 15px; width: 177px; height: 28px; background: transparent url(heading_2.gif) no-repeat top left; margin-top: 0; margin-bottom: 10px; } #participation h3 span { display: none; } #benefits h3 { position: relative; top: 15px; width: 120px; height: 24px; background: transparent url(heading_3.gif) no-repeat top left; margin-top: 0; margin-bottom: 10px; } #benefits h3 span { display: none; } #requirements h3 { position: relative; top: 15px; width: 193px; height: 28px; background: transparent url(heading_4.gif) no-repeat top left; margin-top: 0; margin-bottom: 10px; } #requirements h3 span { display: none; } #footer { text-align: center; padding-bottom: 30px; background-color: #fff; } #footer a:link, a:visited { font-size: 11px; } #footer a:hover, a:active { background-color: #909528; color: #fff; } #linkList { position: absolute; top: 0px; right: 0px; margin-left: 630px; z-index: 1; } #linkList2 { background: transparent url(pickup_top.gif) 10px 0 no-repeat; font: 10px verdana, sans-serif; padding-top: 60px; width: 170px; } #linkList h3.select span { display: none; } #linkList h3.favorites { background: transparent url(favorites_back.gif) no-repeat top left; margin: 20px 0px 5px 8px; width: 79px; height: 20px; } #linkList h3.favorites span { display: none; } #linkList h3.archives { background: transparent url(archives_back.gif) no-repeat top left; margin: 20px 0px 5px 8px; width: 76px; height: 20px; } #linkList h3.archives span { display: none; } #linkList h3.resources { background: transparent url(resources_back.gif) no-repeat top left; margin: 20px 0px 5px 8px; width: 89px; height: 20px; } #linkList h3.resources span { display: none; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 1.1; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 2px; margin-left: 10px; padding-left: 15px; padding-bottom: 5px; } #lselect li { background: transparent url(link_dot.gif) 0 7px no-repeat; } #larchives li, #lfavorites li { background: transparent url(link_dot2.gif) 0 7px no-repeat; } #lresources li { background: transparent url(link_dot3.gif) 0 7px no-repeat; } #linkList li a:link, a:visited { font-size: 9px; font-weight: bold; font-family: verdana, sans-serif; color: #706A47; } #linkList li a:hover, a:active { background-color: #909528; color: #fff; }/* css Zen Garden submission 098 - 'Edo and Tokyo', by Daisuke Sato, http://www.coutworks.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Daisuke Sato */ /* Added: April 14th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { margin: 0px; padding: 0px; background-color: #FFFFFF; font-size: 12px; line-height: 133%; color: #000000; font-family: arial, helvetica, sans-serif; } a { color: #000000; text-decoration: underline; } a:hover, a:active { text-decoration: underline; } /* header */ #pageHeader { position: absolute; top: 32px; left: 385px; background: transparent url(title.gif) no-repeat top left; width: 356px; height: 53px; z-index: 3; } #pageHeader h1, #pageHeader h2 { display: none; } #quickSummary { position: absolute; top: 102px; left: 444px; width: 296px; z-index: 3; } #quickSummary p { margin: 0px; padding: 0px; text-align: right; } #quickSummary a { color: #000000; text-decoration: underline; } /* contents */ #supportingText { position: relative; margin: 0px; padding: 746px 0px 243px 15px; z-index: 1; } #supportingText a { color: #FFFFFF; } #preamble, #explanation, #participation, #benefits, #requirements { margin: 0px 0px 5px 0px; width: 540px; overflow:auto; z-index: 2; } #preamble { position: absolute; top: 583px; left: 15px; height: 158px; } #explanation { height: 183px; } #participation { height: 215px; } #benefits { height: 102px; } #requirements { height: 343px; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 11px 0px 0px 15px; padding: 0px; width: 509px; font-size: 12px; line-height: 133%; color: #FFFFFF; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin: 0px 0px 0px 15px; padding: 0px; width: 509px; color: #FFFFFF; } #footer { position: absolute; top: 1126px; left: 570px; } #footer a { color: #ffffff; text-decoration: none; } /* link */ #linkList { position: absolute; top: 583px; left: 570px; width: 246px; height: 490px; z-index: 1; } #linkList a { color: #FFFFFF; font-style: normal; text-decoration: none; } #linkList ul { margin: 0px; padding: 0px; list-style-type: none; } #linkList li { margin: 0px 0px 0px 15px; padding: 0px; width: 140px; color: #FFFFFF; font-style: italic; } #lselect, #larchives, #lresources { margin: 0px 0px 5px 0px; width: 170px; overflow:auto; z-index: 2; } #lselect { height: 311px; } #larchives { height: 87px; } #lresources { height: 121px; } #lselect h3, #larchives h3, #lresources h3 { margin: 11px 0px 0px 15px; padding: 0px; width: 140px; font-size: 12px; line-height: 125%; color: #FFFFFF; } #lselect a { margin: 0px; padding: 0px; font-style: normal; display: block; } #lselect a.c { font-style: italic; display: inline; } /* images */ #extraDiv1 { position: absolute; top: 0px; left: 0px; background: transparent url(header_bg.gif) no-repeat top left; width: 832px; height: 583px; z-index: 0; } #extraDiv1 span { display: none; } #extraDiv2 { position: absolute; top: 583px; left: 0px; background: transparent url(footer_bg.gif) no-repeat top left; width: 832px; height: 1265px; z-index: 0; } #extraDiv2 span { display: none; } #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; }/* css Zen Garden submission 099 - 'Wiggles the Wonderworm', by Joseph Pearson, http://www.make-believe.org/ */ /* All images used in this Zen Garden are based on freely available images in the public domain. These images and the accompanying CSS are hereby returned to the public domain, as per the Creative Commons Public Domain Dedication (http://creativecommons.org/licenses/publicdomain/). Build on the past, and free your creativity. Fight for fair and reasonable copyright laws."; */ /* Added: April 14th, 2004 */ /*======================================================================== THINGS OF UNIVERSAL IMPORTANCE ========================================================================*/ body { text-align:center; min-width:760px; line-height:100%; background:url(paper.jpg) repeat-y #FFF center top; color: black; } body a { color:black; text-decoration:none; font-weight:bold; } span { font: 12px Comic Sans MS, Verdana, sans serif; text-align:center; line-height:100%; margin-top:5px; } h3 { display:none; } acronym { font-weight:bold; border:none; cursor:help; } #container { text-align:left; margin:0 auto; width:760px; position:relative; } #pageHeader { display:none; } /*================================================================== PAGE 1 This page's content is neatly encapsulated by the intro div. ===================================================================*/ #intro { /*page container*/ position:relative; height:1385px; margin-top:40px; } #extraDiv1 { position:absolute; height:40px; width:820px; top:0; background:url(paperedge.jpg) no-repeat bottom; left:50%; margin-left:-410px; } #quickSummary{ position:absolute; left:6px; top:9px; width:750px; height:491px; background:url(P1PANEL1.jpg) no-repeat black; } #quickSummary p.p1 span { position: absolute; left: 71px; top: 28px; width: 328px; height: 80px; font-size: 16px; } #quickSummary p.p2 span { position:absolute; left:551px; top:0; font: 9px Arial, Helvetica, sans serif; } #quickSummary p.p2 span:before { content:" " } #preamble p.p1{ position:absolute; left:5px; top:506px; width:366px; height:428px; background:url(P1PANEL2.jpg) no-repeat black; } #preamble p.p1 span { position: absolute; left: 217px; top: 30px; width: 127px; height: 92px; } #preamble p.p2{ position:absolute; left:384px; top:507px; width:370px; height:429px; background:url(P1PANEL3.jpg) no-repeat black; } #preamble p.p2 span { position: absolute; left: 18px; top: 12px; width: 160px; height: 104px; } #preamble p.p3{ position:absolute; left:4px; top:941px; width:751px; height:421px; background:url(P1PANEL45.jpg) no-repeat black; } #preamble p.p3 span { position: absolute; left: 5px; top: 5px; width: 348px; height: 56px; text-align:left; } /*================================================================================ PAGE 2 This page must be split into two sections: the explanation div (panels 1 to 4) and the participation div (panel 5). ================================================================================*/ #extraDiv2 { position:absolute; height:100px; width:820px; top:1420px; background:url(paperedge.jpg) no-repeat bottom; left:50%; margin-left:-410px; } #explanation { position:relative; height:535px; margin-top:100px; background:#EEEACD; } #explanation p.p1 { position:absolute; left:3px; top:1px; width:459px; height:509px; background:url(P2PANEL1.jpg) no-repeat black; } #explanation p.p1 span { position: absolute; left: 197px; top: 3px; width: 256px; height: 116px; } #explanation p.p2 { position:absolute; left:462px; top:12px; width:295px; height:491px; background:url(P2PANEL2.jpg) no-repeat black; } #explanation p.p2 span { position: absolute; left: 10px; top: 7px; width: 272px; height: 128px; } #participation { position:relative; width:760px; height:795px; margin-top:-17px; /*hack: should not be needed*/ background:url(P2PANEL5.jpg) no-repeat #EEECD5 19px 343px; z-index:1; } #participation h3 { display:block; position:absolute; left:4px; top:0px; width:747px; height:343px; background:url(P2PANEL34.jpg) no-repeat black; margin:0; padding:0; } #participation h3 span { display:none; } #participation p { position:relative; top:583px; left:437px; width:299px; line-height:20%; margin-top:10px; margin-bottom:0; padding:0; } #participation p.p1 { margin:0; } #participation p span { font: 10px Arial, Helvetica, sans serif; text-align:left; line-height:100%; color:#EEECD5; font-weight:bold; } #participation a { text-decoration:underline; color:#EEECD5; } /*====================================================== PAGE 3 This page is a logistical nightmare. It must contain the BENEFITS text, the REQUIREMENTS text, the FOOTER text and the LINKLIST lists. ======================================================*/ #extraDiv3 { position:absolute; height:100px; width:820px; top:2840px; background:url(paperedge.jpg) no-repeat bottom; left:50%; margin-left:-410px; } #benefits { position:relative; height:726px; background:url(P3PANEL1.jpg) no-repeat black; margin-top:112px; } #benefits p.p1 { position:absolute; left:53px; top:418px; width:298px; height:80px; line-height:20%; text-align:center; margin:0; } #benefits p.p1 span { line-height:100%; text-align:center; } #requirements { position:relative; background:url(dots.gif) black; padding:10px; margin-top:10px; border:2px solid #FCC; width:440px; height:508px; } #requirements h3 { display:inline; float:right; background:url(sparky.gif) no-repeat; width:190px; height:190px; } #requirements h3 span { display:none; } #requirements p.p1 { } #requirements span { font: 9pt Arial, Helvetica, sans serif; line-height:140%; } #requirements p.p1 span { font-style:italic; } #requirements > p.p5 { display:none; /*this line is shown in the footer for MOSe browsers*/ } /*========================= #@%&#!!! LINKLIST. ==========================*/ #linkList { font:italic 10px Arial, Helvetica, sans serif; background:#EEECD5; width:280px; position:relative; margin-top:-593px; left:470px; padding-bottom:25px; } #linkList a span { font: 10px Arial Black, Helvetica, Arial, sans serif; text-transform:uppercase; line-height:100%; } #linkList ul { margin:0; padding:0; display:block; width:140px; border-bottom:2px dotted #200; } #linkList li { margin: 0; padding:8px 3px; border: 2px dotted #200; border-bottom:none; list-style: none; font-weight: bold; text-align:right; } #linkList a { display:block; font:9px Arial Black, Helvetica, Arial, sans serif; text-transform:uppercase; padding-bottom:22px; color:#300; } #linkList a.c { display:inline; font:italic 10px Arial, Helvetica, sans serif; padding-bottom:0; } #lselect { position:absolute; left:0; top:0; width:140px; background:#DEF; } #lselect li { border-right:none; } #larchives { position:relative; left:140px; top:0; width:140px; background:#FFC; } #larchives ul { border-bottom:none; } /* bit of a dodgy hack to get same size list items; IE screws up "height"*/ #larchives li, #lresources li { padding-bottom:21px; } #lresources { padding-top:64px; position:relative; left:140px; width:136px; background:url(adcc.gif) no-repeat #FFC 7px 10px; border:2px dotted #200; border-bottom:none; } #lresources li { border:none; border-top:2px dotted #200; } #lresources ul { width:136px; } /*================================================================ MOSe decorations for linklist. Proudly brought to you by the "Get A Real Browser!" Militant Action Group. ================================================================*/ li { background:url(ad1.gif) no-repeat white 5px 10px; } li + li { background:url(ad2.gif) no-repeat #DFACAC 5px 10px; } li + li + li { background:url(ad3.gif) no-repeat #A5A5D8 5px 10px; } li + li + li + li { background:url(ad5.gif) no-repeat #FFC 5px 10px; } li + li + li + li + li { background:url(ad4.gif) no-repeat white 5px 10px; } li + li + li + li + li + li, #larchives li { background:url(ad6.gif) no-repeat #DFACAC 5px 24px; } li + li + li + li + li + li + li, #larchives li + li { background:url(ad7.gif) no-repeat #A5A5D8 5px 10px; } li + li + li + li + li + li + li + li, #larchives li + li + li { background:url(ad8.gif) no-repeat #FFC 5px 10px; } /*====================== Rounding it off ======================*/ #footer { padding-top:3px; font:9px Arial, Helvetica, sans serif; display:block; position:relative; height:60px; z-index:1000; } /* ah, the foibles of interspersing content with design. But, you know, these are unrealistic restrictions in the real world... */ #footer:before { content:"Approved by the Comics Code of America. Bandwidth graciously donated by DreamFire Studios."; } #footer:after { content:". All images used in this Zen Garden are based on freely available images in the public domain. These images and the accompanying CSS are hereby returned to the public domain, as per the Creative Commons Public Domain Dedication (http://creativecommons.org/licenses/publicdomain/). Build on the past, and free your creativity. Fight for fair and reasonable copyright laws."; } #extraDiv4 { position:absolute; height:48px; width:820px; background:url(paperedge.jpg) no-repeat; left:50%; margin-left:-410px; margin-bottom:0px; }/* css Zen Garden submission 100 - '15 Petals', by Eric Meyer and Dave Shea, http://www.meyerweb.com/ and http://www.mezzoblue.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All photos copyright 2004, Eric Meyer */ /* All other graphics copyright 2004, Dave Shea */ /* Added: April 14th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* This design built specifically for 'More Eric Meyer on CSS'. http://more.ericmeyeroncss.com/ Don't miss chapter 10, "Designing in the Garden", which explores step by step the creation of this CSS Zen Garden design. */ body {margin: 0; padding: 0; text-align: center; color: #000; background: #FFF;} acronym {border: none;} a {text-decoration: none;} a:link {color: rgb(179,63,96);} a:visited {color: rgb(90,32,48);} a:hover {text-decoration: underline;} #container {width: 647px; margin: 75px auto 0; padding: 0; position: relative; text-align: left;} #pageHeader {background: url(pageHeader2.jpg) 0 0 no-repeat; height: 157px; width: auto; position: relative; z-index: 10;} #pageHeader h1 {background: url(ph-flower.gif) 0 0 no-repeat; height: 330px; width: 250px; position: absolute; z-index: 101; top: -95px; right: -80px; margin: 0;} html>body #pageHeader h1 {background-image: url(ph-flower2.png);} #pageHeader h1 span {visibility: hidden; font-size: 1px;} #pageHeader h2 {position: absolute; z-index: 102; top: 134px; right: 140px; margin: 0; padding: 0; color: rgb(91,131,104); text-transform: lowercase; letter-spacing: 0.2em; font: bold italic 1.1em/1em Times, serif; text-align: right;} #pageHeader acronym {text-transform: uppercase;} #quickSummary {font: italic 1em/2 Times, "Times New Roman", serif; color: rgb(42,92,42); background: rgb(94%,98%,96%) url(quickSummary.jpg) 0 100% no-repeat; margin: 1px 0; padding: 1em 180px 1.5em 1.5em;} #quickSummary p {display: inline;} #preamble, #supportingText {padding-right: 217px;} #preamble {background: url(side.jpg) 100% 100% repeat-y;} #supportingText {background: url(side.jpg) 100% 0 repeat-y;} #preamble, #explanation, #participation, #benefits, #requirements { border-left: 1px solid rgb(184,214,194); padding-top: 1px; padding-bottom: 1px;} #preamble {border-top: 1px solid rgb(184,214,194); padding-top: 0.5em;} #preamble p, #supportingText p {font-size: 90%; line-height: 1.66em; margin: 0 1.5em; padding: 0.5em 0;} #preamble h3, #supportingText h3 {letter-spacing: 0.1em; font: italic 1.2em Times, "Times New Roman", serif; color: rgb(107,153,139); margin: 1em 0 0.5em 0.5em;} #requirements {border-bottom: 1px solid rgb(184,214,194); padding-bottom: 100px; background: url(main.jpg) 0 100% no-repeat;} #footer {background: #FFF url(footer.jpg) 0 1px no-repeat; margin: 0 -217px 0 4px; height: 123px; padding: 60px 1em 0 0.5em;} html>body #footer {margin-left: 0;} #footer a {color: rgb(207,216,214); line-height: 1em; font-size: 1.25em; font-weight: 100;} #linkList {position: absolute; z-index: 11; width: 216px; top: 157px; right: 0; margin-top: 8.6em;} #linkList a {color: rgb(99,131,101); font: italic 1.15em Times, serif; text-transform: lowercase;} #linkList ul {margin: 0.5em 1em 0 2em; padding: 0;} #linkList li {list-style: none;} #linkList h3 {margin: 1em 0 0; width: 216px; height: 35px; background: url(resources.gif) 10px 50% no-repeat;} #lselect h3 {background-image: url(design-list.gif);} #larchives h3 {background-image: url(archives.gif);} #linkList h3 span {display: none;} #lselect li {font-size: 85%; margin-bottom: 1.5em;} #lselect li a {display: block; font: bold italic 1.15em Times, serif; letter-spacing: 0.2em; text-transform: lowercase;} #lselect li a.c {display: inline; font: bold 1em Times, serif; letter-spacing: 0; text-transform: none;} #larchives li, #lresources li {margin-bottom: 0.5em;} #larchives li a, #lresources li a {color: rgb(126,164,139);}/* css Zen Garden submission 101 - 'punkass', by Mikhel Proulx, http://www.mikhel.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Mikhel Proulx */ /* Added: May 3rd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0; padding: 0; background: transparent url(bg.gif) no-repeat top left; background-color: #ffffff; width: 1972px; height: 667px; font-family: Verdana; font-size: 11px; line-height: 110%; color: #333333; } a:link { font-weight: bold; color: #075E7B; text-decoration: none; } a:visited { font-weight: bold; color: #075E7B; text-decoration: none; } a:hover, a:active { font-weight: bold; color: #737373; text-decoration: underline; } #container { position: absolute; margin: 0px; padding: 0px; } #intro { position: absolute; margin: 0px; padding: 0px; z-index: 1; } #pageHeader { position: absolute; margin: 0px; padding: 0px; } #pageHeader h1 { z-index: 1; position: absolute; margin: 0px; padding: 0px; background: transparent url(tit.gif) no-repeat top left; width: 278px; height: 186px; left: 25px; top: 165px; } #pageHeader h1 span { display: none; } #pageHeader h2 { z-index:1; position: absolute; margin: 0px; padding: 0px; background: #fff url(cat.gif) no-repeat top left; width: 193px; height: 18px; left: 225px; top: 40px; opacity: .70; } #pageHeader h2 span { display: none; } #quickSummary { position: absolute; margin: 0px; padding: 0px; width: 300px; left: 230px; top: 50px; background: #fff; opacity: .70; } #quickSummary p { z-index:2; position: relative; margin: 0px; padding: 6px 0px 6px 0px; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display: none; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { position: relative; margin: 0px; padding: 6px 0px 6px 15px; } #preamble { position: absolute; margin: 0px; padding: 0px; background: #fff; width: 260px; height: 300px; left: 560px; top: 29px; opacity: .70; } #preamble h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(read.gif) no-repeat top left; width: 298px; height: 25px; } #supportingText { position: absolute; margin: 0px; padding: 0px; z-index: 0; } #explanation { position: absolute; margin: 0px; padding: 0px; width: 300px; height: 300px; left: 773px; top: 360px; background: #fff; opacity: .70; } #explanation h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_explanation.gif) no-repeat top left; width: 241px; height: 25px; } #participation { position: absolute; left: 1059px; top: 10px; padding: 0px; width: 300px; height: 400px; background: #fff; opacity: .70; } #participation h3 { position: relative; margin: 0px 0px 0px 0px; padding: 0px; background: transparent url(head_participation.gif) no-repeat bottom left; width: 142px; height: 25px; } #benefits { position: absolute; left: 1260px; top: 470px; padding: 0px; background: transparent; width: 300px; height: 170px; background: #fff; opacity: .70; } #benefits h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_benefits.gif) no-repeat top left; width: 94px; height: 25px; } #requirements { position: absolute; margin: 0px; padding: 0px; background: transparent; width: 300px; height: 300px; left: 1593px; top: 23px; background: #fff; opacity: .70; } #requirements h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_requirements.gif) no-repeat top left; width: 153px; height: 25px; } #footer { position: absolute; margin: 0px; padding: 0px; background: transparent; width: 300px; left: 1650px; top: 633px; background: #fff; opacity: .70; } #linkList { margin: 0px; padding: 0px; } #linkList ul { position: relative; margin: 0px; padding: 2px 0px 0px 23px; list-style-type: none; } #linkList li { position: relative; margin: 0px; padding: 2px 0px 1px 0px; } #linkList a { font-weight: normal; } #linkList2 { position: relative; margin: 0px; padding: 0px; } #lselect h3 span, #larchives h3 span, #lresources h3 span { display: none; } #lselect { position: absolute; margin: 0px; padding: 0px; width: 145px; left: 360px; top: 189px; background: #fff; opacity: .70; } #lselect h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_select.gif) no-repeat top left; width: 127px; height: 19px; } #lselect a { margin: 0px; padding: 4px 0px 0px 0px; font-weight: bold; display:block; } #lselect a.c { margin: 0px; padding: 0px; font-weight: normal; display:inline; } #larchives { position: absolute; margin: 0px; padding: 0px; width: 270px; left: 30px; top: 461px; background: #fff; opacity: .70; } #larchives h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_archives.gif) no-repeat top left; width: 72px; height: 19px; } #lresources { position: absolute; left: 45px; top: 535px; padding: 0px; width: 270px; background: #fff; opacity: .70; } #lresources h3 { position: relative; margin: 0px; padding: 0px; background: transparent url(head_resources.gif) no-repeat top left; width: 88px; height: 19px; } #extraDiv1 { position: absolute; margin: 0px; padding: 0px; background: transparent; width: 5px; height: 258px; left: 1095px; top: 117px; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; }/* css Zen Garden submission 102 - 'Revolution!', by David Hellsing, http://www.monc.se/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, David Hellsing */ /* Added: May 3rd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* This design was made by David Hellsing for monc. */ /* ////////// GENERAL ////////// */ body { background: #e15 url(img/body_bg.gif) fixed; margin: 0; padding: 0; } /* ////////// TYPOGRAPHY ////////// */ p,ul,ol,li,dt,dl,dd,h1,h2,h3,h4,h5,h6 {margin: 0; padding: 0;} p { font: small/1.8em georgia, tahoma, verdana, tahoma, arial, helvetica, sans-serif; color: #333; } h1,h2,h3,h4,h5,h6 { font: 100% Arial Black, verdana, tahoma, sans-serif; } p { margin-bottom: 9px; } a { color: #26a; text-decoration: none; font-weight: bold; } a:active { color: #000; border-bottom: 1px dotted #000; } a:visited { color: #048; } a:hover { color: #c32; border-bottom: 1px dotted #c32; } h3 { height: 20px; width: 240px; margin: 20px 0 7px 0; } #preamble h3 { background: url(img/head_theroad.gif) no-repeat; } #explanation h3 { background: url(img/head_sowhat.gif) no-repeat;} #participation h3 { background: url(img/head_participation.gif) no-repeat;} #benefits h3 { background: url(img/head_benefits.gif) no-repeat;} #requirements h3 { background: url(img/head_requirements.gif) no-repeat;} .p1,.p2,.p3,.p4,.p5 { padding: 0 30px 0 20px; } span.accesskey { border-bottom: 1px solid #888;} acronym { font-style: normal; font-size: 90%; letter-spacing: 1px; font-weight: bold; border: none; } #pageHeader h1 { width: 100%; height: 100%; background: transparent url(img/top.jpg) no-repeat; } #quickSummary p.p2 { margin: 10px 30px 0 0; padding: 0 0 8px 0; text-transform: uppercase; font: 9px/20px georgia, tahoma, verdana, arial, sans-serif; border-bottom: 1px dotted #333; } #quickSummary p.p2 span { text-transform: uppercase; } /* IE5/win */ #footer a { margin: 5px 20px 0 0; padding: 2px 5px; border-left: 1px solid #26a; border-right: 1px solid #26a; font: 9px/20px georgia, tahoma, verdana, arial, sans-serif; text-transform: uppercase; } #footer a:hover { background: #26a; color: #fff; } #pageHeader h1 span, #pageHeader h2, #quickSummary p.p1, h3 span { display: none; visibility: hidden; } /* ////////// CONTAINERS ////////// */ #container { margin: 0 6%; background: #f4f2ea url(img/container_bg.jpg); border-left: solid 8px #000; border-right: solid 8px #000; border-bottom: solid 32px #000; } #pageHeader { margin: 0; background: #000 url(img/top_bg.jpg); height: 462px; } #footer { margin: 20px 30px 50px 20px; padding-top: 10px; border-top: 1px dotted #000; } #quickSummary { margin-left: 250px; } #preamble { position: relative; margin-left: 230px; text-align: left; } #supportingText { position: relative; margin-left: 230px; text-align: left; } /* ////////// LISTS ////////// */ #linkList { position: absolute; top: 480px; margin-left: 30px; background: url(img/left_bg2.jpg) repeat-y top left; width: 180px; } #linkList2 { font: 9px/12px georgia, tahoma, verdana, arial, helvetica, sans-serif; text-transform: uppercase; color: #333; border-bottom: 5px solid #000; width: 170px; } #linkList ul { list-style: none; } #linkList li { margin: 0 15px; border-top: 1px dotted #333; padding: 8px 0; text-transform: uppercase; } #linkList li a { display: block; color: #c32; font: bold 11px/16px georgia, tahoma, verdana, arial, helvetica, sans-serif; text-transform: none; } #linkList li a:hover { color: #000; border: none; } #linkList li a.c { color: #333; font-size: 9px; font-weight: normal; display: inline; padding: 0; text-transform: uppercase; } #linkList li a.c:hover { color: #888; } #larchives li a, #lresources li a { display: inline; font-weight: normal; font-size: 9px; line-height: 15px; padding: 0; margin: 0; text-transform: uppercase; } #lselect h3, #larchives h3, #lfavorites h3, #lresources h3 { width: 170px; height: 30px; margin: 0 0 -1px 0; } #lselect h3 { background: transparent url(img/left_lselect.gif) no-repeat; } #larchives h3 { background: transparent url(img/left_larchives.gif) no-repeat; } #lfavorites h3 { background: transparent url(img/left_lfavorites.gif) no-repeat; } #lresources h3 { background: transparent url(img/left_lresources.gif) no-repeat; } /* END OF PAGE --> *//* css Zen Garden submission 103 - 'Odyssey', by Terrence Conley, http://www.liquidarch.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Terrence Conley */ /* Added: May 3rd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Inspired by Homer's Odyssey*/ /* All original artwork copyright 2004, Terrence Conley */ /*B A S I C T A G R U L E S */ body { color: #000; background:url(ody-bg3.jpg) repeat-y #000 fixed; margin:0; padding:0; } h3 span, h2 span, h1 span{ display:none; margin:0; padding:0; } h3, h2, h1, p{ margin:0; padding:0; } a:link, a:visited { text-decoration: none; color: #C29E47; } a:hover, a:active { text-decoration: underline; color: #FFEAC8; } acronym{ margin:0; cursor:help; } ul{ list-style:none; margin:0; padding:0 0 10px 0; } /* M A C R O R U L E S */ #container { position: relative; margin-bottom: 0px; margin-left:auto; margin-right:auto; } #intro { position:relative; width:auto; margin-bottom:0px; margin-left:35px; background:url(intro-bg.gif) top left repeat-x transparent; } #supportingText{ width:424px; margin-left:33px; text-align:center; font:.8em/1.5em arial,sans-serif; } #supportingText p{ text-align:left; margin:20px 105px 20px 30px; padding:0; } #supportingText .p1{ padding:0; margin-top:-40px; } * html #supportingText.p1 {margin-top:0px;} #supportingText .p5{ margin-bottom:10px; font:11px/14px arial, sans-serif; font-style:italic; } #linkList{ background:transparent; position:absolute; left:405px; right:0px; top:98px; height:320px; color:#73552A; font-size:.6em; font-family:arial, sans-serif; overflow:hidden; background:url(list-bg.gif) bottom right repeat-y; } * html #linkList {left:375px; right:36px} #linkList2{ height:100%; background:url(blend.gif) repeat-y; padding:12px 25px 5px 15px; } /* M I C R O R U L E S */ #pageHeader{ height:98px; background:url(title2.gif) -2px 0px no-repeat; margin-left:0px; } #pageHeader h1, #pageHeader h2{ display:none; } #quickSummary{ position:absolute; left:425px; top:425px; text-align:left; width:18em; height:95px; color:#AF9874; padding:0px 10px; } * html #quickSummary{top:435px;} #quickSummary p{ font:.7em/1.2em arial, sans-serif; font-style:italic; } #quickSummary .p2{ color:#E4CF9D; line-height:10px; line-height:30px; } #preamble{ height:450px; width:424px; font:12px/15px arial, georgia, serif; font-style:italic; position:relative; color:#AF9874; background:url(preamb2.gif) -2px 231px no-repeat; text-align:left; overflow:hidden; } #preamble p{ margin-top:4px; margin-left:20px; width:310px; text-indent:10px; } #preamble h3{ color:#E4CF9D; height:20px; padding-top:20px; margin:0px; margin-left:20px; background:url(preamb_title.gif) bottom left no-repeat; } #preamble acronym, #quickSummary acronym{ color:#E4CF9D; } #explanation .p1{ text-indent:10px; margin-top:-90px; } #explanation{ color:#E4CF9D; padding:0; margin-bottom:-30px; } #explanation h3{ margin:0; background:url(hd-explain.gif) 0 0 no-repeat transparent; height:134px; } #participation{ margin-bottom:-30px; margin-top:2em; color:#E4CF9D; padding:0; } #participation h3{ background:url(hd-partic.gif) 0 0 no-repeat transparent; height:134px; } #benefits{ margin-bottom:-30px; margin-top:2em; color:#E4CF9D; padding:0; } #benefits h3{ background:url(hd-benefits.gif) 0 0 no-repeat transparent; height:134px; } #requirements{ margin-top:2em; color:#E4CF9D; padding:0; } #requirements h3{ background:url(hd-require.gif) 0 0 no-repeat transparent; height:134px; } #footer{ background:url(footer.gif) top left no-repeat black; height:56px; text-align:left; padding-left:30px; } #footer a:link, #footer a:visited { color: #C29E47; text-transform:uppercase; font:11px/54px arial, serif; } #footer a:hover{ text-decoration: none; color: #FFEAC8; text-transform:uppercase; } /* T H E L I S T S */ #lselect h3, #larchives h3, #lfavorites h3, #lresources h3 { color:#E4CF9D; padding-left:12px; } #lselect h3{ background:url(select.gif) 0 0 no-repeat; height:17px; } * html #lselect h3 {height:17px;} #larchives h3{ background:url(archives.gif) 0 0 no-repeat; height:17px; } * html #larchives h3 {height:17px;} #lfavorites h3{ background:url(favorites.gif) 0 0 no-repeat; height:17px; } * html #lfavorites h3 {height:17px;} #lresources h3{ background:url(resources.gif) 0 0 no-repeat; height:17px; } * html #lresources h3 {height:17px;} #lselect, #lfavorites{ float:left; margin-right:0px; width:18em; } #larchives{ float:left; margin-right:0px; width:14em; } #lresources{ float:left; margin-right:0px; width:16em; } #lselect h3, #larchives h3, #lresources h3, #lfavorites h3{ margin:0 0 4px 0; } #lselect li, #lfavorites li{ padding-bottom:6px; padding-left:25px; background:url(bullet.gif) 14px .4em no-repeat; } #lselect li a, #lfavorites li a{ display:inline; } #larchives li, #lresources li{ padding-bottom:2px } #lselect a:link, #lselect a:visited, #lfavorites a:link, #lfavorites a:visited{ font-family:georgia,"times new roman", serif; font-size:120%; padding-bottom:2px; color:#E4CF9D; text-transform:capitalize; } #lselect a:hover, #lfavorites a:hover{ font-family:georgia,"times new roman", serif; font-size:120%; color:#C29E47; padding-bottom:2px; text-transform:capitalize; text-decoration:none; } #lselect a.c:link, #lselect a.c:visited, #lfavorites a.c:link, #lfavorites a.c:visited{ background:transparent; font-size:100%; color:#AF9874; padding:0; display:inline; } #lselect a.c:hover, #lfavorites a.c:hover{ background:transparent; font-size:100%; color:#C29E47; display:inline; padding:0; } #larchives a,#lresources a{ font-family:georgia,"times new roman", serif; color:#E4CF9D; text-transform:capitalize;; font-size:100%; padding:0 0 10px 30px; } #larchives a:hover,#lresources a:hover{ color:#C29E47; } /* E X T R A D I V S */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none} /* css Zen Garden submission 104 - 'Invitation', by Brad Dailey, http://bradleyboy.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Brad Dailey */ /* Added: May 31st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { background:#968354 url(zen_bg.gif) repeat-y center; margin:0; padding:0; font: 13px/15px georgia; text-align:center; } .p1 { margin-top:0px; } p { margin-left:15px; } a { color:#968354; } a:hover { color:#7e7e7e; } h1 { background:#ffffff url(head.gif); width:710px; height:200px; margin:10px 0 0 0; padding:0; } h1 span, h2 { display:none; } #container { position:relative; width:710px; margin:0 auto 0; padding:0; text-align:justify; } #quickSummary { text-align:center; font-style:italic; color:#7e7e7e; width:500px; margin:0 105px 0; font-size:11px; } #quickSummary a { color:#7e7e7e; } #quickSummary a:hover { color:#333333; } #quickSummary .p1 { margin-top:8px; margin-bottom:0; } #quickSummary .p2 { margin-top: 5px; } #quickSummary p { margin-left:0; } #preamble { width:450px; margin-top:20px; } #preamble h3 { background:transparent url(1.gif) no-repeat; height:35px; margin:0; padding:0; } #preamble h3 span { display:none; } #explanation h3 { background:transparent url(2.gif) no-repeat; height:35px; margin:0; padding:0; } #explanation h3 span { display:none; } #supportingText { width:450px; margin-top:15px; } #participation h3 { background:transparent url(3.gif) no-repeat; height:35px; margin:0; padding:0; } #participation h3 span { display:none; } #benefits h3 { background:transparent url(4.gif) no-repeat; height:35px; margin:0; padding:0; } #benefits h3 span { display:none; } #requirements h3 { background:transparent url(5.gif) no-repeat; height:35px; margin:0; padding:0; } #requirements h3 span { display:none; } #linkList { position:absolute; top:310px; left:50%; margin-left:112px; width:240px; background: url(side_02.gif) repeat-y; text-align:left; } #lselect h3 { background:transparent url(side_01.gif) no-repeat center; height:51px; margin:0; padding:0; } #lselect h3 span { display:none; } #lselect ul, #larchives ul, #lresources ul { list-style:none; margin:12px 0 0 0; padding:0 18px 0 18px; } #lselect ul li, #larchives ul li, #lresources ul li { padding:0 0 0 16px; margin: 0 0 12px 5px; background: url(bull.gif) no-repeat 0 2px; } #larchives a, #lresources a { font-weight:bold; } #lselect a:hover, #larchives a:hover, #lresources a:hover { color:#000; } #lselect a { display:block; margin-bottom:5px; font-weight:bold; } #lselect a.c { display:inline; text-decoration:none; color:#7e7e7e; border:0; font-weight:normal; } #lselect a.c:hover { color:#333333; text-decoration:none; border:0; } #lresources { background: url(side_03.gif) no-repeat bottom right; padding-bottom:10px; } #lresources h3 { background:transparent url(res.gif) no-repeat center; height:40px; margin:0; padding:0; } #lresources h3 span { display:none; } #larchives h3 { display:none; } #footer { text-align:center; padding-bottom:10px; } #footer a { text-decoration:none; font-weight:bold; } #footer a:hover { text-decoration:underline; color:#000; } #extraDiv1 { position:absolute; top:1325px; width:240px; height:174px; background-image: url(env.jpg); left:50%; margin-left:112px }/* css Zen Garden submission 105 - 'Austrian's Dark Side', by Rene Grassegger, http://www.grassegger.at/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Rene Grassegger */ /* Added: May 31st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { font: 12px/16pt "Courier New",monospace !important; color: #fff; background: #000 url(body_bg2.jpg) no-repeat bottom right; } html, body, p, h1, h2, h3, div, ul { margin: 0; padding: 0; } acronym { cursor: help; color: #900; border-bottom: 1px dotted #900; } acronym:hover { border-bottom: 3px solid #f00; font-size: 1.5em; color: #f00; font-weight: bold; } h1, h2, h3 { display: none; } a:link { font-weight: bold; text-decoration: none; color: #f00; } a:visited { font-weight: bold; text-decoration: none; color: #f00; } a:hover, a:active { text-decoration: underline; color: #f00; } /* specific divs */ #container { background: url(csszengarden_bg.jpg) no-repeat top left; position: absolute; top: 0; left: 0; width: 100%; } #quickSummary { position: absolute; top: 20px; left: 350px; background: url(starttext_bg.jpg) no-repeat; clear: both; margin: 0; width: 350px; float: left; } #quickSummary .p1 { font: 12px "Courier New" !important; color: #000; padding: 23px 10px 0 30px; height: 95px; } #quickSummary .p2 { position: absolute; top: -20px; left: 35px; color: #fff; } #preamble { position: absolute; top: 155px; left: 280px; background: url(roadtoenlightment.jpg) no-repeat; height: 416px; width: 466px; margin: 0; padding: 0; } #preamble p { font: 12px "Courier New" !important; color: #000; margin: 0 0 0px 0; padding: 20px 45px 0px 150px; } #preamble .p1 { margin-top: 35px; } #explanation { position: absolute; top: 582px; left: 268px; background: url(sowhatisitabout_bg.jpg) no-repeat; height: 465px; width: 476px; margin: 0; padding: 0; } #explanation p { font: 12px "Courier New" !important; color: #000; margin: 40px 0 -35px 0; padding: 20px 45px 0px 150px; } #participation { position: absolute; top: 1042px; left: 268px; background: url(partcipation_bg.jpg) no-repeat; width: 484px; height: 532px; margin: 0; padding: 0; } #participation p { font: 12px "Courier New" !important; color: #000; margin: 40px 0 -35px 0; padding: 20px 45px 0px 150px; } #benefits { position: absolute; top: 1582px; left: 168px; background: url(benefits_bg.jpg) no-repeat; width: 586px; height: 192px; margin: 0; padding: 0; } #benefits p { font: 12px "Courier New" !important; color: #000; margin: 40px 0 -35px 0; padding: 10px 45px 0px 180px; } #requirements { position: absolute; top: 1802px; left: 68px; background: url(requirements_bg.jpg) no-repeat; width: 677px; height: 586px; margin: 0 0 0 0; padding: 0; } #requirements p { font: 12px "Courier New" !important; color: #000; margin: 40px 0 -35px 0; padding: 10px 45px 0px 180px; } #footer { text-align: center; } #footer a:link, #footer a:visited { margin-right: 20px; } #footer { position: absolute; top: 2700px; left: 30%; } #linkList { background: url(sidebar_bg2.jpg) no-repeat top center; position: relative; top: 349px; left: 15px; margin: 0; padding: 0; height: 950px; width: 211px; color: #000; } #linkList a { font-weight: normal; } #linkList2 { font: 11px "Courier New", Courier, monospace; position: absolute; top: 105px; left: 25px; } #lselect { width: 162px; background: url(archives_bg.gif) no-repeat bottom center; padding-bottom: 100px; } #larchives { background: url(resourcen_bg.gif) no-repeat bottom right; padding-bottom: 100px; width: 142px; text-align: center; } #lresources { width: 160px; text-align: center; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #ea0000; } #linkList li a:visited { color: #ea0000; } /* css Zen Garden submission 106 - 'Mediterranean', by John Whittet, http://www.basseq.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, John Whittet */ /* Added: May 31st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* image: Erdogan Ergun http://yunus.hacettepe.edu.tr/~ergun/ http://www.sxc.hu */ /* Works as expected in: Mozilla 1.6 Mac Safari 1.0 Mac Firefox 0.8 Mac Small loss of effects in: IE 5.2 Mac IE 5.0 PC Errors in: Opera 6.03 Mac - link colors incorrect - overline instead of underline (??) */ /* Basic Default Styles */ body { font: 12px Verdana; color: #000; background: #DFE3BA; margin: 5px 0 5px 50%; } a:link, a:visited { font: 12px "Trebuchet MS", Verdana; text-decoration: underline; color: #000; } a:hover, a:active { font: 12px "Trebuchet MS", Verdana; text-decoration: none; color: #A03E19; } /* I probably would have left off the border on the container, but Safari puts some sort of weird top margin on the div if there's no border. Silly, really. */ #container { position: relative; width: 700px; background: #ADB583 url(header.jpg) no-repeat top left; margin: 0 0 0 -350px; /* Could also use margin-left and -right: auto but IE 5 PC doesn't like that */ border: 5px solid #FFF; } h3 { color: #A03E19; font: 22px "Trebuchet MS", Verdana; margin: 0; text-transform: lowercase; } acronym { border: 0; font-style: normal; } /* Header - just provides space */ #pageHeader { height: 350px; } #pageHeader span { display: none; } /* Content */ #quickSummary { margin-top: 50px; width: 430px; margin-left: 250px; color: #42443A; } #quickSummary a:link, #quickSummary a:visited { color: #42443A; } #quickSummary a:hover, #quickSummary a:active { color: #42443A; } /* This .p1 info is in the header image... */ #quickSummary .p1 { display: none; } #preamble, #supportingText { width: 430px; margin-left: 250px; margin-top: 15px; } #footer { position: relative; left: -250px; width: 400px; height: 20px; padding: 78px 0 0 50px; background: #ADB583 url(footer.jpg) no-repeat top left; } #footer a:link, #footer a:visited { color: #61A7BC; text-decoration: none; } #footer a:hover, #footer a:active { color: #61A7BC; text-decoration: underline; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* Left Bar */ #container #linkList { position: absolute; left: 18px; top: 340px; width: 198px; font: 10px "Trebuchet MS", Verdana; } #linkList h3 { width: 198px; height: 18px; margin-top: 20px; } #linkList h3 span { display: none; } /* left header images */ #linkList h3.select { background: url(left_select.gif) no-repeat top left; } #linkList h3.archives { background: url(left_archive.gif) no-repeat top left; } #linkList h3.resources { background: url(left_resources.gif) no-repeat top left; } #linkList h3.favorites { background: url(left_favorites.gif) no-repeat top left; } #linkList ul { list-style: none; padding: 0 0 18px 0; margin: 0; background: url(left_footer.gif) no-repeat bottom left; } #linkList ul li { padding: 5px 10px 5px 10px; background: url(li_bg.png) bottom left; border-bottom: 1px solid #1A4861; margin: 0; } /* li:hover style... have to replace the BG so the color will show up. */ #linkList ul li:hover { background: #A03E19 url(spacer.gif); color: #FFF; } /* bunch of crazy styles... so IE will still look ok when it doesn't parse :hover. */ #linkList #lselect { color: #666; } #linkList ul li a { /* this would be block, save for the nbsp at the end of the link for "accessibility" purposes. :P */ display: inline; color: #000; text-transform: lowercase; } #linkList #lselect ul li a { font: 14px "Trebuchet MS", Verdana; display: block; color: #000; text-transform: lowercase; } #linkList #lselect ul li a.c, #linkList ul li a.c { display: inline; font: 10px "Trebuchet MS", Verdana; color: #666; text-transform: none; } /* if the browser doesn't read the :hover pseudoclass, this shouldn't render and the text shouldn't change color */ #linkList ul li:hover a, #linkList #lselect ul li:hover a { color: #FFF; } /* Crazy :Hovers Experimentation uncomment for fun */ /* #preamble p, #explanation p, #participation p, #benefits p, #requirements p { display: none; } #preamble:hover p, #explanation:hover p, #participation:hover p, #benefits:hover p, #requirements:hover p { display: block; } #lselect ul, #larchives ul, #lresources ul { display: none; } #lselect:hover ul, #larchives:hover ul, #lresources:hover ul { display: block; } *//* css Zen Garden submission 107 - 'Defiance', by Angelo Paralos, http://www.ehlydesign.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Angelo Paralos */ /* Added: June 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* BASE Elements */ a { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:x-small; font-weight:bold; color:#000000; } a:active { text-decoration:line-through; } a:visited { text-decoration:line-through; } a:hover { text-decoration:line-through; } acronym { } body { background:#000000 url("screwoff.gif") no-repeat top left; } div { } h1 { margin:0px; padding:0px; } h2 { margin:0px; padding:0px; } h3 { margin:0px; padding:0px; } head { } html { } li { } link { } meta { } p { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:x-small; color:#000000; font-weight:bold; padding:0px; margin:0px 0px 10px 0px; } script { } span { } style { } title { } ul { } /* ID Elements */ #css-zen-garden { padding:0px; margin:0px; } #container { width:760px; height:3000px; padding:0px; margin:0px; } #intro { } #intro h1 span { display:none; } #intro h2 span { display:none; } #pageHeader { } #quickSummary p.p1 { width:115px; position:absolute; left:15px; top:588px; color:#FFFFFF; } #quickSummary p.p2 { position:absolute; left:5px; top:2985px; color:#FFFFFF; } #quickSummary a:link { color:#FFFFFF; } #quickSummary a:active { color:#FF0000; text-decoration:line-through; } #quickSummary a:visited { color:#FF0000; text-decoration:line-through; } #quickSummary a:hover { color:#FF0000; text-decoration:line-through; } #preamble { width:195px; position:absolute; left:215px; top:700px; } #preamble p.p1{ position:absolute; left:-50px; } #preamble p.p2{ position:absolute; top:55px; left:-30px; } #preamble p.p3{ position:absolute; top:120px; left:20px; } #preamble h3 span { display:none; } #supportingText { } #explanation h3 span { display:none; } #explanation { width:455px; position:absolute; top:1190px; left:265px; } #participation h3 span { display:none; } #participation { width:100px; position:absolute; top:1412px; left:23px; } #benefits h3 span { display:none; } #benefits { width:577px; position:absolute; top:1932px; left:155px; } #requirements h3 span { display:none; } #requirements { width:520px; position:absolute; top:2408px; left:197px; text-align:right; } #requirements p.p5{ width:520px; position:absolute; top:550px; left:-100px; text-align:right; color:#FFFFFF; } #requirements p.p5 a { color:#FFFFFF; } #requirements p.p5 a:active { color:#FF0000; text-decoration:line-through; } #requirements p.p5 a:visited { color:#FF0000; text-decoration:line-through; } #requirements p.p5 a:hover { color:#FF0000; text-decoration:line-through; } #footer { position:absolute; top:2985px; left:600px; } #footer a { color:#FF0000; text-decoration:none; } #footer a:active { text-decoration:line-through; } #footer a:visited { text-decoration:line-through; } #footer a:hover { text-decoration:line-through; } #linkList { position:absolute; top:710px; left:0px; color:#FF0000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:x-small; font-weight:bold; } #linkList h3 { margin:0px; padding:0px; color:#FF0000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:x-small; font-weight:bold; } #linkList ul { margin:0px; padding:0px; } #linkList li { margin:0px 0px 0px 5px; padding:0px; list-style-type:none; line-height:9px; } #linkList a { display:block; margin:0px; padding:0px; color:#FF0000; text-decoration:none; } #linkList a:active { text-decoration:line-through; } #linkList a:visited { text-decoration:line-through; } #linkList a:hover { text-decoration:line-through; }/* css Zen Garden submission 109 - 'Pneuma', by Adam Polselli, http://www.adampolselli.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Adam Polselli */ /* Added: June 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements -------------------------------------*/ a { font-weight: bold; } a:link, a:visited { text-decoration: none; color: #333; } a:hover, a:active { text-decoration: underline; color: #F36; } acronym { border: none; cursor: help; } body { background: #414141 url(pagebg.gif) repeat-y top center; font: 69%/1.5em 'Lucida Sans Unicode', 'Lucida Grande', verdana, arial, sans-serif; color: #333; margin: 0; padding: 0; text-align: center; } p { margin: 0 0 10px; } /* specific divs --------------------------------------*/ #container { position: relative; background: transparent; margin: 0 auto; text-align: justify; width: 600px; } #container h3 { font-size: 110%; font-weight: bold; margin-bottom: 10px; margin-top: 10px; } #pageHeader { margin: 0; padding-top: 15px; height: 300px; background: #FFF url(header.jpg) no-repeat bottom; border-bottom: 15px solid #FFF; } #pageHeader h1, #pageHeader h2 { margin: 0; padding: 0; display: none; } #quickSummary { position: absolute; bottom: 0; right: 0; z-index: 2; width: 170px; padding: 0 6px 5px; margin: 0; } #quickSummary a { color: #377774; } #quickSummary p { font-size: 90%; text-align: left; color: #377774; margin: 0; } #quickSummary p.p1 { margin: 0; padding: 0; display: none; } #preamble { background: url(preamblebg.gif) repeat-y; position: absolute; top: 330px; right: 0; z-index: 2; width: 190px; font-size: 90%; color: #FFF; text-align: left; border-bottom: 15px solid #FFF; line-height: 14px; } #preamble p { margin: 0 17px 15px 15px; } #preamble h3 { height: 58px; margin: 0; padding: 0; background: url(preambleheader.jpg) no-repeat top; } #preamble h3 span { margin: 0; padding: 0; display: none; } #supportingText { margin: 0 205px 0 0; background: #D8FBFC url(suptextbg.gif) repeat-y; } #supportingText p { margin: 0 20px 15px 20px; } #explanation h3 { height: 46px; margin: 0; padding: 0; background: url(explanation.gif) no-repeat top; } #explanation h3 span { margin: 0; padding: 0; display: none; } #participation h3 { height: 37px; margin: 0; padding: 0; background: url(participation.gif) no-repeat top left; } #participation h3 span { margin: 0; padding: 0; display: none; } #benefits h3 { height: 37px; margin: 0; padding: 0; background: url(benefits.gif) no-repeat top left; } #benefits h3 span { margin: 0; padding: 0; display: none; } #requirements h3 { height: 37px; margin: 0; padding: 0; background: url(requirements.gif) no-repeat top left; } #requirements h3 span { margin: 0; padding: 0; display: none; } #footer { background: #999 url(footerbg.gif) repeat-y 0 0; border-top: 15px solid #FFF; padding: 10px 15px 10px 10px; text-align: right; margin: 0; } #footer a { margin-left: 20px; color: #CCC; } #footer a:hover, #footer a:active { color: #FFF; } #linkList { background: transparent; padding: 0; margin: 0; width: 190px; position: absolute; top: 704px; right: 0; font-size: 90%; } #linkList ul { margin: 0; padding: 0; list-style: none; } #lselect ul, #larchives ul, #lresources ul { margin-top: -10px; margin-bottom: -10px; } #linkList li { display: block; padding: 8px 0 7px 12px; margin: 0; line-height: 160%; border-bottom: 1px solid #FFF; } #linkList li a { color: #333; font: bold 110% arial, helvectica, sans-serif; } #linkList li:hover { background: url(selecthoverbg.gif) 0 0; } #linkList li:hover a { color: #FFF; } #lselect { color: #377774; } #lselect li:hover { background: url(selecthoverbg.gif); color: #FFB9CB; } #lselect li a { text-transform: uppercase; font: bold 110% arial, helvectica, sans-serif; display: block; margin: 0; padding: 0; } #lselect li:hover a { color: #FFF; } #lselect li a.c:link, #lselect li a.c:visited { display: inline; font-weight: normal; text-transform: none; font-size: 100%; color: #377774; } #lselect li:hover a.c { color: #FFB9CB; } h3.select { height: 29px; margin: 0; padding: 0; background: url(select.gif) no-repeat; } h3.select span { margin: 0; padding: 0; display: none; } h3.archives { height: 30px; margin: 0; padding: 0; background: url(archives.gif) no-repeat; } h3.archives span { margin: 0; padding: 0; display: none; } h3.resources { height: 26px; margin: 0; padding: 0; background: url(resources.gif) no-repeat; } h3.resources span { margin: 0; padding: 0; display: none; }/* css Zen Garden submission 110 - 'Perfume de Gardenias', by Armando Sosa, http://nolimit-studio.com/yosoysosa/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Armando Sosa */ /* Added: June 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 10px/16px verdana; color: 333; margin: 0px; background:#f60 url('bg.gif') repeat-y; } h3 { font-family:georgia; font-style:italic; font-size:14px; letter-spacing: 1px; margin-bottom: 0px; text-align:center; color:#c00; } a:link { font-family:"courier new",verdana; font-weight: bold; text-decoration: none; color:#c00; text-transform:uppercase; } a:visited { font-weight: bold; text-decoration: none; } a:hover, a:active { text-decoration: underline; } /* specific divs */ #container { position:absolute; top:0; left:50px; width:90%; color:#333; padding:0 30px; } #intro,#supportingText{ text-align:justify; } #intro abbr,#intro acronym #supportingText abbr,#supportingText acronym{ font-family:"courier new",verdana; text-transform:uppercase; color:#000; } #pageHeader { position:absolute; top:0; left:0; width:650px; height:400px; background:#fcc url('head_bg.gif') repeat-x -50px;; } #pageHeader h1{ top:-40px; left:45px; position:absolute; width:515px; height:70px; text-indent:-5000px; background:transparent url('zengardenia.gif') no-repeat bottom; } #pageHeader h2{ font-family:georgia; font-size:25px; font-style:italic; position:absolute; top:15px; left:130px; padding:0px !important; padding:20px; color:#900; z-index:2 } #quickSummary{ position:absolute; top:65px; left:100px; width:350px; font-family:georgia; font-size:13px; font-weight:bold; text-align:center; padding:15px; color:#000; z-index:3; } #preamble{ position:absolute; top:200px; width:450px; left:50px; padding:10px; } #supportingText{ padding:15px; position:absolute; top:500px; left:230px; width:360px; height:600px; overflow:auto; /* I've used an ExtraDiv to display the background behind this layer, but IE doesn't like my idea. So i put the background directly in the Div for browsers that do not support "!important" */ background:transparent !important; background:transparent url('supp_bg.gif') no-repeat fixed; z-index:2; } #explanation{ margin-top:50px; } #footer{ padding-bottom:100px; } #linkList{ text-align:center; width:200px; height:600px; position:absolute; top:560px; left:5px; padding:75px 25px 0px 0px; color:#b63; background:transparent url('sidebar_bg.gif') no-repeat; } #linkList h3{ color:#c96; } #linkList ul{ margin:0px; padding:15px; } #linkList li{ margin:0; padding:0; list-style:none inside; display:block; padding:2px; } #linkList a{ font-family:verdana; color:#c96; } h3.select{ display:none; } #lselect ul li{ padding-bottom:5px; margin-bottom:5px; border-bottom:dotted 1px #b63; } #lselect ul li a{ display:block; } #lselect ul li a.c{ display:inline; text-transform:lowercase; } #lresources{ left:-5px; top:710px; width:651px; position:absolute; color:#333; background:#900; } #lresources h3{ display:none; } #lresources ul li{ display:inline; } /* Extra Divs */ /* I've used all and everyone of the six provided by the XHTML maybe if there were more, i would used it too :P*/ #extraDiv1{ position:absolute; top:-65px ; left:580px; width:150px; height:615px; background:transparent url('girl.gif') no-repeat; z-index:2; } #extraDiv2{ position:absolute; top:1070px ; left:250px; width:150px; height:200px; background:transparent url('girl.gif') no-repeat; z-index:2; } /*Because of some weird thing, I cannot make this layer to go under the supportingText one, so i've discovered for accident that leaving no space between the url for the graphic used in the background and the no-repeat attribute causes IE to not display any background at all*/ #extraDiv3{ position:absolute; top:470px; left:270px; width:430px; height:700px; background:transparent url('supp_bg.gif')no-repeat; z-index:0; } #extraDiv4{ position:absolute; top:1098px; left:590px; background:transparent url('gardenia.gif') no-repeat; width:200px; height:180px; } #extraDiv5{ position:absolute; top:420px; left:50px; background:transparent url('dead.gif') no-repeat; width:515px; height:150px; } #extraDiv6{ position:absolute; top:0px; left:0px; background:transparent url('gardenia.gif') no-repeat; width:200px; height:200px; } /* css Zen Garden submission 111 - 'Gruener Entwurf', by Hannah F. Liesong, http://www.liesong.de/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Hannah F. Liesong */ /* Added: July 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { margin: 0px; padding: 7% 0px 7% 0px; background-color: #143A1F; } p { font: 10px Verdana, Arial, Helvetica, sans-serif; text-align: justify; color: #1F1F1F; margin: 0px 13px 0px 13px; } acronym { font-style: italic; font-weight: normal; border: 0; cursor: help; } a:link { font-weight: bold; text-decoration: none; border: 1px dotted #61A681; color: #0E9B7D; } a:visited { font-weight: bold; text-decoration: none; border: 1px dotted #61A681; color: #0E8368; } a:hover { font-weight: bold; text-decoration: none; border: 1px dotted #690; background-color: #669900; color: #FCFE85; } /* specific divs */ #container { padding: 0px 0px 1px 0px; margin: 0px; height: 510px; border-bottom: 1px solid white; border-top: 1px solid white; position: relative; left: 0px; background: #254634 url("baeume.jpg") no-repeat; width: 2000px; } #pageHeader h1 { background: url("head1.gif") no-repeat left top; margin-top: 0px; float: none; padding: 0px; height: 101px; width: 778px; z-index: 5; position: absolute; } #pageHeader h1 span { display:none } #pageHeader h2 { margin-top: 58px; margin-bottom: 40px; width: 200px; height: 18px; float: right; } #pageHeader h2 span { display:none; } #quickSummary { margin: 0px; height: 56px; width: 419px; background: url("quicksummary.gif") no-repeat; z-index: 10; position: absolute; padding: 0px; left: 53px; top: 83px; } #quickSummary p { display: none; } #preamble { background: url("praeamble_bg.jpg") no-repeat; position: absolute; left: 53px; top: 139px; width: 419px; height: 300px; overflow: auto; } #preamble h3 { margin: 0; padding: 0; position: relative; height: 61px; width: 419px; left: 0px; top: 0px; background-image: url("praeamble_h1.gif"); background-repeat: no-repeat; } #preamble h3 span { margin: 0; padding: 0; display: none; } #explanation { margin: 0; padding: 0; background: url("explanation_bg.jpg") repeat-x; position: absolute; left: 473px; top: 139px; width: 297px; height: 300px; overflow: auto; } #explanation h3 { margin: 0; padding: 0; background: url("explanation_h.gif") no-repeat; position: relative; height: 61px; width: 277px; left: 0px; top: 0px; } #explanation h3 span { margin: 0; padding: 0; display: none; } #participation { margin: 0; padding: 0; background: url("participation_bg.gif"); position: absolute; left: 771px; top: 139px; width: 348px; height: 300px; overflow: auto; background-repeat: repeat; } #participation h3 { margin: 0; padding: 0; background: url("participation_h.gif") no-repeat; position: relative; height: 61px; width: 328px; left: 0px; top: 0px; } #participation h3 span { margin: 0; padding: 0; display: none; } #benefits { margin: 0; padding: 0; position: absolute; left: 1120px; top: 139px; width: 254px; height: 300px; overflow: auto; background-color: #D5E3B8; } #benefits h3 { margin: 0; padding: 0; background: url("benefits_h.gif") no-repeat; position: relative; height: 61px; width: 254px; left: 0px; top: 0px; } #benefits h3 span { margin: 0; padding: 0; display: none; border: 1px solid red; } #requirements { margin: 0; padding: 0; position: absolute; left: 1375px; top: 139px; width: 600px; height: 300px; overflow: auto; background-color: #E1EBCC; } #requirements h3 { margin: 0; padding: 0; background: url("requirements_h.gif") no-repeat; position: relative; height: 61px; width: 410px; left: 0px; top: 0px; } #requirements h3 span { margin: 0; padding: 0; display: none; } #linkList { padding: 0px 0px 3px 0px; margin: 1px; visibility: visible; z-index: 0; position: absolute; left: 53px; top: 440px; right: 0; background-image: url("select_bg.gif"); width: 1946px; } #lselect { } #linkList h3.select { margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #C1AD79; font-style: normal; font-weight: bold; text-transform: uppercase; position: relative; left: 25px; top: 0px; float: left; width: 140px; } #linkList ul { margin: 0; padding: 0; list-style: none; font-family: Arial, Helvetica, sans-serif; font-size: 10px; font-weight: normal; left: 0px; top: 0px; color: #DBFE72; } #linkList li { list-style-type: none; float: left; margin: 0px 3px 0px 3px; padding: 0px; border-bottom: 1px solid #BCFD69; margin: 0px 3px 0px 3px; } #linkList li a:link { color: #DBFE72; font-weight: bold; text-decoration: none; border: 0; cursor: move; } #linkList li a:visited { color: #DBE272; font-weight: bold; text-decoration: none; cursor: move; border: 0; } #linkList li a:hover { color: #254632; background-color: #DBFE72; font-weight: bold; text-decoration: none; border:0; } #larchives { clear:left; } h3.archives { margin: 3px 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #C1AD79; font-style: normal; font-weight: bold; text-transform: uppercase; position: relative; left: 25px; top: 0px; float: left; width: 140px; } #lresources { clear:left; } h3.resources { margin: 0px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #C1AD79; font-style: normal; font-weight: bold; text-transform: uppercase; position: relative; left: 25px; top: 0px; float: left; width: 140px; } #footer { width: 1946px; position: absolute; left: 0px; top: 490px; margin: 0; padding: 0px 0px 0px 53px; border-top: 1px solid #669900; border-bottom: 1px solid #669900; } #footer a:link, #footer a:visited { font-size: 9px; color: #254634; font-family: Arial, Helvetica, sans-serif; font-weight: normal; text-transform: uppercase; padding: 0; margin: 0; border: 0; } #footer a:hover { color: #DBFE72; font-weight: bold; text-transform: uppercase; text-decoration: underline; } #footer a:before { content: "["; } #footer a:after {content: "]"; } /* css Zen Garden submission 112 - 'Mountain Resort', by Jordi Romkema, http://www.jor-on.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Jordi Romkema */ /* Added: July 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Basic */ body { font: 9pt Arial, Helvetica, sans-serif; color: #000000; background: #00004A url(bg.gif) repeat fixed left top; margin: 0px; } p { font: 9pt Arial, Helvetica, sans-serif; text-align: left; } a:link, a:visited { color: #00004A; font-weight: bold; text-decoration: underline; } a:hover, a:active { color: #C17535; font-weight: bold; text-decoration: underline; } /* Hiding elements we don't want to see */ h1, h2, h3 span, #linkList h3.select span, #linkList h3.archives span, #linkList h3.resources span, #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* Specific Divs */ #container { display: block; position: relative; width: 700px; margin: 0px auto; background: #FFFFFF url(bgend.jpg) no-repeat left bottom; padding-bottom: 20px; } #intro { background: #FFFFFF url(header.jpg) no-repeat 0 0; padding-top: 471px; } #quickSummary { position: absolute; top: 0px; left: 0px; width: 700px; color: #B9E0FF; } #quickSummary a:link, #quickSummary a:visited { color: #B9E0FF; font-weight: bold; text-decoration: underline; } #quickSummary a:hover, #quickSummary a:active { color: #00004A; font-weight: bold; text-decoration: underline; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { font-size: 8pt; text-align: right; margin: 5px; } #preamble, #supportingText { width: 410px; text-align: left; } /* Header Images */ #preamble { background:url(preamble.jpg) no-repeat left top; padding:74px 10px 5px 10px; } #explanation { background:url(explanation.jpg) no-repeat left top; padding:44px 10px 0px; } #participation { background:url(participation.jpg) no-repeat left top; padding:44px 10px 0px; } #benefits { background:url(benefits.jpg) no-repeat left top; padding:44px 10px 0px; } #requirements { background:url(requirements.jpg) no-repeat left top; padding:44px 10px 10px 10px; } /* Footer */ #footer { text-align: center; font-size: 8pt; font-weight: bold; font-family: Arial, Helvetica, sans-serif; padding: 10px; } #footer a:link, #footer a:visited { margin-right: 15px; color: #C17535; } #footer a:hover { margin-right: 15px; color: #00004A; } /* Navigation */ #linkList { position: absolute; top: 471px; left: 437px; width: 263px; background-image: url(bglist.gif); } #linkList2 { font: 8pt Arial, Helvetica, sans-serif; color: #C17535; width: 263px; background: url(listend.jpg) no-repeat left bottom; } #linkList h3 { margin: 0; width: 263px; height: 32px; } /* Navigation Images */ #linkList h3.select { background: url(select.gif) no-repeat left top; height: 177px; } #linkList h3.archives { background: url(archives.gif) no-repeat left top; } #linkList h3.resources { background: url(resources.gif) no-repeat left top; } #linkList h3.favorites { background: url(favorites.gif) no-repeat left top; } /* Spacer */ #lresources { padding-bottom: 176px; } /* Navigation Lists */ #linkList ul { margin: 0px 0px 0px 28px; padding: 0px; width: 211px; } #linkList li { display: block; padding: 5px; border-bottom-width: 1px; border-bottom-style: dashed; border-bottom-color: #D2C598; } #linkList li a { display: block; color: #5B2C02; } #lselect li a:link, #lselect li a:visited, #lfavorites li a:link, #lfavorites li a:visited { text-transform: uppercase; color: #5B2C02; font-weight: bold; text-decoration: none; } #larchives li a:link, #larchives a:visited, #lresources li a:link, #lresources li a:visited { text-transform: uppercase; font-weight: bold; text-decoration: none; } #linkList li a:hover, #linkList li a:active { color: #000000; } #linkList li a.c:link, #linkList li a.c:visited { color: #C17535; font-weight: bold; display: inline; text-transform: none; } #linkList li a.c:hover, #linkList li a.c:active { color: #000000; } #linkList li:hover { background: #D2C598; color: #FFFFFF; } #linkList li:hover a.c:link, #linkList li:hover a.c:visited { color: #FFFFFF; } #linkList li:hover a:link, #linkList li:hover a:visited { color: #000000; }/* css Zen Garden submission 113 - 'Switch On', by Michael Fasani, http://www.michaelfasani.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michael Fasani */ /* Added: July 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0px; padding: 0px; width: 100%; height: 100%; font-family: verdana, arial; background: #000000 url(bg.gif); font-size: 8pt; color: #FFFFFF; } a { color: #99FF00; text-decoration: none; } h3 span { display:none; } a:hover { color: #FF6600; } #container { position: relative; margin: 10px auto; padding: 10px; width: 600px; text-align: left; voice-family: "\"}\""; voice-family: inherit; width: 594px; border: 10px solid #ffffff; background: #000000 url(zentop.gif) no-repeat top left; } #pageHeader { margin-top: 390px; position: relative; } #pageHeader span { display:none; } #quickSummary .p1 { position: absolute; width: 586px; padding: 14px; font-size: 8pt; text-transform: uppercase; background: #000000 url(bg2.gif); color: #99FF00; text-align: center; top: 327px; left: -1px; border: 1px solid #ffffff; } #quickSummary .p2 { position: absolute; font-size: 7.5pt; text-transform: uppercase; font-family: Arial; color: #CCCCCC; top: 307px; left: 345px; width: 270px; } #quickSummary a { color: #FFFFFF; text-decoration: none; } #quickSummary a:hover { background: #99FF00; color: #000000; } #footer { position: absolute; font-size: 7.5pt; text-transform: uppercase; font-family: Arial; color: #FFFFFF; top: 307px; } #footer a { color: #FFFFFF; text-decoration: none; } #footer a:hover { background: #99FF00; color: #000000; } #preamble { width: 440px; text-align: justify; } #preamble h3 { position: relative; background: transparent url(theroad.gif) no-repeat; margin-top: 10px; height: 45px; left: -10px; } #preamble .p1 { text-indent: 20px; margin-top: -28px } #explanation { width: 440px; text-align: justify; } #explanation h3 { position: relative; background: transparent url(sowhat.gif) no-repeat; margin-top: 25px; height: 45px; left: -10px; } #explanation .p1 { text-indent: 20px; margin-top: -28px } #participation { text-align: justify; } #participation h3 { position: relative; background: transparent url(parti.gif) no-repeat; margin-top: 25px; height: 45px; left: -10px; } #participation h3 span { display: none; } #participation .p1 { text-indent: 20px; margin-top: -28px } #participation .p2 { width: 440px; } #participation .p1{ width: 440px; } #benefits { text-align: justify; } #benefits h3 { position: relative; background: transparent url(beni.gif) no-repeat; margin-top: 25px; height: 45px; left: -10px; } #benefits .p1 { text-indent: 20px; margin-top: -28px } #requirements { text-align: justify; } #requirements h3 { position: relative; background: transparent url(reqs.gif) no-repeat; margin-top: 25px; height: 45px; left: -10px; } #requirements .p1 { text-indent: 20px; margin-top: -28px } /* Force carriage return before 'by' */ #lselect li a:link, #lselect li a:visited {display: block;} #linkList li a.c:link, #linkList li a.c:visited {display: inline;} #lselect { width: 160px; position: absolute; top: 395px; left: 457px; background: transparent url(top-menu.gif) no-repeat; height: 400px; } #lselect ul { list-style: none; margin-left: 18px; margin-top: 50px; } #lselect ul li { padding: 0px 0px 0px 16px; background: url(arrow.gif) no-repeat 6px 2px; margin-bottom: 5px; } #larchives { width: 160px; position: absolute; top: 725px; left: 457px; background: transparent url(mid-menu.gif) no-repeat; height: 200px; text-transform: capitalize; } #lresources { width: 160px; position: absolute; top: 847px; left: 457px; background: transparent url(bot-menu.gif) no-repeat; height: 200px; } #larchives ul, #lresources ul { list-style: none; margin-left: 26px; margin-top: 46px; } /* css Zen Garden submission 114 - 'Salvage Yard', by Justin Peters, http://www.vatoweb.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Justin Peters */ /* Added: July 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 12px/17px tahoma, arial; color: #000; background: #DAE8BD url(bg_lines.gif) no-repeat top; margin: auto auto; padding: 0; text-align: center; } p { font: 12px/17px tahoma, arial, sans-serif; margin: 0 0 17px 0; } a:link { font-weight: bold; text-decoration: none; color: #027D87; } a:visited { font-weight: bold; text-decoration: none; color: #858686; } a.c:visited { font-weight: normal; text-decoration: none; color: #858686; } a:hover, a:active { text-decoration: underline; color: #000505; } ul { list-style-type: none; margin: 0; padding: 0; } /* specific divs */ #container { width: 762px; padding: 0; margin: auto; text-align: left; } #intro { vertical-align: bottom; } #pageHeader { padding: 0; margin: 0; height: 246px; border: 1px solid white; } #pageHeader h1 { background: url(title_hdr.jpg) no-repeat top left; width: 760px; height: 176px; margin: 70px 0 0 0; padding: 0; } #pageHeader h1 span { display:none } #pageHeader h2 { padding: 0; margin: 0; } #pageHeader h2 span { display: none; } #quickSummary p.p1 { width: 320px; height: 92px; position: absolute; top: 1px; margin-left: 470px; padding: 0; font-size: 11px; color: #FFF; font-family: arial; background: url(bg_redbox.gif) no-repeat; } #quickSummary p.p1 span{ display: none; } #quickSummary p.p2{ display: block; position: absolute; top: 53px; padding: 0 0 0 7px; font-size: 11px; text-align: right; color: #490909; font-family: arial; clear: both; } #preamble { padding: 0; margin: -3px 0 0 0; width: 291px; float: left; } #preamble h3 { background: url(hdr_enlightenment.gif) no-repeat; width: 291px; height: 47px; margin: 0; padding: 0; border-top: 1px solid white; } #preamble h3 span { display: none; } #preamble p { font: italic normal 12px/19px georgia, 'Times New Roman', times, serif; padding: 0 0 0 3px; width: 270px; } #preamble p.p1 { margin-top: 10px; } #supportingText { padding: 0; margin: -3px 0 40px 0; background: #D6E6B6; border: 1px solid white;; width: 469px; float: right; } #supportingText p { margin: 9px 17px 17px 24px; } #explanation h3 { background: url(hdr_about.gif) no-repeat; width: 469px; height: 32px; margin: 0; padding: 0; } #explanation h3 span { display: none; } #participation h3 { background: url(hdr_participation.jpg) no-repeat; width: 469px; height: 32px; margin: 0; padding: 0; } #participation h3 span { display: none; } #benefits h3 { background: url(hdr_benefits.jpg) no-repeat; width: 469px; height: 32px; margin: 0; } #benefits h3 span { display: none; } #requirements h3 { background: url(hdr_requirements.jpg) no-repeat; width: 469px; height: 32px; margin: 0; padding: 0; } #requirements h3 span { display: none; } #footer { background: #A2C1B9; border-top: 1px solid white; padding: 0 0 2px 24px; } a.c { font-weight: normal; } #lselect, #larchives, #lresources { width: 256px; clear: left; padding: 0; margin: 0; } #lselect { background: url(hdr_select.gif) no-repeat; border-bottom: 1px solid #fff; margin-top: 20px; } #larchives { background: url(hdr_archives.gif) no-repeat; border-bottom: 1px solid #fff; margin-top: 20px; } #lresources { background: url(hdr_resources.gif) no-repeat; border-bottom: 1px solid #fff; margin-top: 20px; } #lselect h3 span, #larchives h3 span, #lresources h3 span { display: none; } #linklist { margin-top: 50px; clear: both; } #linkList #linkList2 ul { padding: 20px 10px 10px 10px; display:block; } #linklist li { margin: 2px 0; } /* css Zen Garden submission 115 - 'Burnt Offering', by Jonny Blair, http://www.jonnyblair.co.uk/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Jonny Blair */ /* Added: July 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0; padding: 0; background: #000 url(drops/main_bg2.jpg) no-repeat bottom fixed; text-align: center; width: 100%; height: 100%; font-family: "verdana", "arial", sans-serif; color: #333; } a:link { color: #860d01; text-decoration: none; } a:hover { color: #870b01; text-decoration: underline; } a:visited { color: #666; text-decoration: none; } h1, h2, h3, h4, h5 { padding: 10px; border: 0px solid orange; } ul { margin: 0; padding: 0; } acronym { cursor: help; } acronym:hover { border-bottom: 1px solid #870b01; } #container { border: 1px solid #000; border-right: none; border-bottom: 0px solid #860d01; border-top: 0px solid #860d01; background-color: transparent; position: relative; margin: auto; margin-top: 0px; margin-bottom: 0px; padding: 0px; width: 760px; text-align:left; voice-family: "\"}\""; voice-family: inherit; width: 754px; } #intro { padding: 0; } #pageHeader { background: url(drops/main_title.jpg) no-repeat top left; height: 145px; border-bottom: 3px solid #860d01; } #supportingText { position: relative; left: 0; width: 523px; color: #777; } #linkList { position: absolute; top: 148px; right: 0px; margin: 0 0 0 515px; background-color: #000; border-left: 1px solid #000; border-bottom: 0px solid #000; border-right: 1px solid #000; border-top: 0px; } #pageHeader h1 { border: 1px solid red; font-size: x-small; margin: 0px; padding: 0px; display: none; } #pageHeader h2 { border: 1px solid red; font-size: x-small; margin: 0px; padding: 0px; display: none; } #quickSummary p.p1 { border: 1px solid red; } #preamble { position:relative; left: 0; padding: 0px; width: 522px; font-size: x-small; display: block; border-bottom: 1px solid #000; border-right: 0px solid #000; background-color: #860d01; color: #fff; min-height: 254px; } #preamble h3 { background: url(headers/preamble_title.jpg) no-repeat top left; margin: 0px; text-indent: -2000px; height: 38px; border-bottom: 1px solid #000; padding: 0px; } #preamble p { margin: 10px; text-align: justify; margin-right: 20px; padding: 0; line-height: 1.6em; } #quickSummary { display: none; } #quickSummary p { margin: 10px; text-align: justify; padding: 0; line-height: 1.6em; } #quickSummary p.p1{ display: none; } #quickSummary a:link, #quickSummary a:active, #quickSummary a:visited { text-decoration: none; border-bottom: 2px solid #506067; } #quickSummary a:hover { text-decoration: none; border-bottom: 2px solid #708089; } #supportingText p { margin: 10px; margin-left: 100px; margin-right: 20px; padding: 0; line-height: 1.6em; font-size: x-small; text-align: justify; } #supportingText h3 { margin: 0px; text-indent: -2000px; height: 22px; } #explanation, #participation, #benefits { padding: 0px; padding-bottom: 20px; margin: 0px; border-right: 1px solid #000; border-bottom: 1px solid #ccc; width: 522px; background-color: #fff; } #requirements { border-bottom: 0px; padding-bottom: 10px; border-right: 1px solid #000; width: 522px; background-color: #fff; } #explanation h3 { background: url(headers/explain_title.jpg) no-repeat top left; } #participation h3 { background: url(headers/participation_title.jpg) no-repeat top left; } #benefits h3 { background: url(headers/benefits_title.jpg) no-repeat top left; } #requirements h3 { background: url(headers/req_title.jpg) no-repeat top left; } #supportingText a:link, #supportingText a:active, #supportingText a:visited { font-weight: bold; } #supportingText a:hover { } #explanation:hover, #participation:hover, #benefits:hover, #requirements:hover { color: #000; background-image: url(drops/jb.gif); background-repeat: no-repeat; background-position: bottom right; } #preamble:hover { background: #4a0201 url(drops/red_drop.jpg) no-repeat 0 38px; color: #fff; } #footer { margin: 0px; width: 522px; height: 6em; line-height: 6em; font-size: x-small; text-align: center; background-color: #000; margin-top: 0px; border-top: 5px solid #ccc; border-right: 1px solid #000; border-bottom: 5px solid #860d01; } #footer a:link, #footer a:active, #footer a:visited { color: #fff; } #footer a:hover { } #linkList ul { list-style: none; width: 230px; margin: 0px; padding: 0px; right: 0px; border-bottom: 0px solid #000; } #lselect { margin: 0px; font-size: 7pt; width: 230px; } #lselect li { padding: 12px 15px 12px 15px; border-bottom: 1px solid #000; height: 52px; line-height: 1.4em; background-color: #860d01; color: #c63; } #lselect li:hover { background-color: #4a0201; background-image: url(drops/li_hi.gif); background-repeat: no-repeat; background-position: top right; color: #fff; } #lselect a:link, #lselect a:active, #lselect a:visited { font-weight: bold; color: #c63; } #lselect a:hover { background-color: #4a0201; color: #fff; } #lselect a.c { font-weight:normal; text-decoration:none; } #lselect h3 { background: url(headers/select_title.jpg) no-repeat top left; margin: 0px; text-indent: -2000px; height: 38px; border-bottom: 1px solid #000; padding: 0px; } #larchives { border-right: 0px solid #000; border-bottom: 0px solid #000; background-color: transparent; width: 230px; } #larchives h3 { background:url(headers/larchives_title.jpg) no-repeat top left; margin: 0px; text-indent: -2000px; height: 38px; border-bottom: 1px solid #000; padding: 0px; } #larchives ul { background-color: #fff; } #larchives li { padding: 12px 0 7px 15px; height: 25px; line-height: 1.2em; background-color: #fff; color: #c63; border-bottom: 1px solid #000; font-size: 7pt; } #larchives a:link, #larchives a:active, #larchives a:visited { color: #c63; font-weight: bold; } #larchives li:hover { background-color: #4a0201; background-image: url(drops/li_hi.gif); background-repeat: no-repeat; background-position: top right; color: #fff; } #larchives a:hover { background-color: #4a0201; color: #fff; } #lresources { border-right: 0px solid #000; border-bottom: 0px solid #000; background-color: #fff; width: 230px; background-position: bottom right; background-repeat: no-repeat; } #lresources h3 { background:url(headers/lresources_title.jpg) no-repeat top left; margin: 0px; text-indent: -2000px; height: 38px; border-bottom: 1px solid #000; padding: 0px; } #lresources li { padding: 12px 0 7px 15px; height: 25px; line-height: 1.2em; background-color: #fff; color: #c63; font-size: 7pt; border-bottom: 1px solid #000; } #lresources li:hover { background-color: #4a0201; background-image: url(drops/li_hi.gif); background-repeat: no-repeat; background-position: top right; color: #fff; } #lresources a:link, #lresources a:active, #lresources a:visited { color: #c63; font-weight: bold; } #lresources a:hover { background-color: #4a0201; color: #fff; } /* css Zen Garden submission 116 - 'Ragged', by Jose Florido, http://www.avidos.net/blogold/ http://www.ovillo.org/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Jose Florido */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Hoja de estilos para "Ragged" */ /* Autor: Jose Florido - jose@avidos.net */ /* Elementos xhtml */ body{ padding: 0; margin: 0; font-family: "MS Trebuchet", Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 75%; line-height: 135%; background-image: url("fondo.gif"); color: #424242; text-align: center; } a{ color: #af0000; font-weight: bold; text-decoration: none; } a:visited{ color: #FF9F9F; text-decoration: none; } a:hover{ text-decoration: underline; } h3{ color: #af0000; font-size: 120%; margin-top: 30px; margin-bottom: 0; position: relative; padding: 0 0 0 25px; background-image: url("bullet.gif"); background-repeat: no-repeat; background-position: 0 1px; } h3 span{ background-color: #fff; } p{ margin: 10px 0 5px 0; } /* ---- divs ---- */ /* En orden de aparicin en el codigo HTML */ #container{ position: relative; background-image: url("abajo.gif"); background-repeat: repeat-x; background-position: bottom; width: 740px; border: 1px solid #5F5F5F; border-bottom: 0; border-top: 0; margin: 0 auto; text-align: left; } #pageHeader { padding: 5px 0 0 15px; } #pageHeader h1{ width: 526px; height: 91px; background-image: url("header1.gif"); margin-bottom: 0; } #pageHeader h1 span { display: block; width: 0; height: 0; overflow: hidden; } #pageHeader h2{ width: 279px; height: 33px; background-image: url("header2.gif"); margin-top: -22px; margin-bottom: 25px; } #pageHeader h2 span { display: block; width: 0; height: 0; overflow: hidden; } #quickSummary{ background-color: #AF0000; color: #fff; margin-bottom: 60px; line-height: 125%; font-size: 110%; } #quickSummary .p1{ position: relative; padding: 29px 20px 0 20px; background-color: #AF0000; background-image: url("qsp1.gif"); background-position: top left; background-repeat: no-repeat; } #quickSummary .p2{ position: relative; padding: 0 20px 25px 20px; background: #AF0000 url("qsp2.gif") no-repeat bottom left ; } #quickSummary a{ color: #fff; font-weight: bold; text-decoration: underline; } #quickSummary a:visited{ color: #CCCCCC; text-decoration: none; } #quickSummary a:hover{ text-decoration: none; } #preamble{ margin-left: 220px; padding-right: 10px; font-size: 90%; } #supportingText{ margin-left: 220px; padding-right: 10px; font-size: 90%; } #requirements{ position: relative; margin-left: -180px; width: 650px; } #requirements .p5{ font-size: 80%; margin: 10px; } #footer{ position: relative; left: -180px; padding: 65px 10px 30px 20px; background-image: url("footer.gif"); background-repeat: no-repeat; background-position: 0 55px; } /* Columna izquierda */ #linkList { position: absolute; left: 12px; top: 320px; width: 178px; padding: 0 2px 0 0; font-size: 80%; line-height: 140%; background: #EFEFEF url("linea.gif") top right repeat-y; } #linkList h3{ background: #af0000; margin: 0; padding: 5px 0 5px 10px; text-transform: lowercase; color: #fff; font-size: 100%; background-image: url("header3.gif"); background-repeat: repeat-x; background-position: bottom; } #linkList h3 span{ background: transparent; } #linkList ul { margin: 0; padding: 0; list-style: none; padding: 20px 10px 20px 10px; background-image: url("izqdaul.gif"); background-repeat: repeat-x; } #linkList li{ padding-left: 18px; background: transparent url("flechita2.gif") 0 2px no-repeat; margin-bottom: 7px; color: #818181; } #linkList li a{ color: #af0000; } #linkList li a.c{ color: #818181; } #lresources{ background: transparent url("izqda.gif") bottom no-repeat; padding-bottom: 20px; } /* css Zen Garden submission 117 - 'Brushwood', by Katrin Zieger, http://www.teamwerk.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Katrin Zieger */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: normal 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; color: #f8f698; background: #7e8b4e; margin: 0px; padding: 0; } p { font: normal 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; text-align: left; } a:link { font-weight: bold; text-decoration: underline; color: #F8f698; } a:visited { font-weight: bold; text-decoration: underline; color: #e9c482; } a:hover, a:active { text-decoration: none; color: #F8f698; } /* specific divs */ #container { width: 98%; padding: 0px 0px 20px 0px; margin: 0px; } #pageHeader { position: absolute; top: 0; left: 0; margin: 0 0 20px 0; z-index: 1; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: url(h1.gif) no-repeat left top; display: block; margin: 0; width: 300px; height: 276px } #pageHeader h1 span { display:none } #pageHeader h2 { background: url(h2.gif) no-repeat left top; margin: 0; width: 300px; height: 72px } #pageHeader h2 span { display:none; } #quickSummary { position: absolute; top: 365px; left: 30px; z-index: 2; background: transparent; margin-right: 12px; width: 300px; padding: 0; } #quickSummary p { font-weight: bold; font-size: 12px; line-height: 180%; text-align:right; width: 250px; } #quickSummary a:link { color: #f8f698; text-decoration: underline; } #quickSummary a:hover { text-decoration: none; } #preamble { background: url(bg-preamble.gif) no-repeat left top; margin: 0 0 0 295px; padding: 105px 35px 25px 37px; position: relative; z-index: 5; width: 303px } #preamble h3 { background: url(roadtoenlightenment.gif) no-repeat left top; margin: 0 0 15px; width: 202px; height: 19px } #preamble h3 span { display:none; } #preamble p { color: #50591b; width: 303px; margin-bottom:0; line-height: 165%; } #supportingText { position: relative; margin: 0 0 0 295px; width: 374px; z-index: 6; } #supportingText p { color: #50591b; width: 303px; line-height: 165%; } #supportingText a, a:link { color: #50591b; font-style: italic; font-weight: bold; text-decoration: underline; } #supportingText a:hover { color: #55310e; text-decoration: underline; } #explanation { background: url(explaination-bg.gif) repeat-y left top; display: block; padding: 0 35px 25px 37px; position: relative; width: 303px } #explanation h3 { background: url(sowhat.gif) repeat-y left top; margin: 0 0 15px; width: 173px; height: 19px } #explanation h3 span { display:none; } #participation { background: url(partic-bg.gif) repeat-y left top; display: block; padding: 0 35px 25px 37px; position: relative; width: 303px } #participation h3 { background: url(participation.gif) no-repeat left top; margin: 0 0 15px; width: 99px; height: 18px } #participation h3 span { display:none; } #benefits { background: url(partic-bg.gif) repeat-y left top; display: block; padding: 0 35px 25px 37px; position: relative; width: 303px } #benefits h3 { background: url(benefits.gif) no-repeat left top; margin: 0 0 15px; width: 99px; height: 18px } #benefits h3 span { display:none; } #requirements { background: url(requi-bg.gif) no-repeat left bottom; display: block; padding: 0 35px 30px 37px; position: relative; width: 303px } #requirements h3 { background: url(requirements.gif) no-repeat left top; margin: 0 0 15px; width: 99px; height: 18px } #requirements h3 span { display:none; } #footer { background: transparent; width: 303px; margin: 25px 0 25px 0px; padding: 0 0 0 35px; text-align: center; } #footer a:link { margin: 0 10px 0 10px; color: #F8f698; font-weight: bold; font-style: normal; text-decoration: underline; } #footer a:hover { text-decoration: none; color: #F8f698; } /* start navbar */ #linkList { margin: 0; position: absolute; top: 297px; left: 664px; z-index: 3; } #linkList2 { background: url(select-list.gif) repeat-y left top; padding: 0; width: 141px } #linkList h3.select { background: url(select.gif) no-repeat left top; margin: 0; width: 141px; height: 65px } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(../zengarden-media/h4.gif) no-repeat top left; margin: 25px 0px 5px 0px; width: 60px; height: 18px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: url(archives.gif) no-repeat left top; margin: 0; width: 141px; height: 68px } #linkList h3.archives span { display:none } #linkList h3.favorites { background: url(favorites.gif) no-repeat left top; margin: 0; width: 141px; height: 68px } #linkList h3.archives span { display:none } #lresources { background: url(nav-bottom.gif) no-repeat left bottom; padding-bottom: 15px; z-index: 4 } #linkList h3.resources { background: url(resources.gif) no-repeat left top; margin: 0; width: 141px; height: 68px } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 12px 20px 20px 20px; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; } #linkList li a:link { color: #F8f698; font-weight: bold; font-style: normal; text-decoration: underline; } #linkList li a:hover { text-decoration: none } /* end navbar */ /* extra divs */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none }/* css Zen Garden submission 118 - 'Some Leafs', by Michael Tupy, http://www.t-2.at/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michael Tupy */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css zen garden - "some leafs" - michael tupy - t2 graphic design - http://www.t-2.at/ */ /* this is a basic theme - works with nearly all browsers */ /* all the text is visible and easy to change */ /* the css code is overcoded and long - so its easier for css starters */ /* tested with: */ /* on mac osx: safari 1.2.2, camino 0.8b, mozilla 1.7, firefox 0.9, omniweb 4.5, ie 5.2.3, */ /* on mac os9: ns 7.0.2, ie 5.1.6, */ /* on win98: ie 6.0.2800, ns 7.0.1, moz 1.6, firefox 0.9, opera 7.03, */ /* ie5 win - grrr - start */ body { font: small serif; margin: 0px; padding: 0px; line-height: 14px; color: #000; font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; text-align: center; } /* ie5 win - grrr - end */ /* opera - grrr - start */ html>body { font-size: small; } /* opera - grrr - end */ /* start of the real css */ /* basic elements */ body { color: #444; background-color: #edf6e3; background-image: url(700_28.jpg); background-position: top center; background-repeat: repeat-y; font-size: 11px; line-height: 14px; font-family: Cochin, Georgia, "New Century Schoolbook", "Bitstream Vera Serif", "Times New Roman", times, serif; text-align: left; margin: 0px; padding: 0px; } p { font-size: 11px; line-height: 14px; font-family: Cochin, Georgia, "New Century Schoolbook", "Bitstream Vera Serif", "Times New Roman", times, serif; text-align: left; margin: 0px; padding: 0px; } h1, h2, h3 { font-size: 11px; line-height: 14px; font-weight: bold; font-family: Cochin, Georgia, "New Century Schoolbook", "Bitstream Vera Serif", "Times New Roman", times, serif; text-align: left; margin: 0px; padding: 0px; } a:link { font-weight: bold; text-decoration: none; color: #6faf30; } a:visited, a:visited:hover { font-weight: bold; text-decoration: none; color: #7fc937; } a:hover, a:active { text-decoration: underline; color: #4f711f; } acronym { font-weight: normal; font-style: normal; border: 0; } /* major divs */ #container { width: 700px; position: relative; margin: 0px auto 0px auto; padding: 0px 0px 0px 0px; } #intro { width: 450px; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; } #supportingText { width: 450px; margin: 0px 0px 0px 0px; padding: 0px 10px 0px 10px; } #linkList { position: absolute; top: 255px; left: 0px; width: 220px; margin: 0px 0px 0px 482px; padding: 0px 0px 0px 0px; } /* minor divs */ #pageHeader { width: 700px; height: 20px; /* strange but ie6 needs this */ background-image: url(blatt02aa.jpg); background-position: top center; background-repeat: no-repeat; border-top: 0px; border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; border-left: 1px solid #aaa; margin: 0px 0px 0px 0px; padding: 224px 0px 0px 0px; } #pageHeader h1 { width: 600px; color: #fff; font-size: 24px; line-height: 24px; font-weight: bold; text-transform: uppercase; margin: -30px 0px 0px 10px; padding: 0px 0px 0px 0px; } #pageHeader h2 { width: 600px; color: #fff; font-size: 11px; line-height: 16px; font-weight: normal; padding: 0px 0px 0px 3px; text-transform: uppercase; margin: 0px 0px 0px 10px; padding: 0px 0px 10px 4px; } #quickSummary { width: 450px; background-image: url(stone_24.gif); background-position: top center; background-repeat: repeat; background-color: #284C00; border: 1px solid #aaa; margin: 10px 0px 10px 0px; padding: 10px 10px 10px 10px; } #preamble { width: 450px; border: 1px solid #aaa; background-image: url(leaf_09d.gif); background-position: bottom center; background-repeat: no-repeat; background-color: #fff; margin: 0px 0px 0px 0px; padding: 10px 10px 20px 10px; } #explanation, #participation, #benefits, #requirements { width: 450px; border: 1px solid #aaa; background-image: url(leaf_09d.gif); background-position: bottom center; background-repeat: no-repeat; background-color: #fff; margin: 10px -10px 0px -10px; padding: 10px 10px 20px 10px; } #footer { width: 450px; border: 1px solid #aaa; background-image: url(stone_19.gif); background-position: center center; background-repeat: repeat; background-color: #284C00; margin: 10px -10px 20px -10px; padding: 10px 10px 10px 10px; text-align: center; } #explanation p, #participation p, #benefits p, #requirements p, #preamble p { padding-bottom: 8px; text-align: justify; } #preamble h3, #supportingText h3 { color: #284C00; background-color: #ddd; background-image: url(stone_21.gif); background-position: bottom center; background-repeat: repeat; font-size: 11px; line-height: 16px; text-transform: uppercase; margin: -10px -10px 4px -10px; padding: 4px 4px 4px 10px; } #quickSummary .p1 { color: #fff ! important; font-size: 10px ! important; line-height: 14px; font-weight: bold; text-transform: uppercase; text-align: left; margin: 0px 50px 0px 0px; padding: 0px 0px 10px 0px; } #quickSummary .p2 { color: #fff ! important; font-size: 10px ! important; line-height: 14px; font-weight: normal; text-transform: uppercase; text-align: left; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; } #linkList ul { border-top: 1px dotted #ccc; margin: 5px 5px 0px 5px; padding: 0px 0px 0px 0px; } #linkList li { display: block; list-style-type: none; color: #6c9e2d; background-color: #f8f8f8; font-size: 11px; line-height: 14px; font-weight: normal; font-style: italic; font-family: Cochin, Georgia, "New Century Schoolbook", "Bitstream Vera Serif", "Times New Roman", times, serif; text-align: left; border-bottom: 1px dotted #ccc; margin: 0px 0px 0px 0px; padding: 3px 5px 3px 5px; } #linkList li a:link, #linkList li a:visited, #linkList li a:visited:hover, #linkList li a:hover, #linkList li a:active { font-style: normal; padding-right: 5px; } .c { color: #6c9e2d ! important; font-weight: normal ! important; font-style: italic ! important; margin: 0px 0px 0px 0px; padding: 0px 14px 0px 0px; } #linkList h3 { color: #7fc937; background-color: #ddd; background-image: url(stone_24.gif); background-position: center right; background-repeat: repeat-x; font-size: 11px; line-height: 16px; font-weight: bold; font-family: Cochin, Georgia, "New Century Schoolbook", "Bitstream Vera Serif", "Times New Roman", times, serif; text-transform: uppercase; text-align: left; border-bottom: 1px solid #aaa; margin: 0px 0px 0px 0px; padding: 3px 5px 3px 5px; } #lselect, #lfavorites, #larchives, #lresources { background-image: url(leaf_09a.gif); background-position: bottom center; background-repeat: no-repeat; background-color: #fff; border: 1px solid #aaa; margin: 0px 0px 10px 0px; padding: 0px 0px 30px 0px; } /* hovers */ #preamble:hover { background-image: url(leaf_09f.gif); } #linkList li:hover { background-color: #fefefe; } #lresources:hover { background-image: url(leaf_09b.gif); } /* css Zen Garden submission 119 - 'Pleasant Day', by Kyle Jones, http://www.justkyle.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Kyle Jones */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ html { background: #89b6f9; } body { font: 8pt georgia; color: #172104; background: #89b6f9 none repeat-y; margin: 0px; position: relative; width: 650px; top: 0px; left: auto; right: auto; margin-left: auto; margin-right: auto; } #container p { font: 8pt/14pt georgia; margin-top: 0px; text-align: justify; padding-right: 5px; text-indent: 10px; background: none no-repeat bottom; } #container h3 { font: 600 18pt "trebuchet ms"; color: #ffffff; background: no-repeat url(flower3.jpg) transparent 400px -8px; text-decoration: none; text-align: left; margin: 0px; padding-bottom: 0px; padding-top: 0px; letter-spacing: .5px; height: 40px; text-indent: 5px; } a:link { font-weight: bold; text-decoration: none; color: #dfce3b; } a:visited { font-weight: bold; text-decoration: none; color: #2262a4; } a:hover, a:active { text-decoration: none; color: #ffffff; background: #668fd1; } /* specific divs */ #container { background: url(repeater.jpg) repeat-y top left; padding: 0px 0px 0px 0px; position: absolute; right: auto; left: auto; width: 680px; } #intro { min-width: 470px; position: relative; } #pageHeader { margin-bottom: 20px; background: url(head2.jpg) no-repeat 21px; height: 300px; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent none no-repeat top left; margin-top: 10px; width: 219px; height: 87px; float: left; } #pageHeader h1 span { display:none; background: none; } #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; margin-top: 58px; margin-bottom: 40px; width: 200px; height: 18px; float: right; } #pageHeader h2 span { display:none; } #quickSummary { margin: 0px 20px 20px 10px; width: 650px; font-size: 10px; position: absolute; top: 0px; text-align: left; color: #fffdfa; } #quickSummary p.p1 { text-align: left; top: 0px; font: italic 10px/11px georgia; width: 360px; padding-left: 10px; padding-top: 4px; background: transparent; margin-left: 10px; margin-right: 0px; border-bottom-style: none; border-style: none; } #requirements, #benefits, #participation, #supportingText, #preamble { background: none no-repeat; margin-bottom: 20px; } #quickSummary p.p2 { width: 230px; font-size: 10px; position: absolute; top: 4px; display: block; border-style: none; margin-top: 0px; margin-right: 20px; margin-bottom: 20px; line-height: 11px; border-width: 1px; text-align: center; right: -2px; } #preamble { clear: right; padding: 0px 190px 0px 30px; } #supportingText { padding-left: 30px; margin-bottom: 40px; padding-right: 190px; } #footer { text-align: center; background: no-repeat none -50px 0px transparent; height: 10px; bottom: 0px; padding-bottom: 0px; width: 500px; font-size: 1.5em; padding-left: 0px; margin: 50px 60px 0px 0px; } #linkList { position: absolute; left: 498px; padding-bottom: 10px; width: 0px; margin-top: 95px; top: 0px; } #linkList2 { background: transparent; padding: 10px; margin-top: 150px; width: 130px; font-family: verdana, sans-serif; } #linkList h3.select { width:230px; background: transparent no-repeat url(designs.jpg) 8px 50px; text-align: center; border-bottom-style: none; margin-top: 10px; margin-right: 0px; margin-left: 0px; height: 100px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(favorites.jpg) 5px -3px no-repeat; margin: 10px 0px 0px 0px; width:230px; height: 45px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.jpg) no-repeat 5px -4px; height: 50px; width:230px; margin: 10px 0px -8px 0px; } #linkList h3.archives span { display:none; background: none; visibility: hidden; } #linkList h3.resources { background: transparent url(resources.jpg) no-repeat -6px -5px; margin: 0px 0px 5px 0px; width:220px; height: 30px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li, #linkList2 li { background: #628f13 url(h1.jpg) repeat-x top center; display: block; border-bottom: 2px #4f740e dotted; padding: 10px 0px 8px 5px; width: 128px; line-height: 1.8ex; border-top: 2px dotted #4f740e; margin-top: 0px; margin-bottom: 8px; color: #172104; text-align: left; } #linkList li:hover, #linkList2 li:hover { background: #668fd1 url(h1.jpg) repeat-x top center; display: block; border-bottom: 2px #5475ab dotted; padding: 10px 0px 8px 5px; width: 128px; line-height: 1.8ex; border-top: 2px dotted #5475ab; margin-top: 0px; margin-bottom: 8px; color: #345082; } #linkList li a:link { color: #dfce3b; text-decoration: none; } #linkList li a:link:hover { color: #fff4ee; text-decoration: none; } #linkList li a:visited { color: #2262a4; text-decoration: none; } #linkList li .c { display: block; color: #000000; text-align: right; padding-right: 5px; padding-top: 5px; padding-bottom: 0px; margin-bottom: 0px; } #extraDiv1 { background: transparent; position: absolute; top: 40px; right: 0px; width: 148px; height: 110px; }/* css Zen Garden submission 120 - 'Medioevo', by Emiliano Pennisi, http://www.peamarte.it/01/metro.html */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Emiliano Pennisi */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Medioevo - Realized from Emiliano Pennisi - MetroStation Deisgn - http://www.peamarte.it/01/metro.html */ /*General*/ body { font-family: Georgia,MS Serif,New York,sans-serif; margin-top: 0px; font-size: 0.8em; color: #fff; background-color: #160605; background-image: url(sfondo.gif); background-repeat: no-repeat; background-attachment: fixed; } p,h1,h2,h3 { text-align: justify; width: 325px; margin: 0px 1px 5px; } acronym { font-weight: bold; font-style: oblique; border: 0px; /*Only for Mozilla Firefox*/ } /*Links and Typography*/ a { color: #B69B86; text-decoration: none; } a:hover { color: #fff; border-bottom: 1px dotted #e2eff3; } /*End Links*/ /******************************************************/ /*******************Container**************************/ /******************************************************/ #container { background-color: Black; border-top: 0px; border-left: 1px solid #B69B86; border-right: 1px solid #B69B86; border-bottom: 25px solid #B69B86; padding: 10px; width: 513px; margin: 0% 74px 0%; } #quickSummary{ margin: 8px 0px 50px; } /*Hide the textual logo*/ #pageHeader h1 span, h2 span { display: none; } /*Hide quicksummary Text*/ #quickSummary .p1 span{ display: none; } #quickSummary .p2 { text-transform: uppercase; font-size: 0.8em; background-image: url(quickbg.gif); background-repeat: repeat-y; height: 22px; } #pageHeader { margin: 0; height: 200px; width: 513px; background-image: url(logo.jpg); } /*Hide for image replacement*/ #preamble h3 span { display: none; } #explanation h3 span { display: none; } #participation h3 span { display: none; } #benefits h3 span { display: none; } #requirements h3 span { display: none; } /*End ir*/ /******************************************************/ /*Image Replacement*/ #preamble h3 { background-image: url(01.gif); background-repeat: repeat-y; height: 30px; } #explanation h3 { background-image: url(02.gif); background-repeat: repeat-y; height: 30px; } #participation h3 { background-image: url(03.gif); background-repeat: repeat-y; height: 30px; } #benefits h3 { background-image: url(04.gif); background-repeat: repeat-y; height: 30px; } #requirements h3 { background-image: url(05.gif); background-repeat: repeat-y; height: 30px; } /*End ir*/ /******************************************************/ /*List style ( menu )*/ /*1 Replace with image replacement*/ .select { background-image: url(select_ds.gif); background-repeat: no-repeat; height: 30px; margin: 3px; } /*Hide text conten*/ #lselect .select span { display: none; } /*2*/ .archives { background-image: url(archives.gif); background-repeat: no-repeat; height: 30px; } #larchives .archives span { display: none; } /*3*/ .resources { background-image: url(resources.gif); background-repeat: no-repeat; height: 30px; margin-left: 15px; } #lresources .resources span { display: none; } /*End*/ #linkList ul { list-style: none; } #linkList li a { display: block; } #linkList li a:hover { color: #666; border: none; } #linkList li a.c { color: #fff; font-size: 9px; font-weight: normal; display: inline; padding: 0; text-transform: uppercase; } /*Positioning of menu and list to right*/ #linkList { position: absolute; top: 300px; margin-left: 342px; background: url(menubg.gif) repeat-y; width: 198px; } #linkList li { height: 28px; margin: 0 0 0; padding: 5px; border-bottom: 1px dotted #B69B86; } #linkList2 { font-size: 0.9em; font-weight: bold; color: #B69B86; width: 150px; } #footer { background: url(footerlogo.gif) repeat-y top right; /*No repeat the image logo and place to left*/ margin: 10px 35px 10px; border-bottom: 1px dashed #850E0E; height: 100px; } #footer a { cursor: help; font: 0.8em georgia, helvetica, sans-serif; text-transform: uppercase; color: #850E0E; font-weight: bold; } #footer a:hover { color: #fff; border: 0px; font-weight: bold; } /*End of CSS*/ /* css Zen Garden submission 121 - '60's Lifestyle', by Emiliano Pennisi, http://www.peamarte.it/02/03.html */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Emiliano Pennisi */ /* Added: Sept. 2nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css Zen Garden - '60 lifestyle', by Emiliano Pennisi, http://www.peamarte.it/02/03.html */ /* This illustrations and design was made by Emiliano Pennisi, MetroStation Design, for more info visit --> http://www.peamarte.it/02/03.html The clipart of the cars is realized by Lens Hanger, for more info visit--> http://www.lenshanger.co.uk/*/ /*****************Page debug*****************Good rule to know the structure of the webpage* NOTE: Only compliant browser no IE* div[id]{ border: 1px solid #000; background-color: #fff; margin: 20px 10px; } div[id]:before{ content: "div#" attr(id); background-color: #cf9; color: #060; display: block; } /*****************End Page debug*****************/ body { font-family: palatino, georgia, times new roman, serif; font-size: 70%; line-height: 150%; background: #688FBA url(img/contentBG.gif) bottom left fixed repeat-y; color: #000; margin: 0px; } /*Links and Typography*/ a { color: #000; text-decoration: none; } a:hover { color: #416D8E; border-bottom: 1px dotted #e2eff3; } acronym { font-weight: bold; font-style: oblique; cursor: help; border: 0px; /*Only for Mozilla Firefox*/ } h3 { color: #416D8E; font-size: 20px; font-weight: bold; margin-top: 13px; margin-bottom: 15px; border-bottom: 5px solid #416D8E; padding-bottom: 10px; padding-left: 55px; } /*H3 Background*/ div#linkList h3,div#intro h3{ background: url(img/h3bg_nav.gif) no-repeat 0px -3px; padding-left: 40px; } div#explanation h3{ background: url(img/h3bg.gif) no-repeat 0px -3px; } div#participation h3{ background: url(img/h3bg_part.gif) no-repeat 0px -3px; padding-left: 50px; } div#benefits h3{ background: url(img/h3bg_benef.gif) no-repeat 0px -3px; padding-left: 37px; } div#requirements h3{ background: url(img/h3bg_req.gif) no-repeat 0px -3px; padding-left: 47px; } /*End H3 background*/ /*Container*/ #container { margin-left: 0px; margin-top: 0px; padding: 0px; } /*Header image*/ div#extraDiv1{ background: url(img/header.gif) no-repeat; width: 100%; height: 648px; margin-left: 15px; margin-top: -20px; } #pageHeader { display: none; } #pageHeader h1 { width: 100%; height: 100%; } #intro { width: 300px; position: absolute; left: 20px; top: 1214px; } #supportingText { width: 450px; position: absolute; left: 330px; top: 620px; } #quickSummary p.p1 span{ display: none; } #quickSummary p.p2 { padding: 0 0 8px 0; text-transform: uppercase; font-weight: bold; } div#explanation,div#participation,div#benefits,div#requirements{ width: 400px; margin-left: 25px; } #footer, #quickSummary, #preamble, #lselect, #lfavorites, #lresources, #larchives { background-color: #CDE0F3; padding: 7px; margin: 15px; border: 5px solid #FFF0F1; } /*Rules for navigation*/ #linkList ul { margin: 0px; padding: 0px; } #linkList{ width: 300px; position: absolute; left: 20px; top: 598px; } #linkList li a{ text-transform: uppercase; font-size: 10px; font-weight: bold; } #linkList li a:hover { color: #416D8E; border: none; } #linkList li { list-style-type: none; display: block; margin: 0 0 0; padding: 1px; border-bottom: 1px dotted #000; } #linkList li a.c { color: #416D8E; font-size: 9px; font-weight: bold; display: inline; padding: 0; text-transform: uppercase; } #linkList li a:hover.c{ background-color: White; } /*End nav rules*/ /*Footer*/ div#footer{ border: 1px solid #416D8E; text-transform: uppercase; font-weight: bold; } /*En of code*/ /* css Zen Garden submission 122 - 'Centerfold', by John Oxton, http://joshuaink.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, John Oxton */ /* Added: Sept. 13th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* August 2004 =========================================================== Title: Centerfold Author: John Oxton Web Site: www.joshuaink.com Note: Ivy on the sides - in retrospect this idea was probably (not conciously) taken from hicksdesign.co.uk ========================================================================== */ /* General =============================================================== */ /* Font-sizes are relative to allow scaling in IE tutorial found at www.clagnut.com/blog/348/ */ body { font:75% Arial, Helvetica, sans-serif; color:#333; background:white url(back.png) repeat-y top center; /* zeldman.com */ margin:0; text-align:center; /* Positions all content in the center of the viewport */ } p{ font-size:1em; /* because of body font-size being 75% acutal font size 0.75em */ line-height:1.4em; margin:0.7em 0 0.7em 0; padding:0; } #preamble p, #supportingText p{ background:transparent url(hr.png) no-repeat bottom center; margin:0; padding:1.4em 0 1.4em 0; } a{ color:#900; } /* a:active added for IE a:focus for Mozilla - added to aid accesibility more than visual appearance */ a:hover, a:focus, a:active { background:black; color:white; border:0; text-decoration:none; } /* Show dotted a:link style only in decent browsers (not IE) - taken from http://www.shauninman.com/mute/project/this_is_cereal.php */ div[id="container"] a, div[id="container"] a:visited{ text-decoration:none; border-bottom:1px dotted #900; } /* Becuase IE6 doesn't do it by default - IE5 doens't do it at all */ acronym{ border-bottom:1px dotted #333; cursor:help; } acronym:hover{ border-top:1px dotted #333; border-bottom:0; } #lresources acronym{ border:0; } /* Content =============================================================== */ /* Center the site and return the contents to the left hand side */ #container { width:515px; text-align:left; padding:0; margin:0 auto; } /* position content to the right hand side */ #intro, #preamble, #supportingText, #quickSummary{ /* width when added with linkList width is 17px short of total site width creating a natural margin in the center */ width:290px; float:right; clear:right; margin:20px 0 0 0; } /* Replace the whole intro section with a graphic */ #intro #pageHeader { width:290px; height:307px; background:white url(intro.jpg) no-repeat top center; text-indent:-10000px; float:right; margin:10px 0 0 0; padding:0; } /* Replace p1 quickSummary with a graphic */ #quickSummary{ height:180px; background: url(quicksum.png) no-repeat bottom center; margin:10px 0 0 0; padding:0; text-indent:-10000px; } /* recover quickSummary p2 from text-indent and move above the graphic */ #quickSummary .p2{ margin:-20px 0 0 0; padding:0; text-indent:0; text-align:center; text-transform:uppercase; font: 0.8em Georgia, "Times New Roman", Times, serif; /* acutal size 0.6em; */ background:white; /* background colour for text size increase, masks background graphic */ } /* Hide headings from visual display (still visible to screen readers) and replace with images - first read about this at hicksdesign.co.uk */ h3{ width:290px; height:35px; margin:5px 0 5px 0; padding:0; text-indent:-10000px; float:right; overflow:hidden; } #preamble h3{ background:url(preamble.png) no-repeat center left; } #explanation h3{ background:url(explanation.png) no-repeat center left; } #participation h3{ background:url(participation.png) no-repeat center left; } #benefits h3{ background:url(benefits.png) no-repeat center left; } #requirements h3{ background:url(requirements.png) no-repeat center left; } /* Navigation ============================================================= */ #linkList{ font-family:Verdana, Arial, Helvetica, sans-serif; margin:0; padding:97px 0 0 0; width:208px; text-align:right; float:left; /* Only IE5 MAC needs the left float \*/ float:none; /* End IE5 MAC comment hack found at stopdesign.com see also http://www.stopdesign.com/log/2004/07/06/filtering-css.html */ } /* Because the linkList is not floated (except for IE5 MAC), this casued problems with usual image replacement methods, so... */ #linkList h3{ float:none; display:none; } /* linkList h3 may be hidden from screen readers and printers due to display none */ @media aural, braille, print{ #linkList h3{ display:block; } } #lselect, #lfavorites, #larchives, #lresources { /* Something shaky going on in IE6 with the background images, border-left stops it shaking */ border-left:1px solid white; padding:75px 0 0 0; margin:0 0 40px 0; } #lselect{ background:transparent url(designhead.png) no-repeat top left; } #lfavorites{ background:transparent url(favoritehead.png) no-repeat top left; } #larchives{ background:transparent url(archivehead.png) no-repeat top left; } #lresources{ background:transparent url(resourceshead.png) no-repeat top left; } #linkList ul{ margin:0; padding:0; list-style:none; } #linkList li{ font-size:0.8em; display:block; margin:0; padding: 0 0 7px 0; border-bottom:1px solid #F9F7F6; } /* Link Styles */ #linkList li a{ display:block; padding:4px 10px 4px 5px; margin:0 0 5px 0; border:0; text-transform:uppercase; font-weight:bold; text-decoration:none; color:#93A871; } /* Background position http://wellstyled.com/css-nopreload-rollovers.html */ #lselect li a, #lfavorites li a{ background:transparent url(visited.png) no-repeat -100px; } #lselect li a:visited, #lfavorites li a:visited{ background-position:0 50% ; } #linkList li a:hover, #linkList li a:focus, #linkList li a:active{ padding-right:6px; border-right:4px solid #81B4CF; color:#81B4CF; text-decoration:none; } #linkList li a.c{ display:inline; padding:0 2px 0 0; text-transform:lowercase; font-style:italic; font-weight:normal; margin:0; border:0; background-position:-100px; } #linkList li a.c:hover, #linkList li a.c:visited, #linkList li a.c:active, #linkList li a.c:focus{ padding:0 2px 0 0; border:0; background-position:-100px; } #larchives li, #lresources li{ border:0; } #lresources li a, #larchives li a{ padding-right:6px; border:1px solid #F9F7F6; border-right:4px solid #D6DECA; text-decoration:none; background:white; } #footer{ height:60px; background:transparent url(relax.png) no-repeat top left; margin:20px 0 0 0; padding:40px 0 0 30px; } #footer a{ color:#DCE4C2; text-decoration:none; font-weight:bold; border:0; } #footer a:hover, #footer a:focus, #footer a:active{ color:#900; text-decoration:none; font-weight:bold; border-bottom:1px dotted #900; background:transparent; } /* Print, because we're running out of trees faster than we are bandwidth ================================================ */ @media print{ body { text-align:left; color:black; } a{ color:black; text-decoration:none; border:0; } #linkList, #footer, #quickSummary .p2{ display:none; position:absolute; } #container{ width:90%; } #intro, #intro #pageHeader, #preamble, #supportingText, #quickSummary{ float:none; width:90%; display:block; text-indent:0; margin:0; padding:0; width:auto; height:auto; } h1, h2, h3{ display:block; text-indent:0; float:none; color:black; width:auto; height:auto; float:none; } }/* css Zen Garden submission 123 - 'Skyroots', by Axel Hebenstreit, http://www.sonnenvogel.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Axel Hebenstreit */ /* Added: Sept. 13th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Basic Elements */ html, body { color: white; font: 11px/16px "trebuchet ms", arial, helvetica, sans; background: #3a200a url(bg.gif) repeat-y center top; text-align: center; margin: 0; padding: 0; } p { font: 11px/16px "trebuchet ms", arial, helvetica, sans; text-align: justify; letter-spacing: 1px; margin: 0 0 0; padding: 0 22px 15px; } a { color: #59365f; text-decoration: none; background-color: #ffae00; } a acronym { color: #59365f; text-decoration: none; } #linkList a acronym { color: #ffae00; text-decoration: none; } a:hover { color: #feffff; text-decoration: underline; } acronym { color: #ffae00; text-transform: uppercase; cursor: help; } /* specific divs */ #footer { background: transparent url(footer_bg.gif) no-repeat left bottom; padding: 20px 0 60px 22px; } #container { background: #411948 url(steine.gif) repeat-y; display: block; margin: 0 auto; padding: 0; position: relative; width: 770px; } #lselect { background: #55012b url(kasten1_03.gif) no-repeat left bottom; padding-bottom: 30px; position: relative; } #larchives, #lresources { background: #b99ab8 url(blume_unten.gif) no-repeat left bottom; margin-top: 26px; padding-bottom: 15px; } /* header graphics */ #pageHeader { background: url(top.jpg) no-repeat 0 0; text-indent: -2000px; margin: 0; padding: 0; height: 366px; } #pageHeader h2 { line-height: 0; background: #411948 url(headlines_02.gif) no-repeat; text-indent: -2000px; display: block; margin: 0; padding: 0; position: relative; top: 385px; left: 355px; width: 370px; height: 68px; } #quickSummary { background-color: #59365f; text-align: left; margin: 82px 0 0; padding: 0; position: relative; top: 0; left: 355px; width: 370px; height: auto; } * html #pageHeader h2, * html #quickSummary { left: 155px; } #quickSummary p { font-style: italic; font-weight: bold; padding-right: 22px; padding-left: 22px; width: 323px; } h3 { text-indent: -2000px; margin: 0; padding: 0; } h1, h2 { display: none; } #preamble h3 { background: url(headlines_03.gif) no-repeat 0 0; margin: 0; padding: 0; width: 370px; height: 48px; } #explanation h3 { background: url(headlines_04.gif) no-repeat 0 0; margin: 0; padding: 0; width: 370px; height: 48px; } #participation h3 { background: url(headlines_05.gif) no-repeat 0 0; margin: 0; padding: 0; width: 370px; height: 48px; } #benefits h3 { background: url(headlines_06.gif) no-repeat 0 0; margin: 0; padding: 0; width: 370px; height: 48px; } #requirements h3 { background: url(headlines_07.gif) no-repeat 0 0; margin: 0; padding: 0; width: 370px; height: 48px; } #preamble, #supportingText { background-color: #59365f; text-align: left; position: relative; left: 355px; width: 370px; } * html #preamble, * html #supportingText { background-color: #59365f; text-align: left; position: relative; left: 155px; width: 370px; } /*linklist */ #linkList { position: absolute; top: 366px; left: 82px; width: 229px; overflow: hidden; } #linkList2 { text-align: left; position: relative; left: 38px; width: 191px; } #linkList h3 { margin: 0; width: 229px; height: 68px; } #linkList h3.select { background: url(kastenlilie.gif) no-repeat left top; position: relative; right: 38px; } #linkList h3.archives { background: url(liliarchives_01.gif) no-repeat left top; margin-top: 23px; position: relative; right: 38px; } #linkList h3.resources { background: url(liliresourcen_01.gif) no-repeat left top; margin-top: 23px; position: relative; right: 38px; } #linkList h3.select span { color: #feffff; font-size: 12px; font-family: "Trebuchet MS", Geneva, Arial, Helvetica, SunSans-Regular, sans-serif; text-transform: uppercase; text-indent: 0; letter-spacing: 1px; display: block; padding-top: 40px; padding-left: 70px; } #linkList h3.archives span, #linkList h3.resources span { display: none; } #linkList ul { margin: 0; padding: 0; } #linkList li { font-size: 11px; line-height: 11px; background: url(bullet1.gif) no-repeat 0 12px; list-style-type: none; display: block; margin: 0 0 0 14px; padding: 0 0 0 20px; height: auto; } #linkList li a { color: #feffff; font-size: 11px; font-weight: bold; line-height: 15px; text-decoration: none; background: transparent; display: block; padding: 9px 0 0 0; width: auto; } #linkList li a:hover { color: #ffae00; text-decoration: underline; } #linkList li a.c:link, #linkList li a.c:visited { color: #ffae00; font-size: 11px; font-weight: normal; line-height: 15px; display: inline; } #linkList li a.c:hover { color: #feffff; text-decoration: underline; } #linkList #larchives li, #linkList #lresources li { background: url(bullet2.gif) no-repeat 0 9px; list-style-type: none; display: block; margin-left: 14px; padding-left: 20px; height: 25px; } #linkList #larchives li a, #linkList #lresources li a { color: #411948; padding-top: 5px; padding-bottom: 3px; } #linkList #larchives li a:hover, #linkList #lresources li a:hover { color: #feffff; } /* extra divs */ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* css Zen Garden submission 124 - 'Teatime', by Michaela Maria Sampl, http://www.freecom.at/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michaela Maria Sampl, except background image, copyright Squidfingers - http://squidfingers.com/patterns/ */ /* Added: Sept. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* BASICS */ body { font: 9pt/16pt Georgia, Times New Roman, Times, serif; color: #010E22; background: #F5F5E9 url(pattern.gif) repeat; margin: 0px; border: 0px; padding: 0px; text-align: center; } p { font: 9pt/16pt Georgia, Times New Roman, Times, serif; margin-top: 0px; text-align: left; color: #010E22; } a:link { font-weight: bold; text-decoration: none; color: #A8A439; } a:visited { font-weight: bold; text-decoration: none; color: #6D7134; } a:hover, a:active { text-decoration: underline; color: #010E22; } /* LAYOUT */ #container { text-align: left; position: relative; background: #fff url(teacup.jpg) no-repeat top left; margin: 10px auto; border: 10px solid #C7CDD8; padding: 0px; width: 760px; voice-family: "\"}\""; voice-family: inherit; width: 740px; } html>body #container { width: 740px; } #intro { background: url(leaves_neu.gif) no-repeat top right; margin: 0px; } #pageHeader { padding-top: 65px; margin-left: 230px; } #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; margin-top: 0px; margin-left: 0px; margin-bottom: 16px; width: 192px; height: 22px; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; margin-left: 0px; margin-bottom: 68px; margin-top: 0px; width: 372px; height: 33px; } #pageHeader h2 span { display:none; } /* CONTENT */ #quickSummary { position: absolute; top: 320px; left: 30px; width: 172px; } #quickSummary p { font: bold 8pt/16pt Georgia, Times New Roman, Times, serif; text-align:left; } #preamble { margin: 0px 0px 0px 230px; padding: 0px 10px 0px 10px; width: 450px; border: 1px solid #B2B9C4; border-bottom: 1px solid #F1F2EF; background: #F1F2EF url(leave_piece_1.gif) no-repeat left top; } #supportingText { background: #F1F2EF url(bg.gif) no-repeat center top; border: 1px solid #B2B9C4; border-top: 1px solid #F1F2EF; margin-left: 230px; width: 470px; margin-bottom: 40px; padding-bottom: 10px; } #explanation { margin: 0px 10px 0px 10px; width: 450px; } #participation, #benefits, #requirements { margin: 15px 10px 0px 10px; width: 450px; } /* LINKS */ #linkList { position: absolute; top: 520px; left: 30px; } #linkList2 { font: 9px verdana, sans-serif; padding: 0px; margin-top: 20px; width: 150px; } #linkList h3.select { background: transparent url(h3_select.gif) no-repeat top left; margin: 0px 0px 0px 0px; width: 150px; height: 36px; } #linkList h3.select span { display:none } #linkList h3.favorites { background: transparent url(h3_favorites.gif) no-repeat top left; margin: 25px 0px 0px 0px; width: 150px; height: 36px; } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(h3_archives.gif) no-repeat top left; margin: 25px 0px 0px 0px; width: 150px; height: 36px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(h3_resources.gif) no-repeat top left; margin: 25px 0px 0px 0px; width: 150px; height: 36px; } #linkList h3.resources span { display:none; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #A8A439; font-weight: normal; } #linkList li a:visited { color: #010E22; font-weight: normal; } #linkList #lselect a.c:link { color: #383B16; font-weight: normal; } #linkList #lselect a.c:visited { color: #010E22; font-weight: normal; } /* FOOTER */ #footer { position: absolute; top: 10px; right: 50px; } #footer a:link, #footer a:visited { margin-right: 10px; } /* HEADLINES */ h3 { text-align: left; margin-bottom: 0px; } h3 span { display: none; } #preamble h3 { background: transparent url(h3_the_road.gif) no-repeat top left; width: 450px; height: 66px; margin-top: 15px; } #supportingText h3 { width: 450px; height: 50px; } #explanation h3 { background: transparent url(h3_a.gif) no-repeat top left; margin-top: 25px; } #participation h3 { background: transparent url(h3_b.gif) no-repeat top left; } #benefits h3 { background: transparent url(h3_c.gif) no-repeat top left; } #requirements h3 { background: transparent url(h3_d.gif) no-repeat top left; } /* css Zen Garden submission 125 - 'Beccah', by Chris Morrell, http://www.cmorrell.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Chris Morrell */ /* Added: Sept. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* General Styles */ html, body { margin: 0; padding: 0; } body { background: #eee; font: 76% Verdana, Arial, Helvetica, sans-serif; } p, div { font-size: 1em; } a:link { color: #900; } a:hover { color: #f00; } a:visited { color: #303; } acronym { cursor: default; } .accesskey { text-decoration: underline; } #container { position: relative; background: url(header.jpg) no-repeat; padding: 170px 10px 10px 10px; width: 770px; } /* Page Header Styles */ #pageHeader { display: none; } /* Navigation Bar Styles */ #linkList { position: absolute; top: 173px; left: 550px; background: url(sidebar.jpg) no-repeat; padding: 20px 25px 0 25px; width: 213px; voice-family: "\"}\""; voice-family: inherit; width: 182px; } html>body #linkList { width: 192px; } #linkList ul, #linkList li { list-style-type: none; margin: 0; padding: 0; } /* "Select a Design" Styles */ #lselect { margin: 100px 0 0 0; } #lselect li { margin-bottom: 5px; } #lselect a { font: bold 1em Georgia, "Times New Roman", Times, serif; display: block; font-variant: small-caps; text-decoration: none; letter-spacing: .3em; } #lselect a.c { font: 1em Verdana, Arial, Helvetica, sans-serif; display: inline; text-transform: none; letter-spacing: normal; } #lselect a.c:link { text-decoration: none; color: #000; } #lselect a.c:hover { text-decoration: underline; color: #f00; } h3.select { margin: 0; padding: 0; background: url(select-a-design.jpg) no-repeat; position: absolute; width: 399px; height: 225px; left: 0px; top: -130px; } h3.archives { margin: 0; padding: 0; position: relative; width: 209px; height: 68px; background: url(archives.gif) no-repeat; } h3 span { display: none; } /* "Archives" Styles */ #larchives li, #lresources li { border-bottom: 1px solid #ddd; margin-bottom: 7px; } #larchives a, #lresources a { text-decoration: none; } /* "Resources" Styles */ h3.resources { margin: 0; padding: 0; position: relative; width: 209px; height: 68px; background: url(resources.gif) no-repeat; } /* Main Content Styles */ #intro, #supportingText { margin: 0 230px 0 0; } #intro h3, #supportingText h3 { background-repeat: no-repeat; margin: 0; padding: 0; height: 50px; width: 475px; } #intro p, #supportingText p { margin-left: 20px; } #preamble, #supportingText { background: url(background.jpg) repeat-y; font: 1.3em Georgia, "Times New Roman", Times, serif; } #participation p, #benefits p { width: 730px; } /* Headings */ #explanation h3 { background-image: url(explanation.gif); } #participation h3 { background-image: url(participation.gif); } #benefits h3 { background-image: url(benefits.gif); } #requirements h3 { background-image: url(requirements.gif); } /* Quick Summary */ #quickSummary { cursor: default; font: 1.35em "Courier New", Courier, mono; margin: 0; padding: 71px 45px 3px 35px; position: relative; top: -34px; left: -10px; background: url(summary.jpg) no-repeat; color: #600; } /* Preamble */ #preamble { margin: 0; } #preamble h3 { background-image: url(preamble.gif); } /* Requirements */ #requirements p { width: 640px; } #requirements p.p1, #requirements p.p2, #requirements p.p3, #requirements p.p4 { background-repeat: no-repeat; padding-left: 90px; } #requirements p.p1 { background-image: url(1.gif); } #requirements p.p2 { background-image: url(2.gif); } #requirements p.p3 { background-image: url(3.gif); } #requirements p.p4 { background-image: url(4.gif); } /* Footer */ #requirements p.p5, #footer { color: #aaa; text-align: center; width: 770px; } #requirements p.p5 { border-top: 1px solid #ccc; padding: 15px 0 0 0; margin: 100px 0 0 0; } #footer { margin: 0 0 30px 0; } #requirements p.p5 a, #footer a { color: #aaa; } /* css Zen Garden submission 126 - 'C-Note', by Brian Williams, http://www.ploughdeep.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Brian Williams */ /* Added: Sept. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /*Portrait of Benjamin Franklin adapted from the U.S. 100 dollar bill; the intaglio for which was originally made by Thomas Hipschen, Master Engraver for the U.S. Bureau of Engraving and Printing.*/ /*--------------------------------------- GRID ---------------------------------------*/ body { margin:0; padding:0;} #container { position:absolute; width:100%;} #pageHeader { width:918px; height:320px;} #quickSummary { position:absolute; top:202px; left:296px; width:246px; height:118px;} #quickSummary p.p2 { position:absolute; top:-28px; left:324px; width:150px; padding:63px 0 50px 0; z-index:3;} #preamble {padding-top:35px;} #preamble, #supportingText { margin-left:185px; width:410px; position:relative; /*\*/left:185px; margin-left:0;/**/} #preamble p.p1 { position:absolute; top:35px; left:-170px; float:left;} #footer { padding:80px 0; text-align:center;} #linkList { position:absolute; top:238px; left:620px; width:480px; z-index:1;} #linkList2 { width:155px; position:relative; top:116px;} /*--------------------------------------- IMAGES ---------------------------------------*/ body {background:url(masthead.jpg) repeat-x;} #container {background:url(sidebody.gif) repeat-y;} #intro {background:url(logo-on-sunburst.jpg) no-repeat;} #pageHeader {background:url(PoorRichard.jpg) no-repeat;} #quickSummary {background:url(quickSummary.gif) no-repeat;} #quickSummary p.p2 {background:url(serial.gif) no-repeat;} #preamble h3 {background:url(preamble-h3.gif) no-repeat;} #preamble p.p1 {background:url(preamble-p1.gif) no-repeat;} #explanation h3 {background:url(explanation-h3.gif) no-repeat;} #participation h3 {background:url(participation-h3.gif) no-repeat;} #benefits h3 {background:url(benefits-h3.gif) no-repeat;} #requirements h3 {background:url(requirements-h3.gif) no-repeat;} #linkList {background:url(watermark.png) top right no-repeat;} #lselect h3 {background:url(lselect-h3.gif) no-repeat;} #larchives h3 {background:url(larchives-h3.gif) no-repeat;} #lresources h3 {background:url(lresources-h3.gif) no-repeat;} /*--------------------------------------- TYPOGRAPHY ---------------------------------------*/ body { font:76% Arial, Helvetica, sans-serif; color:#6C7A70;} h1, h2, h3, h4, h5, h6, p, ol, ul, dl, dt, dd { margin:0; padding:0; list-style-type:none;} h3 {overflow:hidden;} h3 span, #preamble p.p1 span {visibility:hidden;} h1, h2, #quickSummary p.p1{ position:absolute; top:-500px;} p { line-height:2em; text-indent:1em; text-align:justify;} a { text-decoration:underline; color:#728569;} a:hover { text-decoration:underline; color:#900 !important;} a:visited { text-decoration:underline; color:#6C7A70;} #quickSummary p.p2 { line-height:normal; text-indent:0; text-align:left; letter-spacing:1px; text-transform:lowercase; font-variant:small-caps; font-size:10px; voice-family: "\"}\""; voice-family:inherit; font-size:12px;} #supportingText p {margin:5px 0;} #preamble p.p1 { height:0; padding-top:200px; width:155px;} #preamble h3, #supportingText h3 { height:20px; margin-bottom:8px; voice-family: "\"}\""; voice-family:inherit; height:0; padding-top:20px;} #explanation h3 { height:0; padding-top:25px;} #supportingText div {margin-top:20px;} #linkList2 div {margin-top:10px;} #linkList2 ul { margin-top:-110px; /*\*/margin-top:0;/**/} #linkList li { padding:10px 0; color:#909989; letter-spacing:1px;} #linkList2 h3 { height:10px; h\eight:0; padding-top:10px;} #lselect { font-variant:small-caps; text-align:right;} #lselect a { display:block; text-align:left; font:1.1em Georgia, serif; font-variant:normal;} #lselect a.c, #larchives, #lresources, #footer { display:inline; font-family:Arial, Helvetica, sans-serif; text-transform:lowercase; font-variant:small-caps; text-decoration:none; font-size:.8em; voice-family: "\"}\""; voice-family:inherit; font-size:1.0em;} #larchives, #lresources, #footer { display:block; letter-spacing:0px;}/* css Zen Garden submission 128 - 'Dragen', by Matthew Buchanan, http://www.cactuslab.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Matthew Buchanan */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Makes use of Alternate Box Model Hacks as described by Edwardson Tan: http://www.info.com.ph/~etan/w3pantheon/style/abmh.html Makes use of Phark Revisited image replacement as described by Dave Shea: http://www.mezzoblue.com/tests/revised-image-replacement/ Tested and 100% compatible with: Internet Explorer 5.01+ (Win) Firefox 0.9.3 (Win) Opera 7.5.3 (Win) Safari 1.2.3 (Mac) Netscape 7.1 (Mac) Very minor issue found with: Internet Explorer 5.2.3 (Mac) Toy Dragon image by Maartje van Caspel, via iStockPhoto.com http://www.vancaspelenvdr.nl/portfolio/ http://www.istockphoto.com/user_view.php?id=127925 */ /* Document Styles */ body { background: #ccc; font: normal 10px/16px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, Arial, sans-serif; color: #666; margin: 15px; text-align: center; /* For IE */ } p { margin: 0 0 5px 0; } p.p1 { font-size: 13px; line-height: 20px; } h3 { color: #18d; font-size: 10px; font-weight: normal; text-transform: uppercase; margin: 30px 0 2px 0; } a:link, a:visited { color: #9c0; text-decoration: none; } a:hover, a:active { color: #fff; background: #9c0; } ul { margin: 0; padding: 0 23px 10px 27px; list-style: none; line-height: 1.2em; } li { padding-bottom: 7px; } acronym { font-style: normal; border-bottom: 1px dotted #666; } .accesskey { text-decoration: underline; } /* Container Styles */ #container { position: relative; width: 720px !important; width /**/: 750px; background: #fff url(container_bg.gif) repeat-y; border: 15px solid #fff; margin: 0 auto; padding: 0; text-align: left; /* For IE, see above */ } /* Intro Styles */ #pageHeader { width: 720px; height: 220px; background: #18d url(title.jpg) no-repeat; } #pageHeader h1, #pageHeader h2 { text-indent: -999em; margin: 0; } #quickSummary { width: 720px; height: 39px; border-top: 1px solid #fff; background: #147; } #quickSummary p.p1 { position: absolute; left: -999em; } #quickSummary p.p2 { width: 248px !important; width /**/: 276px; height: 28px !important; height /**/: 39px; color: #6cf; margin: 0; padding: 11px 0 0 27px; border-right: 1px solid #fff; } #quickSummary a:link, #quickSummary a:visited { text-decoration: none; text-transform: uppercase; color: #fff; } #quickSummary a:hover, #quickSummary a:active { text-decoration: underline; background: transparent; } /* Supporting Text Styles */ #preamble, #explanation, #participation, #benefits, #requirements { margin: 0 50px 0 320px; } #footer { width: 708px !important; width /**/: 720px; height: 24px !important; height /**/: 30px; background: #18d; margin-top: 15px; padding: 6px 12px 0 0; border-top: 1px solid #fff; text-align: right; } #footer a:link, #footer a:visited { text-transform: uppercase; color: #fff; } #footer a:hover, #footer a:active { color: #18d; background: #fff; } /* Link List Styles */ #linkList { position: absolute; top: 260px; left: 0px; width: 275px; border-bottom: 1px solid #fff; } #linkList h3 { text-indent: -1100px; height: 45px; margin: 0; } #linkList a:link, #linkList a:visited { font-size: 11px; color: #fff; } #linkList a:hover, #linkList a:active { background: #fff; } #linkList a.c { font-size: 10px; } #linkList acronym { border-bottom: none; } #lselect, #lfavorites { border-top: 1px solid #fff; background: #18d; } #lselect h3 { background: url(select.gif); } #lfavorites h3 { background: url(favourites.gif); } #lselect li, #lfavorites li { color: #6cf; background: url(select_bg.gif) repeat-x left bottom; } #lselect a:hover, #lselect a:active, #lfavorites a:hover, #lfavorites a:active { color: #18d; } #larchives { border-top: 1px solid #fff; background: #9c0; } #larchives h3 { background: url(archives.gif); } #larchives li { color: #cf3; background: url(archives_bg.gif) repeat-x left bottom; } #larchives a:hover, #larchives a:active { color: #9c0; } #lresources { border-top: 1px solid #fff; background: #d8c; } #lresources h3 { background: url(resources.gif); } #lresources li { color: #fcc; background: url(resources_bg.gif) repeat-x left bottom; } #lresources a:hover, #lresources a:active { color: #d8c; }/* css Zen Garden submission 130 - 'Pseudo-Sahara', by John Barrick, http://www.waycoolwebdesign.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, John Barrick */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font: 83%/150% verdana, arial; color: #555753; background: #E6CCB3 url(bg_gold-blue-beige.gif) repeat-x top; margin: 0px; padding: 0px; } p { font: 83%/150% verdana, arial; margin-top: 0px; text-align: justify; } h3 { font: normal 100% verdana, arial; letter-spacing: 1px; margin-bottom: 0px; } a:link { font-weight: bold; text-decoration: none; color: #4E7ED1; } a:visited { font-weight: bold; text-decoration: none; color: #4E7ED1; } a:hover, a:active { text-decoration: none; color: #4E7ED1; border-bottom: dotted 1px } /* specific divs */ #container { background: url(bg_hdr-csszengarden.jpg) no-repeat top left; padding: 0px; margin: 0px; position: absolute; top: 0px; left: 0px; width: 744px; height: 326px; } #intro { } #pageHeader { } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent; } #pageHeader h1 span { display:none } #pageHeader h2 { background: transparent; float: right; } #pageHeader h2 span { display: none; } #quickSummary { position: absolute; top: 175px; left: 26px; width: 178px; height: 150px; color: #000; overflow: auto; } #quickSummary p { font: 83%/133% verdana, arial; text-align: left; letter-spacing: 1px; } #preamble { position: absolute; top: 253px; left: 255px; width: 470px; height: 200px; overflow: auto; } #supportingText { position: absolute; top: 466px; left: 255px; width: 470px; } #footer { text-align: center; margin-bottom: 11px; font: 83%/150% verdana, arial; } #footer a:link, #footer a:visited { margin-right: 20px; } #preamble h3 { background: transparent url(bg_hdr_road-to.gif) no-repeat top left; } #explanation h3 { background: transparent url(bg_hdr_what-is-this-about.gif) no-repeat top left; } #participation h3 { background: transparent url(bg_hdr_participation.gif) no-repeat top left; } #benefits h3 { background: transparent url(bg_hdr_benefits.gif) no-repeat top left; } #requirements h3 { background: transparent url(bg_hdr_requirements.gif) no-repeat top left; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 0px; width: 420px; height: 32px; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display:none; } #explanation, #participation, #benefits, #requirements { margin-bottom: 22px; } #linkList { background: transparent url(bg_nav-left.gif) top left repeat-y; position: absolute; top: 330px; left: 0px; width: 256px; margin-top: -4px; z-index: 1; } #linkList2 { font: 82%/150% verdana, arial; margin: 0px; background: transparent url(bg_leftnav_bottom.jpg) bottom left no-repeat; } #linkList h3.select { background: transparent url(bg_hdr_select-a-design.gif) no-repeat top left; width: 256px; height: 26px; margin-top: 0px; margin-bottom: 11px; margin-left: 0px; margin-right: 0px; } #linkList h3.select span { display: none } #linkList h3.favorites { background: transparent url(bg_hdr_favorites.gif) no-repeat top left; width: 256px; height: 26px; } #linkList h3.favorites span { display: none } #linkList h3.archives { background: transparent url(bg_hdr_archives.gif) no-repeat top left; width: 256px; height: 26px; } #linkList h3.archives span { display: none } #linkList h3.resources { background: transparent url(bg_hdr_resources.gif) no-repeat top left; width: 256px; height: 26px; } #linkList h3.resources span { display: none } #lselect, #lfavorites, #larchives { margin-bottom: 20px; } #lselect h3, #lfavorites h3, #larchives h3, #lresources h3 { margin-bottom: 11px; } #lselect ul li, #lfavorites ul li, #larchives ul li, #lresources ul li { margin-left: 28px; width: 160px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; background: transparent url(cr1.gif) no-repeat top center; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #4E7ED1; } #linkList li a:visited { color: #4E7ED1; } #lselect ul a { display: block; font-weight: bold; margin-bottom: -2px; } #lselect ul a.c { display: inline; font-weight: normal; } #lselect ul a:hover { color: #000; text-decoration: none; border: none; } #lresources { background: transparent url(bg_leftnav_bottom.jpg) bottom left no-repeat; padding-bottom: 165px; }/* css Zen Garden submission 131 - 'Type Thing', by Michal Mokrzycki, http://nf.hyperreal.info/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michal Mokrzycki */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { font-family: Georgia, Palatino Linotype, Times, Times New Roman, serif; color: #fff; background: #fff url(body_back.gif) top left repeat-y; margin: 0; padding: 0 0 20px 0; } /* relative font size */ body, body div, body p, body th, body td, body li, body dd, body span { font-size: small; voice-family: "\"}\""; voice-family: inherit; font-size: medium; } html>body, html>body div, html>body p, html>body th, html>body td, html>body li, html>body dd { font-size: medium; } p { line-height: 80%; margin: 5px 0 10px 0; text-align: justify; } p span { font-size: 70%; } a:link { font-weight: bold; color: #FFD200; } a:visited { text-decoration: none; color: #FFD200; } a:hover, a:active { background: #FFD200; text-decoration: none; color: #000; } #container { width: 473px; margin: 0px; } #intro { width: 473px; } #container { width: 473px; background: url(head.gif) top left no-repeat; } #pageHeader { width: 291px; height: 259px; background: url(head_hover.gif) 0 -259px no-repeat; } #pageHeader:hover { background: url(head_hover.gif) 0 0 no-repeat; cursor: move; } /* hide header text */ #pageHeader h1, #pageHeader h2 { width: 1px; height: 1px; text-indent: -9000px; margin: 0; } #quickSummary { width: 140px; position: absolute; top: 270px; left: 298px; } #quickSummary p.p1 { text-indent: -9000px; width: 1px; height: 1px; position: absolute; left: -10px; } #quickSummary p.p2 { font-weight: bold; } #preamble { width: 240px; margin-left: 20px; } #preamble h3 { width: 237px; height: 17px; margin: 15px 0 0 0; text-indent: -9000px; background: url(preamble_h3.gif) top left no-repeat; } #preample p { margin-top: 0; } #supportingText { width: 240px; margin-left: 20px; } #explanation h3 { width: 235px; height: 15px; margin: 10px 0; text-indent: -9000px; background: url(explanation_h3.gif) top left no-repeat; } #participation h3 { width: 239px; height: 103px; margin: 10px 0; text-indent: -9000px; background: url(participation_h3.gif) top left no-repeat; } #benefits h3 { width: 234px; height: 14px; margin: 10px 0; text-indent: -9000px; background: url(benefits_h3.gif) top left no-repeat; } #requirements h3 { width: 234px; height: 15px; margin: 10px 0; text-indent: -9000px; background: url(requirements_h3.gif) top left no-repeat; } div#footer { position: absolute; top: 10px; left: 480px; width: 90px; } div#footer a { display: block; margin-bottom: 1px; border-bottom: 1px solid #f2f2f2; text-align: right; float: left; width: 50px; font-size: 10px; font-family: Tahoma, sans-serif; color: #000; clear: left; font-weight: normal; text-decoration: none; line-height: 20px; } div#linkList { width: 150px; position: absolute; top: 300px; left: 297px; } h3.select { text-indent: -9000px; width: 116px; height: 19px; margin: 20px 0 10px 0; background: url(select_design.gif) top left no-repeat; } h3.archives { text-indent: -9000px; width: 63px; height: 13px; margin: 20px 0 10px 0; background: url(archives.gif) top left no-repeat; } h3.resources { text-indent: -9000px; width: 75px; height: 13px; margin: 20px 0 10px 0; background: url(resources.gif) top left no-repeat; } div#linkList ul { margin: 0; padding: 0; list-style: none; } div#lselect ul li { font-size: 70%; margin-bottom: 3px; padding: 2px; background: #63939C; font-weight: normal; } div#lselect ul li:hover { background: #58828A; } div#lselect ul li a { display: block; text-decoration: none; padding: 5px 5px 5px 0; font-size: 100%; color: #60D4E9; font-family: Tahoma, sans-serif; } div#lselect ul li a:hover { color: #fff; background: none; } div#lselect ul li a.c { display: inline; font-family: Georgia, serif; padding: 0; border: 0; color: #fff; font-size: 100%; } div#larchives ul li, div#lresources ul li { margin-bottom: 3px; padding: 2px; background: #63939C; font-size: 10px; font-family: Tahoma, sans-serif; font-weight: normal; } div#larchives span, div#lresources span { font-size: 10px; } div#larchives ul li a, div#lresources ul li a { text-decoration: none; color: #fff; font-weight: normal; } div#larchives ul li a:hover, div#lresources ul li a:hover { background: none; }/* css Zen Garden submission 132 - 'Bonsai', by Martin Plazotta, http://martin.plazotta.at/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Martin Plazotta */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0; padding: 0; background: #fff; } h3 { margin-left: 22px; margin-top: 20px; border-bottom: 1px dashed #000; } h3 span { display: none; } p { font: normal 13px Arial, Helvetica, sans-serif; color: #000; padding-left: 22px; padding-right: 10px; } a { font: normal 13px Arial, Helvetica, sans-serif; color: #050; text-decoration: underline; } a:visited { color: #003399; text-decoration: underline; } a:hover { color:#00CC00; text-decoration: underline; } acronym { font-weight: bold; color: #000; border-bottom:1px dashed #000; cursor: help; } acronym:hover { color: #050; } li { padding-left: 5px; margin-left: 10px; padding-bottom: 1em; font: normal 13px Arial, Helvetica, sans-serif; list-style-image: url(listimage.gif); } #container { width: 675px; margin: 0; padding: 0; background: url(container_bg.gif) 0 0 no-repeat; text-align: left; float: right; } #intro { width: 500px; margin: 0; padding: 0; float: right; } #pageHeader { width: 300px; height: 195px; margin: 0; padding: 0; background: url(header.gif) 0 0 no-repeat; float: right; } #pageHeader h1, h2 { margin-top: 0; } #pageHeader h1 span, h2 span { display: none; } #quickSummary { width: 200px; height: 500px; margin: 0; padding: 0; background: url(summary_bg.gif) 0 0 no-repeat; float: left; } #quickSummary .p1 span { display: none; } #quickSummary .p1 { margin: 0; padding: 0; } #quickSummary .p2 { margin: 0; padding: 290px 20px 0 50px; text-align: right; } #preamble { width: 300px; height: 345px; margin: 0; padding: 0; background: url(intro_bg.gif) 0 0 no-repeat #C5F7A5; float: right; } #preamble h3 { height: 24px; background: url(road.gif) 0 0 no-repeat; margin-top: 38px; } #supportingText { width: 300px; margin: 0; padding: 0; background: #C5F7A5; float: right; } #explanation h3 { height: 24px; background: url(about.gif) 0 0 no-repeat; } #participation h3 { height: 24px; background: url(participation.gif) 0 0 no-repeat; } #benefits h3 { height: 24px; background: url(benefits.gif) 0 0 no-repeat; } #requirements h3 { height: 24px; background: url(requirements.gif) 0 0 no-repeat; } #footer { width: 279px; height: 30px; padding-top: 8px; padding-right: 20px; margin-top: 50px; margin-bottom: 10px; background: url(footer.gif) 0 0 no-repeat; float: right; text-align: right; /* Tantek's Hack */ voice-family: "\"}\""; voice-family: inherit; width: 259px; height: 22px; } #footer a { font: normal 13px Arial, Helvetica, sans-serif; color: #00CC00; text-decoration: none; } #footer a:hover { color:#050; text-decoration: none; } #linkList { position: absolute; top: 418px; width: 200px; margin-left:175px; padding: 0; background: url(link_bg.gif) 0 100% no-repeat #A5DBA5; } #lselect h3 { height: 24px; background: url(select.gif) 0 0 no-repeat; } #lselect li { padding-bottom: 0.25em; } #lselect a.c { font: normal 11px Arial, Helvetica, sans-serif; display: block; } #lfavorites h3 { height: 24px; background: url(favorites.gif) 0 0 no-repeat; } #larchives h3 { height: 24px; background: url(archives.gif) 0 0 no-repeat; } #lresources h3 { height: 24px; background: url(resources.gif) 0 0 no-repeat; }/* css Zen Garden submission 133 - 'Ordered Zen', by Steve Smith, http://www.orderedlist.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Steve Smith */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* CSS Document */ a:link { color:#8297A7; text-decoration:underline; } a:visited { color:#A082A7; } a:hover { text-decoration:none; } body { font:x-small/1.4 Tahoma, Verdana, Helvetica, Arial, sans-serif; background:#FFF url(style/bg.gif) repeat top left; color:#555040; margin:0; padding:0; } #container { margin:0 0 0 45px; background:#FFF url(style/bg_container.gif) repeat-y top left; width: 640px !important; width /**/:650px; /* IE5/Win */ padding:0 5px; border-bottom:5px solid #FFF; position:relative; font-size:110%; } #pageHeader { width:640px; height:75px; background:#FFF url(style/page_header.jpg) no-repeat top left; } #quickSummary { height:125px; width:640px; background-color:#FFF; position:relative; } #quickSummary p { margin:0; padding:0; } #quickSummary .p1 { position:absolute; top:0; left:0; width:405px; height:120px; background:#555040 url(style/quick_summary_p1.jpg) no-repeat top left; } #quickSummary .p1 span { display:none; } #quickSummary .p2 { position:absolute; top:0; left:410px; width:230px; height:120px; background:transparent url(style/button_html.gif) no-repeat top left; overflow:hidden; } #quickSummary .p2 span { visibility:hidden; white-space:nowrap; } #quickSummary .p2 a { width:230px; height:60px; float:right; visibility:visible; text-indent:-9000px; overflow:hidden; margin-top:-1.4em; margin-bottom:1.4em; } #pageHeader h1, #pageHeader h2 { display:none; } #preamble { margin-right:235px; padding:5px; background:#E9E6D9; } #preamble h3 { margin:0 0 5px; padding:0; width:238px; height:24px; text-indent:-9000px; overflow:hidden; background:transparent url(style/title_the_road.gif) no-repeat top left; } #preamble p { margin:0 10px 10px; padding:0; } #preamble p.p3 { margin:0 10px 5px; } #supportingText { margin-right:235px; padding:5px; } #linkList { position:absolute; top:200px; left:415px; width:230px; } #footer { margin:0 -240px -5px -5px; border-top:5px solid #FFF; background-color:#555040; padding:10px; text-transform:uppercase; } #footer a { color:#FFF; text-decoration:underline; } #footer a:hover { color:#D2DBE2; text-decoration:none; } #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin:10px 0 5px; padding:0; width:238px; height:24px; } #explanation h3 { background:transparent url(style/title_so_what.gif) no-repeat top left; } #participation h3 { background:transparent url(style/title_participation.gif) no-repeat top left; } #benefits h3 { background:transparent url(style/title_benefits.gif) no-repeat top left; } #requirements h3 { background:transparent url(style/title_requirements.gif) no-repeat top left; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display:none; } #lselect li a, #lfavorites li a {display: block; margin-left:-10px; font-weight:bold;} #linkList li a.c, #lfavorites li a.c {float:none; display:inline; margin-left:0; font-weight:normal; font-size:100%;} #supportingText p { margin:0 10px 10px; padding:0; } #linkList ul { width:210px; margin:0 0 10px 15px; padding:0; } #linkList li { padding: 0 0 0 20px; margin:0 0 5px; list-style-type:none; white-space:nowrap; background: transparent url(style/bullet_normal.gif) no-repeat 0 1px; } #lselect ul, #lfavorites ul { width:210px; margin:0 0 10px 15px; padding:0; } #lselect li, #lfavorites li { padding: 0 0 0 25px; margin:0 0 5px; list-style-type:none; clear:left; white-space:nowrap; background: transparent url(style/bullet_styles.gif) no-repeat 0 3px; } #linkList h3 { margin:0 0 10px; background:#6E6855 url(style/link_list_h3.gif) repeat-y top left; padding:5px 5px 5px 15px; font-weight:bold; color:#E9E6D9; font-size:100%; } acronym { border-bottom:1px dotted #555040; cursor:help; } a acronym { border-bottom:1px dotted #8297A7; } #lfavorites, #larchives, #lresources { border-top:5px solid #FFF; } /* css Zen Garden submission 134 - 'El Collar de Tomas', by Maria Stultz, http://www.mqstudio.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Maria Stultz */ /* Added: Oct. 21st, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body {margin: 0; padding: 0; background: #d17415 url(img/bodybg.gif) 748px 0 repeat-y; font: normal 12px/140% "Trebuchet MS", Verdana, Arial, sans-serif;} p {margin: 0; padding: 0;} h3 {margin: 0; padding: 0; color: #900; font-size: 12px;} ul {list-style: none; margin: 0; padding: 0;} a {text-decoration: none;} acronym {font-weight: bold; font-style: normal; border-width: 0;} #linkList acronym {font-weight: normal;} #container {width: 748px; background: #ffeed6 url(img/containerbg.gif) repeat-y;} #extraDiv2 {position: absolute; top: 100px; left: 0; width: 100px; height: 323px; background: url(img/collar.gif) no-repeat;} #intro {width: 600px;} #pageHeader {height: 100px; background: #807944;} #pageHeader h1 {margin: 0 0 0 100px; padding: 0; height: 100px; line-height: 100px; background: #982417 url(img/header.gif) top right no-repeat;} #pageHeader h1 span {position: absolute; left:-5000px;} #pageHeader h2 {position: absolute; left:-5000px;} #quickSummary {margin-left: 100px; height: 50px; background: url(img/summarybg.jpg) 5px 5px no-repeat;} #quickSummary p.p1 {height: 41px; line-height: 41px; background: url(img/summarytxt_1.gif) 232px 7px no-repeat;} #quickSummary p.p1 span {position: absolute; left:-5000px;} #extraDiv1 {position: absolute; top: 107px; left: 332px; width: 257px; height: 41px; background: url(img/summarytxt_2.gif) no-repeat;} #quickSummary p.p2 {position: absolute; top: 423px; left: 0; width: 100px; height: 83px; color: #ffeed6; background: url(img/sample.gif) no-repeat; text-indent: -5000px;} #supportingText {margin: 0 148px 0 100px; background: #982417 url(img/red.gif) bottom no-repeat; } #supportingText a {color: #f93; font-weight: bold;} #supportingText a:visited {color: #c60; text-decoration: underline;} #supportingText a:hover {color: #f93; text-decoration: underline;} #supportingText p {padding-bottom: 12px;} #supportingText div {color: #fdf3e5; font-size: 11px; margin-left: 157px; margin-right: 30px;} #preamble, #supportingText div#explanation {background: #fdf3e5; color: #333; font-size: 12px; margin-right: 0;} #preamble {margin-left: 100px; padding: 30px 30px 0 30px; background: #fdf3e5 url(img/preamblebg.gif) 5px 0 no-repeat;} #supportingText div#explanation {padding: 30px 30px 18px 30px; margin-left: 0;} #preamble p, #explanation p.p1 {display: inline;} #explanation p.p2 {padding-top: 12px;} #participation, #benefits, #requirements {padding: 15px 0 3px 0; border-bottom: 1px solid #b76151;} #participation h3 {width: 102px; left: -122px; background: url(img/participation.gif) no-repeat;} #benefits h3 {width: 70px; left: -90px; background: url(img/benefits.gif) no-repeat;} #requirements h3 {width: 107px; left: -127px; background: url(img/requirements.gif) no-repeat;} #participation h3, #benefits h3, #requirements h3 {height: 17px; line-height: 17px; position: relative;} #participation h3 span, #benefits h3 span, #requirements h3 span {position: relative; left: -5000px;} #participation p.p1, #benefits p.p1, #requirements p.p1 {margin-top: -17px;} #supportingText div#footer {padding: 20px 0 20px 1.5em; text-transform: uppercase; background: #982417 url(img/bullet.gif) 0 50% no-repeat; margin-right: 0;} #footer a {padding: 0 1.5em 0 0; margin: 0 .5em 0 0; background: url(img/bullet.gif) 100% 50% no-repeat; width: 5%;} #linkList {position: absolute; top: 0; left: 601px; width: 147px; background-color: #76693c;} #linkList h3 {text-transform: uppercase; letter-spacing: 2px; line-height: 100%; padding-bottom: 30px;} #linkList h3 span:before {content:".:";} #linkList h3 span:after {content:".";} #linkList h3.select {width: 147px; height: 105px; line-height: 105px; background: #5b5962 url(img/select.gif) bottom no-repeat; padding-bottom: 0;} #linkList h3.select span {position: relative; left:-5000px;} #linkList div {color: #dbd2a1; text-align: center; font-size: 11px;} #linkList div ul {padding: 0 14px;} #linkList div li {display: block; padding: 10px 0; border-bottom: 1px solid #9f916b;} #linkList2 a {color: #dbd2a1;} #linkList2 a:visited {color: #9f9667;} #linkList2 a:hover {color: #fff;} #lselect a, #lfavorites a {display: block; font-weight: bold;} #lselect a.c, #lfavorites a.c {display: inline; font-weight: normal;} #lfavorites, #larchives, #lresources {margin-top: -2px; background: #76693c url(img/stone.gif) 60px 70px no-repeat; padding-top: 50px;} /* css Zen Garden submission 135 - 'contemporary nouveau', by David Hellsing, http://www.monc.se/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, David Hellsing */ /* Added: Oct. 22nd, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ________________ general ________________ */ body { margin: 0; padding: 0; background: #554 url(bg.gif); font: small/1.5em georgia, times, serif; color: #333331; text-align: center; } a { color: #c50; text-decoration: none; border-bottom: 1px solid #dca; } a:visited { color: #a86; border: none; } a:hover { color: #000; border-bottom: 1px solid #333331; } acronym { cursor: help; font-style: normal; border: none; } h1 { display: none; } h2 { font-size: 2em; font-weight: normal; color: #922; margin: 0 0 0.7em 0; padding: 0; } h3 { width: 420px; height: 20px; margin: 1.2em 0 0.8em 0; } h3 span { display: none; visibility: hidden; } p { text-indent: 1.5em; font-size: 88%; margin: 0 0 0.6em 0; } /* The following hack is to correct paragraph text size in IE/WIN */ /* \*/ * html body p { font-size: 80%; } /* */ /* ________________ containers ________________ */ #container { position: relative; text-align: left; margin: 0 auto; width: 750px; background: #fff url(main.jpg) repeat-y; border-bottom: 15px solid #000; } #intro { width: 750px; background: #fff url(main.jpg) repeat-y; } #supportingText { width: 430px; margin-left: 30px; } #preamble { margin-left: 30px; width: 430px; } #pageHeader { width: 750px; height: 250px; background: #000 url(top.jpg) no-repeat; } #quickSummary { position: absolute; left: 510px; width: 210px; background: transparent url(h3-download.gif) no-repeat 0 0; border-bottom: 1px solid #923b09; } #footer { margin: 3em 0 0 0; font: bold 9px/3em tahoma, verdana, sans-serif; text-transform: uppercase; letter-spacing: 1px; padding-bottom: 2em; } #linkList { position: absolute; top: 320px; left: 510px; width: 210px; margin-right: 30px; } /* ________________ lists & typo ________________ */ #pageHeader h1, #pageHeader h2 { display: none; } #quickSummary p.p2 { text-indent: 0; font: 10px/16px tahoma, verdana, sans-serif; color: #efece3; padding: 5px 17px; margin: 25px 0 0 0; background: #bd4d0d url(list-bg.jpg); border-top: 1px solid #923b09; } #quickSummary p.p2 a { color: #efece3; border: none; font-weight: bold; } #quickSummary p.p2 a:hover { color: #ec9; } #quickSummary p.p1 { display: none; } #footer a { background: #cb9; padding: 2px 5px; color: #edb; border: none; margin: 0; } #footer a:hover { background: #000; border: none; } #linkList h3 { width: 210px; height: 25px; margin: 1em 0 0 0; padding: 0; } #linkList p, #linkList li { font: x-small/1.6em tahoma, verdana, sans-serif; color: #efece3; text-indent: 0; } #linkList ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid #923b09; background: #bd4d0d url(list-bg.jpg); } #linkList li { color: #000; border-bottom: 1px solid #923b09; line-height: 1.5em; padding: 0.5em 17px; } #linkList li:hover { background: #b64a0b; } #linkList li a { display: block; border: none; color: #f4f0e6; font-weight: bold; margin-left: -12px; padding-left: 12px; background: url(arrow.gif) no-repeat 0 60%; } #linkList li a:hover { color: #ec9; background-position: -300px 60%; } #linkList li a.c { display: inline; padding: 0; margin: 0; background: none; color: #000; font-weight: normal; } #linkList li a.c:hover { color: #6e2308; } #linkList #larchives li, #linkList #lresources li, #linkList #lfavorites li { padding: 0.5em 0; } #linkList #larchives li a, #linkList #lresources li a, #linkList #lfavorites li a { background: transparent url(bullet.gif) no-repeat 5px 60%; display: inline; padding-left: 17px; margin: 0; } #linkList #larchives li a:hover, #linkList #lresources li a:hover, #linkList #lfavorites li a:hover { background-position: -295px 60%; } h3.select { background: transparent url(h3-select.gif) no-repeat;} h3.resources { background: transparent url(h3-resources.gif) no-repeat;} h3.archives { background: transparent url(h3-archives.gif) no-repeat; } h3.favorites { background: transparent url(h3-favorites.gif) no-repeat; } #preamble h3 { background: url(h3-theroad.gif) no-repeat; margin-top: 0; } #explanation h3 { background: url(h3-sowhat.gif) no-repeat; } #participation h3 { background: url(h3-participation.gif) no-repeat; } #benefits h3 { background: url(h3-benefits.gif) no-repeat; } #requirements h3 { background: url(h3-requirements.gif) no-repeat; height: 23px; margin-bottom: 0.7em; }/* css Zen Garden submission 136 - 'The Final Ending', by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Ray Henry */ /* Added: Oct. 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* The Final Ending */ /* CSS Zen Garden Halloween Submission */ /* Author: Ray Henry */ /* www.reh3.com */ * {margin:0;padding:0;} body {background:#000 url(r3_zen666_bg.jpg) no-repeat top left;} /* Basic Positioning ***********************************************************************************/ #container { width:770px; position:relative; } #pageHeader {width:770px;height:215px;} #quickSummary, #preamble, #supportingText { float:left; width:423px; } #linkList { margin:0 0 0 493px; } * html #linkList {margin:-380px 0 0 493px;} /* for IE 5+ PC */ /* #intro ***********************************************************************************/ #pageHeader { background:url(r3_zen666_banner_bg.jpg) no-repeat top left; } #pageHeader h1 { margin:0 0 0 291px; background:url(r3_zen666_logo.jpg) no-repeat top left; width:479px; height:215px; text-indent:-5000px; } #pageHeader h2 {display:none;} #quickSummary { background:url(r3_zen666_qs_bg.jpg) no-repeat top left; height:120px; padding:28px 35px 0 35px; } #preamble {padding:0 35px 0 35px;} #quickSummary p, #preamble p { font-size:11px; font-family:verdana; color:#555; margin:12px 0; } #preamble p {line-height:16px;} #quickSummary a:link, #quickSummary a:active, #quickSummary a:visited {color:#555;} #quickSummary a:hover {color:#900;} #preamble h3 { background:url(r3_zen666_road_bg.jpg) no-repeat top left; margin:0 0 0 -35px; width:399px; height:37px; text-indent:-5000px; } /* #supportingText ***********************************************************************************/ #supportingText {padding:0 35px 0 35px;} #supportingText p { font-size:11px; font-family:verdana; color:#555; margin:12px 0; line-height:16px; } #supportingText a:link, #supportingText a:active, #supportingText a:visited {color:#555;} #supportingText a:hover {color:#900;} #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin:20px 0 0 -35px; width:399px; height:37px; text-indent:-5000px; } #explanation h3 {background:url(r3_zen666_about_bg.jpg) no-repeat top left;} #participation h3 {background:url(r3_zen666_part_bg.jpg) no-repeat top left;} #benefits h3 {background:url(r3_zen666_ben_bg.jpg) no-repeat top left;} #requirements h3 {background:url(r3_zen666_req_bg.jpg) no-repeat top left;} #footer { background:url(r3_zen666_footer_bg.jpg) no-repeat top left; height:60px; margin:0 -35px 0 -35px; padding:240px 0 0 0; text-align:center; } #supportingText #footer a:link, #supportingText #footer a:active, #supportingText #footer a:visited { margin:0 10px; color:#900; } #supportingText #footer a:hover {color:#555;} /* #linkList ***********************************************************************************/ #linkList { background:url(r3_zen666_lickList_bg.jpg) no-repeat top left; padding:1px 0 0 7px; font-size:10px; font-family:verdana; color:#444; } #linkList ul { margin:0 0 10px 0; list-style:none; width:131px; } #linkList ul li { padding:5px 8px; border-bottom:1px dashed #333; } #lselect h3, #larchives h3, #lresources h3 { margin:0; width:131px; height:35px; text-indent:-5000px; } #lselect h3 {background:url(r3_zen666_lselect_bg.jpg) no-repeat top left;} #larchives h3 {background:url(r3_zen666_larchive_bg.jpg) no-repeat top left;} #lresources h3 {background:url(r3_zen666_lres_bg.jpg) no-repeat top left;} #linkList a:link, #linkList a:active, #linkList a:visited {color:#444;} #linkList a:hover {color:#900;} /* #extraDiv1 ***********************************************************************************/ #extraDiv1 { position:fixed; bottom:0; left:540px; background:url(r3_zen666_tombstone.png) no-repeat top left; width:227px; height:267px; } * html #extraDiv1 {display:none;} /* For IE 5+ PC */ #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {display:none;}/* css Zen Garden submission 137 - 'DJ Style', by Ramon Bispo, http://ilhasol.com/bastidores.asp */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Ramon Bispo */ /* Added: Nov. 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ########################################################################################################## css Zen Garden style - 'Dj Style' by Ramon Bispo da Silva (Page) Rio de Janeiro, Brazil | September - November, 2004 | All Rights reserved ########################################################################################################### */ /* basic elements */ body { font: 12px/17px tahoma, arial; background: #155970; margin: auto auto; padding: 0; text-align: center; } p { font: 12px/17px tahoma, arial, sans-serif; margin: 0 0 17px 0; } a:link { font-weight: bold; text-decoration: none; color: #333399; } a:visited { font-weight: bold; text-decoration: none; color: #6699FF; } a.c:visited { font-weight: normal; text-decoration: none; color: #858686; } a:hover, a:active { text-decoration: underline; color: #3366CC; } ul { list-style-type: none; margin: 0; padding: 0; } /* specific divs */ #container { width: 762px; padding: 0; margin: auto; text-align: left; background: url(pageheader.gif) no-repeat top left; } #intro { vertical-align: bottom; } #pageHeader { padding: 0; margin: 0; height: 425px; border: 1px solid white; } #pageHeader h1 { width: 760px; height: 430px; margin: 0px 0px 0px 0px; padding: 0; } #pageHeader h1 span { display:none } #pageHeader h2 { padding: 0; margin: 0; } #pageHeader h2 span { display: none; } #quickSummary p.p1 { display:none; } #quickSummary p.p1 span{ display: none; } #quickSummary p.p2{ display: block; position: absolute; border: 1px solid #ffffff; top: 400px; margin-left: 250px; padding: 0 7px 0 7px; font-size: 10px; text-align: center; color: #ffffff; text-transform: uppercase; font-family:Arial, Helvetica, sans-serif; clear: both; } #quickSummary p.p2 a:link, a:active{ color:#33eeff; } #quickSummary p.p2 a:hover{ text-decoration: underline; } #quickSummary p.p2 a:visited{ color:#33eeff; text-decoration: line-through; } #preamble { width: 291px; float: left; background: url(bg_preamble.gif) no-repeat; } #preamble h3 { background: url(header_preamble.gif) no-repeat; width: 291px; height: 50px; margin: 0; padding: 0; border-top: 1px solid #ffffff; } #preamble h3 span { display: none; } #preamble p { font-family:Arial, Helvetica, sans-serif; padding: 5px; color: #155970; font-size:12px; text-transform:uppercase; font-weight:bold; width: 270px; } #preamble p.p1 { margin-top: 10px; } #supportingText { padding: 0; margin: -3px 0 40px 0; background: #33ccff; border: 1px solid #ffffff; width: 469px; float: right; } #supportingText p { margin: 9px 17px 17px 24px; color: #155970; } #explanation h3 { background: url(what_is.gif) no-repeat; width: 469px; height: 40px; margin: 0; padding: 0; } #explanation h3 span { display: none; } #participation h3 { background: url(participation.gif) no-repeat; width: 469px; height: 40px; margin: 0; padding: 0; } #participation h3 span { display: none; } #benefits h3 { background: url(benefits.gif) no-repeat; width: 469px; height: 40px; margin: 0; padding: 0; } #benefits h3 span { display: none; } #requirements h3 { background: url(requirements.gif) no-repeat; width: 469px; height: 40px; margin: 0; padding: 0; } #requirements h3 span { display: none; } #footer { background: #155970; border: 1px solid #ffffff; padding: 0 0 2px 24px; font-size: 12px; font-weight:bold; text-align: center; text-transform:uppercase; font-family:Arial, Helvetica, sans-serif; } #footer a:link, a:active{ color: #ffffff; } #footer a:hover{ color: #33eeff; text-decoration:underline; } #footer a:visited{ color: #ffffff; text-decoration: line-through; } a.c { font-weight: normal; } #lselect, #larchives, #lresources { width: 278px; clear: left; padding: 0; margin: 0; } #lselect { background: url(select.gif) no-repeat; border: 1px solid #ffffff; margin-top: 20px; padding: 50px 0 0 5px; } #lselect li a:link, a:active{ text-decoration:none; text-transform:uppercase; font-size:12px; color:#FFFFFF; } #lselect li a:hover { text-decoration:underline; color: #e9e9e9; } #lselect a:visited { color: #155970; text-decoration:line-through; text-transform:uppercase; } #larchives { background: url(archives.gif) no-repeat; border: 1px solid #ffffff; margin-top: 20px; padding: 50px 0 0 5px; } #larchives li a:link, a:active{ text-decoration:none; text-transform:uppercase; font-size:12px; color:#FFFFFF; } #larchives li a:hover { text-decoration:underline; color: #e9e9e9; } #larchives a:visited { color: #155970; text-decoration:line-through; text-transform:uppercase; } #lresources { background: url(resources.gif) no-repeat; border: 1px solid #ffffff; margin-top: 20px; padding: 50px 0 0 5px; } #lresources li a:link, a:active{ text-decoration:none; text-transform:uppercase; font-size:12px; color:#FFFFFF; } #lresources li a:hover { text-decoration:underline; color: #e9e9e9; } #lresources a:visited { color: #155970; text-decoration:line-through; text-transform:uppercase; } #lselect h3 span, #larchives h3 span, #lresources h3 span { display: none; } #linklist { position: absolute; top: 48em; } #linkList #linkList2 ul { padding: 20px 10px 10px 10px; display:block; } #linklist li { margin: 2px 0; } /* css Zen Garden submission 138 - 'DJ Style', by Masanori Kawachi, http://www.804case.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Masanori Kawachi */ /* Added: Nov. 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0px; padding: 0px; background: url(images/body_bg.gif) left top repeat-y #fff; } p { font-size: 10px; !important;font-size: 70%; line-height: 133%; font-family: Arial, Helvetica, sans-serif; color: #666; } h1,h2,h3 { margin: 0px; padding: 0px; } a { color: #336633; } acronym { background-color: #FFF7D2; } #extraDiv1 { position: absolute; left: 0px; top: 0px; z-index: 1; width: 100%; height: 51px; background: url(images/header_bg.gif) left top repeat-x; } #pageHeader h1 { position: absolute; left: 0px; top: 0px; z-index: 2; width: 237px; height: 176px; margin: 0px; padding: 0px; background: url(images/logo.gif) left top no-repeat; } #pageHeader h1 span,#pageHeader h2 { position: absolute; left: -9999px; } #container { background: url(images/rightside_top.gif) 0px 0px no-repeat; width: 510px; margin: 51px 0px 0px 237px; padding-top: 24px; } #quickSummary { margin-left: 34px; padding-left: 30px; width: 425px !important;width /**/:455px; background: url(images/arrow.gif) left top no-repeat; } #quickSummary p { margin: 0px 0px 5px 0px; padding: 0px; } #preamble { margin: 40px 0px 0px 30px; width: 458px; } #preamble h3 { width: 458px; height: 0px !important;height /**/:24px; padding-top: 24px; background: url(images/tit_01.gif) left top no-repeat; display: block; overflow: hidden; } #preamble p { margin: 5px 0px 5px 20px; padding: 0px; } #supportingText { margin: 25px 0px 0px 30px; width: 458px; background: url(images/leaf.gif) right top no-repeat; } #explanation { margin-bottom: 20px; } #explanation h3 { width: 458px; height: 0px !important;height /**/:24px; padding: 24px 0px 0px 0px; background: url(images/tit_02.gif) left top no-repeat; display: block; overflow: hidden; } #explanation p { margin: 5px 0px 5px 20px; padding: 0px; } #participation { margin-bottom: 20px; } #participation h3 { width: 458px; height: 0px !important;height /**/:24px; padding-top: 24px; background: url(images/tit_03.gif) left top no-repeat; display: block; overflow: hidden; } #participation p { margin: 5px 0px 5px 20px; padding: 0px; } #benefits { margin-bottom: 20px; } #benefits h3 { width: 458px; height: 0px !important;height /**/:24px; padding-top: 24px; background: url(images/tit_04.gif) left top no-repeat; display: block; overflow: hidden; } #benefits p { margin: 5px 0px 5px 20px; padding: 0px; } #requirements { margin-bottom: 20px; } #requirements h3 { width: 458px; height: 0px !important;height /**/:24px; padding-top: 24px; background: url(images/tit_05.gif) left top no-repeat; display: block; overflow: hidden; } #requirements p { margin: 5px 0px 5px 20px; padding: 0px; } #footer { margin: 0px 0px 20px 20px; font-size: 10px; !important;font-size: 70%; font-family: Arial, Helvetica, sans-serif; } #linkList { position: absolute; left: 13px; top: 176px; width: 212px; background: url(images/leftside_bg.gif) left top repeat-x; } #lselect { width: 212px; background: url(images/list_bg.gif) left top repeat-y; } #lselect h3 { background: url(images/select_tit.gif) left top no-repeat; width: 212px; height: 0px !important;height /**/:35px; padding-top: 35px; display: block; overflow: hidden; } #lselect ul { margin: 0px; padding: 0px 0px 0px 4px; list-style-type: none; font-size: 10px; !important;font-size: 70%; font-family: Arial, Helvetica, sans-serif; } #lselect li { padding: 13px 5px 13px 5px; margin: 0px; width: 196px !important;width /**/:206px; text-align: center; border-top-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: #e9e9e9; border-bottom-color: #FFFFFF; display: block; } #lselect li:hover { background-color: #fff; } #larchives { width: 212px; background: url(images/list_bg.gif) left top repeat-y; display: block; } #larchives h3 { background: url(images/archives_tit.gif) left top no-repeat; width: 212px; height: 0px !important;height /**/:26px; padding-top: 26px; display: block; overflow: hidden; } #larchives ul { margin: 0px; padding: 0px 0px 0px 4px; list-style-type: none; font-size: 10px; !important;font-size: 70%; font-family: Arial, Helvetica, sans-serif; } #larchives li { padding: 13px 5px 13px 5px; margin: 0px; width: 196px !important;width /**/:206px; text-align: center; border-top-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: #e9e9e9; border-bottom-color: #FFFFFF; display: block; } #larchives li:hover { background-color: #fff; } #lresources { width: 212px; background: url(images/list_bg.gif) left top repeat-y; display: block; } #lresources h3 { background: url(images/archives_tit.gif) left top no-repeat; width: 212px; height: 0px !important;height /**/:26px; padding-top: 26px; display: block; overflow: hidden; } #lresources ul { margin: 0px; padding: 0px 0px 0px 4px; list-style-type: none; font-size: 10px; !important;font-size: 70%; font-family: Arial, Helvetica, sans-serif; } #lresources li { padding: 13px 5px 13px 5px; margin: 0px; width: 196px !important;width /**/:206px; text-align: center; border-top-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-bottom-style: solid; border-top-color: #e9e9e9; border-bottom-color: #FFFFFF; display: block; } #lresources li:hover { background-color: #fff; }/* css Zen Garden submission 139 - 'Neat & Tidy', by Oli Dale, http://www.designerstalk.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Oli Dale */ /* Added: Nov. 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ background-image: url(images/main_bg.jpg); background-position: center; background-position: top; background-repeat: no-repeat; background-color: #000000; margin:0px; padding:0px; color:#ffffff; font-family: Georgia,"Times New Roman", Times, serif; font-size: 11px; text-align: center; } h1{display: none;} h2{display: none;} h3{display: none;} a{color:#B00707;text-decoration: underline;} a:visited{color:#B00707;text-decoration: underline;} a:hover {color:#D6BD15; text-decoration: none;} a:active {color:#D6BD15; text-decoration: none;} acronym { border: none; cursor: help; font-style: italic;} #container{ width:600px; position: relative; text-align: justify; padding:0px; margin: 0 auto; height:1641px; } #preamble{ background-image: url(images/quicksumary_header.gif); background-repeat: no-repeat; position: absolute; top: 165px; left: 5px; padding-top:35px; width:375px; } #preamble h3{ display:none; } #explanation{ background-image: url(images/explanation_header.gif); background-repeat: no-repeat; position: absolute; top: 390px; left: 5px; width:375px; padding-top:35px; } #explanation h3{display: none;} #participation{ background-image: url(images/participation_header.gif); background-repeat: no-repeat; position: absolute; top: 665px; left: 5px; width:375px; padding-top:35px; } #participation h3{display: none;} #benefits{ background-image: url(images/benefits_header.gif); background-repeat: no-repeat; position: absolute; top: 980px; left: 5px; width:375px; padding-top:35px; } #benefits h3{display: none;} #requirements{ background-image: url(images/requirements_header.gif); background-repeat: no-repeat; position: absolute; top: 1115px; left: 5px; width:375px; padding-top:35px; } #requirements h3{display: none;} #footer{ position: absolute; top: 1590px; left: 5px; width:375px; } #intro{ width:375px; } #pageHeader{ background-image: url(images/logo.gif); background-repeat: no-repeat; width:279px; height:170px; } #lselect{ text-align: left; position: absolute; top:950px; right: 0px; width:189px; background-image: url(images/selecter_header.gif); background-repeat: no-repeat; padding-top:35px; } #quickSummary{ width:185px; position: absolute; top: 540px; right: 0px; background-image: url(images/select_header.gif); background-repeat: no-repeat; padding-top:35px; } #larchives{ position: absolute; top: 850px; right: 0px; width:185px; padding-top:10px; background-image: url(images/archives_header.gif); background-repeat: no-repeat; padding-top:35px; } #lresources{ position: absolute; top: 720px; right: 0px; width:185px; padding-top:0px; background-image: url(images/resources_header.gif); background-repeat: no-repeat; padding-top:35px; } li{list-style-type: none;} ul{padding-top:0px; padding-left:0px; padding-right:0px; padding:0px; margin:0px; } /* css Zen Garden submission 139 - 'The Hall', by Michael Simmons, http://www.thoughtanomalies.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Michael Simmons */ /* Added: Nov. 29th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0; background: #444; font-family: arial, verdana, sans-serif; } #container { position: absolute; left: 50%; top: 0; right: auto; bottom: auto; margin-left: -390px; width: 780px; clear: both; background: #F5E783 url(images/linklist_back.jpg) repeat-y 100% 0; border-left: solid 1px #fff; border-right: solid 1px #fff; } #container #intro #pageHeader { width: 780px; height: 311px; background: url(images/pageheader_p1.jpg) no-repeat 0 0; } #container #intro #pageHeader h1 { display: block; margin: 0; padding: 0; height: 311px; text-indent: -2000px; background: url(images/pageheader_p2.jpg) no-repeat bottom; } #container #intro #pageHeader h2 { display: none; } #container #intro, #container #supportingText { width: 469px; } #footer { position: absolute; top: 140px; right: 0; width: 260px; text-align: center; } #footer a { padding: 9px 0 0 0; font-family: "Din-Medium", Arial, Helvetica, sans-serif; text-transform: uppercase; text-decoration: none; font-weight: normal; font-size: 10px; color: #fff; } #footer a:hover { background: url(images/littlearrow.gif) no-repeat top center; } #container #linkList { position: absolute; top: 180px; right: 0; width: 260px; background: url(images/linklist_bevel.jpg) no-repeat 0 0; } #container #linkList2 { padding: 18px 35px 0 23px; } #container #linkList h3 { margin: 10px 0 0 10px; padding: 0; width: 180px; height: 19px; text-indent: -2000px; } #container #linkList h3.select { background: url(images/t_selectadesign.jpg) no-repeat; } #container #linkList h3.archives { background: url(images/t_archives.jpg) no-repeat; } #container #linkList h3.resources { background: url(images/t_resources.jpg) no-repeat; } #container #linkList ul { margin: 10px 0 20px 20px; padding: 0; list-style: none; } #container #linkList ul li { margin: 0 0 9px 0; padding: 0 0 0 12px; background: url(images/bluearrow.gif) no-repeat 0 3px; font-size: 10px; color: #fff; } #container #linkList ul li a { text-transform: uppercase; text-decoration: none; font-size: 11px; font-weight: bold; color: #426279; } #container #linkList ul li a:hover { color: #21313C; } #container #linkList #lselect ul li a { display: block; } #container #linkList #lselect ul li a.c { display: inline; text-transform: none; text-decoration: underline; color: #fff; font-weight: normal; font-size: 10px; } #container #linkList #lselect ul li a.c:hover { text-decoration: none; } #container #quickSummary { position: relative; top: -40px; padding: 0; margin: 0 0 0 42px; font-family: "Lucida Grande", "Trebuchet MS", Verdana, Arial, sans-serif; } #container #quickSummary p { margin: 0 0 10px 0; font-style: italic; font-size: 17px; font-weight: bold; line-height: 18px; color: #D65200; } #container #quickSummary p a { text-decoration: none; color: #9E3E02; border-bottom: dotted 1px #9E3E02; } #container #quickSummary p a:hover { border-bottom: none; } #container #preamble h3 { margin: 0 0 0 42px; padding: 0; text-indent: -2000px; width: 299px; height: 43px; background: url(images/t_theroadtoenlightenment.jpg) no-repeat; } #container #preamble p, #container #supportingText p { margin: 0 0 13px 42px; font-size: 12px; line-height: 18px; color: #444; } #container #supportingText p acronym { border-bottom: dotted 1px #444; cursor: help; } #container #supportingText #explanation h3 { margin: 40px 0 10px 42px; padding: 0; text-indent: -2000px; width: 187px; height: 16px; background: url(images/t_sowhatisthisabout.jpg) no-repeat; } #container #supportingText #participation h3 { margin: 40px 0 6px 42px; padding: 0; text-indent: -2000px; width: 125px; height: 20px; background: url(images/t_participation.jpg) no-repeat; } #container #supportingText #benefits h3 { margin: 40px 0 10px 42px; padding: 0; text-indent: -2000px; width: 125px; height: 16px; background: url(images/t_benefits.jpg) no-repeat; } #container #supportingText #requirements h3 { margin: 40px 0 6px 42px; padding: 0; text-indent: -2000px; width: 125px; height: 20px; background: url(images/t_requirements.jpg) no-repeat; } #container #supportingText #requirements p.p5 { margin: 40px 0 40px 42px; font-size: 11px; font-style: italic; } #container #preamble p a, #container #supportingText p a { text-decoration: none; color: #9E3E02; border-bottom: dotted 1px #9E3E02; } #container #preamble p a:hover, #container #supportingText p a:hover { border-bottom: none; }/* css Zen Garden submission 141 - 'Golden Cut', by Petr Stanciek, http://www.pixy.cz/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Petr Stanciek */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin:0; padding:0; background: #819EFF url("bkgr1.jpg") 7px 0 repeat; color: #333; font: 100%/1.67 "palatino linotype", palatino, serif; } a { color: #819EFF; text-decoration:underline; } a:visited { color: #8A8D99; } a:hover { color: #01228D; } abbr, acronym { color:#B36D00; font-style:italic; cursor:help; } a abbr, a acronym { color:inherit } #container { position:relative; width: 770px; margin: 30px auto 2.5em 7px; padding: 0; background: url("strips.jpg") 474px 0 repeat-y; border-left:1px solid #FFD99E; border-bottom:1px solid #819EFF; } /*FFDAA0*/ /* INTRO */ #intro { width:474px; margin: 0; padding:340px 0 0 0; background: white url("header.jpg") top left no-repeat; } #pageHeader { display:none } #quickSummary .p1 { display:none } #quickSummary .p2 { position:absolute; top: 195px; left: 474px; z-index:10; width:296px; margin:0; font-size:70%; line-height: 1.1; text-align:center; color:white; } #quickSummary .p2 a { white-space: nowrap; color: #FFF5D9; } #quickSummary .p2 a:hover { color: #01228D; } #preamble, #explanation, #participation, #benefits, #requirements { padding: 0 1em 1px 2em; /* 1px bottom padding due to margin-collpasing bug in Opera */ } #intro h3, #supportingText h3 { margin: 1.5em 0 1em 0; padding:0; height: 30px; background: url("ttls.gif") 0 0 no-repeat; } #intro h3 span, #supportingText h3 span { display:none } #preamble h3 { margin-top:0; } #explanation h3 { background-position: 0 -50px; } #participation h3 { background-position: 0 -100px; } #benefits h3 { background-position: 0 -150px; } #requirements h3 { background-position: 0 -200px; } #intro p, #supportingText p { margin: 0.7em 0; font-size:90%; } /* TEXT */ #supportingText { width:475px; margin: 0; padding:1px 0 1em 0; background: white; } #footer { position:absolute; bottom: -1.5em; right: 0; font: 75%/1 sans-serif; white-space:nowrap; } #footer a { padding:0.2em 0.3em; background:#819EFF; color:white; text-decoration:none; font-weight:bold; } #footer a:hover { color:white; background: #01228D; } /* LINKS */ #linkList { position:absolute; top: -20px; left: 474px; width:296px; padding-top:290px; font-size: 85%; line-height: 1.5; background: url("boy.jpg") 0 0 no-repeat; } #linkList h3 { margin: 3em 0 1em 27px; padding:0; height: 20px; background: url("ttls2.gif") 0 0 no-repeat; } #linkList h3 span { display:none } #lselect h3 { margin-top:0; } #larchives h3 { background-position: 0 -50px; } #lresources h3 { background-position: 0 -100px; } #linkList ul { list-style-type:none; margin:0; padding:0; } #linkList li { list-style-type:none; margin:0.5em 0 0.5em 120px; padding:0; } #linkList li a { display:block; margin: 0 0 0 -25px; padding: 0 0 0 25px; font-weight:bold; font-size:100%; color:#666; background: url("bull.gif") left center no-repeat; } #linkList li a.c { display: inline; margin:0; padding:0; background: transparent; font-size:100%; font-weight:normal; font-style:italic; font-variant:small-caps; color:#819EFF; } #linkList li a:hover { color: #01228D; } /* css Zen Garden submission 142 - 'Invasion of the Body Switchers' by Andy Clarke, http://www.stuffandnonsense.co.uk/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Andy Clarke */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin : 0; padding : 0; } body { font : 75% "Lucida Grande", "Lucida Sans Unicode", Verdana, Helvetica, Arial, sans-serif; background : #000 url(body-bg.jpg) repeat-y top center; color : #fff; font-variant : small-caps; text-align : center; /* That Explorer Malarkey */ } h1, h2, h3, p, ul { padding : 0.5em 0; } /* hx */ div#pageHeader h1 { display : none; } div#pageHeader h2 { display : none; } h3 { padding : 0; text-indent : -3000px; } div#preamble h3 { width : 195px; height : 140px; background : url(preamble-h3.gif) no-repeat left bottom; } div#explanation h3 { float : left; width : 210px; height : 135px; margin-right : 10px; background : url(explanation-h3.gif) no-repeat; } div#participation h3 { float : right; width : 230px; height : 200px; background : url(participation-h3.gif) no-repeat; } div#requirements h3 { float : left; width : 230px; height : 180px; background : url(requirements-h3.gif) no-repeat; } div#lselect h3 { width : 200px; height : 45px; background : url(lselect-h3.gif) no-repeat; } div#lresources h3 { width : 90px; height : 20px; background : url(lresources-h3.gif) no-repeat; } div#larchives h3 { width : 90px; height : 20px; background : url(larchives-h3.gif) no-repeat; } /* p */ p { font-size : 100%; line-height : 110%; } div#quickSummary p.p1 { display : none; } div#quickSummary p.p2 { float : right; width : 400px; padding-right: 10px; text-align : right; } div#preamble p.p1, div#preamble p.p2 { display : none; } div#preamble p.p3 { width : 220px; font-size : 120%; } div#explanation p.p1 { display : none; } div#explanation p.p2 { margin-left : 230px; line-height : 110%; } div#participation p.p1, div#participation p.p2 { display : none; } div#participation p.p3 { margin-right : 240px; } div#requirements p.p1, div#requirements p.p2, div#requirements p.p4 { display : none; } div#requirements p.p3 { margin-left : 240px; } div#requirements p.p5 { clear : both; margin-left : 240px; } abbr, acronym { text-decoration : none; border-bottom : 1px dotted #ccc; cursor : help; } .accesskey { text-decoration: underline; } /* anchors, yo ho me hearties */ a:link, a:visited { color : #fdf4b3; text-decoration : none; } div#lselect a:link, div#lselect a:visited { display : block; font-variant : small-caps; } div#lselect a:link.c, div#lselect a:visited.c { display : inline; font-size : 190%; letter-spacing : -1px; color : #fff; } div#quickSummary p.p2 a { font-size : 160%; } div#footer a:link, div#footer a:visited { padding : 0px 4px; font-size : 90%; background : #666; border : 1px solid #999; color : #ccc; text-decoration : none; } div#footer a:hover { background : #555; color : #ccc; text-decoration : none; } a:hover { color : #fff; text-decoration : underline; } /* ul */ ul { list-style-type : disc; padding : 0.5em 10px; } div#linkList ul { margin-top : 20px; padding-left : 10px; } li { list-style-type : none; line-height : 200%; } div#lselect li { padding-bottom : 10px; font-variant : normal; text-align : right; line-height : 16px; } /* layout */ div#container { position : relative; width : 750px; margin : 0 auto; text-align : left; background : url(container-bg.jpg) no-repeat 0 51px; border-bottom : 5px solid #fdf4b3; } div#pageHeader { width : 750px; height : 50px; background : url(header-bg.jpg) no-repeat; border-bottom : 1px solid #fdf4b3; } div#quickSummary { width : 750px; } #preamble { margin : 0 50px 0 470px; } #explanation { margin : 0 50px 0 380px; } #participation, #benefits, #requirements { margin : 40px 50px 0 280px; } div#preamble { margin-top : 170px; } div#supportingText { margin-top : 140px; } div#explanation, div#participation, div#requirements { margin : 40px 40px 0 250px; } div#benefits { display : none; } div#footer { margin-top : 20px; padding : 20px 0; background : url(footer-bg.gif) no-repeat top center; text-align : center; } div#linkList { position : absolute; top : 70px; left : 0px; width : 200px; } div#larchives { padding : 60px 0 0 20px; } div#lresources { padding : 50px 0 0 20px; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv1, #extraDiv5 { display : none; }/* css Zen Garden submission 143 - 'Pixelisation', by Lim Yuan Qing, http://yuanqing.blogspot.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Lim Yuan Qing */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ---------- misc ---------- */ * { padding: 0; margin: 0; border: 0; } body { background: #eee url(body.gif) no-repeat 50% 100%; color: #666; font: 11px/1.3em Arial, Tahoma, sans-serif; text-align: center; } acronym { cursor: help; } /* ---------- div ---------- */ #container { margin: 30px auto; border: 1px solid #ddd; background: transparent url(container.gif) repeat-y 50% 50%; text-align: left; width: 448px !important; width /**/:450px; } #intro { background: transparent url(intro.gif) no-repeat 0 0; } #container, #intro { position: relative; } #pageHeader { width: 448px; height: 260px; } #preamble, #supportingText { width: 303px; } #supportingText { background: transparent url(supportingText.gif) no-repeat 0 100%; width: 448px; } #explanation { background: transparent url(explanation.gif) no-repeat 0 50%; } #participation { background: transparent url(participation.gif) no-repeat 0 80%; } #benefits { background: transparent url(benefits.gif) no-repeat 0 100%; } #requirements { padding-bottom: 2px; } #footer { text-align: center; font: 10px/33px Tahoma, Arial, sans-serif; width: 100%; height: 35px; } #quickSummary, #linkList { position: absolute; left: 303px; width: 140px; font: 10px/1.3em Arial, Tahoma, sans-serif; } #quickSummary { top: 260px; padding-top: 18px; } #linkList { top: 420px; } #linkList div { text-align: center; } #lselect, #larchives, #lresources { padding: 5px 0 10px; } /* ---------- h3 ---------- */ h3 { margin: 7px 15px 3px; background-position: 0 0; background-repeat: no-repeat; text-indent: -9999em; font: 1px/1px sans-serif; /* stop IE from revealing unnecessary bg */ width: 273px; height: 28px; } #preamble h3 { margin-top: 13px; background-image: url(h3_01.gif); } #explanation h3 { background-image: url(h3_02.gif); } #participation h3 { background-image: url(h3_03.gif); } #benefits h3 { background-image: url(h3_04.gif); } #requirements h3 { background-image: url(h3_05.gif); } #linkList h3 { margin: 0 10px; width: 120px; height: 10px; } .select { background-image: url(h3_06.gif); } .archives { background-image: url(h3_07.gif); } .resources { background-image: url(h3_08.gif); } /* ---------- p ---------- */ p { padding: 0 15px 5px; text-align: justify; } #supportingText p { margin-right: 145px; } #quickSummary p { padding: 3px 12px 0; text-align: left; } /* ---------- a ---------- */ a { text-decoration: none; } a:link, a:visited { color: #666; } a:hover, a:active { color: #000; } #supportingText a { font-weight: bold; } #footer a { padding: 0 1px; font-weight: normal; } #quickSummary a:link, #quickSummary a:visited, #footer a:link, #footer a:visited { border-bottom: 1px dotted #888; } #quickSummary a:hover, #quickSummary a:active, #footer a:hover, #footer a:active { border-bottom: 1px dotted #222; } #linkList a:link, #linkList a:visited { text-transform: lowercase; color: #888; } #lselect a:link.c, #lselect a:visited.c { display: inline; color: #666; } #linkList a:hover, #linkList a:active, #lselect a:hover.c, #lselect a:active.c { color: #000; } #lselect a { display: block; text-transform: lowercase; } /* ---------- ul, li ---------- */ ul { margin: 5px 10px 0; border-top: 1px solid #ddd; text-align: left; list-style: none; } li { padding: 3px 0 3px 20px; border-bottom: 1px solid #ddd; background-repeat: no-repeat; background-position: 6px 5px; display: block; list-style: none; } li:hover { background-color: #f3f3f3; } #lselect li { background-image: url(designs.gif); } #larchives li { background-image: url(archives.gif); } #lresources li { background-image: url(resources.gif); } /* ---------- the unused ---------- */ h1, h2, extraDiv1, extraDiv2, extraDiv3, extraDiv4, extraDiv5, extraDiv6 { display: none; }/* css Zen Garden submission 144 - 'Verdure' by Lim Yuan Qing, http://yuanqing.blogspot.com/ */ /* css released under Creative Commons ShareAlike License v1.0 - http://creativecommons.org/licenses/sa/1.0/ */ /* All associated graphics copyright 2004, Lim Yuan Qing */ /* Photography copyright Lynne Lancaster, http://sxc.hu/browse.phtml?f=profile&l=weirdvis */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. */ /* The CSS itself may freely be used for anything you wish, but the associated graphics belong to the designer. */ /* What you may use - .css files. What you may not use - .jpg, .gif, and .png files. */ /* ---------- misc ---------- */ * { padding: 0; margin: 0; } body { background: #f2f2f2; color: #777; font: 11px/1.4em Arial, Tahoma, Verdana, sans-serif; text-align: center; } acronym { cursor: help; } /* ---------- div ---------- */ #container { padding: 0 2px; width: 500px !important; width /**/: 504px; margin: 0 auto; background: #fff url(container.gif) repeat-y; text-align: left; position: relative; } #quickSummary, #preamble, #supportingText div { padding: 5px 20px; width: 330px !important; width /**/: 370px; } #quickSummary { padding: 15px 20px; background: url(line.gif) no-repeat 50% 100%; } #preamble { padding-top: 15px; } #supportingText #requirements { padding-bottom: 12px; } #supportingText #footer { padding: 12px 20px; background: url(line.gif) no-repeat 50% 0; text-align: center; } #linkList { position: absolute; top: 287px; left: 372px; font-size: 10px; line-height: 1.2em; } /* ---------- h1, h2, h3 ---------- */ h1, h2, h3 { font-weight: normal; font-size: 1.0em; line-height: 1.0em; text-indent: -2000em; display: block; } h1 { width: 500px; height: 80px; background: #fff url(h1.gif) no-repeat 0 100%; } h2 { width: 500px; height: 206px; background: #b6c77b url(h2.jpg) no-repeat; } #preamble h3, #supportingText h3 { width: 231px; height: 27px; background-repeat: no-repeat; } #preamble h3 { background-image: url(h3_01.gif); } #explanation h3 { background-image: url(h3_02.gif); } #participation h3 { background-image: url(h3_03.gif); } #benefits h3 { background-image: url(h3_04.gif); } #requirements h3 { background-image: url(h3_05.gif); } #linkList h3 { width: 130px; height: 34px; background-repeat: no-repeat; background-color: #f2f4d8; } .select {background-image: url(h3_06.gif); } .archives {background-image: url(h3_07.gif); } .resources {background-image: url(h3_08.gif); } /* ---------- p ---------- */ p { padding-top: 5px; } .p1 { padding-top: 2px; } /* ---------- ul, li ---------- */ ul, li { list-style: none; } ul { border-top: 1px solid #ddd; } li { text-transform: lowercase; border-bottom: 1px solid #ddd; } #lselect li { padding: 5px 7px 5px 24px; background: url(bullet1.gif) no-repeat; } #lselect li:hover { background: #e6e9cd url(hover.gif) no-repeat; } #larchives li, #lresources li { background: url(bullet2.gif) no-repeat; padding: 5px 0; } div>#larchives li, div>#lresources li { padding: 0; height: 23px; background: url(bullet2.gif) no-repeat; } /* ---------- a ---------- */ a { text-decoration: none; } #intro a, #supportingText a { font-weight: bold; color: #9ead6c; } #footer a, #linkList a { color: #777; } #lselect a { display: block; color: #9ead6c; } #lselect a.c { display: inline; color: #777; } #larchives a, #lresources a { padding: 0 7px 0 22px; } div>#larchives a, div>#lresources a { padding: 5px 7px 5px 22px; height: 13px !important; height /**/: 23px; display: block; } #footer a:hover, #footer a:active, #linkList a:hover, #linkList a:active, #lselect a.c:hover, #lselect a.c:active { color: #222; } #intro a:hover, #intro a:active, #supportingText a:hover, #supportingText a:active, #lselect a:hover, #lselect a:active { color: #85925C; } div>#larchives a:hover, div>#larchives a:active, div>#lresources a:hover, div>#lresources a:active { background: #e6e9cd url(hover.gif) no-repeat -130px 0; }/* css Zen Garden submission 145 - 'Paravion', by Emiliano Pennisi, http://www.peamarte.it/01/metro.html */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Emiliano Pennisi */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ font-family: "Book Antiqua",Georgia,"MS Sans Serif", Geneva, sans-serif; background: #A3181E url(bg_body.gif) fixed repeat-x; margin: 0; text-align: center; margin: 0; padding: 0; height: 100%; } acronym { color: #A3181E; font-weight: bold; } /*h3 rules*/ div#linkList h3 span{ font-size: 16px; background: #A3181E; border-bottom: 2px solid white; color: White; margin-left: 5px; margin-bottom: 0; padding: 3px; width: 185px; display: block; } #preamble h3 span,#supportingText h3 span{ font-family: "Courier New", Courier, monospace; background: url(h3bg.gif) no-repeat 6px 0; color: #A3181E; font-size: 20px; letter-spacing: -1px; padding-left: 35px; } div#linkList h3{ font-family: "Book Antiqua",Times, Helvetica, sans-serif; font-weight: bold; } /*link*/ #preamble a, #supportingText a,#linkList a{ color: #2B497B; font-weight: bold; } #preamble a:hover,#supportingText a:hover{ background: #2B497B; color: White; text-decoration: none; } /*Style for linkList acronym*/ div#linkList acronym { background: #A3181E; color: White; } /*child selector only for compliant mode*/ body>div#container{ height: auto; min-height: 100%; } /*container*/ div#container{ position: relative; height: 100%; background: url(bg_container.gif); margin-left: auto; margin-right: auto; border-right: 3px solid white; border-left: 3px solid white; border-bottom: 20px solid white; width: 650px; text-align: left; font-size: 0.8em; } #pageHeader { background: url(head.gif) no-repeat; height: 452px; margin: 0 0 30px 0; } #pageHeader h1,#pageHeader h2{ display: none; } /*Hide quicksummary*/ #quickSummary .p2 a{ color: #A3181E; } #quickSummary p.p1 span{ display: none; } #quickSummary p.p2 { font-size: 0.9em; line-height: 12px; position: absolute; top: 275px; left: 235px; padding: 0 0 8px 0; width: 200px; text-transform: uppercase; font-weight: bold; border-top: 1px dashed #000; padding-top: 2px; } #preamble,#supportingText{ position: relative; margin-left: 250px; margin-top: -30px; width: 400px; } /*child selector only for compliant mode*/ div#preamble,div#supportingText{ background: url(st_bg.gif); } div#preamble,#supportingText{ padding: 10px; margin-bottom: 10px; width: 370px; /*Start Tantek Box Model Hack*/ voice-family: "\"}\""; voice-family: inherit; width: 350px; } /*child selector only for compliant mode*/ body > div#preamble,#supportingText{ width: 350px; } /**************************Navigation**********************************/ #linkList{ font-family: Georgia,"MS Sans Serif", Geneva, sans-serif; background: url(linklist_bg.jpg); padding: 10px; width: 220px; position: absolute; top: 450px; margin-left: 15px; /*Start Tantek Box Model Hack*/ voice-family: "\"}\""; voice-family: inherit; width: 200px; } #linkList li { color: #fff; } #linkList ul { list-style: none; margin: 5px; margin-top: -20px; padding: 0px; border-top: 10px solid #CAD2DE; background: #2B497B; } #linkList li { color: #000; border-bottom: 1px dotted #fff; padding: 0.2em 10px; line-height: 15px; } #linkList li:hover { background: #A3181E; } #container > #linkList ul li a:hover{ color: White; } #linkList ul li a:hover{ color: #A3181E; } #linkList li a { font-size: 10px; display: block; color: #fff; font-weight: bold; text-decoration: none; text-transform: uppercase; } #linkList li a:hover { color: #fff; } #linkList li a.c:hover { color: #fff; } #lselect ul li{ color: White; } #lselect ul li a.c{ font-weight: bold; display: inline; color: White; text-transform: none; } /*Start Footer rules*/ #footer { font-family: Georgia,"MS Sans Serif", Geneva, sans-serif; margin: 0 -5px -5px; border-top: 5px solid #FFF; background-color: #A3181E; padding: 10px; text-transform: uppercase; text-align: right; } #footer a{ font-size: 9px; color: #fff; font-weight: bold; padding: 3px; text-decoration: none; border-right: 1px solid white; padding: 0 5px 0 0; } /*End of code*/ /* css Zen Garden submission 146 - 'Urban', by Matt, Kim & Nicole, http://www.learnnewmedia.ca/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Matt, Kim & Nicole */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Originally from Session 3 of the Zen Garden student gallery, http://www.mezzoblue.dev/zengarden/alldesigns/student/ */ /* basic elements */ a:hover, a:active {color: #FFF; background: #ccc;} a:visited {color: #559999; text-decoration:none; font-weight:bolder;} a:hover {color: #ffffff; background: #ccc;} a:link {color: #FACD56; text-decoration:none; font-weight:bolder;} p {font: normal 10px/16px Tahoma, Verdana, Arial, sans-serif; text-align: justify; text-decoration:none;} #quickSummary p.p2 {position:absolute; z-index:3; text-align:center; left: 158px; top: 244px; width: 216px; height: 20px;} h3 {font: normal 10px/16px Tahoma, Verdana, Arial, sans-serif; letter-spacing: 1px; color: #7D775C;} /* start of body of text */ #preamble {top: 330px; height: 207px;} #supportingText {top: 540px; height: 1100px;} #supportingText, #preamble {text-decoration:none; width:355px;z-index:2; position:absolute; left: 334px;} /* end of body of text */ /* specific divs */ #css-zen-garden{background-color: #FFF;} #container {position: relative; width:765px; margin: 0 auto; text-align: left;} #footer a {text-decoration:none; text-align:right; text-transform:uppercase; color: #559999; font-weight:bolder; font-size:12px;} /* start of navagation */ #linkList {background: transparent url("final.gif") no-repeat top left; z-index:1; position: absolute; height:1650px; top: 244px; right: 0px; left: -10px; width: 778px; font-size:12px;} #linkList2 {font: 10px tahoma, verdana, sans-serif; width: 130px;} #linkList h3.select {width: 97px; height: 16px;} #linkList h3.favorites span {display:none;} #linkList h3.archives {width:57px; height: 14px; text-decoration:none;} #linkList li a:link {color: #FACD56; text-decoration:none; font-weight:bolder;} #linkList li a:visited {color: #000; text-decoration:none;} #linkList li a:hover {color: #ffffff; background: #ccc;} #linkList ul a.c {color: #ccddcb; display: inline; font-weight: normal;} #lselect ul a {line-height: 3.5ex; display: block; font-weight: bold;} #linkList li {color:#ccddcb; list-style-type: none; z-index:3; text-align:center; list-style-type: none;} #lselect {height: 239px; width: 150px; left: 134px; top: 37px;} #larchives {height: 35px; width: 168px; text-align:center; left: 125px; top: 534px;} #lresources {text-align:center; width: 150px; height: 30px; left: 132px; top: 423px;} #lresources, #larchives, #lselect {position:absolute; font-size:10px;} /* end of navagation */ /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 {background-image:url("title.gif"); background-repeat:no-repeat; height:245px;} #linkList h3.select span {display:none;} #linkList h3.archives span {display:none;} #linkList h3.resources span {display:none;} #pageHeader h1 span {display:none;} #pageHeader h2 span {display:none;} #quickSummary p.p1{width: 202px;} #quickSummary p.p2{width: 118px;} #quickSummary p.p2 a:visited {color:#FFFFFF;} #preamble h3 span {display:none;} #explanation h3 span {display:none;} #explanation h3 {background-image:url("what.gif"); background-repeat:no-repeat; height:20px; padding-top:10px;} #participation h3 span {display:none;} #participation h3 {background-image:url("part.gif"); background-repeat:no-repeat; height:27px;} #benefits h3 span {display:none;} #benefits h3 {background-image:url("benefits.gif"); background-repeat:no-repeat; height:27px;} #requirements h3 span {display:none;} #requirements h3 {background-image:url("require.gif"); background-repeat:no-repeat; height:27px;} #quickSummary p.p1 {display:none;} #extraDiv1 {background-image:url("background2.gif"); height:1617px; float:right; width:345px; z-index:0; background-repeat:no-repeat; margin-top:10px;}/* css Zen Garden submission 147 - 'Attitude', by Stephane Moens */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2004, Stephane Moens */ /* Added: Dec. 16th, 2004 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { background: url(bgFull.gif) repeat-x #6F715C; font: normal 11px/16px Tahoma, Verdana, Arial, sans-serif; color: #333; margin: 0px; } h3 { font: italic normal 12pt Tahoma, Verdana, Arial, sans-serif; letter-spacing: 1px; margin-bottom: 0px; color: #7D775C;} a:link { font-weight: normal; text-decoration: underline; color: #4F8CC3;} a:visited { font-weight: normal; text-decoration: underline; color: #1D3F64;} a:hover, a:active { text-decoration:none ; color: #346293;} acronym {font-weight:bold;} /* specific divs */ #container { position: relative; width: 570px; background: url(bgWoman.gif) no-repeat; margin: 0; padding: 170px 0 0 170px;} #intro { min-width: 470px; } #pageHeader { display: none; } #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; margin-top: 10px; width: 219px; height: 87px; float: left;} #pageHeader h1 span {display:none} #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; margin-top: 58px; margin-bottom: 40px; width: 200px; height: 18px; float: right;} #pageHeader h2 span { display:none;} #quickSummary { position:absolute; left:530px; top: 730px; width:150px; color: #f4f0e6;} #quickSummary p.p1 {display:none;} #quickSummary p.p2 {} #quickSummary a{ color: #98B974; text-decoration:underline;} #quickSummary a:hover{ color: #f4f0e6; text-decoration:none;} #preamble { clear: right; padding: 10px 10px 0 65px; width:260px;} #preamble h3 { display:block; width:100%; height:23px; background: url(title0.gif) no-repeat;} #preamble h3 span {display:none;} #preamble p {margin:5px 0 0 0; padding:0; color: #6F715C; font-style:italic;} #supportingText { clear: right; padding: 20px 10px 0 0; margin:0; width:490px; background:url(dotedLine.gif) 10px 10px no-repeat;} #explanation {margin:0; padding: 0 0 0 65px; width:260px;} #explanation h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #explanation h3 span {display:none;} #explanation p {margin:5px 0 0 0; padding:0; color: #53553F;} #participation {margin:10px 0 0 0; padding: 0 0 0 65px; width:260px;} #participation h3 { display:block; width:100%; height:23px; background: url(title2.gif) no-repeat; margin:0;} #participation h3 span {display:none;} #participation p {margin:5px 0 0 0; padding:0; color: #53553F;} #benefits {margin:10px 0 0 0; padding: 0 0 0 65px; width:260px;} #benefits h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #benefits h3 span {display:none;} #benefits p {margin:5px 0 0 0; padding:0; color: #53553F;} #requirements {margin:10px 0 0 0; padding: 0 200px 0 65px; width:266px; background: url(bgBottom0.gif) right bottom no-repeat;} #requirements h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #requirements h3 span {display:none;} #requirements p {margin:5px 0 0 0; padding:0; color: #53553F;} #footer { padding: 20px 0 30px 45px; width:510px; background: url(bgBottom1.gif) 0px 0px no-repeat;} #footer a:link, #footer a:visited { color:#fff; margin: 0 0 0 15px; } #footer a:hover { color:#3F753E;} #linkList { position: absolute; top: 170px; right: 0px; color:#4C4E39;} #linkList2 { font: 10px Tahoma, Verdana, Arial, sans-serif; width: 220px;} #linkList h3.select { background:url(subTitle0.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.select span {display:none;} #linkList h3.archives { background: transparent url(subTitle1.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.archives span {display:none;} #linkList h3.resources { background: transparent url(subTitle2.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.resources span {display:none;} #linkList p, #linkList li{ font: x-small/1.6em tahoma, verdana, sans-serif; text-indent: 0;} #linkList ul { list-style: none; margin: 0; padding: 0; } #linkList li { color: #fff; padding: 2px 0 0 17px; } #linkList li a { display: block; border: none; color: #98B974; text-decoration:none; font-weight: bold; margin-left: -12px; padding-left: 12px; background: url(arrow.gif) no-repeat 0 2px;} #linkList li a:hover { color: #f4f0e6; background-position: 0 -48px; text-decoration:underline; } #linkList li a.c { display: inline; padding: 0; margin: 0; background: none; color: #4C4E39; font-weight: normal; } #linkList li a.c:hover { color: #f4f0e6; } #linkList #larchives li,#linkList #lresources li,#linkList #lfavorites li { padding: 2px 0 0 5px; } #linkList #larchives li a,#linkList #lresources li a,#linkList #lfavorites li a { background: transparent url(arrow.gif) no-repeat 0 2px; display: inline; padding-left: 17px; margin: 0;} #linkList #larchives li a:hover,#linkList #lresources li a:hover,#linkList #lfavorites li a:hover { background-position: 0 -48px; } #extraDiv1 { background: transparent url(cr2.gif) top left no-repeat; position: absolute; top: 40px; right: 0px; width: 148px; height: 110px; }/* css Zen Garden submission 148 - 'Museum', by Samuel Marin, http://www.info.fundp.ac.be/~sma/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Samuel Marin */ /* Added: Jan. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Tested and 100% compatible with: ================================ Windows browsers: Internet Explorer 5.5/6, Netscape 6/7.1/7.2, Mozilla 1.7.3, Firefox 1.0 Previous Release/1.0, Opera 7.54 Mac browsers (Mac OS X): Internet Explorer 5.2.3, Safari 1.2.3, Firefox 1.0 Unix browsers: Mozilla 1.4.1/1.7b/1.7.3 (Linux), Firefox 0.9.3 (Linux), Galeon 1.3.10 (Linux), Opera 7.54 Final (Linux), Epiphany 1.4.4 (Linux), Mozilla 1.4 (Solaris) (Very) minor issues with: ========================= Internet Explorer 5 (Windows) Konqueror 3.1.4-6 (Linux) Graphics: ========= The graphics are my own illustrations using Adobe Photoshop and Illustrator (some inspirations from google search images). Photos: ======= The photos are from "http://www.sxc.hu/": The tree and the enlighted path by Christopher Bruno (vxdigital) -> http://www.cbruno.com/ The water lily by King Ayo (kingayo) -> http://www.kingayo.com (kingayo@wanadoo.fr) The Butterfly by Dirk De Kegel (Magos) -> Dirk.De.Kegel@pandora.be The flower by Troy Nulus (nulus) -> nulus@mail.com The ladybug by Michal Zajac (babinicz) -> miczajac@poczta.onet.pl The fledglings by Rob Waterhouse (Rob_W) -> robw349@hotmail.com Font: ===== One of the font of the header and the titles of the linklist come from "http://www.dafont.com" and is free: MK British Writing by Manfred Klein -> cybapee@joice.net References: =========== For information, here is the main references I used: * CSS The Definitive Guide (Eric Meyer) * More Eric Meyer on CSS (Eric Meyer) * And a lot of CSS from the Zen Garden website Thanks: ======= Thanks to Charlotte Dereppe for her invaluable advices. */ /* ============== basic elements ============== */ body { background: #444444; padding: 0px; margin: 0px; font: 13px Georgia, Serif; color: #7f7f7f; text-align: center; } p { padding: 0px; margin: 0px; } a:link, a:visited { text-decoration: underline; color: #706F6A; } a:hover, a:active { text-decoration: none; color: #555555; } /* ============= specific divs ============= */ /* --- container --- */ #container { background: #5d5d5d; position: relative; padding: 0px; margin: 0px auto; width: 760px; text-align: left; border-left: 1px solid #fff; border-right: 1px solid #fff; } /* --- intro --- */ #intro { background: url(images/intro_bg.jpg) repeat-y left; padding: 0px; margin: 0px; width: 760px; } /* --- pageHeader --- */ #pageHeader { background: url(images/header_bg.jpg) no-repeat; padding: 0px; margin: 0px; width: 760px; height: 400px; } #pageHeader h1, #pageHeader h2 { display: none; } /* --- quickSummary --- */ #quickSummary p.p1 { display: none; } #quickSummary p.p2 { font-size: 11px; color: #ccc; position: absolute; top: 0px; left: 2px; } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited { text-decoration: underline; color: #ccc; } #quickSummary p.p2 a:hover, #quickSummary p.p2 a:active { text-decoration: none; color: #ccc; } /* --- preamble --- */ #preamble h3 { background: url(images/preamble.jpg) no-repeat; padding: 0px; margin: 0px; width: 560px; height: 147px; } #preamble h3 span { display: none; } #preamble { background: url(images/preamble_bg.jpg) no-repeat top; padding: 0px; width: 560px; } #preamble p { text-indent: 2em; } #preamble p:first-letter { font-size: 180%; font-weight: bold; color: #444444; } #preamble p.p1 { padding: 10px 85px 10px 86px; margin: -100px 0px 0px 0px; } #preamble p.p2 { padding: 0px 85px 20px 86px; margin: 0px; } #preamble p.p3 { background: url(images/preamble_img.jpg) no-repeat bottom; padding: 0px 85px 60px 280px; margin: 0px; } /* --- supporting text --- */ #supportingText { background: url(images/st_bg.jpg) repeat-y; position: relative; padding: 0px; width: 560px; } /* --- explanation --- */ #explanation h3 { background: url(images/trans_prea_expl.jpg) no-repeat; padding: 0px; margin: 0px; width: 560px; height: 153px; } #explanation h3 span { display: none; } #explanation { background: url(images/explanation_bg.jpg) no-repeat top; padding: 0px; margin: 0px; width: 560px; } #explanation p { text-indent: 2em; } #explanation p:first-letter { font-size: 180%; font-weight: bold; color: #444444; } #explanation p.p1 { padding: 10px 115px 10px 106px; margin: 0px; } #explanation p.p2 { background: url(images/explanation_img.jpg) no-repeat bottom; padding: 0px 115px 50px 106px; margin: 0px; } /* --- participation --- */ #participation h3 { background:url(images/trans_expl_part.jpg) no-repeat; padding: 0px; margin: 0px; height: 155px; } #participation h3 span { display: none; } #participation { background: url(images/participation_bg.jpg) repeat-y; padding: 0px; margin: 0px; width: 560px; } #participation p { text-indent: 2em; } #participation p:first-letter { font-size: 180%; font-weight: bold; color: #444444; } #participation p.p1 { padding: 10px 115px 10px 106px; margin: 0px; } #participation p.p2 { padding: 0px 115px 10px 106px; margin: 0px; } #participation p.p3 { background: url(images/participation_img.jpg) no-repeat bottom; padding: 0px 160px 20px 161px; } /* --- benefits --- */ #benefits h3 { background: url(images/trans_part_bene.jpg) no-repeat; padding: 0px; margin: 0px; height: 147px; } #benefits h3 span { display: none; } #benefits { background: url(images/benefits_bg.jpg) repeat-y; padding: 0px; margin: 0px; width: 560px; } #benefits p { text-indent: 2em; } #benefits p:first-letter { font-size: 180%; font-weight: bold; color: #444444; } #benefits p.p1 { padding: 10px 145px 0px 146px; margin: 0px; } /* --- requirements --- */ #requirements h3 { background: url(images/trans_bene_requ.jpg) no-repeat; padding: 0px; margin: 0px; height: 230px; } #requirements h3 span { display: none; } #requirements { background: url(images/requirements.jpg) no-repeat bottom; padding: 0px 0px 105px; margin: 0px; width: 560px; } #requirements p { padding: 0px 105px 10px 106px; margin: 0px; text-indent: 2em; } #requirements p:first-letter { font-size: 180%; font-weight: bold; color: #444444; } #requirements p.p1 { background: url(images/requirements_img.jpg) no-repeat top; padding: 100px 105px 10px 106px; margin: 0px; } /* --- footer --- */ #footer { background: url(images/footer_bg.jpg) repeat-y; font: 11px Georgia, Serif; padding-top: 2px; padding-left: 3px; margin: 0px; width: 560px; height: 35px; } #footer a { font-weight: bold; padding: 0px; } /* --- linkList --- */ #linkList { position: absolute; top: 400px; left: 570px; padding: 0px; margin: 0px; width: 190px; } #linkList h3 span { display: none; } #linkList #lselect h3 { background: url(images/header_lselect.jpg) no-repeat; padding: 0px 5px 0px 5px; margin: 0px; height: 70px; } #linkList #larchives h3 { background: url(images/header_larchives.jpg) no-repeat; padding: 0px 5px 0px 5px; margin: 0px; height: 70px; } #linkList #lresources h3 { background: url(images/header_lresources.jpg) no-repeat; padding: 0px 5px 0px 5px; margin: 0px; height: 70px; } #linkList ul { background: url(images/linklist_bg.jpg) repeat-y; padding: 0px 25px; margin: 0px; } #linkList li { display: block; list-style-type: none; font: 10px Georgia, Serif; line-height: 14px; font-weight: normal; color: #D4D2D2; text-align: left; padding: 3px 2px 10px 2px; margin: 0px; border-bottom: 1px dotted #ccc; } #linkList li a:link, #linkList li a:visited, #linkList li a:visited:hover, #linkList li a:hover, #linkList li a:active { font-style: normal; padding-right: 5px; } .c { font-weight: normal ! important; color: #D4D2D2 ! important; padding: 0px 14px 0px 0px; margin: 0px; } #linkList li a { display: block; font-weight: bold; color: #fff; } #linkList li a.c { display: inline; padding: 0px; margin: 0px; } #larchives, #lselect { background: #fff url(images/linklist_footer.jpg) no-repeat bottom; padding: 0px 0px 127px 0px; margin: 0px 0px 10px 0px; width: 190px; } #lresources { background: #fff url(images/linklist_footer_guard.jpg) no-repeat bottom; padding: 0px 0px 127px 0px; margin: 0px 0px 10px 0px; width: 190px; } /* css Zen Garden submission 149 - 'Uncultivated', by Mario Carboni, http://www.mariocarboni.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Mario Carboni */ /* Added: Jan. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* general _______________________________________________________________________________*/ * { padding: 0; margin: 0; } body { font: 11px/1.3em Arial,Helvetica,sans-serif; text-align: center; background: #bebcad; } p { text-align: justify; padding: 5px 30px 15px 30px; color: #786A47; line-height: 1.5em; } a{ text-decoration: none; background: transparent url(dotlink.gif) repeat-x left bottom; } a:link ,a:visited { color: #5785A4; } a:hover { color: #1D8FDB; } acronym { background: transparent url(dot.gif) repeat-x left bottom; cursor: help; } h3 { font: normal 10px/12px Arial,Helvetica,sans-serif; text-transform: uppercase; margin: 20px 0 0 30px; color: #574D33; } ul { list-style: none; margin: 10px 20px 30px 10px; } li { padding-left: 1px; margin: 10px 0 0 8px; display: block; list-style: none; background: transparent url(dot.gif) repeat-x 0 100%; } /* grid _______________________________________________________________________________*/ #container { margin: 0 auto; text-align: left; width: 580px; background: url(container.gif) repeat-y center top; position: relative; } #quickSummary { background: transparent url(quicksummary.gif) no-repeat top left; height: 178px; } #preamble,#supportingText { padding-right: 200px; } #supportingText { background: transparent url(foot2.jpg) no-repeat 0 100%; } #lresources { padding-bottom: 220px; background: transparent url(flowers.jpg) no-repeat 0 100%; } #footer { height: 34px; line-height: 34px; text-align: center; padding-bottom: 14px; } #linkList { position: absolute; top: 210px; right: 0; width: 210px; } #extraDiv1 { position: absolute; top: 0; left: 0; background: transparent url(uncultivated.gif) no-repeat; width: 43px; height: 297px; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* headers _______________________________________________________________________________*/ #pageHeader h1 { background: transparent url(csszen.jpg) no-repeat top left; width: 580px; height: 40px; } #pageHeader h1 span { display: none } #pageHeader h2 { background: transparent url(beauty.jpg) no-repeat top left; width: 580px; height: 169px; } #pageHeader h2 span { display: none; } #linkList h3.select { background: transparent url(styles.jpg) no-repeat top left; height: 39px; margin: 0; } #linkList h3.select span { display: none; } #linkList h3.archives { background: transparent url(archives.jpg) no-repeat top left; height: 39px; margin: 0; } #linkList h3.archives span { display: none; } #linkList h3.resources { background: transparent url(resources.jpg) no-repeat top left; height: 39px; margin: 0; } #linkList h3.resources span { display: none; } /* p _______________________________________________________________________________*/ #quickSummary .p1 { display: none; } #quickSummary .p2 { margin-right: 200px; color: #382A07; text-align: right; padding-top: 150px; } #preamble p, #supportingText p{ margin: 0 10px; background: url(p.gif); } #requirements .p4{ margin-bottom: 40px; } #requirements .p5{ margin-bottom: 110px; text-align: center; } /* links _______________________________________________________________________________*/ #footer a{ text-decoration: underline; } #footer a:link, #footer a:visited { color: #c6c6c6; } #footer a:hover { color: #fff; } #linkList li a { display: block; font-weight: bold; color: #E5D9BC; text-decoration:none; margin-left: -5px; padding-left: 19px; padding-bottom: 4px; background: url(dot2.gif) no-repeat 0 1px; } #linkList li a:hover { color: #7ECDFF; background: transparent url(dot2on.gif) no-repeat 0 1px; } #linkList li a.c { display: inline; padding: 0; margin: 0; background: none; color: #595339; font-weight: normal; } #linkList li a.c:hover { color: #7ECDFF; } #linkList #larchives li,#linkList #lresources li,#linkList #lfavorites li { padding: 2px 0 0 7px; } #linkList #larchives li a,#linkList #lresources li a,#linkList #lfavorites li a { background: transparent url(dot2.gif) no-repeat 0 1px; display: block; padding-left: 19px; padding-bottom: 5px; margin: 0 0 0 -11px; } #linkList #larchives li a:hover,#linkList #lresources li a:hover,#linkList #lfavorites li a:hover { background: transparent url(dot2on.gif) no-repeat 0 1px; }/* css Zen Garden submission 150 - 'By The Pier', by Peter Ong, http://peter.rock.per.sg/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Peter Ong */ /* Added: Jan. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { color: #fc3; font-size: 11px; font-family: Arial, Helvetica, sans-serif; line-height: 17px; background-color: #000; text-align: center; margin: 0; padding: 0; } a:link { color: #cf6; font-weight: bold; text-decoration: none; } a:visited { color: #007f00; font-weight: bold; text-decoration: none; } a:hover, a:active { color: #f60; text-decoration: none; border-bottom: 1px dotted #005e00; } /* specific divs */ #container { background-color: #0c3379; text-align: left; margin: 8px auto; padding: 0; width: 640px; } acronym { color: #ffff67; font-style: italic; font-weight: bold; text-decoration: none; border-width: 0; } #intro { background-image: url("media/masthead.jpg"); background-repeat: no-repeat; background-position: center top; margin: 0; padding: 0; width: 640px; height: 445px; } #pageHeader { display: none; margin: 0; padding: 0; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 span, #pageHeader h2 span { display: none; } #quickSummary { width: 300px; margin: 0 0 0; padding: 154px 0 0; position: absolute; } #quickSummary .p1 span { display: none; margin: 0; padding: 0; } #quickSummary .p2 span { color: #699fc8; font-size: 10px; text-align: left; margin: 0 0px; padding: 0; position: absolute; top: 150px; float: left; } #preamble { margin: 0; padding: 233px 0 10px 0; width: 375px; float: right; } #supportingText { clear: right; } #explanation, #participation, #benefits, #requirements { background-color: #0c3379; padding-bottom: 10px; width: 375px; float: right; clear: both; } #preamble h3 { background-image: url("media/enlightenment.gif"); background-repeat: no-repeat; background-position: right 0; margin: 199px 0 8px; padding: 0; width: 375px; height: 35px; float: right; } #participation h3 { background-image: url("media/participation.gif"); background-repeat: no-repeat; background-position: right 0; margin: 8px 0; padding: 0; width: 375px; height: 35px; float: right; } #requirements h3 { background-image: url("media/requirements.gif"); background-repeat: no-repeat; background-position: right 0; margin: 8px 0; padding: 0; width: 375px; height: 35px; float: right; } #benefits h3 { background-image: url("media/benefits.gif"); background-repeat: no-repeat; background-position: right 0; margin: 8px 0; padding: 0; width: 375px; height: 35px; float: right; } #explanation h3 { background-image: url("media/whatabout.gif"); background-repeat: no-repeat; background-position: right 0; margin: 8px 0; padding: 0; width: 375px; height: 35px; float: right; } .p1, .p2, .p3, .p4, .p5 { text-align: left; margin: 0; padding: 0 0 8px 15px; width: 320px; float: left; } #preamble h3 span, #participation h3 span, #explanation h3 span, #benefits h3 span, #requirements h3 span { display: none; margin: 0; padding: 0; } #footer { background-image: url("media/base.jpg"); background-repeat: no-repeat; background-position: center bottom; text-align: center; margin-right: auto; margin-left: auto; padding-top: 100px; padding-bottom: 20px; width: 640px; clear: both; } #footer a:link, #footer a:visited { font-weight: bold; margin-top: 0; padding-bottom: 50px; } #linkList { background-color: #0c3379; position: absolute; top: 440px; width: 210px; } #lselect { margin: 0; padding: 0 0 0 0; } #lselect h3 { margin: 0 0 0 40px; padding: 0; } #linkList ul li { font-size: 10px; list-style-type: none; margin: 0; padding: 0 0 5px; } #linkList ul { text-align: right; list-style-type: none; margin-top: 0; margin-right: 0; margin-bottom: 18px; padding: 0; } #linkList h3.select { background-image: url("media/select.gif"); background-repeat: no-repeat; margin: 0 0 0 0; padding: 0 0 8px; width: 210px; height: 35px; } #linkList h3.select span { display: none; } #linkList h3.favorites { background-image: url("media/favourites.gif"); background-repeat: no-repeat; margin: 0 0 0 0; padding: 0 0 8px; width: 210px; height: 35px; } #linkList h3.favorites span { display: none; } #linkList h3.archives { background-image: url("media/archives.gif"); background-repeat: no-repeat; margin: 0 0 0 0; padding: 0 0 8px; width: 210px; height: 35px; } #linkList h3.archives span { display: none; } #linkList h3.resources { background-image: url("media/resources.gif"); background-repeat: no-repeat; margin: 0 0 0 0; padding: 0 0 8px; width: 210px; height: 35px; } #linkList h3.resources span { display: none; } #linkList #lselect li a:link { font-size: 10px; color: #cf6; text-decoration: none; text-transform: uppercase; display: block; padding: 2px 4px; } #linkList #lselect li a:hover { font-size: 10px; color: #f60; text-decoration: none; display: block; padding: 2px 4px; border-width: 0; } #linkList #lselectli a:visited { font-size: 10px; color: #5bbb11; text-decoration: none; display: block; padding: 2px 4px; } #linkList #lselect ul li a.c { font-size: 10px; color: #fff; font-style: italic; text-decoration: none; text-transform: none; display: inline; padding: 2px 4px; } #linkList li a:link { color: #cf6; text-decoration: none; text-transform: uppercase; padding: 2px 4px; } #linkList li a:hover { color: #f60; text-decoration: none; text-transform: uppercase; padding: 2px 4px; border-width: 0; } #linkList li a:visited { color: #5bbb11; text-decoration: none; text-transform: uppercase; padding: 2px 4px; } /* css Zen Garden submission 151 - 'Contempo Finery', by Ro London, http://www.intersmash.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Ro London */ /* Added: Jan. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ *{ margin:0; padding:0; background-repeat:no-repeat; } body{ font-family:arial,helvetica,sans-serif; color:#888; background-color:white; font-size:small; margin-top:100px; text-align:center; background-image:url(z-background2.gif); background-repeat:repeat-y; background-position:center top; } div, p, h2, h1{ text-align:left; width:247px; } h3{ width:200px; padding:0px; color:white; font-size:1px; height:60px; text-indent:-1000px; } acronym{ cursor: help; } #container{ width:500px; margin-left:auto; margin-right:auto; } p{ line-height:150%; } p span{ display:block; padding:0 22px 22px 22px; } #intro{ float:left; } #supportingText{ float:left; width:250px; } #pageHeader{ height:240px; background-image:url(z-header2.gif); background-position:0 0; } #pageHeader *{ display:none; } #quickSummary{ height:470px; background-image:url(z-d.gif); } #quickSummary * { display:none; } #preamble{ margin-top:800px; background-image:url(z-e.gif); background-position:0 0; } #preamble p span{ color:#966; text-align:center; } #preamble .p3{ padding-bottom:30px; } #preamble h3{ padding:20px; height:115px; } #explanation h3{ background-image:url(z-h1.gif); background-position:7px 12px; margin-left:4px; } #participation, #explanation, #benefits, #requirements{ background-image:url(zbg.gif); } #participation h3{ background-image:url(z-h2.gif); background-position:7px 12px; margin-left:4px; } #benefits h3{ background-image:url(z-h3.gif); background-position:7px 12px; margin-left:4px; } p{ background-image:url(zbg.gif); background-position:0 -50px; } #requirements .p5{ background-image:none; } #requirements .p5{ padding-top:50px; background-image:url(z-leaf3.gif); background-position:right center; margin-top:0px; margin-bottom:100px; font-size:x-small; color:#ccc; text-align:center; background-color:#fff; height:250px; } #requirements .p5 span{ margin-right:30px; } #requirements .p5 a{ color:#aaa; text-decoration:none; font-style:italic; } #requirements h3{ background-image:url(z-h4.gif); background-position:7px 12px; margin-left:4px; } #requirements .p4, #benefits .p1, #participation .p3, #explanation .p2, #preamble .p3 { background-image:url(zbg.gif); background-position:center bottom; } #linkList{ clear:both; position:absolute; top:811px; left:50%; z-index:5; margin-left:-258px; * margin-left:-250px; width:247px; background-image:url(zbg.gif); background-position:0 -401px; height:799px; overflow:hidden; padding-bottom:0px; *padding-bottom:0; } head+body #linkList{ margin-left:-250px; padding-bottom:0; } #linkList h3{ height:60px; width:247px; background-position:0 0; } .select{ background-image:url(z-s3.gif); } .archives{ background-image:url(z-s4.gif); margin-top:30px; } .resources{ background-image:url(z-s5.gif); margin-top:30px; } #lselect{ background-image:url(zbg.gif); } li, ul{ list-style-type:none; } a{ color:#366; } a:hover{ background-color:#eee; } li{ display:block; width:247px; min-height:20px; * height:20px; margin-bottom:9px; * margin-bottom:0; background-image:url(zbg.gif); background-position:0 -40px; } li a{ margin-left:2px; border-right:2px solid #fff; border-left:2px solid #fff; display:block; width:239px; height:100%; font-size:x-small; text-transform:uppercase; text-decoration:none; color:#699; text-align:center; padding: 2px 0 2px 0; } li a:hover{ background-color:#f3f3f3; border-right:2px solid #f3f3f3; border-left:2px solid #f3f3f3; } li .c{ display:none; } #footer{ position:absolute; top:0px; left:50%; overflow:hidden; height:24px; width:240px; background-color:#ededed; text-align:center; background-image:url(z-cr.gif); background-position:bottom right; line-height:15px; } #footer a{ color:#999; text-decoration:none; font-size:x-small; text-transform:uppercase; } #footer a:hover{ color:#333; } #extraDiv2{ width:35px; height:24px; position:absolute; left:50%; margin-left:-24px; top:0px; background-image:url(z-cl.gif); background-position:bottom left; } #extraDiv1{ width:102px; height:235px; position:absolute; left:50%; margin-left:-351px; top:520px; background-image:url(z-leaf2.gif); } #lselect li{ text-align:center; * text-align:left; font-size:1px; color:white; } a:visited{ color:#7E84A1; }/* css Zen Garden submission 152 - 'Subway Dream', by Pablo Caro, http://www.nuevostudio.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Pablo Caro */ /* Added: Jan. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body#css-zen-garden { background: url(images/trama.gif); margin: 0; padding: 0; font-size: 70%; font-family: 'Lucida Grande','Lucida Sans Unicode',arial,verdana,sans-serif; color: #B198C5; } p { line-height: 170%; text-indent: 30px; } a { color: #BA76FF; text-decoration: none; } a:hover { color: #F286FF; } acronym { font-style: normal; color: #CCAFE3; cursor: help; } /*POSITIONING======================================*/ #container { position: relative; background: #2E0154 url(images/background.gif) no-repeat top center; border-left: 5px solid #CD9FF3; border-right: 5px solid #CD9FF3; margin: 0 auto; width: 720px; } #intro { width: 100%; background: transparent url(images/girl.gif) no-repeat; } #pageHeader { width: 720px; height: 55px; } #quickSummary { margin-top: 237px; margin-left: 270px; width: 425px; height: 166px; background: transparent url(images/quicksum.gif) no-repeat; } #preamble { margin-left: 75px; margin-right: 280px; background: transparent url(images/back_flowers.gif) no-repeat 0 0; } #supportingText { margin-left: 75px; margin-right: 275px; } #explanation { background: transparent url(images/back_flowers.gif) no-repeat 100% 100%; } #participation { background: transparent url(images/back_flowers.gif) no-repeat 100% 0%; } #benefits { background: transparent url(images/back_flowers.gif) no-repeat 0% 0%; } #requirements { background: transparent url(images/back_flowers.gif) no-repeat 100% 0%; } #linkList { position: absolute; top: 515px; left: 480px; width: 225px; background: transparent url(images/back_list.gif) repeat-y; } #footer { padding: 25px 0; text-align: center; text-transform: uppercase; background: transparent url(images/footer.gif) no-repeat 50% 50%; } /*HEADERS======================================*/ #pageHeader h1, #pageHeader h2 { display: none; } #preamble h3 { position: relative; left: -20px; display: block; height: 57px; background: transparent url(images/title_the_road.gif) no-repeat; text-indent: -1500px; } #supportingText h3 { position: relative; left: -20px; display: block; height: 58px; text-indent: -1500px; } #explanation h3 {background: transparent url(images/title_so_what.gif) no-repeat;} #participation h3 {background: transparent url(images/title_participation.gif) no-repeat;} #benefits h3 {background: transparent url(images/title_benfits.gif) no-repeat;} #requirements h3 {background: transparent url(images/title_requirements.gif) no-repeat;} #linkList2 h3 { display: block; height: 35px; margin: 0px 30px; text-indent: -1500px;} #lselect h3 {background: transparent url(images/title_select.gif) no-repeat;} #larchives h3 {background: transparent url(images/title_archives.gif) no-repeat;} #lresources h3 {background: transparent url(images/title_resources.gif) no-repeat;} /*LISTS======================================*/ #linkList ul { margin: 0 10px 0 35px; padding-left: 0; padding-bottom: 10px; list-style-type: none; font-family: 'Lucida Grande','Lucida Sans Unicode',arial,verdana,sans-serif; font-size: 10px; } #lselect ul li { padding-left: 20px; } #lselect ul li a { margin-left: -25px; padding-left: 25px; background: transparent url(images/bullet_flower.gif) no-repeat 0 50%; line-height: 25px; text-decoration: none; display: block; clear: both; text-transform: uppercase; } #lselect ul li a:hover { color: #F286FF; background-image: url(images/bullet_flower_on.gif); } #lselect ul li a.c { margin-left: 0; padding-left: 0px; padding-right: 12px; background-image: none; display: inline; clear: none; text-transform: none; color: #B198C5; } #lselect ul li a.c:hover { color: #F286FF; background: transparent url(images/bullet_stah.gif) no-repeat 100% 50%; } #lselect ul li a.c:hover { color: #F286FF; } #larchives ul li a, #lresources ul li a { display:block; padding-left: 25px; background: transparent url(images/bullet_oval.gif) no-repeat 0 50%; line-height: 25px; text-decoration: none; } #larchives ul li a:hover, #lresources ul li a:hover { background-image: url(images/bullet_oval_on.gif); } /*VARIOUS======================================*/ #quickSummary p.p1 { display: none; } #quickSummary p.p2 { text-indent: 4px; padding-top: 140px; text-transform: uppercase; } /* css Zen Garden submission 153 - 'Moss', by Mani Sheriar, http://www.manisheriar.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Mani Sheriar */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* CSS Document */ * { padding:0; margin:0; border:0; } * html #content { margin-bottom:-600px; } /*IE */ body { background:#2B411B url(bg2.gif) repeat; padding-bottom:600px; } abbr, acronym { font-style:italic; cursor:help; } a { color:#A7D277; text-decoration:underline; } a:hover { color:#28411C; background-color:#8DBB5A; text-decoration:none; } #container { position:relative; width:818px; padding:125px 0 0 18px; background:url(bg.jpg) repeat-y; margin:0 0 -1200px 0; } #intro, #supportingText { position:relative; width:500px; backgroun-color:#2B411B } #pageHeader { position:absolute; top:-125px; left:-18px; width:813px; height:201px; background:url(logo.jpg) no-repeat; z-index:1; } h1 span, h2 span, #preamble h3 span, #supportingText #explanation h3 span, #supportingText #participation h3 span, #supportingText #benefits h3 span, #supportingText #requirements h3 span, #pageheader span, h3.select span, h3.archives span, h3.resources span { visibility:hidden; } h1 span, h2 span { position:absolute; } #quickSummary { margin:0 0 50px 0; } #quickSummary p.p1 { position:relative; font:normal 15px/17px Georgia, "Times New Roman", Times, serif; color:#C9E2AB; z-index:2; } #quickSummary p.p2 { position:absolute; top:-100px; left:568px; width: 141px; font:normal 13px/16px Georgia, "Times New Roman", Times, serif; color:#C9E1AA; z-index:3; } #quickSummary p.p2 a:hover { color:#69913E; background-color:#C9E1AA; text-decoration:none; } #preamble p, #supportingText p { font:normal 13px/16px Verdana, Arial, Helvetica, sans-serif; color:#A3C979; margin:12px 0; } #preamble h3 { width:227px; height:36px; background:url(enlightenment.gif) no-repeat; margin:30px 0 -10px -2px; } #explanation h3 { width:233px; height:36px; background:url(about.gif) no-repeat; margin:30px 0 -10px -2px; } #preamble p.p3 { margin:12px 0 0 0; } #participation h3 { width:114px; height:36px; background:url(participation.gif) no-repeat; margin-top:30px; margin-bottom:-10px; } #benefits h3 { width:114px; height:36px; background:url(benefits.gif) no-repeat; margin-top:30px; margin-bottom:-10px; } #requirements h3 { width:150px; height:36px; background:url(requirements.gif) no-repeat; margin-top:30px; margin-bottom:-10px; } #linkList { position:absolute; width:174px; top: 100px; left: 572px; font:normal 10px/12px Verdana, Arial, Helvetica, sans-serif; color:#69913E; z-index:4; } #linkList #lselect li { margin-bottom:8px; } #linkList a { font:bold 12px/12px Georgia, "Times New Roman", Times, serif; color:#E7F9D3; display:block; background-color:#B1D48A; text-decoration:none; margin:0 0 1px 0; } #linkList a:hover { color:#436023; } #linkList #lselect a.c, #linkList #larchives a, #linkList #lresources a { font:normal 10px/12px Verdana, Arial, Helvetica, sans-serif; color:#69913E; display:inline; text-decoration:underline; } #linkList #lselect a.c:hover, #linkList #larchives a:hover, #linkList #lresources a:hover { color:#C9E1AA; background-color:#66992D; text-decoration:none; } #linkList h3 { margin:25px 0 0 0; height:54px; } #linkList ul { margin:-25px 0 0 20px; list-style-type:none; list-style-image:url(bullet.gif); } #linkList ul li { margin:0 0 4px 0; } h3.select, h3.archives, h3.resources { background-repeat:no-repeat; } h3.select { background-image:url(design.gif); width:124px; } h3.archives { background-image:url(archives.gif); width:81px; } h3.resources { background-image:url(resources.gif); width:84px; } #footer { position:relative; left:-18px; background:url(footer.jpg) no-repeat bottom left; width:615px; height:47px; padding:60px 220px 0 0; text-align:center; } #footer a { color:#C9E1AA; } #footer a:hover { color:#69913E; background-color:#C9E1AA; } #extraDiv1 { position:relative; top:600px; left:561px; height:600px; width:454px; background:url(tree.jpg) no-repeat bottom left; z-index:5; } #extraDiv2 { position:relative; top:0; left:561px; height:600px; width:454px; background:url(treeBg.gif) no-repeat bottom left; margin-bottom:-600px; z-index:6; }/* css Zen Garden submission 154 - 'Butterfly Effect', by Kevin Linkous, http://www.sitemaker.us/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Kevin Linkous */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { background: url(bgFull.gif) repeat-x #000000; font: normal 11px/16px Tahoma, Verdana, Arial, sans-serif; color: #333; margin: 0px; } h3 { font: italic normal 12pt Tahoma, Verdana, Arial, sans-serif; letter-spacing: 1px; margin-bottom: 0px; color: #7D775C;} a:link { font-weight: normal; text-decoration: underline; color: #4F8CC3;} a:visited { font-weight: normal; text-decoration: underline; color: #1D3F64;} a:hover, a:active { text-decoration:none ; color: #346293;} acronym {font-weight:bold;} /* specific divs */ #container { position: relative; width: 570px; background: url(bg_home.jpg) no-repeat; margin: 0; padding: 170px 0 0 170px;} #intro { min-width: 470px; } #pageHeader { display: none; } #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; margin-top: 10px; width: 219px; height: 87px; float: left;} #pageHeader h1 span {display:none} #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; margin-top: 58px; margin-bottom: 40px; width: 200px; height: 18px; float: right;} #pageHeader h2 span { display:none;} #quickSummary { position:absolute; left:530px; top: 730px; width:150px; color: #f4f0e6;} #quickSummary p.p1 {display:none;} #quickSummary p.p2 {} #quickSummary a{ color: #98B974; text-decoration:underline;} #quickSummary a:hover{ color: #f4f0e6; text-decoration:none;} #preamble { clear: right; padding: 10px 10px 0 65px; width:260px;} #preamble h3 { display:block; width:100%; height:23px; background: url(title0.gif) no-repeat;} #preamble h3 span {display:none;} #preamble p {margin:5px 0 0 0; padding:0; color: #6F715C; font-style:italic;} #supportingText { clear: right; padding: 20px 10px 0 0; margin:0; width:490px; background:url(dotedLine.gif) 10px 10px no-repeat;} #explanation {margin:0; padding: 0 0 0 65px; width:260px;} #explanation h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #explanation h3 span {display:none;} #explanation p {margin:5px 0 0 0; padding:0; color: #53553F;} #participation {margin:10px 0 0 0; padding: 0 0 0 65px; width:260px;} #participation h3 { display:block; width:100%; height:23px; background: url(title2.gif) no-repeat; margin:0;} #participation h3 span {display:none;} #participation p {margin:5px 0 0 0; padding:0; color: #53553F;} #benefits {margin:10px 0 0 0; padding: 0 0 0 65px; width:260px;} #benefits h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #benefits h3 span {display:none;} #benefits p {margin:5px 0 0 0; padding:0; color: #53553F;} #requirements {margin:10px 0 0 0; padding: 0 200px 0 65px; width:266px; background: url(bgBottom0.gif) right bottom no-repeat;} #requirements h3 { display:block; width:100%; height:23px; background: url(title1.gif) no-repeat; margin:0;} #requirements h3 span {display:none;} #requirements p {margin:5px 0 0 0; padding:0; color: #53553F;} #footer { padding: 110px 0 30px 45px; width:510px; background: url(bgBottom1.gif) -37px 0px no-repeat;} #footer a:link, #footer a:visited { color:#fff; margin: 0 0 0 15px; } #footer a:hover { color:#3F753E;} #linkList { position: absolute; top: 170px; right: 0px; color:#E8CFB0;} #linkList2 { font: 10px Tahoma, Verdana, Arial, sans-serif; width: 220px;} #linkList h3.select { background:url(subTitle0.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.select span {display:none;} #linkList h3.archives { background: transparent url(subTitle1.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.archives span {display:none;} #linkList h3.resources { background: transparent url(subTitle2.gif) no-repeat; margin: 10px 0px 5px 0px; width: 160px; height: 23px; } #linkList h3.resources span {display:none;} #linkList p, #linkList li{ font: x-small/1.6em tahoma, verdana, sans-serif; text-indent: 0;} #linkList ul { list-style: none; margin: 0; padding: 0; } #linkList li { color: #E8CFB0; padding: 2px 0 0 17px; } #linkList li a { display: block; border: none; color: #98B974; text-decoration:none; font-weight: bold; margin-left: -12px; padding-left: 12px; background: url(arrow.gif) no-repeat 0 2px;} #linkList li a:hover { color: #f4f0e6; background-position: 0 -48px; text-decoration:underline; } #linkList li a.c { display: inline; padding: 0; margin: 0; background: none; color: #E8CFB0; font-weight: normal; } #linkList li a.c:hover { color: #f4f0e6; } #linkList #larchives li,#linkList #lresources li,#linkList #lfavorites li { padding: 2px 0 0 5px; } #linkList #larchives li a,#linkList #lresources li a,#linkList #lfavorites li a { background: transparent url(arrow.gif) no-repeat 0 2px; display: inline; padding-left: 17px; margin: 0;} #linkList #larchives li a:hover,#linkList #lresources li a:hover,#linkList #lfavorites li a:hover { background-position: 0 -48px; } #extraDiv1 { background: transparent url(cr2.gif) top left no-repeat; position: absolute; top: 40px; right: 0px; width: 148px; height: 110px; }/* css Zen Garden submission 154 - 'Butterfly Effect', by Alen Grakalic, http://www.pixelpusher.biz/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Alen Grakalic */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css by Alen Grakalic of Pixelpusher.biz Thanks for taking the time to go through my code. Central photo was taken by me. It is a fountain in my home town Rijeka, Croatia. I made several photo calendars and it inspired me to make this Css Zen Garden entry that I call "November". */ body { background: #2F3027 url(back.jpg) no-repeat; font:0.7em Tahoma, Arial, Verdana, sans-serif; color:#666; margin:0; padding:0; } a{ color:#BD8100; text-decoration:none; } a:hover{ background:#BD8100; color:#FFF; } h3{ margin:0; padding:0; } h3 span{ display:none; } acronym{ border-bottom:1px dotted; } .accesskey{ text-decoration:underline; } ul{ margin: 0; padding:10px 0px 10px 10px; list-style: none; } li{ padding-right: 12px; padding-bottom: 0.6em; background:url(li_bullet.gif) no-repeat 100% 2px; } #container { margin:0; padding:0; } /* Intro */ #intro{ width:467px; } #pageHeader h1{ margin:0 0 0 16px; height:367px; background:url(page_header.gif) no-repeat; text-indent:-2000px; } #pageHeader h2, #quickSummary .p1{ display:none; } #quickSummary .p2{ margin:0 0 0 16px; padding-left:343px; font-size:6px; height:82px; background:url(quicksummary_back.gif) no-repeat; white-space:no-wrap; } #quickSummary .p2 span{ visibility:hidden; } #quickSummary .p2 a{ width:36px; height:20px; float:left; visibility:visible; text-indent:-2000px; margin:-7px 17px 0 0; padding:0; } #quickSummary .p2 a:hover{ background:none; } #preamble{ margin:0 0 0 16px; padding:0; background:url(txt_back.gif) repeat-y; } #preamble h3{ height:69px; background:url(theroad_back.gif) no-repeat; } #preamble p{ line-height:1.4em; padding:19px 19px 5px 19px; margin:0; } /* Supporting Text */ #supportingText{ width:467px; background:url(txt_back.gif) repeat-y 16px; } #supportingText p{ font-size:11px; line-height:1.4em; padding:19px 19px 5px 19px; margin:0; } #supportingText h3{ margin:0; padding:0; height:107px; } #explanation, #participation, #benefits, #requirements{ margin:0 0 0 16px; } #explanation h3{ background:url(explanation_back.gif) no-repeat; } #participation h3{ background:url(participation_back.gif) no-repeat; } #benefits h3{ background:url(benefits_back.gif) no-repeat; } #requirements h3{ background:url(requirements_back.gif) no-repeat; } #footer{ margin:0 0 0 16px; padding-top:58px; padding-bottom:20px; background:url(footer_back.gif) no-repeat; text-align:center; } #footer a{ margin:3px; padding:2px 5px; font-weight:bold; } /* Link List */ #linkList { position:absolute; top:64px; left:467px; width:226px; background:url(linklist_back.gif) no-repeat; padding-top:62px; text-align:right; } #linkList acronym{ border:none; } .select{ background:url(select_back.gif) no-repeat 100% 0; height:30px; } .archives{ background:url(archives_back.gif) no-repeat 100% 0; height:27px; } .resources{ background:url(resources_back.gif) no-repeat 100% 0; height:27px; } /* css Zen Garden submission 156 - 'Table Layout Assassination', by Marko Krsul & Marko Dugonjic, http://web.burza.hr/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Marko Krsul & Marko Dugonjic */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* general settings */ * { margin: 0; padding: 0; } html { background: #000; color: #000; font: 65%/1.5 Arial, Helvetica, sans-serif; } body { background: #000 url(body.gif) repeat-y 747px 0; } p { font-size: 1.2em; line-height: 19px; } * html p { line-height: 1.5em; } ul { list-style: none; } a { color: #da0000; text-decoration: none; border-bottom: 1px solid #da0000; } a:hover { color: #000; border: 0 !important; } acronym { border: 0; font-style: italic; color: #da0000; cursor: help; } a acronym { color: inherit; } /* header and overall layout */ #container { position: relative; width: 747px; background: #fff url(ferlauf.png) repeat-x 0 95%; } #intro { background: url(header.jpg) no-repeat 0 0; width: 747px; padding-top: 184px; } #pageHeader { position: absolute; left: -9999px; top: 0; width: 0; height: 0; overflow: hidden; } #quickSummary { width: 175px; margin-left: 262px; } #quickSummary p { margin-bottom: 10px; color: #f6f6f6; } #quickSummary acronym { color: #fff; font-weight: bold; } #quickSummary a { color: #ff0705; font-weight: bold; border-bottom: 1px solid #ff0705; } #quickSummary p.p2 { width: 130px; margin-bottom: 45px; } #preamble p, #supportingText p { margin-left: 262px; width: 282px; margin-bottom: 1em; text-align: justify; } #preamble a, #supportingText a { font-weight: bold; } #quickSummary h3, #preamble h3, #supportingText h3 { height: 46px; margin-left: 262px; } #supportingText #footer { position: absolute; top: 150px; left: 0; margin: 0 !important; width: 262px; height: 200px; text-align: center; } * html #supportingText #footer/**/{ left: -262px; } #footer a { border: 0; font-size: 1.1em; } #footer a:hover { text-decoration: underline; } #supportingText, #supportingText #requirements { position: relative; } #supportingText { background: url(footer.gif) no-repeat 0 100%; } #supportingText #requirements .p5 { margin: 0; width: 747px; padding: 140px 0 20px 0; text-align: center; color: #fff; font-size: 1.1em; } #supportingText #requirements .p5 a { color: #ff0705; } #extraDiv1 { position: absolute; top: 367px; left: 45px; width: 161px; height: 411px; background: url(herLegs.gif) no-repeat 0 0; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* h3 image replacements and icons */ h3 { background-repeat: no-repeat; background-position: 0 15px; } h3 span { display: block; text-indent: -9999px; } #preamble h3 { background-image: url(h3road.gif); } #preamble { background: url(road.gif) no-repeat 216px 0; } #explanation h3 { position: relative; background-image: url(h3about.gif); } #explanation h3 span { position: absolute; left: -46px; top: 0; width: 46px; height: 38px; background: url(about.gif) no-repeat 0 0; } #participation h3 { background-image: url(h3part.gif); } #participation { background: url(part.gif) no-repeat 223px 20px; } #benefits h3 { background-image: url(h3ben.gif); } #benefits { background: url(ben.gif) no-repeat 223px 5px; } #requirements h3 { background-image: url(h3req.gif); } #requirements { background: url(req.gif) no-repeat 225px 18px; } #linkList h3 { font-size: 1.2em; height: 20px; background-position: 0 0; margin-bottom: 1em; } #lselect h3 { background-image: url(h3sel.gif); } #larchives h3 { background-image: url(h3arc.gif); } #lresources h3 { background-image: url(h3res.gif); } /* sidebar */ #linkList { position: absolute; top: 387px; right: 0; width: 182px; } #linkList ul { margin-bottom: 2em; } #linkList li { font-size: 1.1em; padding: 0 16px; } #linkList a { font-weight: bold; border: 0; text-transform: lowercase; } #linkList a:hover { text-decoration: underline; } #linkList acronym { font-style: normal; cursor: pointer; } #lselect li { margin-bottom: 1em; } #lselect a { display: block; line-height: 1.2em; } #linkList a.c { display: inline; clear: none; color: #000; } #linkList a.c:hover { text-decoration: none; color: #51C3C4; } #lselect li { background: url(shuriken.gif) no-repeat 2px .3em; } #larchives li { background: url(ninjapac.gif) no-repeat 5px .5em; } #lresources li { background: url(lamp.gif) no-repeat 0 .3em; }/* css Zen Garden submission 157 - 'Bugs', by Zohar Arad, http://www.captainserious.co.uk/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Zohar Arad */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* General Styles */ body{ color:#000; font: normal 11px Times, serif; line-height:1.4em; letter-spacing: 1pt; margin:0 0 20px 0; padding:0; text-align:center; } a{font-weight:bold;color: #8B3C12;text-decoration:none} a:hover{text-decoration:underline;} a:active, a:visited{color: #B07D03;} h3{margin:0; padding:0;} /* General DIV Styles */ #container{ background:transparent url(header.gif) no-repeat top left; margin:0 auto; padding: 330px 0 0 0; position:relative; width:685px; text-align:left; } #container p{margin: 0 20px; padding: 5px 0} .p1:first-letter{font-size: 18px;} #intro, #supportingText{width:415px; background-color:#FBD1BC; padding:0; margin:0} #pageHeader{display:none} #quickSummary{position:absolute; top: 310px; margin:0 0 0 115px; padding:0} #quickSummary p{margin:0; padding:0;} #quickSummary p.p1{display:none} #footer{margin:-25px 0 0 0;width: 415px;text-align:center;} #footer a{color:#FFFFFF} /* headings replacement styles */ #preamble h3{ display:block; background: transparent url(heading1.gif) no-repeat center left; height: 161px; width: 415px; } #preamble h3 span{display:none;} #explanation h3{ display:block; background: transparent url(so.gif) no-repeat center center; height: 45px; width: 415px; } #explanation h3 span{display:none;} #participation h3{ display:block; background: transparent url(heading2.gif) no-repeat center left; height: 173px; width: 415px; } #participation h3 span{display:none;} #benefits h3{ display:block; background: transparent url(benefits.gif) no-repeat center center; height: 45px; width: 415px; } #benefits h3 span{display:none;} #requirements{ background: transparent url(footer.gif) no-repeat bottom center; padding-bottom:70px; } #requirements h3{ display:block; background: transparent url(heading3.gif) no-repeat center left; height: 173px; width: 415px; } #requirements h3 span{display:none;} /* Navigation Styles */ #linkList{ position:absolute; top: 330px; margin-left: 445px; padding-bottom: 360px; background: #EEFFC5 url(link_footer.gif) no-repeat bottom center; width:200px; } #linkList ul{ list-style-type:none; margin:0 20px; padding:30px 0 20px 0; } #linkList li{ background: transparent url(leaf.gif) no-repeat top left; padding:0 0 0 28px; margin-bottom: 10px; } #lselect a{ display:block; padding: 0; margin:0; } #lselect a.c{ display:inline; color:#2B7F01; } #larchives ul{ padding:30px 0 5px 0; } #lresources ul{ padding:20px 0; } #lselect h3{ display:block; background: transparent url(choose.gif) no-repeat center left; height: 112px; width: 200px; } #lselect h3 span{display:none;} #larchives h3{ display:block; background: transparent url(archive.gif) no-repeat center left; height: 96px; width: 200px; } #larchives h3 span{display:none;} #lresources h3{ display:block; background: transparent url(resources.gif) no-repeat center center; height: 25px; width: 200px; } #lresources h3 span{display:none;} /* Original images used in this design were downloaded from morguefile.com and manipulated for the purpose of this design only. This style sheet was created to symbolise the endless bugs Web artists have to deal with on a daily basis and give hope (as well as a good laugh) to all those who work hard to make the Web a better and bug-free environment Style Sheet by Zohar Arad */ /* css Zen Garden submission 158 - 'a Simple Sunset', by Rob Soule, http://www.couchfort.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Rob Soule */ /* Added: Mar. 7th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* 'a Simple Sunset' design by rob soule www.couchfort.net */ /* --// basic elements --// */ body { font: 11px georgia,times,serif; color: #F0E9CE; background: #F0E9CE url(mainBg.gif) repeat-x top; margin: 0; text-align: center; } acronym { cursor: help; border-bottom: 1px dotted #F0E9CE; } /* --// links --// */ a { color: #F0AC4A; text-decoration: none; } a:hover,a:active { text-decoration: underline; } a acronym { border: 0; } li a { display: block; color: #2B0101; font-weight: bold; font-size: 11px; text-transform: none; padding: 2px 0 3px 0; } li a.c { font-size: 9px; font-weight: normal; display: inline; padding: 0; text-transform: uppercase; } #larchives li a, #lresources li a { display: inline; font-weight: normal; font-size: 9px; line-height: 15px; margin: 0; text-transform: uppercase; } li a:hover, li a:hover.c { color: #5E1919; } #footer a { color: #B6B2A3; margin: 0 5px; border: 1px solid #CBC7B5; text-decoration: none; padding: 2px 3px; } #footer a:hover { background: #CBC7B5; color: #2B0101; } /* --// id selectors --// */ #container { margin: 0 auto; text-align: left; background: url(contBg.gif) repeat-y center; width: 672px; } #intro,#supportingText { line-height: 19px; } #pageHeader { height: 287px; background: url(top.jpg) no-repeat; } #quickSummary { background: url(preBg.gif) no-repeat center top; height: 87px; font-size: 9px; text-transform: uppercase; } #preamble { width: 380px; margin-top: -95px; padding: 0 0 0 260px; font-style: italic; } #supportingText { width: 380px; padding: 0 0 0 260px; } #linkList { position: absolute; top: 325px; padding-left: 45px; color: #2B0101; } #lselect,#larchives,#lresources { background: url(lselectBttm.gif) no-repeat bottom; padding-bottom: 12px; margin-top: 15px; } /* --// layout ...booya --// */ #preamble h3,#explanation h3, #participation h3, #benefits h3, #requirements h3{ text-indent: -5000px; height: 37px; } #lselect h3, #lresources h3, #larchives h3 { height: 23px; width: 189px; margin: 0; text-indent: -5000px; } #preamble h3 { background: url(h3Road.gif) no-repeat right; } #explanation h3 { background: url(h3AllAbout.gif) no-repeat right; } #participation h3 { background: url(h3Part.gif) no-repeat right; } #benefits h3 { background: url(h3Benefits.gif) no-repeat right; } #requirements h3 { background: url(h3Require.gif) no-repeat right; } #lresources h3 { background: url(lresourcesSpan.gif); } #larchives h3 { background: url(larchivesSpan.gif); } #lselect h3{ background: url(lselectSpan.gif); margin: -15px 0 0 0; } #quickSummary .p2 { position: absolute; top: 190px; width: 280px; text-align: right; margin-left: 360px; } #quickSummary .p1 { position: absolute; top: 100px; width: 158px; margin-left: 482px; text-align: right; line-height: 14px; } #footer { display: block; width: 625px; margin-left: -235px; text-align: center; padding: 15px 0 25px 0; font: 10px verdana,arial,serif; text-transform: uppercase; letter-spacing: -1px; background: #DCD5B8 url(footerBg.gif) repeat-x bottom; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv1, #extraDiv5, #pageHeader h1,h2 { display : none; } /* --// lists --// */ ul,li { list-style: none; padding: 0; margin: 0; } li { background: #F0E9CE; padding: 5px 7px; border-bottom: 1px solid #DCD5B8; text-transform: uppercase; font-size: 9px; } li:hover { background: #DCD5B8; } /* --// the lone class --// */ .p5 { clear: both; } /* the end... doh doh doh *//* css Zen Garden submission 159 - 'Berry Flavour', by Maren Becker, http://www.honeyjazz.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Maren Becker */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ******************************** HTML Tags ******************************** */ * { padding: 0px; margin: 0px; } body { margin: 0px; padding: 0px; border: 0px; background: url(bg.gif) repeat-y center top fixed; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #D48EA8; text-align: center; } p { line-height: 1.4em; } a:link, a:visited { color: #858585; text-decoration: none; } a:hover, a:active { color: #BF4E77; text-decoration: none; } acronym { cursor: help; color: #CD9CAE; font-weight: bold; border-bottom: 1px solid #FEF6FA; } /* ******************************** Container, Intro ******************************** */ #container { padding: 12px 0px 0px; width: 428px; margin-right: auto; margin-left: auto; position: relative; text-align: left; } #intro { margin-top: 0px; } /* ******************************** Page Header ******************************** */ #pageHeader { height: 175px; width: 428px; margin-top: 0px; margin-bottom: 12px; background: url(header.jpg) no-repeat; } #pageHeader h2 { height: 120px; width: 119px; position: absolute; left: 319px; top: 79px; background-image: url(berryflavour.gif); } /* ******************************** Quick Summary ******************************** */ #quickSummary { background: #FEF6FA url(bg_content.gif) repeat-y; border-top: 1px solid #F6E1EA; border-right: 1px solid #F6E1EA; border-bottom: 1px solid #F6E1EA; position: absolute; top: 199px; left: 0px; padding: 2px 2px 2px 6px; height: 36px; width: 142px; voice-family: "\"}\""; voice-family: inherit; width: 134px; } /* ******************************** Preamble ******************************** */ #preamble { border-top: 1px solid #F6E1EA; border-bottom: none; } #preamble p { padding-left: 7px; padding-right: 7px; margin-top: 7px; } #preamble h3 { background: url(bg_preamble.gif) no-repeat; height: 29px; } #preamble p.p3 { padding-bottom: 15px; } /* ******************************** Supporting Text ******************************** */ #supportingText, #preamble { margin-top: 0px; margin-left: 155px; background: #FEF6FA url(bg_content.gif) repeat-y; border-right: 1px solid #F6E1EA; width: 278px; voice-family: "\"}\""; voice-family: inherit; width: 271px; } #supportingText p { margin-top: 7px; padding-right: 7px; padding-left: 7px; } #explanation h3 { background: url(bg_explanation.gif) no-repeat; background-repeat:; height: 29px; } #explanation p.p2, #participation p.p3, #benefits p.p1 { margin-bottom: 20px; } #participation h3 { background: url(bg_participation.gif) no-repeat; height: 29px; } #benefits h3 { background: url(bg_benefits.gif) no-repeat; height: 29px; } #requirements h3 { background: url(bg_requirements.gif) no-repeat; height: 29px; } #requirements p.p5 { margin-top: 30px; } /* ******************************** Footer ******************************** */ #footer { text-align: right; padding-right: 12px; padding-bottom: 20px; margin-top: 40px; } /* ******************************** Link List ******************************** */ #linkList{ position: absolute; top: 251px; left: 0px; width: 142px; font-size: 10px; } #linkList h3 { font-size: 12px; font-weight: bold; padding-left: 14px; margin-top: 6px; margin-bottom: 6px; margin-left: 2px; } #lselect h3 { height: 19px; background: url(bg_select.gif) no-repeat; } #lresources h3 { height: 19px; background: url(bg_resources.gif) no-repeat; } #larchives h3 { height: 19px; background: url(bg_archives.gif) no-repeat; } #lselect, #lresources, #larchives { background: #FEF6FA url(bg_content.gif) repeat-y; border-top: 1px solid #F6E1EA; border-right: 1px solid #F6E1EA; border-bottom: 1px solid #F6E1EA; margin-bottom: 12px; } #linkList ul { list-style: none; margin: 5px; padding: 0px; } #linkList li a { display: block; } #linkList li:hover { background-color:#FAEBF1; } #lselect a { text-transform: uppercase; } #lselect ul li a.c { display: inline; text-transform: none; } #lselect li, #larchives li, #lresources li { padding-top: 4px; padding-bottom: 4px; background: url(dots.gif) repeat-x; } #footer a:link, #footer a:visited { font-weight: bold; } #footer a:hover, #footer a:visited { padding-bottom: 2px; border-bottom: 4px solid #858585; color: #858585; } /* ******************************** Hidden ******************************** */ #pageHeader h1 span, #pageHeader h2 span, #quickSummary p.p1 span, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #linkList h3 span { display:none; } /* css Zen Garden submission 160 - 'Daruma', by Stuart Cruickshank, http://www.stuartandpetra.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Stuart Cruickshank */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body {background:#dcdcdc url(grad_top.jpg) repeat-x; font:12px "Trebuchet MS", verdana, arial, sans-serif; color:#606060;} #container {width:765px; margin:0 auto;} #pageHeader {background-image:url(header.jpg); width:699px; height:347px;} #pageHeader h1, h2 {display:none;} #quickSummary {position:relative;} #quickSummary p.p1 {display:none;} #quickSummary p.p2 {position:absolute; left:600px; top:-65px; width: 130px;} #quickSummary p.p2 a:link {color: #606060; text-decoration:underline; font-weight:bold;} #quickSummary p.p2 a:visited {color:#787878;} #quickSummary p.p2 a:hover {color:#949494;} #preamble {width:765px; background:url(preamble_bg.gif) bottom; padding-bottom:15px; line-height:22px; text-align:justify;} #preamble h3 span {display:none; } #preamble h3 {position:relative; background-image:url(preamble_hdr.gif); width:765px; height:35px;} #preamble p {padding: 7px 20px;} #supportingText {float:left; width:543px; background-image:url(body_bg.gif); line-height:22px; text-align:justify;} #supportingText p {padding: 7px 20px;} #supportingText a:link {color:#df0000; text-decoration:none; font-weight:bold; border-bottom:1px solid #930000;} #supportingText a:visited {color:#df0000; text-decoration:none; border:0;} #supportingText a:hover{border-bottom: 1px solid #df0000;} #explanation {background:url(so_what_btrflys.gif) bottom left no-repeat;} #explanation h3 span {display:none;} #explanation h3 {position:relative; background-image:url(so_what_hdr.gif); width:543px; height:28px;} #participation {background: url(participation_btrflys.gif) bottom left no-repeat;} #participation h3 span {display:none;} #participation h3 {position:relative; background-image:url(participation_hdr.gif); width:543px; height:37px;} #benefits h3 span {display:none;} #benefits h3 {position:relative; background-image:url(benefits_hdr.gif); width:543px; height:35px;} #requirements {background: url(req_btrflys.gif) top left no-repeat;} #requirements h3 span {display:none;} #requirements h3 {position:relative; background-image:url(req_hdr.gif); width:543px; height:36px;} #requirements .p5 {margin-bottom:0; padding-bottom:14px;} #footer {position:relative; font-size: 14px; text-align:center;background:url(footer_bg.gif) no-repeat; width:543px; height:35px; padding-top:63px;} #footer a:link {color: #c20000; font-weight:bolder; text-decoration:none; border:0;} #footer a:visited {color:#c20000; font-weight:bolder;} #footer a:hover {color:#f33; border:0;} #linkList {float:right; width:195px; color:#d70000; background-image:url(linklist_bg.gif); font-size:11px;} #linkList ul {list-style-type:none;} #lselect a:link {display:block;color: #d70000; text-decoration:none; font-weight:bolder; border-bottom:1px solid #ddd;} #lselect a:visited {display:block; color:#c66; text-decoration:none; border-bottom:1px solid #b1b1b1;} #lselect a:hover {color: #f70000;} #lselect a:link.c {display:inline; color:#5d5d5d; text-decoration:none; font-style:italic; margin-left:5px; border:0;} #lselect a:visited.c {display:inline; color:#787878; font-weight:normal; text-decoration:none; border:0;} #lselect a:hover.c{color:#949494;} #linkList2 li {padding: 0 20px;} #linkList2 {background:url(resources_btm_2.gif) bottom no-repeat; padding-bottom: 10px; padding-bottom: 119px;} #lselect h3 {position:relative; background-image: url(select_design_hdr.gif); width:195px; height:60px;} #lselect h3 span {display:none;} #lselect ul {padding-top:8px;} #lselect li {padding-bottom:10px;} #larchives h3 {position:relative; background-image: url(archives_hdr.gif); width:195px; height:30px;} #larchives h3 span {display:none;} #lresources h3 {position:relative; background: url(resources_hdr.gif) no-repeat; width:195px; height:30px;} #lresources h3 span {display:none;} #larchives ul, #lresources ul {padding-top:8px;} #larchives ul li, #lresources ul li {padding-bottom:8px;} #larchives a:link, #lresources a:link {color:#606060; text-decoration:none; font-weight:bolder;} #larchives a:visited, #lresources a:visited {color:#787878;text-decoration:none;} #larchives a:hover, #lresources a:hover {color:#949494; font-style:italic;} * {margin:0; padding:0;} acronym {border-bottom: 1px dotted #606060; cursor:help;} /* css Zen Garden submission 161 - 'Zenfandel', by Nicholas Rougeux, http://www.c82.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Nicholas Rougeux */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Zenfandel design by Nicholas Rougeux [ www.c82.net ] All photography originated from free stock for commercial and personal use from the good folks at Stock Exchange. [ www.sxc.hu ] */ /*__________Clean slate__________*/ body, h1, h2, h3, li, p, ul { font-size: 1em; margin: 0; padding: 0; } /*__________Basics__________*/ a, a:link, a:visited, a:hover, a:active { color: #ada364; } a:hover { text-decoration: none; } acronym { border: 0; color: #780101; cursor: help; } .accesskey { text-decoration: underline; } body { background: url(bgMain.gif) repeat-y; color: #0f330d; font-family: "Lucida Grande", Georgia, "Times New Roman", Times, serif; font-size: 0.8em; padding-bottom: 20px; } h3 { color: #8f9947; font-style: italic; font-size: 1.7em; font-weight: normal; margin-bottom: 0.5em; } #container { position: relative; z-index: 99; } p { line-height: 1.5em; margin-bottom: 1em; } /*__________Header__________*/ #pageHeader { background: #fff url(header.jpg) no-repeat left top; border-bottom: 1px solid #acb7a6; height: 155px; } #pageHeader span { display: none; } /*__________Quick summary__________*/ #quickSummary { font-size: 0.85em; font-style: italic; line-height: 1.4em; } #quickSummary .p2 { text-align: right; } /*__________Preamble__________*/ #preamble, #quickSummary { margin-left: 219px; margin-top: 10px; padding-left: 150px; /* Make IE play nice with others */ width: 530px; voice-family: "\"}\""; voice-family:inherit; width: 380px; } html>body #quickSummary, html>body #preamble { width: 380px; } /*__________Supporting text__________*/ #supportingText { background: url(bottle.gif) no-repeat right bottom; margin-left: 230px; width: 530px; z-index: 100; } #preamble .p3, #explanation, #participation, #benefits, #requirements { background: url(curlSmall.gif) no-repeat bottom; margin-bottom: 1em; padding-bottom: 37px; } #requirements { margin-right: 160px; } /*__________Side__________*/ #linkList { color: #fff; font-family: Arial, Tahoma, Geneva, Helvetica, Verdana, sans-serif; font-size: 0.85em; font-weight: bold; left: 0; overflow: hidden; position: absolute; top: 156px; width: 220px; } #linkList a, #linkList h3 { font-family: Georgia, "Times New Roman", Times, serif; } #lselect a { display: block; } #lselect a.c { display: inline; } #linkList a { color: #fff; font-size: 1.1em; font-style: italic; font-weight: normal; text-decoration: none; } #linkList a:hover { text-decoration: underline; } #linkList a.c { color: #fffbe2; font-family: Arial, Tahoma, Geneva, Helvetica, Verdana, sans-serif; font-size: 1em; font-style: normal; font-weight: bold; } #linkList acronym { color: #f6f1c0; } #linkList h3 { color: #ccc180; font-size: 1.4em; font-style: normal; padding-top: 0.5em; text-align: center; text-transform: uppercase; } #linkList li { background: url(bullet.gif) no-repeat 0 0.3em; padding-left: 15px; } #linkList ul { list-style: none; padding: 0 10px 0.8em 10px; } #lselect { background: #44410d url(curlBig.gif) no-repeat bottom; padding-bottom: 40px; } #lselect li { padding-bottom: 0.8em; } #larchives, #lresources { border-top: 3px double #8e7253; } #larchives li, #lresources li { margin-bottom: 0.2em; } /*__________Footer__________*/ #footer { font-size: 0.85em; font-style: italic; text-align: right; } /*__________Extras__________*/ /* Extra div used for grapes image so the entire image is not clipped when text is resized */ #extraDiv1 { background: transparent url(grapes.gif) no-repeat left top; height: 351px; left: 220px; position: absolute; top: 156px; width: 147px; z-index: 1; }/* css Zen Garden submission 162 - 'Angelus', by Vladimir Lukic, http://www.c82.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Vladimir Lukic */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* All images are Copyright (c) 2005 by Vladimir Lukic | www.wortahn.com */ /* The Angel sculpture is from the main doors of the Metropolitan United Church in */ /* Toronto, Canada, photographed by the author. */ /* The inspiration for this work draws on the stained glass windows of */ /* St. Michael's Catholic Cathedral, Toronto, Canada, and medieval Catholic prayer books */ /* ENG: To any Croatian designers reading this, at home and abroad, a big hello from Canada! */ /* HRV: Svim hrvatskim designerima koji ovo citaju, doma i u inozemstvu, velik pozdrav iz Kanade! */ /* basic elements */ html, body { font-family: 'Tahoma', sans-serif; font-size: small; color: rgb(104,0,0); background: url("body-bg.jpg") rgb(70, 0, 0); padding: 0px; margin: 0px; } p { font-family: 'Tahoma', sans-serif; font-size: x-small; margin-top: 0px; margin-bottom: 7px; margin-left: 76px; margin-right: 30px; text-align: left; line-height: 130%; } h3 { font-family: 'Tahoma', serif; font-size: medium; font-stretch: condensed; font-style: italic; margin-bottom: 10px; color: #7D775C; margin-top: 0px; } a:link { font-weight: bold; text-decoration: none; color: #7D775C; } a:visited { font-weight: bold; text-decoration: none; color: #7D775C; } a:hover, a:active { text-decoration: underline; color: navy; } acronym { cursor: help; } /* specific divs */ #container { position: relative; width: 640px; background: url("container-bg.jpg") rgb(245, 203,144) top left repeat-y; border-top: 0px; padding-top: 1px; padding-bottom: 0px; border-left: 2px solid white; border-right: 3px solid black; margin: auto; margin-bottom: 0px; overflow: hidden; /*needed to avoid horizontal scrollbars that appear in mozilla with margin: auto at 800x600*/ } #intro { background: url("text-bg.jpg") 45px 0px repeat-y; margin: 0px; padding: 0px; } #pageHeader { width: 640px; position: relative; height: 314px; background: transparent url("banner2.jpg") top left no-repeat; margin: 0px; padding-top: 1px;/*needed to account for collapsing margins -- mozilla properly adds extra space on top if no padding is specified*/ margin-bottom: 0px; padding-right: 0px; z-index: 100; } #preamble { position: relative; padding-left: 0px; width: 400px; margin-left: 15px; margin-top: 0px; margin-right: 0px; padding-bottom: 0px; padding-top: 0px; background: transparent url("l.jpg") 25px 35px no-repeat; } #preamble h3 { width: 183px; height: 25px; background: url("preamb-title.jpg") top center no-repeat; margin-left: auto; margin-right: auto; } #preamble h3 span { display: none; } #preamble .p3 { background: url("preamb-bg.jpg") 42% 100% no-repeat; padding-bottom: 85px; } #preamble p { font-variant: small-caps; color: #7D775C; font-weight: bold; font-size: small; line-height: 100%; } #preamble p.p1:first-letter { margin-left: -7px; color: rgb(245, 203,144); } #quickSummary { background: url("demo.jpg") transparent top right no-repeat; width: 207px; height: 174px; clear: none; position: relative; padding: 0px; right: 35px; top: 0px; float: right; text-align: right; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1, h2 { display: none; } #quickSummary p.p1 { display: none } #quickSummary p.p2 { display: block; position: relative; top: 120px; bottom: 0px; margin: 0px; margin-left: 50px; padding: 0px; text-align: right; } #supportingText { padding-left: 0px; padding-right: 0px; padding-bottom: 0px; width: 100%; padding-top: 1px; margin-top: 30px; margin-left: 0px; margin-right: 0px; position: relative; background: transparent url("text-bg.jpg") 45px 0px repeat-y; z-index: 100; } #supportingText h3 { margin-left: auto; margin-right: auto; } #supportingText .p1:first-letter { margin-left: -7px; color: rgb(245, 203,144); display: none; } #supportingText div { padding-left: 0px; width: 400px; margin-left: 15px; margin-bottom: 45px; height: 1%; } #supportingText #footer { text-align: right; padding: 0px; width: 640px; height: 191px; margin-left: 0px; padding-left: 0px; margin-bottom: 1px; position: relative; background: url("footer.jpg") bottom left no-repeat; padding-top: 0px; } #explanation { background: transparent url("t.jpg") 25px 33px no-repeat; } #participation { background: transparent url("g.jpg") 25px 33px no-repeat; } #benefits { background: transparent url("w.jpg") 25px 18px no-repeat; } #requirements { background: transparent url("w2.jpg") 25px 18px no-repeat; } #explanation h3 { width: 167px; height: 22px; background: url("what-title.jpg") top left no-repeat; } #explanation h3 span{ display: none; } #participation h3 { width: 90px; height: 23px; background: url("part-title.jpg") top left no-repeat; } #participation h3 span{ display: none; } #benefits h3 { width: 53px; height: 18px; background: url("ben-title.jpg") top left no-repeat; } #benefits h3 span{ display: none; } #requirements h3 { width: 90px; height: 23px; background: url("req-title.jpg") top left no-repeat; } #requirements h3 span{ display: none; } #lselect, #larchives, #lresources { display: block; font-size: x-small; margin-bottom: 20px; } #footer a { position: relative; top: 140px; right: 60px; color: rgb(245, 203,144) } #footer a:hover{ color: #7D775C; } #linkList { position: absolute; width: 180px; height: auto; right: 35px; top: 500px; clear: none; text-align: right; padding-bottom: 30px; z-index: 100; background: transparent url("link-bg.jpg") bottom left no-repeat; } #linkList2 { margin: 0px; padding: 0px; width: auto; } #linkList h3.select { text-align: right; width: 180px; height: 23px; background: url("sel-title.jpg") top right no-repeat; } #linkList h3.select span { display: none; } #linkList h3.archives { text-align: right; width: 180px; height: 23px; background: url("arch-title.jpg") top right no-repeat; } #linkList h3.archives span { display: none; } #linkList h3.resources { text-align: right; width: 180px; height: 23px; background: url("res-title.jpg") top right no-repeat; } #linkList h3.resources span { display: none; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2.5ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { font-weight: bold; text-decoration: none; color: #7D775C; } #linkList li a:visited { font-weight: bold; text-decoration: none; color: #7D775C; } #linkList li a:hover, a:active { text-decoration: underline; color: navy; } #requirements .p5 { text-align: right; font-style: italic; font-size: x-small; padding-top: 5px; margin-top: 20px; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4 { display:none; } /* css Zen Garden submission 163 - 'Like the Sea', by Lars Daum, http://www.redrotate.de/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Lars Daum */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { padding: 0; margin: 0; } body { font-family: Tahoma, Arial, Helvetica, sans-serif; text-align: center; background: #FBFBE5 url(grass.gif) right bottom fixed no-repeat; color: #566047; } a, a:link, a:visited { color: #566047; text-decoration: underline; } a:hover { text-decoration: none; } a:active, a:focus { color: #566047; } .p5 span a { font-weight: bold; } p { margin-bottom: 10px; line-height: 19px; font-size: 70%; } acronym { font-weight: bold; text-decoration: none; border-bottom: none; } #container { position: relative; margin: auto; text-align: left; background: #FBFBE5 url(container_bg.gif) center top repeat-y; width: 760px; } #pageHeader { text-align: center; background: #8C9777 url(page_header_bg.jpg) center top no-repeat; height: 300px; } #pageHeader h1 span, #pageHeader h2 span { display: none; } #quickSummary .p1 { position: absolute; top: 65px; left: 40px; font-weight: bold; color: #FBFBE5; width: 475px; } #quickSummary .p2 span { position: absolute; color: #566047; font-size: 100%; text-align: left; top: 245px; left: 530px; } #preamble { margin: -40px 50px 20px 265px; padding: 20px 20px 10px; border: 3px solid #8C9777; background: #FBFBE5; } #preamble h3 { margin-bottom: 10px; height: 32px; background: transparent url(h3_preamble.gif) left top no-repeat; border-bottom: 1px solid #7D8965; } #preamble h3 span { display: none; } #supportingText { margin-left: 230px; padding: 0 0 35px 35px; } #supportingText h3 span { display: none; } #explanation, #participation, #benefits, #requirements { padding-right: 50px; } #explanation h3 { margin-bottom: 10px; height: 32px; background: transparent url(h3_explanation.gif) left top no-repeat; border-bottom: 1px solid #7D8965; } #participation h3 { margin-bottom: 10px; height: 32px; background: transparent url(h3_participation.gif) left top no-repeat; border-bottom: 1px solid #7D8965; } #benefits h3 { margin-bottom: 10px; height: 32px; background: transparent url(h3_benefits.gif) left top no-repeat; border-bottom: 1px solid #7D8965; } #requirements h3 { margin-bottom: 10px; height: 32px; background: transparent url(h3_requirements.gif) left top no-repeat; border-bottom: 1px solid #7D8965; } #footer { margin: 0 0 -55px -265px; padding: 20px 20px 0 530px; text-align: center; clear: both; font-size: 70%; background: #FBFBE5 url(footer_bg.jpg) center top no-repeat; height: 166px; voice-family: "\"}\""; height: 146px; voice-family: "\"}\""; } #linkList { position: absolute; top: 275px; left: 64px; width: 138px; } #linkList h3 span { display: none; } #linkList h3 { margin-top: 25px; width: 138px; height: 30px; border-bottom: 1px solid #7D8965; } h3.select { margin-bottom: 5px; background: transparent url(h3_select.gif) left center no-repeat; } h3.archives { margin-bottom: 5px; background: transparent url(h3_archives.gif) left center no-repeat; } h3.resources { margin-bottom: 5px; background: transparent url(h3_resources.gif) left center no-repeat; } #linkList ul { list-style: none; } #lselect ul li { margin-bottom: 5px; padding-bottom: 5px; font-size: 70%; color: #8C9777; border-bottom: 1px solid #8C9777; } #linkList a.c, #linkList a.c:link, #linkList a.c:visited, #linkList a.c:hover, #linkList a.c:active, #linkList a.c:focus { display: inline; padding: 0; font-size: 100%; font-weight: normal; text-decoration: none; color: #8C9777; background-image: none; } #lselect ul li a, #lselect ul li a:link, #lselect ul li a:visited { display: block; clear: both; padding: 0 0 2px 20px; font-size: 100%; font-weight: bold; text-decoration: underline; color: #566047; background: transparent url(lselect_a_bg.gif) left center no-repeat; } #lselect ul li a:hover { text-decoration: none; } #lselect ul li a, #lselect ul li a:active, #lselect ul li a:focus { display: block; clear: both; padding: 0 0 2px 20px; font-size: 100%; font-weight: bold; text-decoration: underline; color: #566047; background: transparent url(lselect_a_bg.gif) left center no-repeat; } #larchives ul li { margin-bottom: 5px; font-size: 70%; color: #8C9777; } #larchives ul li a, #larchives ul li a:link, #larchives ul li a:visited { font-weight: bold; color: #8C9777; text-decoration: underline; } #larchives ul li a:hover { text-decoration: none; } #larchives ul li a:active, #larchives ul li a:focus { font-weight: bold; color: #8C9777; text-decoration: underline; } #lresources ul li { margin-bottom: 5px; font-size: 70%; color: #8C9777; } #lresources ul li a, #lresources ul li a:link, #lresources ul li a:visited { font-weight: bold; color: #8C9777; text-decoration: underline; } #lresources ul li a:hover { text-decoration: none; } #lresources ul li a:active, #lresources ul li a:focus { font-weight: bold; color: #8C9777; text-decoration: underline; } /* css Zen Garden submission 164 - 'Chien', by Alex Miller, http://www.pixul.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Alex Miller */ /* Added: Apr. 15th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* You may notice this CSS file has no IE hacks. This is because I think hacks are messy, and I don't care if my page screws up for some people. It's their fault for using Internet Explorer in the first place. If everyone didn't include hacks, more people would not use IE! */ body { background-image: url(background.gif); font-family: verdana, arial, serif; font-size: 11px; text-align: center; padding: 0; margin: 0; line-height: 16px; color: #333; } #container { width: 633px; margin: auto; border-top: 1px solid #000; background-image: url(containerbackground.gif); text-align: left; padding: 0 0 0 29px; position: relative; top: -1px; } #pageHeader { background-image: url(top.gif); width: 605px; height: 332px; margin-top: 0; } #pageHeader h1, h2 { display: none; } #preamble, #supportingText { margin: 0 0 0 8px; width: 389px; } #preamble h3, #supportingText h3 { margin-top: 0; } #preamble p, #supportingText p, #quickSummary p { margin: 10px 15px 10px 15px; } #quickSummary, #linkList { position: absolute; left: 435px; width: 192px; } #quickSummary { top: 332px; background: url(summary.gif) no-repeat; padding-top: 46px; color: #000; } #linkList { top: 526px; } #footer { text-align: center; width: 100%; padding-bottom: 10px; } #preamble h3 { background-image: url(title1.gif); width: 389px; height: 46px; } #preamble h3 span { display: none; } #explanation h3 { background-image: url(title2.gif); width: 389px; height: 46px; } #explanation h3 span { display: none; } #participation h3 { background-image: url(title3.gif); width: 389px; height: 46px; } #participation h3 span { display: none; } #benefits h3 { background-image: url(title4.gif); width: 389px; height: 46px; } #benefits h3 span { display: none; } #requirements h3 { background-image: url(title5.gif); width: 389px; height: 46px; } #requirements h3 span { display: none; } h3.select { background-image: url(designs.gif); width: 192px; height: 45px; } h3.select span { display: none; } h3.archives { background-image: url(archives.gif); width: 192px; height: 45px; } h3.archives span { display: none; } h3.resources { background-image: url(resources.gif); width: 192px; height: 45px; } h3.resources span { display: none; } li { padding: 0 0 6px 0; text-transform: capitalize; } #lselect a:link.c, #lselect a:visited.c { display: inline; } #lselect a { display: block; } #lselect ul li { list-style-image: url(paperfolded.gif); } #larchives ul li, #lresources ul li { list-style-image: url(paper.gif); } a:LINK { text-decoration: none; color: #CC0000; } a:VISITED { text-decoration: none; color: #CC6666; } a:HOVER { text-decoration: underline; color: #CC0000; } #footer { border-top: 1px solid #999; padding: 6px 0 6px 0; background-color: #FFF; } #footer a { font-weight: bold; } /* css Zen Garden submission 165 - 'Red Paper', by Rob Soule, http://www.couchfort.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Rob Soule */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* --// basic elements --// */ body { font: 11px/18px verdana,arial,helvetica,sans-serif; color: #512720; background: #512720 url(bodyBg.gif) center top repeat-y; margin: 0; padding: 0; text-align: center; } acronym { cursor: help; border-bottom: 1px dotted #B0915F; } /* --// layout // */ #container { width: 765px; background: url(mainBg.gif) repeat-y; margin: 0 auto; padding: 0; text-align: left; } #pageHeader { width: 765px; height: 343px; background: url(headerBg.jpg) no-repeat; } #preamble, #supportingText { text-align: left; width: 455px; margin: 0 0 0 43px; } #preamble p, #supportingText p { margin: 0 0 12px 0; } #quickSummary { position: relative; } #quickSummary .p2 { position: absolute; margin-top: -70px; left: 615px; font: 9px/14px Georgia,Times,Serif; text-transform: uppercase; width: 100px; padding: 0; } #linkList { position: absolute; top: 343px; margin-left: 529px; color: #2B0101; width: 175px; } #footer { display: block; padding: 12px 0 0 0; margin: 20px 0 0 120px; text-align: center; background: url(footer.gif) no-repeat; height: 43px; width: 204px; } .p1,.p2,.p3,.p4,.p5 { padding-left: 8px; } /* --// headers // --*/ #preamble h3,#explanation h3, #participation h3, #benefits h3, #requirements h3 { height: 60px; text-indent: -8000px; margin: 0; padding: 0; } #lselect h3, #lresources h3, #larchives h3 { height: 23px; margin: 0; padding: 0; text-indent: -8000px; } #preamble h3 { background: url(hdRoad.gif) no-repeat; } #explanation h3 { background: url(hdAbout.gif) no-repeat; } #participation h3 { background: url(hdPart.gif) no-repeat; } #benefits h3 { background: url(hdBen.gif) no-repeat; } #requirements h3 { background: url(hdReq.gif) no-repeat; } #lselect h3 { background: url(hdSelect.gif) no-repeat; } #larchives h3 { background: url(hdArch.gif) no-repeat; margin-top: 15px;} #lresources h3 { background: url(hdResc.gif) no-repeat; margin-top: 15px; } /* --// links --// */ a { color: #683A33; text-decoration: none; border-bottom: 1px dotted #683A33; } a:hover,a:active { border-bottom: 1px solid #512720; background: #C3A680; } a acronym { border: 0; } li a { display: block; font-weight: bold; font-size: 10px; text-transform: uppercase; padding: 0 0 0 10px; background: url(star.gif) no-repeat; border-bottom: 0; } li a.c { font-size: 9px; font-weight: normal; display: inline; padding: 0; background: none; } #larchives li a, #lresources li a { display: inline; font-weight: normal; font-size: 9px; margin: 0; text-transform: uppercase; } #larchives li a { background: none; } li a:hover, li a:hover.c { color: #5E1919; border-bottom: 0; } li a:hover { background: url(star_over.gif) no-repeat; } li a:hover.c { background: none; } #footer a { text-decoration: none; border: none; font: 10px georgia,times,serif; padding: 1px; text-transform: uppercase; } #footer a:hover { background: none; border-top: 1px solid #683A33; border-bottom: 1px solid #683A33; } /* --// no display // -- */ #quickSummary .p1, #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6, #pageHeader h1,h2 { display : none; } /* --// lists --// */ ul,li { list-style: none; padding: 0; margin: 0; line-height: 15px; } #lselect, #lresources, #larchives { padding-bottom: 6px; background: url(liBttmBg.gif) center bottom no-repeat; } li { padding: 5px 5px 12px 5px; background: url(liBg.gif) center bottom no-repeat; text-transform: uppercase; font-size: 9px; /*border-bottom: 1px solid #A68858;*/ } /* --// hover effects //-- */ .p1:hover,.p2:hover,.p3:hover,.p4:hover,.p5:hover { border-left: 2px solid #B0915F; padding-left: 6px; } #quickSummary .p2:hover { border: 0; padding: 0; } /* css Zen Garden submission 166 - 'Obsequience', by Pierce Gleeson, http://www.piercegleeson.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Pierce Gleeson */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin: 0; padding: 0; } body { font: 75%/160% verdana; color: #333; background: #333 url(equaliser.jpg) repeat top left; margin: 0; text-align:right; padding-top:0px; font-family: "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Verdana, sans-serif; } #container { padding: 0; margin: 30px 30px 0 auto; width:720px; text-align:left; background:transparent url(back.jpg) top left repeat-y; overflow:auto; } #extraDiv1{ padding: 0; margin: 0 30px 30px auto; width:720px; height:75px; background:transparent url(useless.jpg) top left repeat; overflow:auto; } #linkList{ background:transparent url(linkback.gif) repeat-y top left; margin:0 0 0 70px; float:left; width: 120px; position:absolute; top: 299px !important; /* Good Browsers */ top: 269px; /* IE 5 */ top/**/:/**/299px; /* IE 6 */ } #linkList2{ background:transparent url(linkbottom.jpg) no-repeat bottom left; padding:0 2px 20px 2px; } #lselect h3, #larchives h3, #lresources h3, #lfavorites h3{ margin:10px 0 0 0; text-indent: -15000px; height: 28px; overflow: hidden; } #lselect h3{ background: transparent url(select.gif) no-repeat left top; height:50px; margin:0px;} #larchives h3{ background: transparent url(archives.gif) no-repeat left top;} #lfavorites h3{ background: transparent url(favourites.gif) no-repeat left top;} #lresources h3{ background: transparent url(resources.gif) no-repeat left top;} #quickSummary{ padding:0; margin:0 10px 0 250px !important; margin:0 5px 0 250px; float:right; width:250px; clear:right; background:#fff; color:#666; } #quickSummary p{ margin:5px 5px 5px 5px; height:100%; } #quickSummary p.p1{ text-indent:-15000px; overflow:hidden; height:1px; margin:0; } #pageHeader{ background: url(header.jpg) no-repeat top left; padding:0; margin:0; text-indent: -15000px; height: 290px; overflow: hidden; } #supportingText{ padding:0; margin:0 10px 0 0 !important; margin:0 5px 0 0; } #preamble{ padding:0; margin:0 0 20px 205px !important; margin:0 0 20px 102px; float:left; width:230px; clear:left; background: url(preambleback.jpg) repeat-y top left; } #explanation{ background:transparent; margin:0 0 10px 20px !important; margin:0 0 10px 457px; padding-bottom:10px; width: 250px; clear:right; float:right !important; float:none; overflow:auto; } #participation{ background:transparent; margin:0 0 40px 20px !important; margin:0 0 40px 205px; float:right !important; float:none; width: 505px; clear:right; overflow:auto; background: transparent url(participationback.jpg) repeat-y top left; } #benefits, #requirements{ background:transparent; margin: 40px 0 0 70px; clear:both; overflow:auto; width:640px; background: transparent url(benback.jpg) repeat-y top left; position:relative; } #footer{ text-align:center; padding:40px 0 10px 0; background: transparent url(footback.jpg) top left no-repeat; margin:0 0 0 460px; width: 250px; float:right !important; float:none; overflow:auto; border-bottom:2px solid #fff; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3{ padding:0; margin:0 0 10px 0; text-indent: -15000px; height: 40px; overflow: hidden; } #preamble h3{ background: transparent url(road.jpg) no-repeat left top;} #explanation h3{ background: transparent url(what.jpg) no-repeat left top;} #participation h3{ background: transparent url(participation.jpg) no-repeat left top;} #benefits h3{ background: transparent url(benefits.jpg) no-repeat left top;} #requirements h3{ background: transparent url(requirements.jpg) no-repeat left top;} #preamble p, #explanation p, #participation p, #benefits p, #requirements p{ margin:10px 15px; text-align:justify; } #participation p{ margin:10px 15px 10px 25px; } #participation h3, #benefits h3, #requirements h3{ margin:0; height: 50px; } #participation p.p3{ background:transparent url(participationbottom.jpg) no-repeat bottom left; margin:0; padding:10px 15px 30px 25px; } #benefits p,#requirements p{ margin:10px 15px 10px 25px; } #benefits p.p1,#requirements p.p5{ background:transparent url(benbottom.jpg) no-repeat bottom left; margin:0; padding:10px 15px 30px 25px; } #preamble p{ margin:10px 20px 10px 20px; } #preamble p.p3{ background:transparent url(preamblebottom.jpg) no-repeat bottom left; margin:0; padding:10px 25px 30px 25px; } #preamble h3{ margin:0 0 20px 0; height:50px; } a, a:link, a:visited { background-color:transparent; color:#996; text-decoration:none; font-weight:bold; } a:visited { background-color:transparent; color:#600; } a:hover {text-decoration:underline; color:#600;} #linkList ul { list-style: none; padding: 0; margin: 0; font-size: .9em; letter-spacing:1px; } #linkList ul li { padding: 5px 10px 5px 5px; margin: 0; } #linkList ul li:hover { background: #cc9; color: #333; } #linkList ul li:hover a{ background: #cc9; color: #333; } #linkList #lselect { color: #333; } #linkList ul li a { display: inline; color: #363; font-weight:normal; } #linkList #lselect ul li a { display: block; } #linkList #lselect ul li a.c, #linkList ul li a.c { display: inline; font-size: .8em; color: #363; color: #600; text-transform: none; font-weight:normal; } /* css Zen Garden submission 167 - 'Hoops - Tournament Edition', by David Marshall Jr., http://www.pixelflexmedia.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, David Marshall Jr. */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic html attributes ------------------------------------------------------------------- */ body { padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; background: #6B320E url(bg.gif) repeat-y 50% 0; text-align: center; } p, ul { font-family: arial, verdana, helvetica, sans-serif; font-size: 11px; line-height: 17px; color: #000000; } a:link, a:visited { text-decoration: underline; color: #B52E00; } a:hover, a:active { text-decoration: underline; color: #6B320E; } h1, h2 { display: none; } h3 { width: 323px; height: 37px; } h3 span { display: none; visibility: hidden; } /* main divs ------------------------------------------------------------------------------- */ #container { position: relative; margin: 0 auto; width: 600px; text-align: left; } #intro { width: 600px; } #supportingText { width: 340px; margin: 0px 0px 0px 20px; } #preamble { width: 340px; margin: 0px 0px 0px 20px; } #pageHeader { width: 600px; height: 471px; background: url(main.jpg) no-repeat; } #quickSummary { position: absolute; top: 480px; left: 390px; width: 190px; background: transparent url(h3_thegoods.jpg) no-repeat; border-bottom: 1px solid #FFFFFF; } #footer { font-family: arial, verdana, helvetica, sans-serif; font-size: 10px; text-transform: uppercase; margin: 30px 0px 30px 0px; } #linkList { position: absolute; top: 570px; left: 390px; width: 190px; margin: 0px 30px 0px 0px; } #pageHeader h1, #pageHeader h2 { display: none; } /* text & links ---------------------------------------------------------------------- */ #quickSummary p.p2 { text-indent: 0; font-family: arial, verdana, helvetica, sans-serif; color: #FFFFFF; padding: 7px 12px 7px 12px; margin: 38px 0px 0px 0px; background: #6B320E; border-top: 1px solid #FFFFFF; } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited { text-decoration: underline; color: #FEEC83; font-weight: bold; } #quickSummary p.p2 a:hover, #quickSummary p.p2 a:active { text-decoration: underline; color: #FFFFFF; font-weight: bold; } #quickSummary p.p1 { display: none; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { padding: 0px 0px 0px 0px; margin: 30px 0px 5px 0px; } #preamble h3 { margin: 0px 0px 5px 0px; } #preamble .p1, #explanation .p1, #participation .p1, #benefits .p1, #requirements .p1 { padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; } #footer a:link, #footer a:visited { text-decoration: underline; color: #FFFFFF; background: #6B320E; padding: 2px 16px 2px 16px; margin: 0px 0px 0px 0px; border: 1px solid #FFFFFF; } #footer a:hover, #footer a:active { text-decoration: underline; color: #000000; border: 1px solid #FFFFFF; background: url(li_bg.jpg) no-repeat; } /* linklist on sidebar --------------------------------------------------------------- */ #linkList h3 { width: 190px; height: 37px; padding: 0px 0px 0px 0px; margin: 20px 0px 0px 0px; } #linkList p, #linkList li { font-family: arial, verdana, helvetica, sans-serif; font-size: 10px; text-indent: 0px; } #linkList ul { list-style: none; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; background: #6B320E; border-top: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF; } #linkList li { color: #000000; line-height: 12px; padding: 7px 17px 7px 17px; } #linkList li:hover { background: url(li_bg.jpg) no-repeat; } #linkList li a { display: block; border: none; color: #FFFFFF; font-weight: bold; padding: 0px 0px 0px 12px; margin: 0px 0px 0px -12px; background: url(bullet_white.gif) no-repeat 0px 4px; } #linkList li a:hover { color: #000000; background: url(bullet_black.gif) no-repeat 0px 4px; } #linkList li a.c { display: inline; padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; background: none; color: #FEEC83; font-weight: normal; } #linkList li a.c:hover { color: #000000; } #linkList #larchives li, #linkList #lresources li { padding: 7px 0px 7px 0px; } #linkList #larchives li a, #linkList #lresources li a { display: inline; padding: 0px 0px 0px 12px; margin: 0px 0px 0px 5px; background: url(bullet_white.gif) no-repeat 0px 4px; } #linkList #larchives li a:hover, #linkList #lresources li a:hover { background: url(bullet_black.gif) no-repeat 0px 4px; } /* h3 image replacement -------------------------------------------------------------- */ h3.select { background: transparent url(h3_select.jpg) no-repeat; } h3.resources { background: transparent url(h3_resources.jpg) no-repeat; } h3.archives { background: transparent url(h3_archives.jpg) no-repeat; } #preamble h3 { background: url(h3_theroad.gif) no-repeat; margin-top: 0; } #explanation h3 { background: url(h3_sowhat.gif) no-repeat; } #participation h3 { background: url(h3_participation.gif) no-repeat; } #benefits h3 { background: url(h3_benefits.gif) no-repeat; } #requirements h3 { background: url(h3_requirements.gif) no-repeat; }/* css Zen Garden submission 168 - 'Hengarden', by Mr. Khmerang, http://www.khmerang.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Mr. Khmerang */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Chicken Should Smile! * Hengarden is made to celebrate the year of the cock, * for general concern about rights of the innocent chickens * and in fear of Chicken's Revenge (a.k.a the flu, you know what I'm talking about) * but also to * laugh at the growing use of image replacements in * css design and especially at zengarden. */ body { background: #fff url(bodybg.gif) 395px 0 repeat-y; margin: 0; padding: 3px; font: 80%/80% Trebuchet MS, Arial, Helvetica, Sans Serif; } #pageHeader { background: #fff url(pageheaderbg.gif) repeat-x; width: 389px; height: 272px; } h1 { background: url(pageheader.jpg) 33px 22px no-repeat; width: 389px; height: 272px; padding: 0; } h1 span, h2, #quickSummary p, h3 span, p, p.p1 span{ display: none; } h1, h3, p.p1 { margin:0 auto 8px auto; display: block; } h3 { margin-top: 20px; } #quickSummary { position:absolute; left: 420px; top: 40px; background-image: url(quicksummary.gif); background-repeat:no-repeat; width: 138px; height: 83px; } #preamble, #supportingText { width: 389px; text-align:center; } #preamble h3 { background: url(preambleH.gif) no-repeat; width: 289px; height: 41px; } #preamble p.p1 { background: url(preamble.gif) no-repeat; width: 343px; height: 182px; } #explanation h3 { background: url(explanationH.gif) no-repeat; width: 247px; height: 41px; } #explanation p.p1 { background: url(explanation.gif) no-repeat; width: 342px; height: 212px; } #participation h3 { background: url(participationH.gif) no-repeat; width: 171px; height: 41px; } #participation p.p1 { background: url(participation.gif) no-repeat; width: 342px; height: 256px; } #benefits h3 { background: url(benefitsH.gif) no-repeat; width: 130px; height: 41px; } #benefits p.p1 { background: url(benefits.gif) no-repeat; width: 342px; height: 83px; } #requirements h3 { background: url(requirementsH.gif) no-repeat; width: 174px; height: 41px; } #requirements p.p1 { background: url(requirements.gif) no-repeat; width: 342px; height: 313px; } #requirements p.p4 { display: block; background: url(requirementsend.gif) no-repeat; width: 367px; height: 138px; margin-left: 22px; margin-bottom: 60px; text-align: left; } #supportingText { background: url(footer.gif) right bottom no-repeat; text-align: center; } #requirements p.p4 span,#requirements p.p5 span { display: none; } #footer { background-color:#4178E6; padding: 5px; font-weight:bold; } #footer a { color: #fff; } #linkList { position:absolute; left: 395px; top: 140px; width: 189px; } #linkList ul { list-style-type: none; margin: 0; padding: 0; } #linkList ul li { border-bottom: 1px solid #CBDAF8; padding: 6px 15px; color: #555; text-align:center; } #linkList ul li:hover { background-color: #CBDAF8; } #linkList ul li a { text-decoration: none; } #lselect a { color: #4178E6; } #lresources a { color: #82A839; } #larchives a { color: #fa0; } #linkList ul li a:hover { color: #000; } h3.select, h3.resources { width: 189px; height: 40px; display: block; } h3.select { background: url(lselectH.gif); } h3.resources { background: url(lresourcesH.gif); } /* css Zen Garden submission 169 - 'Greece Remembrance', by Pierre-Leo Bourbonnais, http://www.kaligrafy.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Pierre-Leo Bourbonnais */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { background: #30261d; padding: 0px; margin-right: auto; margin-left: auto; margin-bottom: 0px; margin-top: 0px; width: 776px; text-align: center; font: 12px Georgia, Times New Roman, Times, serif; color: #ffffff; } #container { background: repeat-y url(sculptures.jpg); margin: 0px; padding: 0px; margin-right: auto; margin-left: auto; margin-top: 381px; top: 381px; width: 776px; text-align: justify; color: #362F27; line-height: 19px; } #intro { margin: 0px; padding: 0px; width: 589px; background: repeat-y url(content_bkgd.jpg); margin-left: 94px; border-top: 1px none; border-bottom: 1px none; } #pageHeader { position: absolute; top: 0px; background: no-repeat center url(header.jpg); height: 381px; width: 776px; margin: 0px; padding: 0px; margin-left: -94px; right: auto; left: auto; } #supportingText { margin: 0px; padding: 0px; width: 589px; background: repeat-y url(content_bkgd.jpg); margin-left: 94px; border-top: 1px none; border-bottom: 1px none; margin-top: -20px; } #quickSummary { background: no-repeat url(top.jpg); width: 589px; height: 85px; margin: 0px; padding: 0px; } .p1 { text-indent: 0px; padding: 0px; margin: 0px; } .p2, .p3, .p4, .p5 { text-indent: 22px; } h1, h2 { display: none; } h3 span { display: none; } #quickSummary p { display: none; } #quickSummary p.p2 { display: block; width: 156px; margin: 0px; padding: 0px; position: absolute; top: 470px; left: auto; right: auto; margin-left: 415px; text-indent: 0px; text-align: left; vertical-align: middle; font-size: 10px; line-height: 16px; height: 50px; font-style: oblique; } #quickSummary a { padding: 0px; margin: 0px; color: #000000; text-decoration: underline; } #quickSummary a:hover { margin: 0px; padding: 0px; color: #ebdccc; font-style: italic; border-bottom: 1px none; text-decoration: none; } #quickSummary span { margin: 0px; padding: 0px; padding-left: 5px; display: block; } #preamble, #explanation, #participation, #benefits, #requirements { margin: 0px; padding: 0px; width: 405px; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p { margin: 0px; padding: 8px; padding-left: 41px; padding-right: 27px; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { width: 362px; height: 22px; margin: 0px; padding: 0px; margin-bottom: 5px; margin-left: 38px; margin-top: 20px; } #preamble h3 { margin-top: 5px; background: url(h3_preamble.gif) no-repeat; } #explanation h3 { background: url(h3_explanation.gif) no-repeat; } #participation h3 { background: url(h3_participation.gif) no-repeat; } #benefits h3 { background: url(h3_benefits.gif) no-repeat; } #requirements h3 { background: url(h3_requirements.gif) no-repeat; } #preamble { padding-bottom: 20px; } #linkList { position: absolute; width: 139px; margin: 0px; padding: 0px; top: 510px; left: auto; right: auto; font-size: 11px; margin-left: 507px; text-indent: 0px; text-align: right; } #linkList h3 { width: 139px; height: 22px; margin: 0px; padding: 0px; margin-bottom: 5px; margin-left: 0px; margin-top: 20px; padding-right: 2px; } #linkList ul { margin: 0px; padding: 0px; list-style: none; margin-left: 0px; width: 139px; } #linkList li { margin: 0px; padding: 0px; list-style: none; } #linkList a { margin: 0px; padding: 0px; display: block; color: #B82A09; text-decoration: none; text-transform: uppercase; } #linkList a:hover { margin: 0px; padding: 0px; display: block; color: #741600; text-decoration: none; } #lselect h3 { margin-top: 2px; background: url(h3_select.gif) no-repeat; } #larchives h3 { background: url(h3_archives.gif) no-repeat; } #lresources h3 { background: url(h3_resources.gif) no-repeat; } #larchives a, #lresources a { margin: 0px; padding: 0px; display: inline; text-decoration: none; text-transform: none; } #larchives a:hover, #lresources a:hover { margin: 0px; padding: 0px; display: inline; text-decoration: none; text-transform: none; } #linkList a.c { margin: 0px; padding: 0px; display: inline; font-style: italic; color: #754f38; text-decoration: none; text-transform: none; } #linkList a.c:hover { margin: 0px; padding: 0px; display: inline; font-style: italic; color: #462f22; text-decoration: none; text-transform: none; } a { color: #B82A09; text-decoration: none; } a:hover { color: #B82A09; text-decoration: underline; } a:visited { color: #754f38; } #footer { width: 589px; background: no-repeat url(bot.jpg) #30261d; margin: 0px; padding: 0px; margin-bottom: -2px; text-align: center; padding-top: 54px; text-indent: 0px; font: 10px Verdana, Arial, Helvetica, sans-serif; text-transform: uppercase; padding-bottom: 17px; } #footer a { color: #362F27; text-decoration: none; text-transform: uppercase; } #footer a:hover { color: #B82A09; text-decoration: none; text-transform: uppercase; } #requirements p.p5 { position: relative; bottom: -35px; width: 589px; text-indent: 0px; text-align: center; font: 10px Verdana, Arial, Helvetica, sans-serif; margin: 0px; padding: 0px; } #requirements p.p5 a { color: #5d5144; text-decoration: none; } #requirements p.p5 a:hover { color: #B82A09; text-decoration: none; } #intro acronym { color: #5d5144; font-style: italic; text-decoration: none; border-bottom: none; } #supportingText acronym { color: #5d5144; font-style: italic; text-decoration: none; border-bottom: none; } #linkList acronym { border-bottom: none; text-decoration: none; font-style: oblique; }/* css Zen Garden submission 170 - 'Love is in the Air', by Nele Goetz, http://www.april-design.de/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Nele Goetz */ /* Added: May. 31st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ * {margin: 0; padding: 0} body { background:#3C6FAC url(back.gif) repeat-x; font-size:100.01%; font-family:"trebuchet ms", verdana, sans-serif; color:#2C5079} p {padding:10px 30px 10px 20px; font-size:0.9em; line-height:1.6} a{text-decoration:none} a:link{color:#E5FBBB} a:visited{color:#B8DBFF} a:hover, a:active{color:white} acronym{cursor:help} /* specific divs */ #container{position:relative; min-width:744px} #intro{ height:1%; border-right:1px solid #2B4D70; border-left:1px solid #2B4D70; margin:0 240px 0 0; background:url(back_top.gif)} #pageHeader{ background:url(head.jpg) center no-repeat; height:365px} #pageHeader h1 span{display:none} #pageHeader h2 span{ /*misused for the googbye-grafic*/ color:#3C6FAC; position:absolute; bottom:0px; right:128px; width:112px; height:69px; background:url(bye.gif); font-size:0px; line-height:0px} #supportingText{ border-right:1px solid #2B4D70; border-left:1px solid #2B4D70; margin:0 240px 0 0} #quickSummary{text-align:center} #quickSummary p{ color:#C5E1FF; font-style:italic; padding:0} #quickSummary p.p1{ font-size:1em; margin:30px 10px; width:70%; float:left} #quickSummary p.p2{ float:right; font-size:0.8em; width:20%; margin:3em 10px 0 0; text-align:right} #quickSummary a:link, #quickSummary a:visited{text-decoration:underline; color:#C5E1FF} #quickSummary a:hover, #quickSummary a:active{text-decoration:underline; color:white} #preamble{background:#79A6D4; clear:both} #preamble h3{ height:55px; background:#98AE6D url(preamble.jpg) no-repeat; border-top:1px solid #BDCCA3; border-bottom:1px solid #386496} #preamble h3 span{display:none} #supportingText{background:#79A6D4} #supportingText h3{ height:55px; border-top:1px solid #BDCCA3; border-bottom:1px solid #386496} #supportingText h3 span {display:none} #explanation h3{background: #98AE6D url(about.jpg) no-repeat} #participation h3{background: #98AE6D url(participation.jpg) no-repeat} #benefits h3{background: #98AE6D url(benefits.jpg) no-repeat} #requirements h3{background: #98AE6D url(requirements.jpg) no-repeat} #footer { text-align:left; background:#DE5608; padding:10px 20px; border-top:1px solid #EFAE89} #footer a{ color:#F4A21F; font-size:0.8em} #footer a:visited{color:#992D2A} #footer a:hover{color:white} #linkList{ font:0.8em/1.6 "trebuchet ms", verdana, sans-serif; position:absolute; right:0px; top:0px} #linkList2{width:201px} #linkList h3{ width:201px; height:53px; border-right:1px solid #3D82AD; border-left:1px solid #3D82AD; voice-family:"\"}\""; voice-family:inherit; width: 199px} .dummy{margin: 0} #linkList h3 span{display:none} #linkList h3.select{background:transparent url(select.jpg)} #linkList h3.favorites{background:transparent url(favorites.jpg)} #linkList h3.archives{background:transparent url(archives.jpg)} #linkList h3.resources{background:transparent url(resources.jpg)} #linkList ul{ background:#B7D1ED; border-right:1px solid #3D82AD; border-left:1px solid #3D82AD} #lresources ul{ padding:0 0 41px 0; background:#B7D1ED url(attent.jpg) no-repeat left bottom} #linkList li{ list-style-type:none; display:block; border-bottom:1px solid #3D82AD; color:#3D82AD; padding:7px 0 7px 10px} #linkList li a{ font-weight:bold; display:block; color:white; background:url(heart.gif) no-repeat 0px 55%; padding:0 0 0 15px} #linkList li a:hover{color:#3D82AD; background:url(heart2.gif) no-repeat 0px 55%} #linkList li a:visited{font-weight:normal} #linkList li a.c{ letter-spacing:0.2em; color:#3D82AD; font-size:0.81em; font-weight:normal; display:inline; text-transform:uppercase; background:none; padding:0 0 0 5px} #linkList li a.c:hover{font-weight:bold; background:none} /*This one is dedicated to my little son Jelrik */ /* css Zen Garden submission 171 - 'Shaolin Yokobue', by Javier Cabrera, http://www.emaginacion.com.ar/hacks/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Javier Cabrera */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Coded and designed by Javier Cabrera (emaginacion) http://www.emaginacion.com.ar/geek (blog). */ body { font: 8pt/12pt georgia, sans-serif; color: #c0c0c0; margin: 0px; } #container { top:0; position: absolute; padding: 0px; left: 50%; margin-left: -277px; width: 595px; background: transparent url(zen-bg.gif) no-repeat; background-position: 0 40px; } p { margin:10px 0 0 0; } a:link { text-decoration: none; color: #fff; } a:visited { font-weight: bold; text-decoration: underline; color: #d4cddc; } a:hover, a:active { text-decoration: underline; color: #fff; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(h1.gif) no-repeat; margin:0 0 0 97px; position:absolute; width: 332px; height: 40px; top:60px; } #pageHeader h1 span { display:none } #pageHeader h2 { position: absolute; background: transparent url(h2.gif) no-repeat; margin: 0 0 0 355px; width: 80px; height: 25px; top:98px; } #pageHeader h2 span { display: none } h3 { margin: 0 0 0 30px; font-weight: bold; font: 13pt Georgia, sans-serif; font-style:italic; padding: 0; } /* Sidebar */ #linkList { position:absolute; top: 920px; left: 390px; height:500px; font: 8pt/11pt arial, sans-serif; } #linkList ul { list-style-type: none; margin-top:5px; } #linkList h3 { color:#fff; } #linkList2 { margin-top:55px; } #lselect a:link.c, #lselect a:visited.c { display: inline; } #lselect a { display: block; } #lresources { background: transparent url(rockbottom.gif) no-repeat; height:250px; width:190px; background-position:28px 0; } /* Content */ .p1 { margin-top:1px; padding-top:30px; } .p5 { text-align:center; color:#FFE1A4; font: 8pt/12pt Arial, sans-serif; margin:47px 0 0 0; width:215px; } #quickSummary { font: 10pt/15pt "Trebuchet MS", sans-serif; margin:400px 0 0 135px; padding-bottom:8px; color: #fff; width: 250px; text-align: left; border-bottom:1px solid #353535; } #quickSummary :first-letter { font: 1.5em/15pt "Georgia", sans-serif; } #preamble { margin: 20px 0 0 148px; width: 230px; } #preamble h3 { position:absolute; background: transparent url(titulo1.gif) no-repeat; margin: 0 0 0 -35px; width: 395px; height: 41px; } #preamble h3 span { display:none; } /* This little guy here ensures that if you want to make the text 100% in mozilla, you will still see the design &*/ #supportingText { width:314px; margin-left:100px; background: transparent url(back.gif) repeat-y; background-position:-78px 0; } #explanation { margin: 20px 0 0 47px; width: 230px; } #explanation h3 { position:absolute; background: transparent url(titulo2.gif) no-repeat; margin: 0 0 0 -30px; width: 145px; height: 41px; } #explanation h3 span { display:none; } #participation { margin: 20px 0 0 47px; width: 230px; } #participation h3 { position:absolute; background: transparent url(titulo3.gif) no-repeat; margin: 0 0 0 -35px; width: 250px; height: 41px; } #participation h3 span { display:none; } #benefits { margin: 20px 0 0 47px; width: 230px; } #benefits h3 { position:absolute; background: transparent url(titulo4.gif) no-repeat; margin: 0 0 0 -35px; width: 250px; height: 41px; } #benefits h3 span { display:none; } #requirements { margin: 20px 0 0 47px; width: 230px; } #requirements h3 { position:absolute; background: transparent url(titulo5.gif) no-repeat; margin: 0 0 0 -35px; width: 250px; height: 41px; } #requirements h3 span { display:none; } #footer { color:#000; height:60px; position:absolute; margin:0 0 0 -15px; background: transparent url(bottom.gif) no-repeat; width:345px; padding:40px 0 30px 134px; } #footer a:link, #footer a:active{ color:#c0c0c0; } #footer a:hover { color:#fff; text-decoration:underline; }/* css Zen Garden submission 172 - 'Blackcomb*75', by Bryan Carichner, http://www.carichner.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Bryan Carichner */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ----- The Design ----- blackcomb*75 - Bryan Carichner (http://www.carichner.com) ----- The Photograph ----- A View of 'Spearhead' taken from across the bowl on the Blackcomb Glacier - Bryan Carichner (Whistler, BC, Canada - February 2004) */ /* ----- BASIC ----- */ html { margin: 0; padding: 0; } body { margin: 0; padding: 0; height: 100%; font: normal 11px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; background: #1D0D00 url(images/BG_body.jpg) repeat-y; } #container { position: absolute; margin: 0; padding: 0; width: 900px; height: 964px; background: url(images/BG_blackcomb.jpg) top left no-repeat; } a:link, a:visited { color: #3F5671; } a:hover { color: #DA8C11; } acronym { font-style: italic; cursor: help; border: none; } /* hidden */ h1 span, h2 span, h3.select span, h3.archives span, h3.resources span, #preamble h3 span, #supportingText h3 span { visibility: hidden; } /* ----- MAIN CONTENT ----- */ #preamble { position: absolute; top: 190px; left: 90px; width: 320px; height: 300px; text-align: center; color: #1D0D00; background: url(images/BG_preamble.gif) no-repeat top; } #preamble h3 { margin: 0; padding: 0; } #preamble .p1 { margin: 0; padding: 25px 10px 10px 10px; } #preamble .p2 { margin: 0; padding: 0px 10px 10px 10px; } #preamble .p3 { margin: 0; padding: 0px 10px 10px 10px; } #supportingText { position: absolute; top: 425px; left: 90px; width: 318px; padding: 0px; margin: 0; text-align: center; color: #1D0D00; background: #FFFFFF; border-left: 1px solid #A4B0C8; border-right: 1px solid #A4B0C8; } /* h3 text-replacing images (text hidden above) */ #explanation h3 { margin: 0; height: 60px; background: url(images/BG_h3exp.gif) no-repeat top center; } #participation h3 { margin: 0; height: 60px; background: url(images/BG_h3par.gif) no-repeat top center; } #benefits h3 { margin: 0; height: 60px; background: url(images/BG_h3ben.gif) no-repeat top center; } #requirements h3 { margin: 0; height: 60px; background: url(images/BG_h3req.gif) no-repeat top center; } #explanation .p1 { margin: 0; padding: 5px 10px 0 10px; } #explanation .p2 { padding: 0 10px 10px 10px; } #participation .p1 { margin: 0; padding: 5px 10px 0 10px; } #participation .p2 { padding: 0 10px 0 10px; } #participation .p3 { padding: 0 10px 10px 10px; } #benefits .p1 { margin: 0; padding: 5px 10px 20px 10px; } #requirements .p1 { margin: 0; padding: 5px 10px 0 10px; } #requirements .p2, #requirements .p3, #requirements .p4, #requirements .p5 { padding: 0 10px 0 10px; } #footer { margin: 0; padding-top: 14px; text-align: center; height: 30px; width: 318px; background: url(images/BG_footer.gif) no-repeat bottom center; } #footer a:link, #footer a:visited { padding: 0px 3px 1px 3px; color: #E2E7EF; border: 1px solid #A4B0C8; text-decoration: none; } #footer a:hover { padding: 0px 3px 1px 3px; color: #3F5671; background: #E2E7EF; border: 1px solid #A4B0C8; } /* ----- MENUS & PROJECT SUMMARY (positioned over maple leaf scrim) -----*/ #container #linkList { position: absolute; left: 435px; top: 275px; width: 145px; text-align: left; } #linkList h3 { width: 145px; height: 26px; margin: 0; } #linkList h3 span { display: none; } /* h3 text-replacing images */ #linkList h3.select { background: url(images/BG_h3select.gif) top left no-repeat; } #linkList h3.archives { background: url(images/BG_h3archives.gif) top left no-repeat; } #linkList h3.resources { background: url(images/BG_h3resources.gif) top left no-repeat; } #linkList h3.favorites { background: url(images/BG_h3favorites.gif) top left no-repeat; } #linkList ul { list-style: none; padding: 0 0 6px 0; margin: 0; line-height: 13px; } #linkList ul li { padding: 3px 0px 3px 0px; margin: 0; font-size: 10px; border-bottom: dotted 1px #A4B0C8; } /* subtle hover effect for friendly browsers */ #lselect li:hover { border-bottom: dotted 1px #3F5671; } #linkList #lselect { font-style:italic; color: #A4B0C8; margin-bottom: 8px; } #linkList #lselect li { padding-top: 6px; } #linkList #lselect a:link, #linkList #lselect a:visited { display: block; font: bold 11px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #72141A; text-decoration:none; padding: 0px 0px 2px 15px; background: url(images/BG_li.gif) top left no-repeat; } #linkList #lselect a:hover { font: bold 11px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #DA8C11; text-decoration: none; padding: 0px 0px 2px 15px; background: url(images/BG_li_hover.gif) top left no-repeat; } #linkList #larchives { margin-bottom: 8px; } #linkList #larchives a, #linkList #lresources a, #linkList #larchives a:visited, #linkList #lresources a:visited { display: inline; font: bold 10px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #3F5671; text-decoration:none; padding: 0px 0px 2px 14px; background: url(images/BG_li_2.gif) no-repeat left; } #linkList #larchives a:hover, #linkList #lresources a:hover { display: inline; font: bold 10px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #DA8C11; text-decoration:none; padding: 0px 0px 2px 14px; background: url(images/BG_li_2_hover.gif) no-repeat left; } #linkList #lselect a.c, #linkList #lselect a.c:visited { display: inline; margin-bottom: 4px; padding: 0; font: normal 10px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #3F5671; border: 0; text-decoration: none; background: none; } #linkList #lselect a.c:hover { display: inline; padding: 0; font: normal 10px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; color: #DA8C11; border: 0; text-decoration: none; background: none; } #quickSummary { position: absolute; top: 505px; left: 630px; width: 130px; margin: 0; padding: 5px 4px 8px 5px; text-align: left; color: #A4B0C8; font: normal 10px "Lucida Grande", Verdana, Arial, Helvetica, sans-serif; } #quickSummary a:link, #quickSummary a:visited { color: #3F5671; text-decoration: none; } #quickSummary a:hover { color: #DA8C11; text-decoration: none; } /* ----- Final Touch ----- */ #extraDiv1 { position: absolute; top: 1180px; left: 410px; width: 76px; height: 546px; background: transparent url(images/BG_bc.gif) no-repeat; } /* css Zen Garden submission 173 - 'Red Stars', by Shafiq Rizwan, http://www.1988online.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Shafiq Rizwan */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { font: 8pt/16pt georgia; color: #fffafa; background: #fff url(blossoms.jpg) no-repeat bottom right; margin: 0px; text-align: center; } p { font: 8pt/16pt georgia; margin-top: 0px; text-align: justify; } h3 { margin-bottom: 0px; } a:link { font-weight: bold; text-decoration: none; color: #B7A5DF; } a:visited { font-weight: bold; text-decoration: none; color: #D4CDDC; } a:hover, a:active { text-decoration: underline; color: #9685BA; } #container { margin: 0 auto; width: 619px; background: url(bg.jpg) repeat-y; text-align:left; } #intro { background: url(intro.jpg) no-repeat; } #pageHeader { position:absolute; width:55px; } #pageHeader h1 { background: transparent url(header.gif) no-repeat; text-indent: -5000px; width: 46px; height: 254px; } #pageHeader h1 span { display:none } #pageHeader h2 { text-indent: -5000px; } #pageHeader h2 span { display:none } #quickSummary { position:absolute; margin-top:90px; margin-left:322px; height:90px; width:260px; } #quickSummary p { font: 10px arial; text-align:center; color : #FFF; } #preamble { padding: 205px 0 0 62px; width:335px; } #preamble h3 { text-indent:-5000px; background: url(road.jpg) no-repeat; width:344px; height:50px; } #preamble p { font-style: italic; margin:0 5px 0 30px; } #supportingText { padding-left: 73px; width:330px; } #supportingText p { margin:0 10px 0 20px; } #supportingText h3 { margin:0 0 0 7px; } #explanation, #participation, #benefits, #requirements { margin: 10px 0 0 0; } #explanation h3 { background: url(what.jpg) no-repeat; text-indent:-5000px; width:324px; height:40px; } #participation h3 { background: url(participation.jpg) no-repeat; text-indent:-5000px; width:324px; height:40px; } #benefits h3 { background: url(benefits.jpg) no-repeat; text-indent:-5000px; width:324px; height:40px; } #requirements h3 { background: url(requirements.jpg) no-repeat; text-indent:-5000px; width:324px; height:40px; } #footer { background: url(footerbg.jpg) no-repeat; text-align: center; padding:10px; height:28px; } #footer a:link, #footer a:visited { margin-right: 20px; } #linkList { position:absolute; top:197px; margin:0 0 0 400px; width:200px; } #linkList2 { font: 10px verdana, sans-serif; background: transparent url(paper-bg.jpg) top left repeat-y; padding: 10px; width: 130px; text-align:left; } #linkList h3.select { background: url(select.jpg) no-repeat; margin: 10px 0px 5px 0px; width: 177px; height: 40px; } #linkList h3.select span { display:none } #linkList h3.archives { background: transparent url(archives.jpg) no-repeat; margin: 25px 0px 5px 0px; width:177px; height: 40px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.jpg) no-repeat; margin: 25px 0px 5px 0px; width:177px; height: 40px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { list-style-type: none; border:1px #761C1C none; width:170px; padding-left:7px; } #linkList #lselect li { height:30px; padding-top:5px; } #linkList #larchives li, #linkList #lresources li { height:15px; padding-top:3px; } #linkList a { display:block; } #linkList a.c { display:inline; font-weight: normal; color: #FFF; border-bottom: 1px #FFF none; } #linkList a.c:hover { text-decoration: none; border-bottom: 1px #FFF dotted; } #linkList li:hover { background: url(lbg.jpg) #8F2323 repeat-x; border:1px #761C1C solid; }/* css Zen Garden submission 174 - 'Simple', by Shawn Chin, http://www.shawnchin.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Shawn Chin */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { text-align:center; padding:0; margin:1px 0 0; font:normal 11px Arial, Helvetica, Sans-serif; color:#666; } a { color:#777; } a:hover { color:#A77749; } #container { text-align:left; background:#FFF url(container_bg.gif) repeat-y top left; width:700px; margin:auto; position:relative; padding:0; } #pageHeader { width:700px; height:80px; background:#666 url(main_title.gif) no-repeat; margin:0; padding:0; } #pageHeader h1,h2 { padding:0; margin:0; display:none; } #quickSummary{ margin:0; padding:0; position:relative; border-top:#FFF 1px solid; width:700px; height:75px; background:#FFF; } #quickSummary p{ margin:0; padding:0; } #quickSummary .p1{ position:absolute; top:0; left:0; width:700px; height:75px; background:#FFF url(quickSummary_main.gif) no-repeat 251px 0; } #quickSummary .p1 span{ display:none; } #quickSummary .p2{ position:absolute; top:0; left:0; width:250px; height:75px; background:url(quickSummary_button.gif) no-repeat top left; } #quickSummary .p2 span{ visibility:hidden; white-space:nowrap; } #quickSummary .p2 a { width:250px; height:37px; float:right; visibility:visible; text-indent:-9000px; overflow:hidden; margin-top:-1.3em; margin-bottom:1.4em; } #preamble { position:relative; border-top:#fff 1px solid; margin:0; padding:0; width:524px; background:#CCC url(preamble_top.gif) no-repeat top left; } #preamble h3{ display:none; margin:0; padding:0; } #preamble .p1{ margin:0; padding:31px 15px 0px 15px; } #supportingText{ width:524px; } #explanation .p1, #participation .p1, #requirements .p1{ margin:0; padding:41px 15px 0px 15px; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p{ margin:0; padding:10px 15px 0px 15px; } #explanation h3, #participation h3, #benefits h3, #requirements h3, #lselect h3, #larchives h3, #lresources h3{ display:none; } #preamble .p3, #explanation .p2, #participation .p3, #requirements .p5{ margin:0; padding:10px 15px 7px 15px; } #benefits .p1{ margin:0; padding:41px 15px 7px 15px; } #explanation{ background:#CCC url(explanation_top.gif) no-repeat top left; } #participation{ background:#CCC url(participation_top.gif) no-repeat top left; } #benefits{ background:#CCC url(benefits_top.gif) no-repeat top left; } #requirements{ background:#CCC url(requirements_top.gif) no-repeat top left; } #footer{ background:#FD9453 url(footer_top.gif) no-repeat top left; padding-top:17px; padding-left:15px; } #linkList { position:absolute; top:156px; left:525px; width:175px; background:#FD9453; border-top:#fff 1px solid; color:#fff; } #linkList a, #footer a{ color:#FFF; text-decoration:none; } #linkList a:hover, #footer a:hover{ color:#FCD2B8; } #lselect{ background:#FD9453 url(lselect_top.gif) no-repeat top left; padding:29px 0 0 0; } #larchives{ background:#FD9453 url(larchives_top.gif) no-repeat top left; padding:39px 0 0 0; } #lresources{ background:#FD9453 url(lresources_top.gif) no-repeat top left; padding:39px 0 0 0; } #lselect ul, #larchives ul, #lresources ul{ margin:0; padding:0 15px 5px 15px; } #lselect li, #larchives li, #lresources li{ padding: 0 0 5px 15px; margin:0; list-style-type:none; background:transparent url(bullet2.gif) no-repeat 0 4px; } #extraDiv1{ margin:auto; width:700px; height:9px; background:#fff url(extradiv1_bg.gif) no-repeat top left; } /* css Zen Garden submission 175 - 'Business Style', by Gunta Klavina, http://www.klavina.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Gunta Klavina */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { margin: 0; padding: 0; color: #333; font: 13px Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif; background: #E2EBED; text-align: center; } a { color: #307082; } a:hover { color: #D60808; } acronym { border: none; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #lresources h3.resources span, #larchives h3.archives span, #lselect h3.select { display:none; } #container { margin: 0 auto; width: 724px; position: relative; background: #fff; padding: 0 10px 0 10px; text-align: left; } * html #container { width: 744px; w\idth: 724px; } #pageHeader { position: absolute; top: 25px; left: 40px; } h1 { background: url("logo.gif"); width: 156px; height: 25px; overflow: hidden; margin: 0; } h1 span { display: none; } h2 { font-size: 12px; margin: 0; } #quickSummary { padding-top: 85px; } #quickSummary .p2 { font-size: 12px; position: absolute; top: 65px; right: 20px; margin: 0; } #container #intro #quickSummary .p1 { font-size: 11px; height: 171px; background: url("background.jpg") no-repeat; margin: 0; width: 724px; color: #fff; font: 12px/150% Trebuchet MS; } #container #intro #quickSummary .p1 span { padding: 30px 530px 0 30px; display: block; margin: 0; font: 12px/150% Trebuchet MS; } #preamble, #supportingText { margin: 0 20px 0 243px; } #supportingText p, #preamble p { line-height: 150%; margin: 10px 0 10px 0; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { width: 200px; height: 24px; margin: 40px 0 10px 0; } #preamble h3 { background: url("heading01.gif") no-repeat; } #explanation h3 { background: url("heading02.gif") no-repeat; } #participation h3 { background: url("heading03.gif") no-repeat; } #benefits h3 { background: url("heading04.gif") no-repeat; } #requirements h3 { background: url("heading05.gif") no-repeat; } #requirements { margin-bottom: 40px; } #linkList { position: absolute; top: 295px; left: 0; width: 210px; } #lselect ul, #larchives ul, #lresources ul { list-style-type: none; margin: 0; padding: 0 0 0 40px; } #lselect ul li a { text-decoration: underline; display: block; font-size: 13px; } #lselect ul li.c, #lselect ul li a.c { display: inline; font-size: 12px; color: #333; } #lselect ul li a.c { text-decoration: none; } #lselect ul li a.c:hover { color: #D60808; } #lselect ul li { font-size: 12px; border-bottom: 1px solid #E6EEF0; } #linkList #larchives ul li { font-size: 13px; border-bottom: 1px solid #E6EEF0; display: block; padding: 5px 0; } #linkList #lresources ul li { font-size: 13px; border-bottom: 1px solid #E6EEF0; display: block; padding: 5px 0; } #lresources h3.resources { background: url("resources.gif") no-repeat; width: 69px; height: 15px; margin: 30px 0 5px 40px; } #larchives h3.archives { background: url("archives.gif") no-repeat; width: 69px; height: 15px; margin: 30px 0 5px 40px; } #footer { background: url("footer.gif") no-repeat; color: #fff; height: 48px; text-align: right; padding: 0 10px 0 0; line-height: 26px; font-size: 11px; } #footer a { color: #fff; text-decoration: none; } #footer a:hover { text-decoration: underline; } /* css Zen Garden submission 176 - 'Kelmscott', by Bronwen Hodgkinson, http://www.cdevision.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Bronwen Hodgkinson */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body {font:8pt georgia, serif; color:#333; background:#fff url(bground.gif); margin:0; border:1px solid #000;} p {font:8pt georgia, serif; margin:0 0 12px 0; text-align:justify;} h3 {font:bold 12pt georgia, serif; margin-bottom:0;} acronym {font-weight:bold; border-bottom: none;} a:link, a:visited {text-decoration:none; color:#900;} a:hover, a:active {text-decoration:underline; color:#c00;} /* specific divs */ #container {width:604px; padding:0; margin:80px auto 80px 80px; border:2px solid #333; position:relative; background:#f8f8f8 url(bottomBorder.gif) 2px 100% no-repeat;} #intro {background:url(header.gif) no-repeat; width:600px;} #pageHeader {margin-bottom:0; height:30px;} #pageHeader h1, #pageHeader h2 {margin:17px 0 0 0; padding:0; height:30px;} #pageHeader h1 {background:transparent url(h1.gif) no-repeat; width:223px; float:left;} #pageHeader h2 {background:transparent url(h2.gif) no-repeat; width:377px; float:right;} #pageHeader h1 span, #pageHeader h2 span {display:none} #quickSummary {clear:both; margin:0 0 6px 0; width:600px; height:73px; background:url(summary.gif) 0 0 no-repeat;} #quickSummary p.p1 {display:none;} #quickSummary p.p2 {position:absolute; top:129px; left:430px; padding:0; font-size:8pt; z-index:10; font-weight:bold; width:150px; text-align:left;} #preamble {padding:210px 0 0 20px; margin:0 188px 0 0; background:url(mainImage.gif) 13px 0 no-repeat; width:392px;} #preamble h3 {background:url(preAmble.gif) -9px 0 no-repeat; height:41px; width:392px; margin:0; padding:0;} #preamble h3 span {display:none;} #supportingText {margin:0 8px 50px 20px; width:390px;} #supportingText h3 span {display:none;} #supportingText h3 {height:41px; width:392px;} #explanation h3 {background:url(explanation.gif) -9px 0 no-repeat;} #participation h3 {background:url(participation.gif) -9px 0 no-repeat;} #benefits h3 {background:url(benefits.gif) -9px 0 no-repeat;} #requirements h3 {background:url(requirements.gif) -9px 0 no-repeat;} #linkList {width:170px; position:absolute; top:170px; left:422px; background:url(linklistBottom.gif) 0 100% no-repeat; padding-bottom:200px; font:7.5pt georgia, serif; padding-left:7px;} #linkList h3 span {display:none} #linkList h3 {width:165px; height:15px; margin:0;} #linkList h3.select {background:url(select.gif) no-repeat;} #linkList h3.archives {background:url(archives.gif) no-repeat;} #linkList h3.resources {background:url(resources.gif) no-repeat;} #linkList ul {margin:0 0 17px 0; padding:0;} #linkList li {line-height:1.2em; list-style-type:none; display:block; padding-top:5px; margin-left:0;} /* css Zen Garden submission 177 - 'Zen City Morning', by Ray Henry, http://www.reh3.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Ray Henry */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ----------------------------------------------------------------------------------------- Global -------------------------------------------------------------------------------------- */ * {margin:0;padding:0;} /* zero out everything */ body { width:100%; background:#0A3443 url(r3_zc_main_bg.jpg) repeat-y top left; font-family:verdana, arial, sans-serif; } ul, ol {list-style:none;} /* ----------------------------------------------------------------------------------------- Layout Structure -------------------------------------------------------------------------------------- */ #container {width:760px;} #intro, #supportingText { float:left; width:570px; } #linkList { padding:190px 0 0 0; margin:0 0 0 570px; font-size:11px; } * html #linkList {position:absolute;left:0;top:0;} /* For Internet Explorer */ /* ----------------------------------------------------------------------------------------- =intro -------------------------------------------------------------------------------------- */ #pageHeader h1 { width:570px; height:190px; background:url(r3_zc_title.gif) no-repeat top left; text-indent:-5000px; } #pageHeader h2 {display:none;} #quickSummary p {font-size:11px;margin:0;padding:0;} #quickSummary p.p1 { float:left; width:380px; height:178px; background:url(r3_zc_summary.gif) no-repeat top left; text-indent:-5000px; } #quickSummary p.p2 { float:left; width:190px; padding:102px 0 50px 9px; height:76px; background:url(r3_zc_download.gif) no-repeat top left; color:#E6B788; /* start box model to fix main nav in IE 5.5 */ voice-family: "\"}\""; voice-family:inherit; width:181px; padding:102px 0 0 9px; height:76px; /* end box model to fix main nav in IE 5.5 */ } #quickSummary p.p2 a:link, #quickSummary p.p2 a:visited, #quickSummary p.p2 a:active {color:#E6B788;} #quickSummary p.p2 a:hover {color:#F4D3B3;} #preamble { clear:both; width:570px; padding:0 0 20px 0; background:#4A6774 url(r3_zc_road_bg.gif) repeat-x top left; font-size:11px; } #preamble h3 { width:268px; height:45px; background:url(r3_zc_road_title.gif) no-repeat top left; text-indent:-5000px; } #preamble p { margin:12px; color:#CFD9DC; } /* ----------------------------------------------------------------------------------------- =supportingText -------------------------------------------------------------------------------------- */ #supportingText div { padding: 19px 0; background:#DECD95 url(r3_zc_support_bg.gif) repeat-x top left; } #supportingText h3 { float:left; width:190px; text-indent:-5000px; } #supportingText #explanation h3 { height:40px; background:url(r3_zc_what_title.gif) no-repeat top left; } #supportingText #participation h3 { height:28px; background:url(r3_zc_participation_title.gif) no-repeat top left; } #supportingText #benefits h3 { height:26px; background:url(r3_zc_benefits_title.gif) no-repeat top left; } #supportingText #requirements h3 { height:26px; background:url(r3_zc_requirements_title.gif) no-repeat top left; } #supportingText p { margin:0 0 0 190px; padding:0 10px 22px 0; font-size:11px; line-height:16.5px; color:#4D3A33; } #supportingText p a {padding:2px;text-decoration:none;} #supportingText p a:link {color:#C64708;} #supportingText p a:visited {color:#4D3A33;} #supportingText p a:active {color:#C64708;} #supportingText p a:hover {background:#C6B478;color:#fff;} #supportingText div#footer { clear:both; padding:6px 0; background:#555; text-align:center; font-size:10px; } #supportingText div#footer a { margin:5px 15px; padding:5px; } #supportingText div#footer a:link, #supportingText div#footer a:visited, #supportingText div#footer a:active {color:#999;text-decoration:none;} #supportingText div#footer a:hover {background:#777;color:#bbb;} /* ----------------------------------------------------------------------------------------- =linkList -------------------------------------------------------------------------------------- */ #linkList2 { width:180px; padding:0 0 250px 10px; background:url(r3_zc_linklist_bg.gif) no-repeat top left; } #linkList2 h3 { width:180px; height:22px; text-indent:-5000px; } #lselect h3 {background:url(r3_zc_lselect_title.gif) no-repeat top left;} #larchives h3 {background:url(r3_zc_larchives_title.gif) no-repeat top left;} #lresources h3 {background:url(r3_zc_lresources_title.gif) no-repeat top left;} #linkList2 ul { margin:10px 0 20px 0; color:#7FA2B0; } #linkList2 ul li {margin:10px 0 0 0;padding: 1px 0 0 12px;} #lselect ul li {background:url(r3_zc_lselect_bullet.gif) no-repeat top left;} #lselect ul li a:link, #lselect ul li a:visited, #lselect ul li a:active { color:#fff; font-weight:bold; text-decoration:none; } #lselect ul li a:hover {color:#C64708;} #lselect ul li a.c:link, #lselect ul li a.c:visited, #lselect ul li a.c:active, #larchives ul li a:link, #larchives ul li a:visited, #larchives ul li a:active, #lresources ul li a:link, #lresources ul li a:visited, #lresources ul li a:active { color:#7FA2B0; font-weight:normal; } #lselect ul li a.c:hover, #larchives ul li a:hover, #lresources ul li a:hover {color:#C64708;} { color:#7FA2B0; font-weight:normal; } /* ----------------------------------------------------------------------------------------- =Extra Divs -------------------------------------------------------------------------------------- */ #extraDiv1 { position:fixed; left:0; top:0; width:770px; height:184px; background:url(r3_zc_clouds.png) no-repeat top left; } * html #extraDiv1 {display:none;} /* Hide from Internet Explorer */ /* css Zen Garden submission 178 - 'Pinups', by Emiliano Pennisi, http://www.peamarte.it/02/03.html */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Emiliano Pennisi */ /* Added: July 9th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css Zen Garden - 'Pinups', by Emiliano Pennisi All illustrations and design was made by Emiliano Pennisi, MetroStation Design, for more info visit --> http://www.peamarte.it/02/03.html The image of the first list it has been taken give: Stylegala Bullet Madness list ************************************************************************************/ /* General */ body{ font-family: "Lucida Grande", Georgia, "Times New Roman", Times, serif; font-size: 0.8em; background: #d07b00; text-align: center; margin: 0; } body>#container{ margin-top: -20px; } /* General links */ a:link,a:visited{ color: #000; font-weight: bold; } a:hover{ color: #B74213; } /* Paragraphs */ p{ line-height: 1.3em; margin: 15px 0 0 10px; } acronym { color: #B74213; font-weight: bold; font-size: 10px; border-bottom: 1px dashed #B74213; } h3{ font-size: 12px; } /* Start layout rules */ #preamble h3 span{ display: none; } #preamble h3{ background: url(01.gif); width: 380px; height: 72px; } /* Images replacement group */ #explanation h3 span{ display: none; } #explanation h3{ background: url(02.gif); width: 380px; height: 60px; } #participation h3 span{ display: none; } #participation h3{ background: url(03.gif); width: 380px; height: 60px; } #benefits h3 span{ display: none; } #benefits h3{ background: url(04.gif); width: 380px; height: 60px; } #requirements h3 span{ display: none; } #requirements h3{ background: url(05.gif); width: 380px; height: 60px; } /* Container */ #container{ position: relative; width: 700px; margin-left: auto; margin-right: auto; margin-top: -10px; } #quickSummary { position: absolute; top: 320px; left: 44%; font-size: 10px; font-weight: bold; text-transform: uppercase; } /* Child Selector - compliant browser */ #intro>#pageHeader{ width: 700px; } #pageHeader{ background: url(head.jpg); width: 690px; height: 356px; } #pageHeader h1 span,#pageHeader h2 span,#quickSummary .p1 span{ display: none; } #preamble,#supportingText{ text-align: left; padding: 10px; } #preamble{ background: #ecca99; width: 408px; margin: -20px 0 0 214px; voice-family: "\"}\""; voice-family: inherit; width: 388px; } /* Child Selector - compliant browser */ #intro>#preamble{ margin: 0px 0 0 248px; } #supportingText{ background: #ecca99; width: 408px; margin: -10px 0 0 214px; voice-family: "\"}\""; voice-family: inherit; width: 388px; } /* Child Selector - compliant browser */ #container>#supportingText{ background: #ecca99; width: 388px; margin: -10px 0 0 248px; } #larchives li a, #lresources li a { display: inline; font-weight: normal; font-size: 9px; line-height: 15px; padding: 0; margin: 0; text-transform: uppercase; } /* Navigation rules */ #linkList{ position: absolute; top: 350px; /* bottom: 0;*/ left: 46px; font-size: 10px; background: #ecca99; width: 200px; background: #ecca99 url("bottom_linklist.gif") no-repeat left bottom; padding-bottom: 24px; } /* Child Selector - compliant browser */ #container>#linkList{ left: 41px; } #linkList ul{ text-align: left; list-style: url(list.png); } #linkList a{ text-decoration: none; } #linkList li { margin: 0 0 5px -10px; border-bottom: 1px solid #ebab6b; background: #ecca99; width: 150px; padding-bottom: 5px; } #lselect li a { text-transform: uppercase; font-size: 11px; } #lselect li a:hover{ color: #d07b00; } #lselect .c { text-transform: capitalize; font-size: 10px; } #lselect a { display: block; font-weight: bold; } #lselect a.c { display: inline; font-weight: bold; color: #B74213; } #larchives ul li,#lresources ul li{ border-bottom: none; } #larchives ul,#lresources ul{ list-style: url(star_blt.png); } #larchives ul li,#lresources ul li{ margin: 0 0 -5px -10px; } #larchives ul a,#lresources ul a{ color: #000; font-weight: bold; } h3.select{ color: #ecca99; background: url(bgh3sel.gif); height: 14px; text-align: left; padding: 5px; } h3.archives,h3.resources{ color: #ECCA99; background: url(bgh3.gif); height: 14px; text-align: left; padding: 5px; border-bottom: none; } /*Footer*/ #footer{ background: url(footer.gif); line-height: 45px; height: 45px; margin: 30px -10px -10px -10px; padding: 0 10px 0 0; font-weight: bold; text-align: right; } #footer a{ text-transform: uppercase; font-size: 9px; color: #EFECDE; text-decoration: none; } /* End code */ /* css Zen Garden submission 179 - 'Vin Rouge', by Thorsten Bopp, http://www.bopp-medien.de/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Thorsten Bopp */ /* Added: September 1st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* tested with IE5+/Win, Mozilla, IE5/Mac, Safari, Opera8/Win */ /* colors wine red: #9E2E2F dark brown: #541D1D light yellow:#F7F5D9 link: #EA907F */ body { background: #371212 url(background.gif) top repeat-x; font-family: Tahoma, Arial, Helvetica, sans-serif; color: #F7F5D9; font-size: 0.75em; line-height: 1.6em; padding: 0; margin: 0; text-align: center; } /* fonts ------------------------------------------------------------------------- */ a:link {color: #EA907F;text-decoration: none;} a:visited {color: #EA907F;text-decoration: none;} a:hover {color: #F7F5D9;text-decoration: underline;} p, h1, h2, h3 {margin: 0; padding: 0;} abbr, acronym { text-decoration: none; border-bottom: 1px dotted #F7F5D9; cursor: help; } /* container ------------------------------------------------------------------- */ div#container { background: #000000 url(background_header.gif) top center no-repeat; width: 760px; margin-left: auto; margin-right: auto; margin-top: 0; margin-bottom: -50px; padding: 0; text-align: left; } /* intro ------------------------------------------------------------------- */ div#intro { width: 580px; margin: 0; padding: 0; } div#pageHeader { display: none; } div#quickSummary { width: 260px; height: 20px; padding: 220px 0 0 0; margin: 0 0 30px 310px; color: #9E2E2F; } div#quickSummary p.p1 { display: none; } /* preamble ------------------------------------------------------------------- */ div#preamble { background: url(content_boxes_middle_preamble.gif) repeat-y; width: 375px; margin-left: 205px; } div#preamble h3 { background: url(headline_preamble.gif) top left no-repeat; height: 85px; } div#preamble h3 span { display: none; } div#preamble p { padding: 0 10px 10px 20px; } div#preamble p.p1 { margin-top: -25px; } div#preamble p.p3 { background: url(content_boxes_bottom_preamble.gif) bottom left no-repeat; padding-bottom: 65px; /* for IE5 */ margin-bottom: 0px; } /* supportingText ------------------------------------------------------------------- */ div#supportingText { width: 580px; margin: 0 0 50px 0; padding: 0; } div#explanation, div#participation, div#benefits, div#requirements { background: url(content_boxes_middle.gif) repeat-y; width: 550px; margin-left: 30px; } div#explanation p, div#participation p, div#benefits p, div#requirements p { padding: 0 10px 10px 20px; } div#explanation p.p1, div#participation p.p1, div#benefits p.p1, div#requirements p.p1 { margin-top: -25px; } div#explanation p.p2, div#participation p.p3, div#benefits p.p1, div#requirements p.p5 { background: url(content_boxes_bottom.gif) bottom left no-repeat; padding-bottom: 65px; /* for IE5 */ margin-bottom: 0px; } div#explanation h3 { background: url(headline_explanation.gif) top left no-repeat; } div#participation h3 { background: url(headline_participation.gif) top left no-repeat; } div#benefits h3 { background: url(headline_benefits.gif) top left no-repeat; } div#requirements h3 { background: url(headline_requirements.gif) top left no-repeat; } div#explanation h3, div#participation h3, div#benefits h3, div#requirements h3 { height: 85px; } div#explanation h3 span, div#participation h3 span, div#benefits h3 span, div#requirements h3 span { display: none; } /* footer ------------------------------------------------------------------- */ div#footer { width: 425px; height: 40px; margin-left: 155px; text-align: right; font-size: 0.9em; padding-top: 20px; } div#footer a:link {color: #9E2E2F;} div#footer a:visited {color: #9E2E2F;} div#footer a:hover {color: #F7F5D9;} /* linkList ------------------------------------------------------------------- */ div#linkList { position: absolute; left:auto; right:auto; top:290px; width: 155px; margin-left: 595px; padding: 0; font-size: 0.9em; line-height: 1.6em; color: #9E2E2F; } ul { list-style: none; background: url(marginal_boxes_bottom.gif) bottom left no-repeat; margin: 5px 0 0 0; padding: 0 0 45px 0; } li { margin-left: 0; padding: 0 10px 5px 15px; } div#lselect li { background: url(li_element.gif) bottom center no-repeat; padding: 0 10px 25px 15px; } div#lselect a { display: block; font-weight: bold; } div#lselect a.c { display: inline; font-weight: normal; } div#lselect, div#larchives, div#lresources { background: url(marginal_boxes_middle.gif) repeat-y; width: 155px; } div#lselect h3 { background: url(headline_select.gif) top left no-repeat; } div#larchives h3 { background: url(headline_archives.gif) top left no-repeat; } div#lresources h3 { background: url(headline_resources.gif) top left no-repeat; } div#lselect h3, div#larchives h3, div#lresources h3 { height: 35px; } div#lresources h3 span, div#lselect h3 span, div#larchives h3 span { display: none; } /* extraDivs ------------------------------------------------------------------- */ div#extraDiv1, div#extraDiv2, div#extraDiv3, div#extraDiv4, div#extraDiv5, div#extraDiv6 { display: none; }/* css Zen Garden submission 180 - 'Vertigo', by Antonio Cella, http://www.digitalink.it/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Antonio Cella */ /* Added: September 1st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* GENERAL STYLES */ body { margin: 0; padding: 0; background: url(bck.jpg) no-repeat top left; } h1, h2{ margin: 0; padding: 0; } h3 { margin: 3px 0 3px 0; padding: 0; font-size: 17px; font-weight: 500; background: none; } p { margin: 2px 0; } a:link { font-weight: bold; text-decoration: underline; color: #000; } a:visited { font-weight: bold; text-decoration: underline; color: #000; } a:hover, a:active { text-decoration: underline; font-weight: bold; text-decoration: underline; color: #333; background: #ccc; } ul { margin: 0; padding: 0; list-style: none; } /* MAIN DIV STYLES*/ #container { margin: 0 0 20px 0; padding:0; background: url(bck2.jpg) no-repeat 150px 0; } /* CLASS STYLES */ .p1 { text-indent: 33px; } .p5 { margin-top: 15px; width: 300px; text-align: left; } .select { margin: 3px 0 3px 0; padding: 0; font-size: 17px; font-weight: 500; background: none; } /* ID STYLES */ #intro { margin: 0; padding: 0; } #pageHeader { margin: 0; padding: 0; } #quickSummary { text-align: justify; padding: 100px 0 0 150px; width: 550px; font-family: "lucida grande", verdana, tahoma, arial; font-size: xx-small; voice-family: "\"}\""; voice-family:inherit; font-size: x-small; width: 400px; } html>#quickSummary { font-size: x-small; width: 400px; } #preamble { text-align: justify; padding: 10px 0 0 150px; width: 550px; font-family: "lucida grande", verdana, tahoma, arial; font-size: xx-small; voice-family: "\"}\""; voice-family:inherit; font-size: x-small; width: 400px; } html>#preable { font-size: x-small; width: 400px; } #preamble h3, #explanation h3, #participation h3, #benefits h3, #requirements h3 { margin: 8px 0 3px 0; padding: 3px 0 0 0; font-size: 17px; font-weight: 500; background: url(piuma.gif) no-repeat top left; text-indent: 33px; } #supportingText { text-align: justify; padding: 0 0 0 150px; width: 550px; font-family: "lucida grande", verdana, tahoma, arial; font-size: xx-small; voice-family: "\"}\""; voice-family:inherit; font-size: x-small; width: 400px; } html>#supportingText { font-size: x-small; width: 400px; } #linkList { top: 170px; margin-left: 588px; position: absolute; text-align: right; font-family: "lucida grande", verdana, tahoma, arial; font-size: xx-small; width: 198px; padding: 0 12px; voice-family: "\"}\""; voice-family:inherit; font-size: x-small; width: 174px; } html>#linkList { font-size: x-small; width: 174px; } #linkList a:link { font-weight: normal; text-decoration: none; color: #000; } #linkList a:visited { font-weight: normal; text-decoration: none; color: #000; } #linkList a:hover, #linkList a:active { font-weight: normal; text-decoration: none; color: #000; } #larchives, #lresources { margin-top: 10px; } #extraDiv1 { top: 0; left: 265px; background: url(title2.jpg) no-repeat top left; position: absolute; width: 143px; height: 100px; } #footer { text-align: center; margin-top: 20px; } #footer a:link { width: 40px; padding: 20px 15px 0 10px; font-weight: bold; text-decoration: none; color: #000; } #footer a:visited { width: 40px; padding: 20px 15px 0 10px; font-weight: bold; text-decoration: none; color: #000; } #footer a:hover, #footer a:active { width: 40px; padding: 20px 15px 2px 10px; font-weight: bold; text-decoration: none; color: #333; background: #fff url(svirgolata.gif) no-repeat -2px 10px ; } /* OTHER STYLES */ h1 span { margin: 0; padding: 0; display: none; } h2 span { margin: 0; padding: 0; display: none; } /* css Zen Garden submission 181 - 'Pretty in Pink', by Jordi Romkema, http://www.jor-on.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Jordi Romkema */ /* Added: September 1st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ html, body { background: url(images/bg.gif) left top repeat-y #F06; background-attachment: fixed; margin: 0; padding: 0; font-family: "Trebuchet MS", Tahoma, Lucida Sans, Arial, Verdana, Helvetica, sans-serif; } abbr, acronym { border-bottom: 1px dotted #FFE6F0; } div#pageHeader h1, div#pageHeader h2, div#linkList h3 { display: none; } div#container { display: block; } div#intro { display: block; } @media screen { div#pageHeader, div#quickSummary { position: fixed; } * html div#pageHeader, * html div#quickSummary { position: absolute; } } div#pageHeader { left: 0; top: 0; width: 200px; height: 320px; background: url(images/logo.gif) left top no-repeat; } div#quickSummary { left: 0; top: 250px; width: 185px; color: #FFE6F0; font-size: 12px; padding: 5px; padding-right: 10px; } div#quickSummary a { font-weight: bold; color: #FFE6F0; } div#quickSummary a:hover { color: #000; } div#preamble, div#supportingText { margin-left: 463px; padding: 10px; padding-left: 20px; padding-bottom: 0; } div#preamble h3, div#supportingText h3 { display: block; background: url(images/hbg.gif) left top repeat #000; margin: 0; padding: 0; padding-left: 20px; color: #FFF; font-size: 24px; line-height: 50px; text-transform: lowercase; } div#preamble p, div#supportingText p { font-size: 14px; color: #000; line-height: 1.5em; } div#preamble a, div#supportingText a { color: #000; } div#preamble a:hover, div#supportingText a:hover { color: #FFF; } div#preamble abbr, div#preamble acronym, div#supportingText abbr, div#supportingText acronym { border-bottom: 1px dotted #000; } div#footer { display: block; height: 20px; background: url(images/hbg.gif) left top repeat #000; padding: 3px; font-size: 12px; line-height: 20px; text-align: center; margin-bottom: 10px; } div#footer a { color: #FFF; font-weight: bold; } div#footer a:hover { color: #000; } div#linkList { position: absolute; left: 200px; top: 0px; width: 263px; font-family: Baskerville, Georgia, Garamond, Times New Roman, serif; } div#linkList ul { list-style: none; padding: 0; margin: 0; } div#linkList ul { list-style: none; } div#linkList ul li { border-bottom: 1px solid #CCC; } div#linkList ul li a { display: block; padding: 5px; padding-left: 20px; padding-right: 20px; font-weight: bold; font-size: 12px; color: #F06; text-transform: uppercase; text-decoration: none; } div#linkList ul li a:hover { background-color: #000; color: #FFF; } div#linkList div#lselect ul li { padding: 5px; padding-left: 20px; padding-right: 20px; font-size: 10px; } div#linkList div#lselect ul li a { padding: 0; font-size: 12px; } div#linkList div#lselect ul li a:hover { color: #000; background-color: #FFF; } div#linkList div#lselect ul li a.c { display: inline; text-transform: none; font-size: 10px; color: #000; } div#linkList div#lselect ul li a.c:hover { text-decoration: underline; } div#linkList div#lselect, div#linkList div#larchives, div#linkList div#lresources { display: block; margin-top: 10px; } div#linkList div#lselect h3, div#linkList div#larchives h3, div#linkList div#lresources h3 { display: block; height: 35px; width: 100%; margin: 0; padding: 0; } div#linkList div#lselect h3 span, div#linkList div#larchives h3 span, div#linkList div#lresources h3 span { display: none; } div#linkList div#lselect h3 { background: url(images/ll_selectadesign.gif) left top no-repeat; } div#linkList div#larchives h3 { background: url(images/ll_archives.gif) left top no-repeat; } div#linkList div#lresources h3 { background: url(images/ll_resources.gif) left top no-repeat; }/* css Zen Garden submission 182 - '45 RPM', by Thomas Michaud, http://www.ivfx.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Thomas Michaud */ /* Added: September 1st, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* --HTML and BODY Information-- */ html { margin: 0px; padding: 0px; } body { font-family: "Trebuchet MS", "Times New Roman", serif; font-size: 12px; color: #83986D; background: #E0E8B6 url(sidegraphic.gif) no-repeat fixed; margin: 0px; padding: 0px; line-height: 17px; font-weight: normal; } /* --Typography and Links-- */ p { text-align: justify; width: 380px; margin: 0px; } h1,h2,h3 { margin: 0px; } acronym { color: #706D32; font-weight: bold; font-style: oblique; border: 0px; } a:link { color: #83986d; text-decoration: none; font-weight: bold; } a:visited{ color: #83986d; text-decoration: none; } a:hover, a:active { color: #DB7762; border-bottom: 1px dotted #e6ad6c; } /*End Links*/ /* --Container-- */ #container { width: 560px; margin-left: 100px; padding-left: 5px; } #quickSummary{ padding: 0px 0px 0px 5px; margin: 0px 1px 10px 0px; background-image: url(bar.gif); background-repeat: no-repeat; width: 325px; height: 30px; } /* --Hide the Text for Logo-- */ #pageHeader h1 span, h2 span { display: none; } /* --Hide quicksummary Text-- */ #quickSummary .p1 span{ display: none; } #quickSummary .p2 { text-transform: uppercase; font-size: 12px; } #pageHeader { background-image: url(preamble.gif); background-repeat: no-repeat; height: 455px; width: 552px; margin: 0px; padding: 0px; } /* --Hide Header3 Text for image replacement-- */ #preamble h3 span { display: none; } #explanation h3 span { display: none; } #participation h3 span { display: none; } #benefits h3 span { display: none; } #requirements h3 span { display: none; } /* --Image Replacement for each h3 subject-- */ #preamble h3 { background-image: url(01.gif); background-repeat: no-repeat; background-position: left top; height: 60px; width: 400px; } #explanation h3 { background-image: url(02.gif); background-repeat: no-repeat; background-position: left top; height: 60px; width: 400px; } #participation h3 { background-image: url(03.gif); background-repeat: no-repeat; background-position: left top; height: 60px; width: 325px; } #benefits h3 { background-image: url(04.gif); background-repeat: no-repeat; background-position: left top; height: 60px; width: 325px; } #requirements h3 { background-image: url(05.gif); background-repeat: no-repeat; background-position: left top; height: 60px; width: 325px; } /* --Link Menu Position on Right-- */ #linkList { position: absolute; top: 300px; margin-left: 400px; width:240px; } #linkList a{ display: inline; } #linkList2 { font-size: 12px; padding: 10px; margin-top: 150px; width:240px; } #linkList h3.select { background: url(playlist.gif) no-repeat top left; margin: 0px 0px 5px 0px; width: 195px; height: 30px; } #linkList h3.select span { display:none } #linkList h3.archives { background: url(goldenoldies.gif) no-repeat top left; margin: 15px 0px 5px 0px; width: 195px; height: 30px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: url(resources.gif) no-repeat top left; margin: 15px 0px 5px 0px; width: 195px; height: 30px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; } #linkList li { line-height: 2ex; list-style-type: none; display: block; padding-top: 5px; margin-bottom: 5px; } #linkList li a:link { color: #83986D; } #linkList li a:hover { color: #706D32; } #linkList li a:visited { color: #B6BB68; } #linkList li a.c{ color: #DB7762; font-size: 12px; font-weight: normal; } /* --Footer Information to Close everything out-- */ #footer { background-image: url(footer.gif); background-repeat: no-repeat; background-position: left top; height: 100px; width: 400px; margin: 10px 35px 10px; text-align: center; } #footer a { cursor: help; font: 0.8em "Trebuchet MS", "Times New Roman", serif; text-transform: uppercase; color: #83986D; font-weight: bold; } #footer a:hover { color: #DB7762; border: 0px; font-weight: bold; } /* --Fini-- */ /* css Zen Garden submission 184 - 'Peace of Mind', by Carlos Varela, http://www.carlosvarela.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Carlos Varela */ /* Added: September 16th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ html { min-width:750px; } body { font:11px/32px Georgia, 'Times New Roman', Times, serif; color:#28780A; text-align:center; background:#fff url(bg.gif) repeat-x; margin:0; padding:0; } a,a:link,a:visited,a:active { text-decoration:none; color:#5EA936; text-transform:uppercase; font-weight:700; } a:hover { color:#ABD550; } acronym { cursor:help; border-bottom:1px dotted #5EA936; color:#ABD550; font-weight:600; letter-spacing:1px; text-transform:uppercase; } h1,h2,h3,ul ,li { margin:0; padding:0; } li { list-style:none; } p { line-height:1.5em; margin:0; padding:5px 0 0 12px; } #benefits h3 { background:url(benefits.gif) no-repeat; } #container { width:750px; height:1500px; background:url(girl.jpg) top right no-repeat; text-align:left; position:relative; margin:0 auto; padding:0; } #explanation h3 { background:url(sowhat.gif) no-repeat; } #explanation,#participation,#benefits { background:transparent url(bg_text.jpg) left bottom no-repeat; margin:0 0 50px 0; padding:0; } #footer { text-align:center; height:50px; background:url(footer_bg.png) top right no-repeat; margin:0; padding:0 0 0 15px; font-family: 'Times New Roman', Times, serif; letter-spacing: 1.5px; font-size: 12px; } #footer a { text-transform:uppercase; color:#96CB18 } #footer a:hover { color: #99CC00 } #intro { text-align:center; } #larchives h3 { background:url(archives.gif) no-repeat; } #linkList { position:absolute; width:255px; left:444px; top:581px; margin:0; padding:0; } #linkList ul { text-align:left; list-style:none; } #lresources h3 { background:url(resources.gif) no-repeat; } #lselect .c { text-transform:capitalize; font-size:10px; line-height:11px; } #lselect a { display:block; } #lselect a.c { display:inline; line-height:5px; margin:0; padding:0; } #lselect h3 { background:url(select.gif) no-repeat; } #lselect li a { text-transform:uppercase; font-size:11.5px; line-height:13px; font-weight:bold; background:url(bg_li.gif); margin:0; font-family:Georgia, 'Times New Roman', Times, serif; color: #96CB18 } #lselect li a:hover { color:#CEC81A; } #lselect li,#lresources li,#larchives li { background:url(bg_li.gif); margin:0 0 1px; padding:8px 0 0 10px; } #lselect,#larchives,#lresoucers { margin:0 0 50px; } #larchives li a, #lresources li a { text-transform: lowercase; font-size: 11px; font-family:Georgia, 'Times New Roman', Times, serif; color: #96CB18 } #pageHeader { position:absolute; height:300px; width:500px; background:transparent url(title.gif) top right no-repeat; left:0; top:16px; z-index:10; margin:0; padding:0; } #pageHeader span,#preamble h3 span,#explanation h3 span,#participation h3 span,#benefits h3 span,#requirements h3 span,#lselect h3 span,#larchives h3 span,#lresources h3 span,#extradiv3,#extraDiv4,#extraDiv5,#extraDiv6 { display:none; } #participation h3 { background:url(participation.gif) no-repeat; } #preamble { position:absolute; top:270px; left:12px; text-align:justify; width:390px; background:transparent url(bg_text.jpg) left bottom no-repeat; margin:0 0 50px; padding:0; height: 351px; } #preamble h3 { background:url(theroad.gif) no-repeat; } #preamble h3,#explanation h3,#participation h3,#benefits h3,#requirements h3,#lselect h3 ,#larchives h3,#lresources h3 { width:380px; height:60px; } #preamble p,#explanation p,#participation p,#benefits p,#requirements p { text-align:justify; font:12px/22px Georgia, 'Times New Roman', Times, serif; margin:0; padding:10px 0 0 35px; } #quickSummary { position:absolute; width:300px; height:250px; background:url(quicksummary_bg.gif) no-repeat; font-style:italic; font-size:12px; left:421px; top:325px; text-align:center; } #quickSummary .p1 { text-indent:-9999px; height:200px; display:none; margin:0; padding:0; } #quickSummary .p2 { background:transparent; font-style:normal; text-transform:uppercase; font-family:Arial, Helvetica, sans-serif; font-size:10px; margin:210px 0 0; padding:0; } #requirements { background:transparent url(bg_text.jpg) left bottom no-repeat; margin:0; padding:0; } #requirements .p5 { height:200px; background:url(flower.jpg) center no-repeat; text-align:center; margin:0; padding:135px 0 0; } #requirements h3 { background:url(requirements.gif) no-repeat; } #supportingText { position:absolute; width:390px; float:left; left:13px; top:641px; margin:0 70px 0 0; padding:0; } #extraDiv1 { position:absolute; background:url(leaves.jpg) no-repeat; height:242px; width:332px; left:666px; /* 6 6 6 the number of the div! */ top:1641px; } #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none } /* css Zen Garden submission 185 - 'Manhattan Edition', by TheOm3ga, http://www.theom3ga.tk/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, TheOm3ga */ /* Added: September 16th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ margin: 0; padding: 0; background-color: #0D0C0D; background-image:url(fondo.gif); background-repeat:repeat-x; background-position:7px 0; color: white; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 10px; } #container{ width:759px; margin: 0; padding: 0; } #pageHeader{ background-image: url(top.jpg); background-repeat: no-repeat; background-position: top left; width: 759px; height: 432px; margin: 0; padding: 0; } #quickSummary{ position: absolute; top: 437px; left: 565px; font-family: Tahoma, Arial, Helvetica, sans-serif; color: white; padding-bottom: 10px; background-image:url(panel_azul_bajo.gif); background-repeat:no-repeat; background-position:bottom; } #quickSummary p.p1{ background-image:url(panel_naranja_medio.gif); width: 161px; min-height: 86px; margin-bottom: 0px; padding-bottom: 0px; } #quickSummary p.p1 span{ background-image:url(panel_naranja_top.gif); background-position:top; background-repeat:no-repeat; } #quickSummary p.p1 span, #quickSummary p.p2 span{ margin: 0px; padding-left: 35px; padding-top: 9px; padding-right: 10px; display: block; } #quickSummary p.p2{ margin-top: 0px; padding-top: 0px; margin-bottom: 0px; padding-bottom: 0px; background-image:url(panel_azul_medio.gif); width: 161px; min-height: 39px; } #quickSummary p.p2 span{ padding-top: 24px; background-image:url(panel_naranja_bottom.gif); background-repeat:no-repeat; background-position:top; min-height: 24px; } #quickSummary a{ color: white; } #linkList{ position: absolute; left: 565px; /*top:600px;*/ /*top: 56.5em; /* top for fonts @ 10px */ top: 60.6em; /* top for fonts @ 11px */ float:right; width: 159px; background-image:url(panel3_top.gif); background-position:top; background-repeat: no-repeat; } #linkList2{ position:relative; top: 10px; background-image:url(panel3_med.gif); } #lresources{ background-image:url(panel3_bot.gif); background-repeat:no-repeat; background-position:bottom; } #linkList h3{ margin-top: 0; margin-left: 10px; margin-bottom: 0px; padding: 0; font-size: 12px; } #linkList a{ color: white; } #linkList acronym, #quickSummary acronym{ border-bottom-color: white; } #linkList ul{ margin-top: 3px; margin-left: 0px; padding-left: 25px; padding-bottom: 5px; background-image:url(divizor.gif); background-repeat:no-repeat; background-position:bottom center; } li{ margin-bottom: 5px; } #lresources ul{ background-image: none; } #footer{ width: 558px; text-align: center; margin-bottom: 30px; } #pageHeader h1{ display: none; } #pageHeader h2{ display: none; } #preamble h3{ background-image:url(theRoadTo.jpg); } #explanation h3{ background-image:url(soWhatIs.jpg); } #participation h3{ background-image:url(participation.jpg); } #benefits h3{ background-image:url(benefits.jpg); } #requirements h3{ background-image:url(requirements.jpg); } #preamble h3, #supportingText h3{ margin: 0; padding: 0; width: 558px; height: 38px; } #preamble h3 span, #supportingText h3 span{ display: none; } #preamble{ margin-top: 6px; } #preamble, #explanation, #participation, #benefits, #requirements{ position: relative; display: block; left: 4px; background-image: url(fondoParagraphBottom.gif); background-position:bottom; background-repeat:no-repeat; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #666666; width: 558px; padding-bottom: 29px; } #preamble p, #explanation p, #participation p, #benefits p, #requirements p{ margin-top: 0px; margin-bottom: 0px; padding-left: 26px; padding-right: 35px; padding-bottom: 10px; background-image:url(fondoParagraph1.gif); background-repeat:repeat-y; } a{ color: #666666; font-weight: bold; text-decoration: none; } a:hover{ text-decoration: underline; } acronym{ font-style:italic; border-bottom: 1px dotted #666666; } #benefits p{ padding-bottom: 0px; }/* css Zen Garden submission 186 - 'Floral Simplicity', by Mani Sheriar, http://www.manisheriar.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Mani Sheriar */ /* Added: November 10th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin:0; padding:0; } body { background:#cadeb9 url(zenGarden.gif) no-repeat top left; background-attachment:fixed; padding:14px 20px 0 73px; margin:0; } p { margin:12px 0; } #container { position:absolute; width:700px; margin:0; padding:0; background:transparent url(lines.gif) repeat-y top left; } #intro { position:relative; text-align:left; background:transparent url(pink.jpg) no-repeat top left; width:335px; font:normal 13px/18px arial; color:#333; padding:150px 75px 0 75px; } #pageHeader { display:none; } #quickSummary { } #quickSummary p.p1 { color:#7CAF6B; font-style:italic; font-size:14px; padding-top:0 !important; padding-top:12px; } #quickSummary p.p2 { padding-left:20px; background:transparent url(download.gif) no-repeat top left; color:#C99AAD; } #quickSummary p.p2 a { color:#C99AAD; } #quickSummary p.p2 a:hover { color:#fff; text-decoration:none; background-color:#E2C0CE; } #preamble { margin-top:24px; color:#999; } h3 span { display:none; } #preamble h3 { width:260px; height:16px; background:url(enlightenment.gif) no-repeat; } #supportingText { position:relative; font:normal 13px/18px arial; color:#999; width:335px; margin-left:75px; z-index:200; } #supportingText h3 { margin-top:24px; } #supportingText a { color:#98A892; } #supportingText a:hover { text-decoration:none; color:#fff; background-color:#ADC8A2; } #explanation h3 { width:202px; height:16px; background:url(about.gif) no-repeat; } #participation h3 { width:202px; height:16px; background:url(participation.gif) no-repeat; } #benefits h3 { width:202px; height:16px; background:url(benefits.gif) no-repeat; } #requirements h3 { width:230px; height:16px; background:url(requirements.gif) no-repeat; } #requirements { padding-bottom:1px; } #footer { position:absolute; background:url(footerBg.gif) no-repeat top center; width:485px; height:48px; margin-left:-150px; padding-left:150px; padding-top:27px; padding-bottom:0; margin-bottom:0; z-index:300; text-indent:-150px; text-align:center; font-size:11px; } #linkList { position:absolute; top:0; width:200px; left:500px; font:normal 11px/15px arial; color:#999; background:#fff url(lines2.gif) repeat-y top center; color:#666; float:left; } #linkList2 { background:transparent url(orange.jpg) no-repeat top left; padding:50px 25px 0 25px; width:150px; } h3.select { width:115px; height:18px; background:url(select.gif) no-repeat; } h3.archives { width:115px; height:18px; background:url(archives.gif) no-repeat; } h3.resources { width:115px; height:18px; background:url(resources.gif) no-repeat; } #linkList a { color:#98A892; } #linkList a:hover { color:#fff; background-color:#ADC8A2; text-decoration:none; } #lselect a { display:block; } #lselect a.c { display:inline; color:#999; } #lselect a.c:hover { color:#C99AAD; background:none; } ul { margin:4px 0 16px 18px; } li { margin:4px 0; list-style-image:url(bullet.gif); } #lresources { margin:0 -25px; padding:0 25px 15px 25px; background:url(linkListBottom.gif) no-repeat bottom center; } #lresources ul { margin-bottom:0; padding-bottom:14px; }/* css Zen Garden submission 187 - 'Wilderness', by Aadesh Mistry, http://www.idizyn.com/blog/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Aadesh Mistry */ /* Added: November 10th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /*------------------------------------------------------ G L O B A L E L E M E N T S ------------------------------------------------------*/ * { margin: 0; padding: 0; } body { margin: 0; padding: 0; background: url(background.gif); } a { color: #E0B53D; } a:hover { color: #FBBA04; } h1, h2, h3 span { display: none; } /*------------------------------------------------------ C O N T A I N E R ------------------------------------------------------*/ #container { position: relative; margin: 0 auto 0 auto; padding: 0 50px 0 50px; width: 640px !important; width /**/: 750px; background: url(background_container.gif) repeat-y; font-family: "Trebuchet MS", Arial, Verdana, sans-serif; font-size: .75em; color: #BBB5A2; } #pageHeader { width: 670px; height: 150px; background: url(page_header.jpg) no-repeat; } #intro { width: 460px; } #quickSummary { margin: -10px 0 0 30px; } #quickSummary .p1 { display: none; } #preamble { margin: 20px 0 30px 0; padding: 0 0 0 30px; width: 420px !important; width /**/: 460px; } #preamble h3{ margin: 0; padding: 0; width: 265px; height: 20px; background: url(h_preamble.gif) no-repeat; } #preamble .p1 { padding: 0; margin: 5px 0 0 0; } /*------------------------------------------------------ S U P P O R T I N G T E X T ------------------------------------------------------*/ #supportingText { width: 460px; } #supportingText { padding: 30px; padding-bottom: 0; width: 408px !important; width /**/: 468px; background: url(background_supportingtext.gif) repeat-y; /*background: url(i_supportingtext_header.gif) no-repeat;*/ color: #BDC1BC; } #explanation { margin: -30px -30px 0 -30px ; padding: 30px 30px 0 30px; background: url(i_supportingtext_header.gif) no-repeat; } #explanation h3 { width: 369px; height: 25px; background: url(h_sowhat.gif) no-repeat; } #participation h3 { width: 396px; height: 25px; background: url(h_participation.gif) no-repeat; } #benefits h3 { width: 396px; height: 25px; background: url(h_benefits.gif) no-repeat; } #requirements h3 { width: 396px; height: 25px; background: url(h_requirements.gif) no-repeat; } #explanation,#participation,#benefits,#requirements { margin-bottom: 30px; } .p1,.p2,.p3,.p4,.p5 { margin-top: 10px; } .p5 { padding: 10px; background: #0B1C07; } /*------------------------------------------------------ F O O T E R ------------------------------------------------------*/ #footer { margin: 0 -30px; padding: 40px 30px 10px 30px; height: 20px !important; height /**/: 70px; background: #000000 url(background_footer.gif) no-repeat; } #footer a{ color: #FFFFFF; } /*------------------------------------------------------ L E F T C O L U M N ------------------------------------------------------*/ #linkList { position: absolute; top: 160px; left: 530px; width: 177px; } #linkList2 { color: #C13003; } /*------------------------------------------------------ S E L E C T A D E S I G N ------------------------------------------------------*/ .select { margin-top: 20px; padding-bottom: 5px; width: 177px; height: 31px; background: url(h_selectadesign.gif) no-repeat; } #lselect ul { width: 150px; list-style-type: none; } #lselect ul li { width: 150px; padding: 5px 0 5px 25px; display: block; background: url(bullets.gif) 14px 7px no-repeat; border-bottom: 1px solid #311D00; } #lselect ul li a{ display: block; font-weight: bold; color: #D07B02; text-decoration: none; line-height: 12px; } #lselect ul li a:hover{ color: #FAA123; } #lselect ul li a.c { color: #C13003; display: inline; font-weight: bold; } #lselect ul li a.c:hover { color: #C13003; text-decoration: underline; } /*------------------------------------------------------ A R C H I V E S ------------------------------------------------------*/ .archives { margin-top: 20px; padding-bottom: 5px; width: 177px; height: 31px; background: url(h_archives.gif) no-repeat; } #larchives ul { width: 150px; list-style-type: none; } #larchives ul li { width: 150px; padding: 3px 0 3px 25px; border-bottom: 1px solid #311D00; } #larchives ul li a{ font-weight: bold; color: #D07B02; text-decoration: none; line-height: 12px; } #larchives ul li a:hover{ color: #FAA123; } /*------------------------------------------------------ R E S O U R C E S ------------------------------------------------------*/ .resources { margin-top: 20px; padding-bottom: 5px; width: 177px; height: 31px; background: url(h_resources.gif) no-repeat; } #lresources ul { width: 150px; list-style-type: none; } #lresources ul li { width: 150px; padding: 3px 0 3px 25px; background: url(bullets.gif) 14px 8px no-repeat; border-bottom: 1px solid #311D00; } #lresources ul li a{ font-weight: bold; color: #D07B02; text-decoration: none; line-height: 12px; } #lresources ul li a:hover{ color: #FAA123; } /* css Zen Garden submission 188 - 'Organica Creativa', by Eduardo Cesario, http://www.criaturacreativa.com.ar/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Eduardo Cesario */ /* Added: November 10th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css Zen Garden "Organica Creativa", by Eduardo Cesario, La Criatura Creativa. All images, photos and vector art present on this design, are copyrighted by Eduardo Cesario, La Criatura Creativa. To see more of my work, you can go to http://www.criaturacreativa.com.ar */ a:link { text-decoration: none; } #participation a:link { color: #FF0000; } #requirements a:link { color: #009999; } a:visited { text-decoration: none; color: #666666; } a:hover { text-decoration: underline; } a:active { text-decoration: none; } body { background-color: #99CC00; background-image: url("bg_body.gif"); background-repeat:no-repeat; margin: 0px; margin-left:122px; font-family: Tahoma, Arial, Verdana, sans-serif; font-size: 11px; line-height: 15px; color: #999999; font-weight: bold; } #container { position:absolute; margin-top:0px; width: 658px; background-image: url("bg_container.gif"); background-repeat: repeat-y; background-position:left; } #intro { margin-top: 250px; } #pageHeader h1 , #pageHeader h2 , #pageHeader span { display: none; height: 5px; background-color: #00CCCC; } #quickSummary { position: absolute; top: 1330px; left: 415px; width: 230px; height: 111px; background-image: url("sidebar_part_4.gif"); background-repeat: no-repeat; margin: 5px; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { margin: 10px; margin-top: 30px; color: #FF6600; } #quickSummary a { color: #CC0000; } #intro, #supportingText, #linkList { padding: 25px; width: 320px; } #intro h3 span, #supportingText h3 span { display: none; } #intro h3 { background: url("title1.jpg"); width: 313px; height: 75px; } p.p1 { color: #666666; } p.p1, p.p2, p.p3 { margin: 0px; padding: 0px; margin-top: 8px; } #explanation h3 { background: url("title2.jpg"); width: 313px; height: 75px; margin: 0px; padding: 0px; } #participation h3 { background: url("title3.jpg"); width: 313px; height: 75px; } #benefits h3 { background: url("title4.jpg"); width: 313px; height: 75px; } #requirements h3 { background: url("title5.jpg"); width: 313px; height: 75px; } #extraDiv1 { background-image: url("header.gif"); background-repeat: no-repeat; background-position:top; position: absolute; top: 0px; left: 122px; width: 658px; height: 259px; } #extraDiv2 { background: transparent url("photo_csspill.jpg") top left no-repeat; position: absolute; top: 191px; left: 485px; width: 295px; height: 339px; } #linkList { position: absolute; top: 530px; left: 363px; width: 295px; height: 755px; z-index: 1; } #linkList2 { margin-top: 70px; margin-left: 26px; } #lselect { width: 230px; height: 384px; background-image: url("sidebar_part_1.gif"); color:#CCCCCC; } #lselect h3 span, #larchives h3 span, #lresources h3 span { display: none; } #lselect h3, #larchives h3, #lresources h3 { width: 229px; height: 50px; } #lselect h3 { background: url("sidetitle_01.gif"); width: 229px; height: 40px; top: 0px; margin: 0px; padding: 0px; } #lselect ul, #larchives ul, #lresources ul { margin-top: 5px; } #lselect li { border-bottom: 1px dotted #FFFFFF; width: 170px; margin-bottom: 8px; list-style-position: outside; list-style-image: url("bullet_01.jpg"); } #lselect .c { text-transform: capitalize; } #lselect a { display: block; font-weight: bold; color:#FFFFFF; } #lselect a:hover { display: block; font-weight: bold; color: #3399FF; background-color:#FFFFFF; } #lselect a.c { color: #FFCC00; display: inline; font-weight: bold; } #lselect a.c:hover { color: #FFCC00; display: inline; font-weight: bold; background-color:#3399FF; } #larchives a, #lresources a { /*display: block;*/ font-weight: bold; color:#FFFFFF; } #larchives li, #lresources li { width: 170px; list-style-position: outside; } #lresources li { list-style-image: url("bullet_02.jpg"); } #larchives li { list-style-image: url("bullet_03.jpg"); } #larchives { width: 230px; height: 169px; background-image: url("sidebar_part_2.gif"); } #larchives h3 { background: url("sidetitle_02.gif"); width: 229px; height: 40px; top: 0px; margin: 0px; padding: 0px; } #lresources { width: 230px; height: 156px; background-image: url("sidebar_part_3.gif"); } #lresources h3 { background: url("sidetitle_03.gif"); width: 229px; height: 40px; top: 0px; margin: 0px; padding: 0px; } #requirements p.p5 { font-variant:small-caps; font-size: 9px; border-bottom: 2px dotted #FFCC00; text-align: center; width: 470px; } #footer { background: url("footer.jpg"); background-repeat:no-repeat; width: 470px; height: 46px; text-align:center; margin-top:10px; padding: 10px; } #footer a { color: #FF9900; } acronym { font-style:italic; }/* css Zen Garden submission 189 - 'Mozart', by Andrew Brundle, http://mr-thomas-dot-com.port5.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Andrew Brundle */ /* Added: November 10th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /*************** Main background, container & logo. *************************/ HTML{ margin: 0px; padding: 0px;} BODY{ margin: 0px; padding: 0px; background: #292421 url(bg-mozart.jpg) repeat-y fixed 50% 48%;} #container{ width: 703px; position: absolute; left: 50%; background: transparent url(bg-bio.gif) no-repeat 0px 50px; margin-left: -352px;} #pageHeader h1 span{ display: none;} #pageHeader h1{ width: 533px; height: 173px; margin: 0px 0px 0px 170px; background: url(logo.jpg);} #pageHeader h2{ display: none;} /*************** End background, container & logo. *************************/ /*************** Fonts and decoration. *************************/ P{ font: 9pt Times, "Times New Roman", Georgia, Verdana, serif; color: #cfb35b; text-align: left; text-indent: 10px; padding: 3px 5px 2px 5px; margin: 0px;} #preamble P.p3, #explanation P.p2, #participation P.p3, #benefits P.p1, #requirements P.p5{ padding-bottom: 5px; border-bottom: solid 1px #cfb35b;} /*************** End fonts and decoration. *************************/ /*************** Main links & acronym. *************************/ ACRONYM{ border: none;} A:link, A:visited{ color: #cfb35b;} A:hover, A:active{ color: #000; background: #cfb35b;} /*************** End main links. *************************/ /*************** Main content. *************************/ #preamble{ width: 360px; margin: 0px 0px 25px 172px; border-bottom: solid 1px #000; background: #000 url(border-1.gif);} #preamble h3 span{ display: none;} #preamble h3{ margin: 0px; height: 26px; background: url(preamble.gif);} #supportingText{ width: 365px; margin: 0px 0px 0px 170px; padding: 0px 0px 31px 0px; background: url(bottom.gif) no-repeat bottom;} #explanation, #participation, #benefits, #requirements{ width: 360px; margin: 0px 0px 25px 2px; border-bottom: solid 1px #000; background: #000 url(border-1.gif);} #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span{ display: none;} #explanation h3, #participation h3, #benefits h3, #requirements h3{ margin: 0px; height: 27px;} #explanation h3{ background: url(explanation.gif);} #participation h3{ background: url(participation.gif);} #benefits h3{ background: url(benefits.gif);} #requirements h3{ background: url(requirements.gif);} /*************** End main content. *************************/ /*************** Footer division. *************************/ #footer{ width: 360px; text-transform: uppercase; font-weight: bold; text-align: center; word-spacing: 2px; padding: 5px 0px 0px 0px; margin: -10px 0px 0px 2px; border-top: solid 1px #cfb35b; background: #000 url(border-1.gif);} html>body #footer{padding: 8px 0px 0px 0px;} #footer a:link, a:visited{ font-size: 11pt; text-decoration: none; color: #cfb35b; background: #000; border: solid 1px #292421;} #footer a:hover, a:active{ color: #cfb35b; background: #000;} /*************** End footer division. *************************/ /*************** Download sample CSS & HTML files. *************************/ #quickSummary{ width: 169px; position: absolute; left: 534px; top: 173px; padding: 5px 0px 50px 0px; background: #000 url(border-3.gif) repeat-y right;} #quickSummary p.p1{ display: none} #quickSummary p.p2{ text-align: center; text-indent: 0px; padding: 0px 0px 10px 0px; margin: 0px 13px 0px 10px; background: url(divider.gif) no-repeat center bottom;} #quickSummary p.p2 a:link, a:visited{ font-weight: bold; text-decoration: none;} #quickSummary p.p2 a:hover, a:active{ color: #000; background: #cfb35b;} #extraDiv1{ width: 167px; height: 1px; background: #cfb35b; position: absolute; top: 173px; left: 50%; margin-left: 182px;} /*************** End download sample CSS & HTML files. *************************/ /*************** Right column: navigation & graphics. *************************/ UL{ list-style-type: none; margin: 0px 3px 0px 0px; padding: 0px; border-top: double 3px #cfb35b; background: url(corners.gif) no-repeat center 3px;} html>body UL{background: url(corners.gif) no-repeat top;} li{ padding: 0px 0px 9px 0px; margin: 0px 10px 0px 10px; background: url(divider.gif) no-repeat center bottom;} html>body Li{padding: 5px 0px 9px 0px;} #linkList{ position: absolute; top:240px; left: 534px; margin: 0px; width: 169px; padding-bottom: 13px; background: #000 url(border-2.gif) no-repeat bottom;} #linkList2{ font-size: 9pt; color: #cfb35b; text-align: center; background: url(border-3.gif) repeat-y right;} #lselect, #larchives, #lresources{ padding: 0px 0px 20px 0px;} #lselect h3 span, #larchives h3 span, #lresources h3 span{ display: none;} #lselect h3, #larchives h3, #lresources h3{ height: 23px; margin: 0px;} #lselect h3{ background: url(select.gif) no-repeat left;} #larchives h3{ background: url(archives.gif) no-repeat left;} #lresources h3{ background: url(resources.gif) no-repeat left;} #linkList li a:link, a:visited{ font: 9pt "Times New Roman", Times, Georgia, Verdana, serif; color: #cfb35b; font-weight: bold; text-decoration: none; display: block;} #lselect li a.c{ font-weight: normal; display: inline;} #linkList li a:hover, a:active{ color: #000; background: #cfb35b;} /*************** End right column: navigation & graphics. *************************/ /* css Zen Garden submission 190 - 'Lonely Flower', by Mitja Ribic, http://mitja.impresija.com/mic/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2005, Mitja Ribic */ /* Added: November 10th, 2005 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ----- BASICS ELEMENTS ------------------------------------------------------------------------------------------------- */ body { font: Tahoma; color: #999999; background-color: #626262; margin: 0px; padding: 0px; text-align: center; } p { padding: 0px; font: 11px Tahoma; margin-top: 8px; margin-bottom: 15px; text-align: justify; } h1,h2,h3 { margin-top: 15px; padding: 0px; } h3 { font: bold 11pt Tahoma; margin-bottom: 0px; color: #6AA14E; padding-bottom: 0px; } #supportingText h3 span,#preamble h3 span { padding-bottom: 4px; background: url(flower3.gif) no-repeat 0 0; padding-left: 24px; } #linkList h3 span { padding-bottom: 4px; background: url(flower2.gif) no-repeat 0 30%; padding-left: 14px; } a:link { font-weight: bold; text-decoration: none; color: #7F7F7F; } a:visited { font-weight: bold; text-decoration: line-through; color: #7F7F7F; } a:hover, a:active { text-decoration: underline; color: #3C9A35; } acronym { font-weight: bold; border-bottom: 1px dotted #bbbbbb; } /* ----- LAYOUT ------------------------------------------------------------------------------------------------------ */ #container { background: url(bg_main.gif) repeat-y; width: 569px; margin-left: auto; margin-right: auto; margin-top: 0px; padding-top: 0px; text-align: left; position: relative; } #pageHeader { background: url(bg_header.jpg) no-repeat right top; width: 378px; height: 217px; float: left; } #quickSummary { background: url(bg_header2.jpg) no-repeat left top; width: 180px; height: 217px; float: right; } #preamble { margin-left: 31px; padding: 20px; padding-top: 1px; padding-bottom: 30px; width: 306px; clear: both; background: url(bg_divide.gif) no-repeat bottom; } #supportingText { margin-left: 31px; padding: 0px 20px; width: 306px; position: relative; } #preamble h3 { margin-top: 20px; } #linkList { width: 148px; font: 10px Tahoma; position: absolute; top: 217px; left: 389px; margin: 0px; padding: 0px; } #footer { text-align: center; font: bold 10px Tahoma; padding: 20px; text-transform: uppercase; margin-top: 20px; border-top: 1px dashed #dddddd; } /* ----- OTHER ------------------------------------------------------------------------------------------------- */ #lselect,#larchives,#lresources { padding: 0px 15px 45px 15px; margin: 0px; background: url(bg_divide1.gif) no-repeat bottom center; } #explanation,#participation,#benefits,#requirements { margin-top: 0px; padding-top: 0px; } #explanation h3 span { margin-top: 20px; } #linkList h3 { font-size: 11px; padding: 3px 3px 3px 1px; color: #E98523; margin-bottom: 10px; margin-top: 20px; } #lselect ul, #larchives ul, #lresources ul { list-style-type: none; padding: 0px 0px 0px 0px; margin: 0px; } #lselect li, #larchives li, #lresources li { padding: 5px 0px; background: url(bullet.gif) no-repeat 0 50%; } #lselect li a { display: block; } #lselect li a.c { display: inline; } #linkList #lselect ul li { border-bottom: 1px solid #EEEEEE; display: block; padding: 5px 0 5px 15px; } #linkList #larchives ul li { border-bottom: 1px solid #EEEEEE; display: block; padding: 5px 0 5px 15px; } #linkList #lresources ul li { border-bottom: 1px solid #EEEEEE; display: block; padding: 5px 0 5px 15px; } #pageHeader h1 span,#pageHeader h2 span,#quickSummary p.p1 { display: none; } #quickSummary p.p2 { text-align: left; color: #ffffff; font: 11px Tahoma; width: 120px; padding: 145px 0px 0px 15px; }/* css Zen Garden submission 191 - 'The Diary', by Alexander Shabuniewicz, http://eye.loveline.ru/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Alexander Shabuniewicz */ /* Added: February 15th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ font:11px/20px Georgia,"Times New Roman",Times,serif; color:#666; background:#00496C; margin:0; padding:0 } h1,h2,h3{ margin:0; padding:0 } a{ color:#191970 } a:hover{ color:#B22222 } a:visited{ color:#696969 } a acronym{ border:none } acronym{ cursor:help } /* main */ #container{ background:url("cover_bot.png") no-repeat left bottom; left:50%; position:absolute; width:770px; margin:10px 0 20px -385px; padding-bottom:120px } /* intro */ #intro{ padding:0 30px; background:url("cover.png") repeat-y; padding-bottom:1px } #pageHeader{ margin:0 -30px; background:url("cover_top.png") no-repeat } #pageHeader h1{ background:url("csszengarden.jpg") no-repeat; height:71px; width:268px; position:relative; top:50px; left:71px } #pageHeader h1 span{ display:none } #pageHeader h2{ background:url("thebeauty.jpg") no-repeat; height:20px; width:299px; position:relative; top:55px; left:57px } #pageHeader h2 span{ display:none } #quickSummary{ position:absolute; top:41px; padding:0 0 0 380px } #quickSummary .p1{ margin:10px 81px 0 0; font-size:120% } #quickSummary .p2{ margin:0; background:url("bookmark.jpg") no-repeat; position:absolute; top:-25px; left:620px; width:81px; height:131px } #quickSummary .p2 span{ display:block; padding:20px 10px; color:#fff; font:11px/18px "Trebuchet MS",Arial,Helvetica,sans-serif } #quickSummary .p2 a{ color:#fff } #quickSummary .p2 a:hover{ text-decoration:none; color:#ccc } #preamble{ padding-top:120px; background:url("img_1.jpg") 10px 170px no-repeat; height:1% } #preamble h3{ background:url("roadto.png") no-repeat; position:relative; left:120px; height:44px; width:212px } #preamble h3 span{ display:none } #preamble p{ text-align:left; margin-top:-44px; font-style:italic; padding:0 10px 35px 380px } /* main content */ #supportingText{ background:url("cover.png") repeat-y; padding:0 30px } #explanation{ height:1%; background:url("img_2.jpg") 370px 50% no-repeat } #explanation h3{ background:url("sowhat.png") no-repeat; position:relative; left:380px; height:45px; width:176px } #explanation h3 span{ display:none } #explanation p{ text-align:right; margin-top:-45px; font-style:italic; padding:0 380px 35px 10px } #participation{ height:1%; background:url("img_3.jpg") 5px 50% no-repeat } #participation h3{ background:url("participation.png") no-repeat; position:relative; left:180px; height:45px; width:157px } #participation h3 span{ display:none } #participation p{ text-align:left; margin-top:-45px; font-style:italic; padding:0 10px 35px 380px } #benefits{ background:url("img_4.png") 380px 50% no-repeat } #benefits h3{ background:url("benefits.png") no-repeat; position:relative; left:380px; height:47px; width:150px } #benefits h3 span{ display:none } #benefits p{ text-align:right; margin-top:-47px; font-style:italic; padding:0 380px 35px 10px } #requirements h3{ background:url("requirements.png") no-repeat; position:relative; left:180px; height:46px; width:150px } #requirements h3 span{ display:none } #requirements p{ text-align:left; margin-top:-46px; font-style:italic; padding:0 10px 35px 380px } #footer{ padding-left:380px; text-align:center } #footer a{ color:#666; text-decoration:none; border:1px solid #fffcf1; padding:5px } #footer a:hover{ border:1px solid #ccc } /* notes */ #linkList{ font-size:120%; font-style:italic; position:absolute; width:300px; bottom:70px; left:80px } #linkList h3.select{ width:142px; height:29px; background:url("select.png") no-repeat; position:relative; left:8px; top:8px } #linkList h3.select span{ display:none } #linkList h3.archives{ width:74px; height:25px; background:url("archives.png") no-repeat; position:relative; left:8px } #linkList h3.archives span{ display:none } #linkList ul{ margin:10px 5px 10px 40px; padding:0 5px } #linkList ul li{ list-style-type:none; list-style-image:none } #lselect ul li{ list-style:outside url("bull.png") } #linkList ul li a{ text-decoration:none } #lresources{ font:16px/22px "Trebuchet MS",Arial,Helvetica,sans-serif; display:block; background:url("notes.jpg") no-repeat; padding:20px 15px; width:252px } #lresources ul{ margin:30px 20px 50px 25px } #lresources h3.resources{ width:85px; height:22px; background:url("resources.png") no-repeat } #lresources h3.resources span{ display:none } /* css Zen Garden submission 192 - 'LuGoZee', by Viallon Pierre-Antoine, http://www.accxs.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Viallon Pierre-Antoine */ /* Added: February 15th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* CSS Document */ #css-zen-garden{ font-family:Georgia, Garamond, serif; font-size:12px; color:#000001; background-color:#000000; background-image:url(mur_fond.jpg); background-position:top left; background-repeat:repeat-x; } #css-zen-garden H1 { margin:0px; } #css-zen-garden H1 SPAN { display:none; } #css-zen-garden H2 { margin:50px 0px 0px 0px; padding:25px 0px 0px 0px; height:75px; text-align:center; font-size:16px; } #css-zen-garden H3 { color:#4A0000; padding:30px 0px 0px 42px; margin:10px 0px 0px 0px; height:53px; font-size:16px; text-transform:uppercase; } #css-zen-garden H3:first-letter {font-size:2px;} #css-zen-garden P { margin:0px; } #css-zen-garden A { color:#960000; text-decoration:none; font-weight:bold; } #css-zen-garden A:HOVER { text-decoration:underline; } #css-zen-garden acronym { text-decoration:overline; color:#9A7339; } #container { position:absolute; top:0px; left:215px; width:600px; background:url(fond-centre.jpg); background-position:top left; background-repeat:repeat-y; z-index:10; } #intro { background:url(H1.jpg); background-position:top left; background-repeat:no-repeat; width:550px; border-top:1px solid black; margin:0px; } #quickSummary { width:350px; padding:0px 0px 0px 50px; text-align:center; margin-top:-25px; } #explanation, #benefits { padding:0px 0px 0px 15px; width:385px; margin-top:15px; } #preamble { padding:0px 0px 0px 15px; width:385px; margin:15px 0 0 15px; } #supportingText { padding:0px 15px 0px 15px; } #benefits, #participation { width:500px; padding:0px 0px 0px 15px; } #preamble H3 { background-image:url(T.gif); background-repeat:no-repeat; background-position:top left; } #explanation H3 { background-image:url(S.gif); background-repeat:no-repeat; background-position:top left; } #participation H3 { background-image:url(P.gif); background-repeat:no-repeat; background-position:top left; } #benefits H3 { background-image:url(B.gif); background-repeat:no-repeat; background-position:top left; } #linkList {position:absolute; top:0px; left:463px; z-index:15; background:url("menu_droite_fd_center.jpg") top left repeat-y; width:230px; font-family:"Courier New", Courier, serif; } #linkList H3 { margin:0px 0px 0px 10px; padding:0px; text-align:center; } #linkList .select { background:url(select_design.gif) top right no-repeat; width:100px; height:65px; margin-top:90px; } #linkList .archives { background:url(archives.gif) top center no-repeat; width:100px; height:65px; } #linkList .resources{ background:url(resources.gif) top center no-repeat; width:100px; height:40px; } #linkList H3 SPAN {display:none;} #linkList A { color:#9C5600; text-decoration:none;} #linkList A:HOVER { color:#FF8D00; } #linkList UL {margin:-5px 42px 0 25px; list-style-image:url(clou.gif); padding:0; } #linkList UL LI {margin:-5px 0 0 0; padding-top:0} #linkList2 { background:URL("menu_droite_fd_top.jpg") top left no-repeat; width:210px; border-top:1px solid black; margin:0 0px 0px 0px; color:#FFFFFF; } #lresources { background:URL("menu_droite_fd_bottom.jpg") bottom left no-repeat; margin:0 0 0 0; height:200px; } #requirements { background:url(author.jpg) bottom left no-repeat; width:420px; padding:0px 70px 125px 70px; margin:0px 0px 0px -15px; } #requirements H3 { background:url(R.gif) top left no-repeat; } #footer A{color:#D6AE73} #footer { margin-top:-100px; text-align:center; height:75px; } #extraDiv1 { background:url(bella.jpg) top left no-repeat; width:119px; height:600px; position:absolute; left:90px; top:0px; } #extraDiv2 { background:url(candel.jpg) top left no-repeat; width:126px; height:600px; position:absolute; top:0px; left:775px; z-index:2; }/* css Zen Garden submission 193 - 'Leggo My Ego', by Jon Tan, http://www.gr0w.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Jon Tan */ /* Added: February 15th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* css Zen Garden 'Leggo My Ego' By Jon Tan Knowledge is like Lego: Bits of data. Design is how you present the bits. Wisdom is understanding why. It's autumn in the Zen Garden. CSS is bedding in to the World Wide Web for the duration. Bits of data are falling through the community on the breeze. The debates still flow beneath the bridge that the ancients built between design and structure but as the sun rises, the message is clear: CSS is beautiful. I stand on the shoulders of those who came before. There are too many to list here but if you search for mezzoblue, stopdesign, tantek, zeldman, meyerweb, southcot, pwhitrow, joe clark, alistapart, carter and cone or css you will probabaly find most of them. Thank you to them all. */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* start the fun */ body { margin: 0 0 30px 0; padding:0; border:0; font: 80% tahoma,sans-serif; color: #7A745A; line-height:1.5em; background: #fff url(bg.gif) top center no-repeat; text-align:center; } /* layers */ #container{ position:relative; width:750px; margin: 270px auto 0 auto; background: url(bg_container.gif) bottom left no-repeat; } #supportingText{ margin: 0 0 0 405px; text-align:left; } #preamble{ position:absolute; top:120px; left:0; width:170px; text-align:left; } #linkList{ position:absolute; top:120px; left:205px; width:200px; text-align:left; } #footer{ height:3.5em; background: url(bg_p_p2.gif) right no-repeat; margin-top:2em; } /* display:none content */ #intro h2, #quickSummary p.p1{display:none;} /* headers and paragraphs */ h1, #explanation h3, #preamble h3, #supportingText h3, #linkList h3 {margin:0;text-indent: -9999px;} h1{ height:120px; background: url(bg_h1.gif) no-repeat; } h3 {font-size:150%} #explanation h3 {height:6em;background: url(bg_h3_ex.gif) no-repeat;} #preamble h3 {height:220px;background: url(bg_h3_preamble.gif) top no-repeat;} #participation h3 {height:30px;background: url(bg_h3_participation.gif) no-repeat;} #benefits h3 {height:30px;background: url(bg_h3_benefits.gif) no-repeat;} #requirements h3 {height:30px;background: url(bg_h3_requirements.gif) no-repeat;} h3.select {height:120px;background: url(bg_h3_select.gif) no-repeat;} h3.archives {height:30px;background: url(bg_h3_archives.gif) no-repeat;} h3.resources {height:30px;background: url(bg_h3_resources.gif) no-repeat;} p{ letter-spacing:+0.05em; word-spacing:0.1em; } #quickSummary p.p2 { float:right; width:70px; height:4em; margin:75px 0 0 0; padding-left:40px; text-align:right; font: 80% tahoma,sans-serif; line-height:1.1em; letter-spacing:0; word-spacing:0; background: url(bg_p_p2.gif) top left no-repeat; } #benefits p, #preamble p{ letter-spacing:0; font:italic 120% georgia,serif; } /* hyperlinks and lists*/ a{ color:#d25c3e; text-decoration:none; border-bottom:1px dotted #d25c3e; } a:hover{ color:#0cf; text-decoration:none; border-bottom:1px solid #ddd1a8; } /*So the IE audience sees somthing visual for acronyms */ acronym{cursor:help;border-bottom:1px dotted #ccc;} #lselect a{ font:normal 100% tahoma,sans-serif; text-transform:uppercase; display:block; text-decoration:none; background: #fff0f0; padding-left:0.25em; margin-left:-0.25em; border-bottom:0; } #lselect a:hover{ background:#f3efe0; } #lselect a.c{ font: italic 100% georgia,serif; text-transform:none; color:#d25c3e; display:inline; padding-left:0; margin-left:0; background:none; } #lselect a.c:hover{ color:#0cf; background:none; border-bottom:1px solid #ddd1a8; } #linkList ul{ list-style:none; padding:0; margin-right:40px; margin-left:0.5em; } #linkList ul li{ margin: 0.5em 0; padding: 0.3em 0; font: normal 90% tahoma,serif; }/* css Zen Garden submission 194 - 'Dark Rose', by Rose Fu, http://www.rosefu.net/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Rose Fu */ /* Added: February 15th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* ~~~ General Properties ~~~ */ * { padding: 0; margin: 0; } body { color: #64645A; background: #A09B7D url(bg.jpg) repeat; font: normal 70% Georgia, Palatino, Times, Times New Roman, serif; color: #666; } a:link { text-decoration: none; border-bottom: 1px solid #BEB9AA; color: #968C5A; } a:visited { text-decoration: none; border-bottom: 1px solid #BEB9AA; color: #B3AE94; } a:hover { text-decoration: none; border-bottom: 1px solid #AAA08C; color: #AA7846; } a:active { text-decoration: none; border-bottom: 1px solid #AAA08C; color: #8C7846; } /* ~~~ Text Properties ~~~ */ p { font: 100% Georgia, Palatino, Times, Times New Roman, serif; line-height: 17px; margin-top: 0px; text-align: justify; padding-left: 14px; padding-bottom: 10px; padding-right: 100px; } .p5 { padding-bottom: 40px; } h3 { text-indent: -1000em; } acronym { font-style: italic; border: 0px; cursor: help; } /* ~~~ Div Properties ~~~ */ #container { background: url(back.jpg) center center repeat-y; width: 750px; height: auto; margin-left: auto; margin-right: auto; } #intro { display: block; } #pageHeader { background: url(header.jpg) no-repeat; position: relative; width: 660px; height: 175px; top: 0px; left: 80px; text-indent: -1000em; } #quickSummary .p1 { background: url(summary.jpg) no-repeat; left: 80px; position: relative; width: 660px; height: 155px; text-indent: -1000em; } #quickSummary .p2 { background: url(download.jpg) top right no-repeat; font: 100% Georgia, Times, Times New Roman, serif; line-height: 20px; position: absolute; top: 1500px; display: block; width: 126px; height: 420px; z-index: 5; } #quickSummary .p2 span { display: block; position: relative; top: 80px; left: 90px; width: 100px; text-align: center; } #preamble { background: url(preamble.jpg) no-repeat; position: relative; top: -10px; left: 240px; width: 500px; height: 540px; } #supportingText { background: url(paper.jpg) repeat-y; display: block; position: relative; top: 0px; left: 92px; margin-top: -270px; width: 500px; height: auto; padding-left: 150px; } /* ~~~ Header Properties ~~~ */ #preamble h3 { background: url(preamble.gif) no-repeat; position: relative; width: 306px; height: 50px; top: 0px; left: 0px; } #explanation h3 { background: url(explanation.gif) no-repeat; position: relative; width: 250px; height: 50px; top: 0px; left: 0px; } #participation h3 { background: url(participation.gif) no-repeat; position: relative; width: 164px; height: 50px; top: 0px; left: 0px; } #benefits h3 { background: url(benefits.gif) no-repeat; position: relative; width: 100px; height: 50px; top: 0px; left: 0px; } #requirements h3 { background: url(requirements.gif) no-repeat; position: relative; width: 157px; height: 50px; top: 0px; left: 0px; } /* ~~~ List Properties ~~~ */ #linkList { position: absolute; top: 330px; } #linkList ul { margin-top: 35px; list-style-type: none; } #linkList ul li { list-style-image: url(button.gif); font-size: 90%; width: 120px; margin-left: 15px; margin-top: 5px; } #linkList ul li a { display: block; font-size: 110%; width: 120px; border: 0px; line-height: 15px; } #linkList ul li a:hover { text-decoration: underline; } #lselect { background: url(lselect.jpg) no-repeat; width: 210px; height: 540px; padding-left: 25px; position: relative; left: 30px; } #lselect h3.select { background: url(select.gif) no-repeat; display: block; width: 106px; height: 31px; position: relative; top: 25px; left: 15px; } #lselect li a.c { font: 100% Georgia, Times, Times New Roman, serif; text-transform: none; display: inline; color: #64645A; } #lselect ul li a:hover.c { color: #8C7846; text-decoration: underline; } #larchives { background: url(archives.jpg) no-repeat; width: 210px; height: 200px; position: relative; left: 30px; padding-left: 45px; padding-top: 35px; } #larchives ul li a { font: 110% Georgia, Times, Times New Roman, serif; line-height: 17px; } #larchives h3.archives { background: url(archives.gif) no-repeat; display: block; width: 145px; height: 145px; position: absolute; top: -100px; left: 20px; text-indent: -1000em; } #larchives h3.resources { background: url(resources.gif) no-repeat; display: block; width: 69px; height: 31px; position: relative; top: 25px; left: 30px; } #lresources { background: url(resources.jpg) no-repeat; width: 210px; height: 470px; position: relative; left: 30px; padding-left: 45px; } #lresources ul li a { font: 110% Georgia, Times, Times New Roman, serif; line-height: 17px; } #lresources h3.resources { background: url(resources.gif) no-repeat; display: block; width: 69px; height: 31px; position: relative; top: 25px; left: 30px; } /* ~~~ Misc Properties ~~~ */ #footer { display: block; background: url(footer.jpg) no-repeat; width: 400px; height: 45px; font: 11px Verdana, Tahoma, Arial, Helvetica, sans-serif; line-height: 45px; text-align: center; text-transform: uppercase; padding-bottom: 20px; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* css Zen Garden submission 195 - 'Dazzling Beauty', by Deny Sri Supriyono, http://blog.denysri.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Deny Sri Supriyono */ /* Added: February 15th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin: 0; padding: 0; } html { background: transparent url(htmlbg.jpg) repeat-x; } body { margin: 0; padding: 0; font: normal 0.7em/1.4em Tahoma, Verdana, Arial, Georgia, sans-serif; color: #7c7c7c; text-align: center; background: transparent url(bodybg.jpg) no-repeat center top; } #container { margin: 0px auto; padding: 0; width: 696px; border: none; text-align: left; background-image: url(footerbg.jpg); background-repeat: no-repeat; background-position: bottom; padding-bottom: 70px; } #pageHeader span, #quickSummary .p1, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #lselect h3 span, #larchives h3 span, #lresources h3 span, #extradiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none; } a, a:visited { text-decoration: none; color: #D7661C; border-bottom: 1px dotted #ccc; } a:hover { text-decoration: none; color: #94AB36; border-bottom: 1px solid #ccc; } acronym { text-decoration: none; color: #D7661C; border-bottom: 1px dotted #ccc; cursor: help; } p { margin-bottom: 10px; } #quickSummary .p2 { padding-top: 220px; margin-left: 430px; font: normal 0.9em/0.9em Arial, Tahoma, Georgia, sans-serif; letter-spacing: -1px; color: #C3A176; text-transform: uppercase; width: 220px; } #linkList{ position: absolute; left:auto; right:auto; top: 385px; margin-left: 410px; width: 196px; background-image: url(bgsidebar.jpg); background-repeat: no-repeat; background-position: left top; padding-left: 30px; } #linkList2{ padding: 0; margin: 0; background-image: url(extraflower.jpg); background-repeat: no-repeat; background-position: right bottom; padding-bottom: 250px; } #linkList ul { text-align: left; list-style: none; margin: 0; padding: 0; } #linkList ul li{ margin: 0; padding: 3px 0 3px 10px; border-bottom: 1px solid #ECEFD7; } #linkList ul li a, #linkList ul li a:visited { border-bottom: none; } #linkList ul li a:hover { color: #94AB36; } #lselect { font-size: 0.9em; } #lselect ul li { background: transparent url(ikonli.jpg) no-repeat 0% 25%; padding: 3px 0 3px 25px; } #lselect a { display: block; font-size: 1.1em; color: #789B51; } #lselect a.c { display:inline; line-height:5px; margin:0; padding:0; font: normal 1.0em/0.9em Verdana, Arial, Tahoma, sans-serif; color: #B9B9B9; letter-spacing: -1px; } #preamble, #explanation, #participation, #benefits, #requirements{ top: 150px; position: relative; left: 63px; color: #B0A77E; width: 340px; padding-bottom: 29px; text-align: justify; } #preamble h3 { background-image: url(theroadto.jpg); background-repeat: no-repeat; background-position: left; width: 340px; height: 38px; } #explanation h3 { background-image: url(sowhatgitulowh.jpg); background-repeat: no-repeat; background-position: left; width: 340px; height: 38px; } #participation h3 { background-image: url(participation.jpg); background-repeat: no-repeat; background-position: left; width: 340px; height: 38px; } #benefits h3 { background-image: url(benefits.jpg); background-repeat: no-repeat; background-position: left; width: 340px; height: 38px; } #requirements h3 { background-image: url(requirements.jpg); background-repeat: no-repeat; background-position: left; width: 340px; height: 38px; } #lselect, #larchives { margin-bottom: 20px; } #lselect h3 { background-image: url(selectadesign.jpg); background-repeat: no-repeat; background-position: left; width: 196px; height: 40px; } #larchives h3 { background-image: url(archives.jpg); background-repeat: no-repeat; background-position: left; width: 196px; height: 40px; } #lresources h3 { background-image: url(resources.jpg); background-repeat: no-repeat; background-position: left; width: 196px; height: 40px; } #footer{ text-align: left; padding-left: 63px; padding-top: 140px; } #footer a, #footer a:visited { padding: 5px; border: 1px solid #f4f4f4; background-color: #fff; } #footer a:hover { padding: 5px; border: 1px solid #993300; background-color: #D94904; color: #fff; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none }/* css Zen Garden submission 196 - 'Elegance in Simplicity', by Mani Sheriar, http://www.manisheriar.com/blog/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Mani Sheriar */ /* Added: December 1st, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin:0; padding:0; } body { background:#fff; padding:0 0 20px 0; } a { color:#8fb34f; font-weight:bold; text-decoration:none; } a:hover { border:1px solid #d7d6b7; border-right:none; border-left:none; } abbr, acronym { cursor:help; } #container { position:relative; width:781px; left:50%; margin-left:-390px; background:#fff url(bg.gif) repeat-y center; overflow:auto; z-index:100; } #container h3 span { display:none; } #intro { position:relative; padding-bottom:14px; height:auto !important; height:1%; } #pageHeader { position:relative; width:781px; height:245px; margin:0 auto; background:url(header.jpg) no-repeat right; } #pageHeader h1, #pageHeader h2 { display:none; } #quickSummary p.p1 { display:none; } #quickSummary p.p2 { font:normal 12px/12px Georgia,"Times New Roman",Times, serif; color:#a8a781; position:absolute; bottom:0px; left:58px; background:url(download.gif) no-repeat left center; text-indent:14px; } #quickSummary p.p2 a { display:inline; position:relative; } #preamble { width:440px; margin-left:42px; font:normal 12px/18px Georgia,"Times New Roman",Times, serif; font-style:italic; color:#a8a781; margin-top:19px; } #preamble h3 { width:302px; height:14px; background:url(enlightenment.gif); } #preamble p { margin:18px 0 18px 17px; letter-spacing:0.03em; text-align:justify; } #supportingText { width:430px; font:normal 11px/16px "Lucida Grande","Lucida Sans","Lucida Sans Unicode",Lucida,Arial,Helvetica,sans-serif; color:#a1a07b; margin:55px 0 0 59px; padding-bottom:26px !important; padding-bottom:0; text-align:justify; } #explanation h3 { width:424px; height:18px; background:url(about.gif); } #participation h3 { width:424px; height:22px; background:url(participation.gif); margin:25px 0 -5px 0; } #benefits h3 { width:424px; height:22px; background:url(benefits.gif); margin:25px 0 -5px 0; } #requirements h3 { width:424px; height:22px; background:url(requirements.gif); margin:25px 0 -5px 0; } #supportingText p { margin:16px 0; } #requirements { margin-bottom:37px; } #footer { display:inline; float:right; background:url(check.gif) no-repeat left center; padding-left:18px; margin-bottom:-26px; } #extraDiv1 { position:relative; left:50%; margin-left:-390px; background:url(bottom.gif); width:781px; height:42px; } #linkList { width:196px; position:absolute; top:284px; right:59px; } #linkList h3.select { width:196px; height:34px; background:url(select.gif); } #linkList h3.archives { width:196px; height:25px; background:url(archives.gif); } #linkList h3.resources { width:196px; height:12px; background:url(resources.gif); margin-top:30px; } #linkList ul { list-style-image:url(blt_sm.gif); margin:5px 0 20px 23px; font:normal 11px/16px "Lucida Grande","Lucida Sans","Lucida Sans Unicode",Lucida,Arial,Helvetica,sans-serif; color:#bcbb93; } #linkList ul li { margin-bottom:8px; } #linkList ul a { color:#a9a867; font-weight:normal; font-style:italic; font-size:12px; text-transform:lowercase; } #linkList ul a:hover { color:#b2d378; border:none; } #linkList #lselect ul { list-style-image:url(blt_lrg.gif); margin:5px 0 20px 23px; font:normal 11px/16px "Lucida Grande","Lucida Sans","Lucida Sans Unicode",Lucida,Arial,Helvetica,sans-serif; color:#bcbb93; } #linkList #lselect ul a { display:block; color:#a9a867; font-weight:normal; font-style:italic; font-size:12px; text-transform:none; line-height:14px; } #linkList #lselect ul a.c { display:inline; font-style:normal; font-size:11px; color:#bcbb93; letter-spacing:0; text-transform:lowercase; } #linkList #lselect ul a:hover { color:#b2d378; border:none; } #linkList #larchives ul, #linkList #lresources ul { margin:10px 0 20px 24px; } #extraDiv2 { width:49%; position:absolute; top:0; left:0; height:127px; background:url(topLeft_bg.gif) repeat-x; z-index:10; } #extraDiv3 { width:49%; position:absolute; top:0; right:0; height:141px; background:url(topRight_bg.gif) repeat-x; z-index:10; } /* css Zen Garden submission 197 - 'Floral Touch', by Jadas Jimmy, http://www.jahmasta.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Jadas Jimmy */ /* Added: December 4th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ body { font-family: Arial, Helvetica, sans-serif; font-size: 10px; color: #919191; background-image: url(back.gif); background-repeat: repeat; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } p { margin-top: 10px; text-align: justify; font-family: arial; font-size: 8pt; line-height: 10pt; } h3 { font: normal 12pt arial; letter-spacing: 1px; margin-bottom: 0px; color: #7D775C; } a:link { font-weight: bold; text-decoration: none; color: #74529A; } a:visited { font-weight: bold; text-decoration: none; color: #993399; } a:hover, a:active { text-decoration: underline; color: #74529A; } acronym { font-weight: bold; border-bottom: 1px dotted #DB008C; } /* specific divs */ #container { margin-top: 0px; margin-right: auto; margin-bottom: 0px; margin-left: auto; padding: 0px; width: 691px; text-align: left; position: relative; border-left: 1px solid #F1F1F1; border-right: 1px solid #F1F1F1; background-color: #ffffff; } #intro { min-width: 470px; background: url(header.png) no-repeat right top; } #pageHeader { width: 506px; height: 234px; float: left; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { margin-top: 10px; width: 219px; height: 87px; float: left; } #pageHeader h1 span { display:none } #pageHeader h2 span { display:none; } #quickSummary { background: url(down1.gif) no-repeat left top; margin-top: 165px; margin-right: 6px; width: 179px; height: 117px; float: right; } #preamble { margin-left: 10px; padding-top: 1px; padding-bottom: 30px; width: 460px; clear: both; padding-right: 0px; padding-left: 0px; } #supportingText { margin-left: 10px; padding: 0px 0px; width: 460px; position: relative; } #footer { text-align: center; font: bold 10px arial; padding: 0px; text-transform: uppercase; margin-top: 0px; width: 660px; margin-bottom: 0px; height: 20px; } #footer a:link, #footer a:visited { margin-right: 20px; margin-bottom: 30px; } #linkList { background-image: url(menuback.gif); width: 179px; font: 10px verdana #A50069; position: absolute; top: 293px; left: 506px; margin: 0px; padding-top: 0px; padding-right: 6px; padding-bottom: 0px; padding-left: 0px; background-repeat: repeat-y; } #linkList2 { font: 10px verdana; padding: 0px; margin-top: 0px; width: 179px; } #linkList h3.select { background: url(m1.gif) no-repeat top left; margin: 0px 0px 0px 0px; width: 179px; height: 41px; } #linkList h3.select span { display:none } #linkList h3.favorites span { display:none } #linkList h3.archives { background: url(m2.gif) no-repeat top left; margin: 0px 0px 0px 0px; width: 179px; height: 41px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: url(m3.gif) no-repeat top left; margin: 0px 0px 0px 0px; width: 179px; height: 41px; } #linkList h3.resources span { display:none } #lresources { background-image: url(mfoot.gif); background-repeat: no-repeat; width: 179px; height: 514px; background-position: 0px 200px; } #linkList ul { margin: 0px; padding: 0px; } #linkList li { border-bottom: 1px solid #F2E1EC; line-height: 15px; list-style-type: none; display: block; padding-left: 20px; padding-top: 0px; padding-bottom: 10px; margin-bottom: 5px; margin-top: 5px; background-image: url(picto.gif); background-repeat: no-repeat; background-position: 5px 0px; } #linkList li a:link { color: #999999; border-bottom: 1px dotted #DB008C; } #linkList li a:hover { color: #996699; } #linkList li a:visited { color: #919191; } -------------------------------------------- /* Modifications */ p.p2{ font: bold 11px verdana; text-align: center; color: #DB008C; padding: 30px 10px 0px 10px;} #quickSummary p.p2{ font: bold 11px verdana; text-align: center; color: #DB008C; padding: 30px 10px 0px 10px;} #pageHeader h1 span, #pageHeader h2 span, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #quickSummary p.p1 {display: none;} #preamble h3 { text-align: left; color: #919191; font: 11px Arial; width: 479px; height: 40px; padding: 0px 0px 0px 0px; background-image: url(t1.gif); background-repeat: no-repeat; background-position: 0px top; } #explanation h3 { text-align: left; color: #919191; font: 11px Arial; width: 479px; height: 40px; padding: 0px 0px 0px 0px; background-image: url(t2.gif); background-repeat: no-repeat; background-position: 0px top; } #participation h3 { text-align: left; color: #919191; font: 11px Arial; width: 479px; height: 40px; padding: 0px 0px 0px 0px; background-image: url(t3.gif); background-repeat: no-repeat; background-position: 0px top; } #benefits h3 { text-align: left; color: #919191; font: 11px Arial; width: 479px; height: 40px; padding: 0px 0px 0px 0px; background-image: url(t4.gif); background-repeat: no-repeat; background-position: 0px top; } #requirements h3 { text-align: left; color: #919191; font: 11px Arial; width: 479px; height: 40px; padding: 0px 0px 0px 0px; background-image: url(t5.gif); background-repeat: no-repeat; background-position: 0px top; } .p1 {padding: 0px 0px 0px 21px;} .p2 {padding: 0px 0px 0px 21px;} .p3 {padding: 0px 0px 0px 21px;} .p4 {padding: 0px 0px 0px 21px;} .p5 {padding: 0px 0px 0px 21px;} #requirements p.p5 span{ font: bold 15px arial; text-align: center; color: #DB008C; padding: 35px 0px 0px 0px; background-image: url(footer1.gif); background-repeat: no-repeat; background-position: 0px top; display: block; width: 691px; height: 50px; margin: 0px 0px 0px -30px; padding: 35px 0px 0px 0px; } /* css Zen Garden submission 198 - 'The Original', by Joachim Shotter, http://www.bluejam.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Joachim Shotter */ /* Added: December 4th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body { font: 12px Arial, Helvetica, sans-serif; color: #CCCCCC; background: #000000 url(background.jpg) no-repeat center bottom; margin: 0px; } p { width: 354px; padding-right: 25px; text-align: justify; color: #999999; margin-bottom: 10px; float: right; clear: both; margin-top: 0px; margin-right: 0px; margin-left: 0px; padding-top: 0px; padding-bottom: 0px; padding-left: 0px; } a, a:visited { background :url(a_link.jpg) left center; color: #FFFFFF; text-decoration: none; text-transform: uppercase; height: 15px; padding-right: 2px; padding-left: 2px; } acronym{ border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #FF0000; } #container { background: url(../zen-bg.jpg) no-repeat top left; width: 770px; margin-right: auto; margin-left: auto; margin-top: 0px; margin-bottom: 0px; } #pageHeader { background: url(css_zen.jpg) no-repeat; background-position: left bottom; display: block; height: 459px; width: 770px; margin: 0px; padding: 0px; } #pageHeader h1, #pageHeader h2 { margin: 0px; padding: 0px; } #pageHeader h1 span { display:none; } #pageHeader h2 span { display: none; } #quickSummary { top: 175px; width: 770px; position: absolute; font-size: 10px; } #quickSummary p { width: 376px; text-transform: uppercase; } #quickSummary .p2{ float: left; padding-left: 20px; position: absolute; top: 300px; } h3{ margin: 0px; padding-bottom: 10px; float: right; } h3 span{ display: none; } #preamble h3{ background: url(preamble.jpg) no-repeat; width: 434px; height: 155px; } #supportingText h3{ background: url(supportingText.jpg) no-repeat; width: 434px; height: 169px; } #participation h3{ background: url(participation.jpg) no-repeat; width: 434px; height: 129px; } #benefits h3{ background: url(benefits.jpg) no-repeat; width: 434px; height: 129px; } #requirements h3{ background: url(requirements.jpg) no-repeat; width: 434px; height: 129px; } #linkList { background: url(original.jpg) no-repeat; background-position: left bottom; color: #777777; position: absolute; top: 500px; width: 321px; padding-bottom: 431px; } #linkList2 { background: url(linkList.jpg) repeat-y; width: 100%; } #lselect ul{ list-style-type: none; margin: 0px; padding: 0px 0px 180px 100px; clear: both; } #lselect li { margin-bottom: 15px; width: 190px; } #lselect li a, #lselect li a:visited { color:#999999; background-image: none; font-size: 15px; font-weight: bold; display: block; margin: 0px; padding: 0px; } #lselect li a.c, #lselect li a.c:visited { display: inline; background-image: none; font-size: 10px; color: #CCCCCC; margin: 0px; padding: 0px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #FF0000; } #larchives li, #lresources li { margin-bottom: 5px; } #larchives ul, #lresources ul { list-style-type: none; margin: 0px; padding: 0px 0px 20px 115px; clear: both; } #larchives li a, #lresources li a{ font-size: 10px; text-transform: uppercase; background-image: none; color: #999999; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #FF0000; } #lselect li a:hover, #larchives li a:hover, #lresources li a:hover { color: #FFFFFF; } #linkList h3.select { background: url(selectAdesign.jpg); height: 90px; width: 100%; } #linkList h3.archives { background: url(archives.jpg); margin-top: 250px; height: 100px; width: 100%; } #linkList h3.resources { background: url(resources.jpg); height: 100px; width: 100%; } #footer { height: 80px; clear: both; padding-left: 305px; padding-top: 150px; font-size: 10px; } #footer a, #footer a:visited { color: #999999; background-image: none; } .p5{ width: 340px; float: right; position: relative; top: 150px; font-size: 10px; text-transform: uppercase; margin: 0px; padding: 0px; text-align: right; left: 90px; } /* a:hover, a:active {} #intro {} #linkList h3.select span {} #linkList h3.favorites {} #linkList h3.favorites span {} #linkList h3.archives span {} #linkList h3.resources span {} #lresources{} #extraDiv1 {} */ /* css Zen Garden submission 199 - 'Zen Army', by Carl Desmond, http://www.niceguy.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Carl Desmond */ /* Added: December 5th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ html { margin: 0px; padding: 0px; min-width:764px; background: url(topgrnd.jpg) repeat-x top; background-color:#E7D8AF; } body { font: 10pt/18pt "Trebuchet MS", Arial, Verdana, sans-serif; color: #000; margin: 0px; background: url(btmgrnd.jpg) no-repeat bottom left; height:2200px; width:764px; } p { font: 10pt/18pt "Trebuchet MS", Arial, Verdana, sans-serif; margin-top: 0px; text-align: left; } h3 { font: italic normal 12pt georgia; letter-spacing: 1px; margin-bottom: 0px; color: #7D775C; } a:link { font-weight: bold; text-decoration: none; color: red; } a:visited { font-weight: bold; text-decoration: none; color: red; } a:hover, a:active { text-decoration: underline; color: #3B6132; } #container { position:absolute; left:50%; width: 750px; margin-left: -380px; } #intro { min-width: 764px; } #pageHeader { margin-bottom: 20px; } #pageHeader h1 { background: transparent url(header.jpg) no-repeat top center; margin-top: 0px; width: 764px; height: 380px; } #pageHeader h1 span { display:none } #pageHeader h2 { } #pageHeader h2 span { display:none; } #quickSummary { position:absolute; top:365px; left:30px; } #quickSummary p.p1 span { display:none; } #preamble { position: absolute; top:400px; left:250px; } #preamble h3 { background:url(h1_road.gif) no-repeat; width:400px; height:43px; } #preamble h3 span{ display:none; } #explanation h3 { background:url(h1_sowhat.gif) no-repeat; width:400px; height:43px; } #explanation h3 span{ display:none; } #participation h3 { background:url(h1_participate.gif) no-repeat; width:400px; height:43px; } #participation h3 span{ display:none; } #benefits h3 { background:url(h1_benefit.gif) no-repeat; width:400px; height:43px; } #benefits h3 span{ display:none; } #requirements h3 { background:url(h1_requirements.gif) no-repeat; width:400px; height:43px; } #requirements h3 span{ display:none; } #supportingText { position: absolute; left:250px; top: 680px; padding-left: 0px; margin-bottom: 0px; } #linkList { position: absolute; top: 385px; } #linkList li{ text-align:left; padding-left: 45px; } #linkList2 { font: 10pt "Trebuchet MS", Arial, Verdana, sans-serif; line-height:12px; background-image:url(linklist_bk.gif); background-repeat:repeat-y; background-position:left; width: 222px; } #linkList h3.select { background: url(selectdesign.jpg) no-repeat top left; width: 222px; height: 169px; } #linkList h3.select span { display:none; } #linkList h3.favorites { } #linkList h3.favorites span { display:none } #linkList h3.archives { background: transparent url(archives.jpg) no-repeat top left; margin: 0px 0px 0px 0px; width:222px; height: 191px; } #linkList h3.archives span { display:none } #linkList h3.resources { background: transparent url(resources.jpg) no-repeat top left; width:222px; height: 202px; } #linkList h3.resources span { display:none } #linkList ul { margin: 0px; padding: 0px; padding-bottom:5px; } #linkList li { background: url(hrzline.gif) no-repeat top right; display: block; padding-top: 10px; } #linkList li a:link { color: red; } #linkList li a:visited { color: #3B6132; } #lresources { padding-bottom:10px; } #lselect li a { font-size: 12px; } #lselect li a:hover{ color: #3B6132; } #lselect .c { font-size: 10px; } #lselect a { display: block; font-weight: bold; } #lselect a.c { display: inline; color: #3B6132; } #footer { text-align: right; } #footer a:link, #footer a:visited { margin-right: 20px; }/* css Zen Garden submission 200 - 'Icicle Outback', by Timo Virtanen, http://www.timovirtanen.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Timo Virtanen */ /* Added: December 6th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ font-family:Arial, Helvetica, sans-serif; background:#2baffa url(pics/content_background.jpg) repeat-y top left; font-size:0.8em; color:#fff; font-weight:normal; margin:0; padding:0; } /*left column*/ #pageHeader{ position:absolute; top:0; left:0; background:#2baffa url(pics/header.jpg) no-repeat top left; height:467px; width:100%; } #quickSummary{ font-size:0.8em; overflow:hidden; position:absolute; left:590px; top:140px; height:140px; text-align:center; width:230px; z-index:3; } #quickSummary a{ text-transform:uppercase; } #preamble, #supportingText{ position:relative; text-align:justify; width:370px; top:302px; left:150px; z-index:4; } #preamble h3, #supportingText h3{ margin-top:40px; } * html #preamble{ top:302px; } #preamble h3 { background:transparent url(pics/header1.gif) no-repeat center top; height:55px; } #explanation h3 { background:transparent url(pics/header2.gif) no-repeat center top; height:55px; } #participation h3 { background:transparent url(pics/header3.gif) no-repeat center top; height:55px; } #benefits h3 { background:transparent url(pics/header4.gif) no-repeat center top; height:55px; } #requirements h3 { background:transparent url(pics/header5.gif) no-repeat center top; height:55px; } #supportingText{ width:370px; left:150px; margin-top:0; padding-bottom:40px; } * html #supportingText{ padding-bottom:240px; } #footer{ text-align:center; background:transparent url(pics/footer.jpg) no-repeat top center; height:55px; padding-top:10px; margin-top:40px; } #footer a{ border-bottom:none; } /*right column*/ #linkList{ position:absolute; top:251px; width:210px; text-align:center; left:602px; font-size:0.85em; background:transparent url(pics/right_list_bg.jpg) repeat-y top left; } #linkList h3{ padding:0; margin:0; } #lselect h3{ margin-bottom:14px; } #lselect a:link, #lselect a:visited{ text-transform:uppercase; display:block; font-weight:bold; color:#fff; border-bottom:none; } #lselect a:hover, #lselect a:active{ color:#a9e0ff; text-decoration:underline; } #lselect a:link.c, #lselect a:visited.c{ display:inline; text-transform:none; color:#a9e0ff; font-weight:normal; border-bottom:#a9e0ff dotted 1px; text-decoration:none; } #lselect a:hover.c, #lselect a:active.c{ color:#fff; border-bottom:#fff dotted 1px; } #lselect ul{ margin-top:-290px; } #lselect ul li + li{ background:transparent url(pics/list_background.jpg) no-repeat center top; padding-bottom:5px; padding-top:2px; } * html #lselect ul li{ background:transparent url(pics/list_background_ie.jpg) no-repeat center top; } #lselect ul li{ padding-bottom:5px; padding-top:2px; } #larchives ul li, #lresources ul li{ padding-bottom:0; padding-top:0; } #lselect ul{ background:transparent url(pics/design_bottom.jpg) no-repeat left bottom; padding-bottom:30px; padding-right:30px; width:215px; } #larchives ul{ background:transparent url(pics/archives_bottom.jpg) no-repeat left bottom; margin-top:-28px; padding-bottom:20px; padding-right:40px; width:205px; } * html #larchives ul{ padding-bottom:14px; } #lresources ul{ background:transparent url(pics/resources_bottom.jpg) no-repeat left bottom; padding-bottom:60px; margin-top:-28px; padding-right:40px; width:205px; } * html #lresources ul{ padding-bottom:57px; } #lselect h3 { background:transparent url(pics/design_header.jpg) no-repeat left top; height:378px; width:245px; } #larchives h3 { background:transparent url(pics/archives_header.jpg) no-repeat left top; height:90px; width:245px; } #lresources h3 { background:transparent url(pics/resources_header.jpg) no-repeat left top; height:90px; width:245px; } * html #larchives ul li, * html #lresources ul li{ background:none; } /* global typography */ a:link, a:visited{ color:#a9e0ff; text-decoration:none; border-bottom:#a9e0ff dotted 1px; } a:hover, a:active{ color:#fff; border-bottom:#fff dotted 1px; } abbr, acronym{ border-bottom:#fff dotted 1px; cursor:help; } /*lists*/ ul{ margin:0; padding:0; } ul li{ list-style:none; } /* hidden stuff */ #pageHeader h1,h2, h3 span, #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display:none; } /* css Zen Garden submission 201 - 'Lily Pond', by Rose Thorogood, http://tulips4rose.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Rose Thorogood */ /* Added: December 11th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* --- LAYOUT ---------------------------------- */ body { margin: 0px; padding: 0px; background: #421d42 url(images/bg.gif); color: #471c47; font-family: Verdana, Arial, sans-serif; font-size: 0.7em; } #container { width: 750px; height: 1335px; } #pageHeader { width: 250px; height: 625px; background: url('bg-pageHeader.gif') no-repeat; margin-top: 0px; margin-left: 0px; position: absolute; top: 350px; left: 250px; z-index: 0; } #quickSummary { margin-top: 0px; margin-left: 0px; position: relative; top: 350px; left: 250px; z-index: 1; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { width: 425px; margin-top: 0px; margin-left: 0px; position: absolute; top: -18px; left: -250px; z-index: 2; } #preamble { width: 500px; height: 350px; background: #471c47 url('bg-road.gif'); margin-top: 0px; position: absolute; top: 0px; } #explanation { width: 250px; height: 490px; background: #a690af url('bg-about.gif'); margin-top: 0px; margin-left: 0px; position: absolute; top: 0px; left: 500px; } #participation { width: 250px; height: 485px; background: #a690af url('bg-participation.gif'); margin-top: 0px; margin-left: 0px; position: absolute; top: 490px; left: 500px; } #benefits { width: 250px; height: 230px; background: #85a3c2 url('bg-benefits.gif'); margin-top: 0px; position: absolute; top: 350px; } #requirements { width: 250px; height: 755px; background: #85a3c2 url('bg-requirements.gif'); margin-top: 0px; position: absolute; top: 580px; } #footer { width: 500px; height: 20px; background: #336699 url('bg-footer.gif'); margin-top: 0px; margin-left: 0px; position: absolute; top: 1280px; left: 250px; } #linkList { width: 500px; height: 305px; background: #336699 url('bg-select.gif'); margin-top: 0px; margin-left: 0px; position: absolute; top: 975px; left: 250px; } #lselect { margin-bottom: 0px; margin-left: 0px; position: absolute; bottom: -5px; left: 10px; width: 300px; } #larchives { margin-top: 0px; margin-left: 0px; position: absolute; top: 30px; left: 290px; } #lresources { margin-top: 0px; margin-left: 0px; position: absolute; top: 180px; left: 290px; } /* --- FORMATTING HEADINGS --------------------- */ h1 span { display: none; } h2 span { display: none; } #explanation h3 { background-image: url('heading-about.gif'); width: 250px; height: 100px; } #explanation h3 span { display: none; } #participation h3 { background-image: url('heading-participation.gif'); width: 250px; height: 50px; } #participation h3 span { display: none; } #benefits h3 { background-image: url('heading-benefits.gif'); width: 250px; height: 60px; } #benefits h3 span { display: none; } #requirements h3 { background-image: url('heading-requirements.gif'); width: 250px; height: 50px; } #requirements h3 span { display: none; } #lselect h3 { display: none; } #larchives h3 { display: none; } #lresources h3 { display: none; } /* --- FORMATTING TEXT ------------------------- */ p { padding: 0 15px 0 15px; } #preamble p.p1 { margin-top: -20px; } #preamble p.p1, #preamble p.p2, #preamble p.p3 { color: #ffffff; font-size: 1.25em; font-style: italic; } #supportingText { background-color: #341256; } #quickSummary p.p1 { display: none; } #quickSummary p.p2 { color: #ffffff; font-weight: bold; text-align: right; padding: 0; } #benefits, #requirements { color: #072849; } #requirements p.p5 { margin-top: 0px; margin-left: 0px; position: absolute; top: 720px; left: 250px; width: 500px; height: 35px; font-size: .9em; background-color: #ffffff; color: #471c47; text-align: center; padding: 0; } #requirements p.p5 span { position: relative; top: 10px; } #footer { text-align: center; text-transform: uppercase; } acronym { font-weight: bold; border-bottom: 1px dotted #ffffff; } #quickSummary acronym { font-weight: bold; border-bottom: 1px dotted #339999; } /* --- FORMATTING NAVIGATION ------------------- */ a { color: #ffffff; text-decoration: none; } a:hover { color: #336699; text-decoration: underline; } #quickSummary a { color: #339999; text-decoration: none; } #quickSummary a:hover { color: #336699; text-decoration: underline; } #explanation a:hover, #participation a:hover { color: #770e77; } #requirements p.p5 a { color: #336699; font-weight: bold; text-decoration: none; } #requirements p.p5 a:hover { color: #339999; text-decoration: underline; } #footer a { font-weight: bold; } #linkList a, #footer a { color: #ffffff; text-decoration: none; } #linkList a:hover, #footer a:hover { background-color: #ffffff; color: #471c47; text-decoration: underline; } #lselect a { font-weight: bold; } #lselect a.c { font-weight: normal; } li { padding-bottom: 3px; list-style: none; } /* css Zen Garden submission 202 - 'Retro Theater', by Eric Rog, http://space-sheeps.info/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Eric Rog */ /* Added: December 12th, 2006 */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ a, a:visited { text-decoration:none; color:#ccc; position:relative; } a:hover { text-decoration:underline; } div, p, body, ul, li, h1, h2, h3 { display:block; margin:0; padding:0; border:none; } ul { list-style:none; } h1, h2, h3{ text-transform:uppercase; font-weight:normal; } acronym { border:none; } body { position:relative; background:#000 url('cote.png') repeat-y 50% 0%; text-align:center; z-index:1; } #container { position:relative; width:450px; margin:0 auto; padding:230px 0 350px 0; font-size:0.8em; font-family:arial, sans serif; background-color:#313131; color:#b9b9b9; text-align:left; background-image:url('ecran.gif'); z-index:3; } p { font-variant:small-caps; } #intro { text-align:center; } #pageHeader h1 span, #pageHeader h2 span { display:none; } #pageHeader h1 { width:450px; height:258px; background:url('titre.png') no-repeat 50% 0; } #pageHeader h2 { margin-top:-20px; width:450px; height:37px; background:url('sous-titre.png') no-repeat 90% 0; } #quickSummary { width:80%; margin:10em auto 0 auto; text-align:center; } #quickSummary p { display:inline; font-size:125%; line-height:80%; } #preamble h3 { margin-top:1.5em; font-size:80%; } #preamble p { width:80%; font-size:95%; line-height:90%; margin:0 auto; margin:0 auto; } #supportingText { float:left; padding:10em 0; } #supportingText { width:100%; margin-top:2em; } #explanation { float:left; width:60%; } #explanation h3 { font-size:125%; font-weight:bold; text-align:right; margin:0 5% 0 10%; margin-bottom:-1.1em; } #explanation p { line-height:4em; text-align:right; margin:0 5% 0 10%; font-variant:normal; text-transform:capitalize; padding-bottom:4em; } #participation { float:right; width:40%; } #participation h3 { font-size:125%; font-weight:bold; margin:0 10% 0 5%; } #participation p { line-height:2em; margin:0 10% 0 5%; font-weight:bold; font-variant:normal; text-transform:uppercase; } #benefits { float:left; clear:left; margin-top:10em; width:24%; } #benefits h3 { font-size:125%; font-weight:bold; margin:0 10% 0 5%; text-align:center; margin-bottom:1.2em; } #benefits p { line-height:2em; font-weight:bold; margin:0 20px 0 5%; font-variant:normal; text-transform:uppercase; text-align:center; } #requirements { float:right; margin:10em 0 0 0; width:72%; text-align:center; } #requirements h3 { font-size:125%; font-weight:bold; margin-bottom:1.2em; } #requirements p { line-height:2em; font-weight:bold; font-variant:normal; text-transform:uppercase; } #requirements .p1 { float:left; /*margin-top:-1em; line-height:4em;*/ width:20%; margin-right:3%; text-align:left; text-transform:none; } #requirements .p2 { float:left; width:36%; } #requirements .p3, #requirements .p4, #requirements .p5 { float:right; width:35%; text-align:right; margin-right:2%; } #linkList { clear:both; } #lselect h3, #larchives h3, #lresources h3 { padding-top:7em; font-size:125%; font-weight:bold; text-align:center; clear:both; } #lselect ul { margin:0; padding:0; } #lselect li { position:relative; width:90%; margin:.5em auto; padding:0; color:#313131; border-bottom:2px dashed #b9b9b9; } #lselect a { position:relative; top:5px; padding:0 4px 0 0; font-weight:bold; text-transform:uppercase; background:url('ecran.gif'); } #lselect a.c { position:absolute; right:-1px; padding:0 0 0 4px; } #larchives, #lresources { clear:both; } #larchives h3, #lresources h3 { padding-top:6em; font-size:125%; font-weight:bold; text-align:center; } #larchives ul, #lresources ul { margin:1em 0 0 0; width:100%; } #lresources ul { padding-bottom:200px; background:url('sponsorts.png') no-repeat 50% 100%; } #larchives li, #lresources li { text-align:center; } #larchives a, #lresources a { visibility:visible; font-weight:bold; text-transform:uppercase; } #footer { position:absolute; clear:both; bottom:300px; left:0; width:100%; text-align:center; } #extraDiv1 { position:fixed !important; position:absolute; top:0; left:0; width:100%; height:23.2% !important; height:102px; min-height:102px; max-height:230px; z-index:2; } #extraDiv1 span { display:block; position:absolute; bottom:-198px; left:0; width:100%; height:428px; background:url('haut1.png') no-repeat 50% 100%; } #extraDiv2 { position:fixed !important; position:absolute; top:0; left:0; width:100%; height:23.2% !important; height:102px; min-height:102px; max-height:230px; background:url('haut2.png') no-repeat 50% 100%; z-index:4; } #extraDiv3 { position:fixed !important; position:absolute; bottom:0; left:0; width:100%; height:30% !important; height:110px; min-height:110px; max-height:318px; background:url('bas.png') no-repeat 50% 0%; z-index:4; }/* css Zen Garden submission - 'Tiny Blue', by Timo Virtanen, http://www.timovirtanen.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Timo Virtanen */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ body{ text-align:center; margin:0; padding:0; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; font-size:0.75em; color:#fff; background:#fff url(pics/background.gif) repeat-y top center; } h1, h2, h3{ font-size:1.4em; text-align:center; margin:0; padding:0; } p{ margin:0.9em 0 0.9em 0; padding:0; line-height:1.2em; } #container{ width:396px; position:absolute; left:50%; margin-left:-198px; } * html #container{ /*IE FIX*/ margin-left:-197px; } #container h3{ padding:6px 0; background:url(pics/header_bg.gif) top left repeat; } #supportingText, #preamble, #linkList{ padding:0 30px; text-align:justify; } #preamble h3{ margin-top:1.4em; } ul{ padding:0; margin:0; } ul li{ list-style:none; padding-left:1em; border-bottom:1px #365779 solid; height:1.6em; } ul li a:link, ul li a:visited, ul li acronym{ color:#ffa94d; font-weight:normal; text-decoration:none; } ul li acronym{ border-bottom:1px dotted #ffa94d; } ul li a:hover, ul li a:active, ul li a:hover acronym{ color:#fff; text-decoration:underline; } ul li a.c:link, ul li a.c:visited{ color:#bcd0e5; font-style:italic; } ul li a.c:hover, ul li a.c:active{ color:#fff; } ul li:hover{ background:url(pics/list_over.gif) top left repeat-x; } acronym{ color:#bcd0e5; border-bottom:1px dotted #bcd0e5; cursor:help; } a:link, a:visited{ color:#fff; font-weight:bold; text-decoration:underline; } a:hover, a:active{ color:#bcd0e5; text-decoration:none; } #pageHeader{ width:396px; height:319px; background:url(pics/header.jpg) no-repeat top left; } #quickSummary{ margin:-0.9em 0 0 0; padding:0; } #quickSummary .p2{ padding:0; margin:0 0 0.9em 0; width:396px; height:25px; background:url(pics/download.gif) no-repeat top left; } #quickSummary .p2 span{ visibility:hidden; white-space:nowrap; } #quickSummary .p2 span a{ visibility:visible; text-indent:-9000px; display:block; margin-top:-1.1em; height:25px; float:left; width:198px; overflow:hidden; } #linkList{ background:#fff url(pics/background2.gif) repeat-y top center; padding-top:0.5em; } #lselect h3, #larchives h3, #lresources h3{ width:336px; height:21px; margin-top:1em; } #lselect h3{ background:url(pics/header_design.gif) no-repeat top left; } #larchives h3{ background:url(pics/header_archives.gif) no-repeat top left; } #lresources h3{ background:url(pics/header_resources.gif) no-repeat top left; } #lresources ul{ padding-bottom:8em; } #footer{ text-align:center; position:absolute; margin-top:43em; margin-left:-30px; padding:6px 0; padding-bottom:1em; width:396px; height:72px; text-transform:uppercase; background:url(pics/footer.gif) bottom left no-repeat; } #extraDiv1{ position:fixed; top:0; width:37px; height:433px; left:50%; margin-left:-235px; background:url(pics/the_beauty.gif) no-repeat top left; } * html #extraDiv1{ position:absolute; } /*hidden*/ #linkList h3 span, #pageHeader h1, #pageHeader h2, #quickSummary p.p1 span{ display:none; }/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* CSS Zen Garden Top Level Styles || William Duffy || www.wdart.co.uk || 01 March 2006 /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ body { color: #AB9F82; font: 9pt/13pt georgia, sans-serif; margin: 0px; padding: 0px; background: black url(images/background_body.jpg) no-repeat center top; } /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ acronym { border-bottom: 1px dotted #AB9F82; cursor: help; font-weight: bold; } /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Container Styles /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #container { margin: 0px auto 0px auto; position: relative; width: 750px; } /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* Intro Styles /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #intro #pageHeader { background: transparent url(images/background_pageheader.jpg) no-repeat 17px 22px; width: 464px; height: 446px; } #intro #pageHeader h1, #intro #pageHeader h2 { margin: 0px; } #intro #pageHeader h1 span, #intro #pageHeader h2 span { display: none; } #intro #quickSummary { background: transparent url(images/txt_quicksummary.gif) no-repeat left top; color: #D9D0B7; position: absolute; top: 186px; left: 336px; width: 172px; height: 160px; } #intro #quickSummary .p1 { display: none; } #intro #quickSummary .p2 { background: transparent url(images/bullet_download.gif) no-repeat 0px 4px; color: #E8D6A3; padding: 0px 0px 0px 12px; position: absolute; top: 1110px; left: 203px; z-index: 100; width: 150px; } #intro #quickSummary .p2 a {color: #DEC35A; text-decoration: underline;} #intro #quickSummary .p2 a:visited {color: #DEC35A;} #intro #quickSummary .p2 a:hover {color: #E8D6A3;} #intro #preamble { background: transparent url(images/breakrule.gif) no-repeat center bottom; padding: 25px 0px 37px 0px; width: 464px; } #intro #preamble .p1, #intro #preamble .p2, #intro #preamble .p3, #intro #preamble .p4, #intro #preamble .p5 { padding: 0px 0px 0px 49px; } #intro #preamble h3 { background: transparent url(images/txt_sowhatisthisabout.gif) no-repeat left top; height: 25px; margin: 0px 0px -9px 27px; } #intro #preamble h3 span { display: none; } /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* supportingText Styles /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #supportingText #explanation, #supportingText #participation, #supportingText #benefits, #supportingText #requirements { background: transparent url(images/breakrule.gif) no-repeat center bottom; padding: 25px 0px 37px 0px; width: 464px; } #supportingText .p1, #supportingText .p2, #supportingText .p3, #supportingText .p4, #supportingText .p5 { padding: 0px 0px 0px 49px; } #supportingText a {color: #D2C9BB;} #supportingText a:visited {color: #D2C9BB;} #supportingText a:hover {color: #D34E1A;} #supportingText h3 { height: 25px; margin: 0px 0px -9px 27px; } #supportingText h3 span { display: none; } #supportingText #explanation h3 {background: transparent url(images/txt_participation.gif) no-repeat left top;} #supportingText #participation h3 {background: transparent url(images/txt_benefits.gif) no-repeat left top;} #supportingText #benefits h3 {background: transparent url(images/txt_participation.gif) no-repeat left top;} #supportingText #requirements h3 {background: transparent url(images/txt_requirements.gif) no-repeat left top;} #supportingText #footer { background: transparent url(images/background_footer.jpg) no-repeat right bottom; height: 20px; padding: 152px 0px 0px 0px; text-align: right; } #supportingText #footer a {color: #CCAD50; font-weight: bold; text-decoration: none;} #supportingText #footer a:visited {color: #CCAD50;} #supportingText #footer a:hover {color: #D2C9BB;} /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* linkList Styles /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ #linkList { color: #E8D6A3; position: absolute; top: 75px; left: 516px; width: 205px; } #linkList a {color: #E8D6A3; text-decoration: none;} #linkList a:visited {color: #E8D6A3;} #linkList a:hover {color: #DEC35A; text-decoration: underline;} /* Begin lselect styles */ #linkList #lselect { font-style: italic; } #linkList #lselect h3 { background: transparent url(images/txt_designs.gif) no-repeat left top; margin: 0px 0px -17px 0px; width: 168px; height: 79px; } #linkList #lselect h3 span { display: none; } #linkList #lselect ul { list-style-type: none; margin: 0px 0px 0px 20px; padding: 0px; } #linkList #lselect ul li { background: transparent url(images/bullet_designs.gif) no-repeat left 4px; padding: 0px 0px 12px 14px; } #linkList #lselect a {display: block; font-style: normal; font-weight: bold;} #linkList #lselect a.c {display: inline; font-weight: normal;} /* End lselect styles */ /* Begin larchives styles */ #linkList #larchives h3 { background: transparent url(images/txt_archives.gif) no-repeat left top; margin: 0px 0px -17px 0px; width: 168px; height: 79px; } #linkList #larchives h3 span { display: none; } #linkList #larchives ul { list-style-type: none; margin: 0px 0px 0px 20px; padding: 0px; } #linkList #larchives ul li { background: transparent url(images/bullet_designs.gif) no-repeat left 4px; padding: 0px 0px 0px 14px; } /* End larchives styles */ /* Begin lresources styles */ #linkList #lresources { background: transparent url(images/background_lresources.jpg) no-repeat left top; padding: 117px 0px 0px 38px; position: absolute; top: 950px; left: -37px; width: 233px; height: 422px; } #linkList #lresources h3 { background: transparent url(images/txt_resources.gif) no-repeat left top; margin: 0px 0px -17px 0px; width: 168px; height: 79px; } #linkList #lresources h3 span { display: none; } #linkList #lresources ul { list-style-type: none; margin: 0px 0px 0px 20px; padding: 0px; } #linkList #lresources ul li { background: transparent url(images/bullet_resources.gif) no-repeat left 5px; padding: 0px 0px 0px 14px; } /* End lresources styles */ /* css Zen Garden submission - 'spring360', by Rene Hornig, http://www.medialab360.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Rene Hornig */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ * { margin: 0; padding: 0; } body { background: #DFDBD3 url(images/bg.gif) top left repeat-x; color: #4C4C4C; font-family: Verdana,Arial,Helvetica,sans-serif; } p { font-size: .8em; line-height: 2em; } h3 { font-size: .7em; font-weight: bold; line-height: 1.3em; padding-top: 2.5em; } acronym, abbr { background: transparent url(images/abbr.gif) bottom left repeat-x; border: 0 none; cursor: help; font-style: italic; } a:link, a:visited { background: #EBF3CE; color: #5D7403; text-decoration: none; } a:hover, a:active, a:focus { background: #B2CF42; color: #FFF; } #container { background: transparent url(images/contbg.gif) top left repeat-y; width: 700px; } #intro, #supportingText { padding: 0 69px 0 86px; width: 545px; } #intro { background: transparent url(images/logo.gif) top left no-repeat; padding-top: 230px; } #preamble h3, #preamble p, #supportingText h3, #supportingText p { padding-left: 10px; padding-right: 40px; } #preamble, #explanation, #participation, #benefits, #requirements { border-bottom: 1px solid #E4E1DB; padding-bottom: 20pt; } #pageHeader, #pageHeader h1, #pageHeader h2, #quickSummary .p1, #linkList2 h3 span { display: none; } #quickSummary .p2 { background: transparent url(images/nav_dl.gif) top left no-repeat; display: block; font-size: .6em; font-weight: bold; left: 661px; line-height: 1.4em; padding: 40px 40px 0 30px; position: absolute; top: 160px; width: 141px; z-index: 20; } #quickSummary .p2 a:link, #quickSummary .p2 a:visited { background: transparent; color: #E6E3DE; text-decoration: none; } #linkList { background: transparent url(images/navbg.gif) top left repeat-y; left: 661px; padding-top: 10em; position: absolute; top: 130px; width: 285px; z-index: 10; } #linkList2 { background: transparent url(images/navbtmbg.gif) bottom left no-repeat; font: .6em/1.4em verdana, sans-serif; padding-bottom: 160px; } #linkList2 h3 { background: transparent top left no-repeat; display: block; height: 26px; padding: 0 0 10px 0; width: 285px; } #linkList2 .select { background-image: url(images/nav_des.gif); } #linkList2 .archives { background-image: url(images/nav_arch.gif); } #linkList2 .resources { background-image: url(images/nav_res.gif); } #linkList2 ul { list-style-type: none; padding: 0 75px 25px 15px; } #linkList2 li { color: #E6E3DE; padding: 6px 10px; } #linkList2 a:link, #linkList2 a:visited { background: transparent; color: #4C4C4C; font-weight: bold; } #linkList2 a.c:link, #linkList2 a.c:visited { color: #E6E3DE; font-weight: normal; } #quickSummary .p2 a:hover, #quickSummary .p2 a:active, #quickSummary .p2 a:focus, #linkList2 a:hover, #linkList2 a:active, #linkList2 a:focus, #linkList2 a.c:hover, #linkList2 a.c:active, #linkList2 a.c:focus { background: #B2CF42; color: #FFF; text-decoration: none; } #lselect li { background: transparent url(images/navico.gif) 3pt 5pt no-repeat; border-bottom: 1px solid #CFCCC4; padding: 7px 10px 7px 25px; } #footer { font-size: .7em; line-height: 1.5em; padding-top: 10px; padding-bottom: 40px; text-align: center; } #footer a:link, #footer a:visited, #footer a:hover, #footer a:active, #footer a:focus { background: transparent; color: #857E70; }/* css Zen Garden submission - 'A Walk in the Garden', by Simon Van Hauwermeiren,, http://users.skynet.be/bk316398/temp.html */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Simon Van Hauwermeiren */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ html { background: url(02.gif); margin: 0; padding: 0; } body { margin: 0; padding: 0; } #container { background: url(08.jpg) no-repeat 270px 1335px; } p { font-family: Georgia, serif; font-size: 12px; color: #666; margin: 10px 15px 20px 10px; line-height: 16px; } acronym { color: #063; border-bottom: 1px dotted #063; cursor: help; } #pageHeader h1 { background: url(01.jpg) no-repeat left top; width: 750px; height: 404px; margin: 0; } #pageHeader h1 span, #pageHeader h2, #quickSummary p.p1 { display: none; } #preamble h3 { background: url(conh1.gif) no-repeat left top; width: 367px; height: 68px; margin: 0; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display: none; } #explanation h3 { background: url(conh2.gif) no-repeat left top; width: 367px; height: 68px; margin: 0; } #participation h3 { background: url(conh3.gif) no-repeat left top; width: 367px; height: 68px; margin: 0; } #benefits h3 { background: url(conh4.gif) no-repeat left top; width: 367px; height: 68px; margin: 0; } #requirements h3 { background: url(conh5.gif) no-repeat left top; width: 367px; height: 68px; margin: 0; } #participation a, #requirements a, #quickSummary a, #footer a { color: #063; text-decoration: underline; } #participation a:hover, #requirements a:hover, #quickSummary a:hover { text-decoration: none; } #footer a:hover { color: #FFF; text-decoration: none; background: #063; } #supportingText { width: 367px; text-align: justify; } #intro { width: 367px; text-align: justify; } #quickSummary p.p2 { background: url(05.gif) no-repeat right top; padding: 0 40px 0 0; margin: -20px 0 0 0; height: 50px; line-height: 42px; text-align: right; font-style: italic; } #linkList { position: absolute; top: 470px; left: 405px; font-family: Verdana, Arial, sans-serif; font-size: 10px; } #lselect ul { background: url(03.gif) no-repeat left top; height: 465px; width: 208px; margin: 0; padding: 0; } #lselect li { background: url(04.gif) no-repeat left top; height: 39px; width: 120px; list-style-type: none; padding: 5px 0 0 55px; } #larchives ul { background: url(06.gif) no-repeat left top; width: 208px; height: 113px; margin: 0; padding: 0; } #larchives li { list-style-type: square; padding: 7px 0 0 5px; margin: 0 0 0 35px; } #lresources ul { background: url(07.gif) no-repeat left top; width: 208px; height: 164px; margin: 0; padding: 0; } #lresources li { list-style-type: square; padding: 7px 0 0 5px; margin: 0 0 0 35px; } #lresources h3 { padding: 0; background: url(listh3.gif) no-repeat left bottom; width: 208px; height: 50px; margin: 0; } #lresources h3 span { display: none; } #larchives h3 { padding: 0; background: url(listh2.gif) no-repeat left bottom; width: 208px; height: 50px; margin: 0; } #larchives h3 span { display: none; } #lselect h3 { background: url(listh1.gif) no-repeat left bottom; width: 208px; height: 50px; margin: 0; } #lselect h3 span { display: none; } #lselect a.c { display: inline; color: #333; text-decoration: underline; font-size: 10px; } #lselect a.c:hover { color: #333; text-decoration: none; } #lselect a { font-family: Arial, Verdana, sans-serif; display: block; font-size: 12px; color: #063; text-decoration: underline; } #lselect a:hover, #lresources a:hover, #larchives a:hover { color: #633; text-decoration: none; } #lresources a, #larchives a { font-family: Arial, Verdana, sans-serif; font-size: 12px; color: #063; text-decoration: underline; } #footer { clear: both; width: 605px; border-top: 1px solid #666; font-family: Verdana, Arial, sans-serif; font-size: 14px; text-align: right; margin: 0 0 15px 0; }/* css Zen Garden submission - 'Kyoto Forest', by John Politowski, http://rpmdesignfactory.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2007, John Politowski */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* basic elements */ html { margin: 0; padding: 0; } body { font-family:Arial, Helvetica, sans-serif; line-height:18px; font-size:12px; color: #06185c; background: #e6fad6 url(body_bg.jpg) no-repeat top center; margin: 0; padding: 0; } body a:link, a:active, a:visited{ text-decoration:none; color:#720a0b; } body a:hover{ text-decoration:underline; } p{ margin: 10px; padding: 0; } h3 { display:none; } ul { list-style-type: none; padding-left: 0; margin-left: 0; } li { background: url(bullet.gif) left center no-repeat; padding-left: 7px; margin-bottom: 5px; } acronym { border-bottom: none; } /* content div's */ #container { margin: auto; width:892px; background:url(content_bg_top.jpg) no-repeat top center; position:relative; } #intro{ width:892px; height:451px; } #pageHeader { background:url(header_what_about.gif) no-repeat top center; height:34px; overflow:hidden; position:absolute; top:462px; left:205px; width:587px; } #pageHeader span{ display:none; } #quickSummary { display:none; } #preamble{ padding:240px 100px 0 205px; } #preamble p.p1{ margin-top: 20px; } #supportingText{ background-image:url(content_tile.jpg); height:100%; } #explanation { padding:50px 100px 30px 205px; background:url(content_bg_bottom.jpg) top no-repeat; height:100%; } #participation { margin:20px 100px 30px 205px; padding-top:40px; background: url(header_participation.gif) no-repeat top center; height:100%; } #benefits { margin:65px 100px 30px 205px; padding-top:40px; background: url(header_benefits.gif) no-repeat top center; height:100%; } #requirements{ margin:65px 100px 30px 205px; padding:40px 0 15px 0; background: url(header_requirements.gif) no-repeat top center; border-bottom:1px solid #720a0b; height:100%; } #footer{ padding:10px; text-align:center; } /* link list and extra div's */ #linkList { position:absolute; width:150px; top:603px; z-index:5; color: #666666; font-size:10px; left: 25px; height:550px; line-height:13px; } #linkList a:link, a:active, a:visited { color:#113c05; text-decoration:none; } #linkList a:hover{ text-decoration: underline; } #lselect{ background:url(header_select_design.gif) top left no-repeat; margin: 5px 0 0 0; padding: 20px 0 0 0; width:150px; } #larchives{ background:url(header_archives.gif) top left no-repeat; margin: 10px 0 0 0; padding: 30px 0 0 0; width:150px; } #lresources{ background:url(header_resources.gif) top left no-repeat; margin: 15px 0 0 0; padding: 30px 0 0 0; width:150px; }/* css Zen Garden submission - 'Sakura', by Tatsuya Uchida, http://www.re-bloom.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Tatsuya Uchida */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* /////////////// basic elements /////////////// */ body { margin:0; padding:0; font:75%/1.4 verdana,Helvetica,sans-serif; background-image:url(body_bg.gif); text-align:center; } h1,h2,h3 span { display:none; } h3 { height:39px; margin:0; padding:0; } p {margin:0;padding:0;} acronym { border:none; } a { color:#D9189F; background-color:#ffffff; text-decoration:underline; } a:hover, a:hover { color:#FC7AD5; background-color:#ffffff; } /* ////////////// layout ///////////////// */ #container { width:772px; margin:0 auto; padding:0 13px; position:relative; background:url(bg.gif) repeat-x #dfdfdf; border-left:1px solid #ffffff; border-right:1px solid #ffffff; color:#454545; text-align:left; } #pageHeader { width:772px; height:179px; background:url(top.jpg); } #quickSummary, #preamble, #explanation, #participation, #benefits, #requirements { width:546px; background-color:#ffffff; background-repeat:repeat-y; margin:0 0 2px 226px; color:#454545; display:block;padding:0; } #footer { width:539px; margin:5px 0 0 226px; text-align:right; padding:3px 14px 43px 0; } #linkList { position:absolute; top:179px; left:20px; width:207px; } #lselect, #larchives, #lresources { margin:0 0 2px 0; } #quickSummary p span, #explanation p span, #benefits p span { padding:0 15px 10px 77px; display:block; } #preamble p span, #participation p span, #requirements p span { padding:0 85px 10px 17px; display:block; } #requirements .p5 { padding:0 85px 10px 17px; } #requirements .p5 span { display:inline; padding:0; } #linkList li { list-style:none; padding:6px 0 10px 0; background:url(line.gif) bottom repeat-x; } #linkList li a { padding-left:7px; background:url(link.gif) left center no-repeat; text-decoration:none; } #linkList li a:hover { text-decoration:underline; } #quickSummary .p1 span { padding-top:14px; background:url(quicksummary_top.gif) top no-repeat; } #quickSummary .p2 span { padding-bottom:20px; background:url(right_bottom.gif) bottom no-repeat; } #lselect li a { display:block; font-weight:bold; background-position:0 0.6em; } #lselect .c { display:inline; color:#666666; padding:0; background:none; background-color:#ffffff; } #footer a{ text-decoration:none; color:#888888; background-color:#dfdfdf; border:1px solid #bdbdbd; padding:3px 3px; height:100%; } #footer a:hover{ background-color:#ebebeb; color:#777777; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6{display:none;} /* ///////////// background image ////////////// */ /* right image */ #quickSummary p, #explanation p , #benefits p { background:url(right_bg.gif) right repeat-y; } #lselect, #larchives, #lresources { background:url(left_bg.gif) repeat-y; } /* side image */ #quickSummary {background-image:url(img_quicksummary.jpg);background-position:left bottom;} #preamble {background-image:url(img_preamble.jpg);background-position:right bottom;} #explanation {background-image:url(img_explanation.jpg);background-position:left bottom;} #participation {background-image:url(img_participation.jpg);background-position:right bottom;} #benefits {background-image:url(img_benefits.jpg);background-position:left bottom;} #requirements {background-image:url(img_requirements.jpg);background-position:right bottom;} /* h3 image */ #preamble h3 {background:url(title_preamble.gif) no-repeat;} #explanation h3 {background:url(title_explanation.gif) no-repeat;} #participation h3 {background:url(title_participation.gif) no-repeat;} #benefits h3 {background:url(title_benefits.gif) no-repeat;} #requirements h3 {background:url(title_requirements.gif) no-repeat;} #lselect h3 {background:url(title_select.gif) no-repeat;} #larchives h3 {background:url(title_archives.gif) no-repeat;} #lresources h3 {background:url(title_resources.gif) no-repeat;} /* bottom image */ #preamble .p3 span, #explanation .p2 span, #participation .p3 span, #benefits .p1 span, #requirements .p5{ padding-bottom:20px; background:url(right_bottom.gif) bottom no-repeat; } #lselect ul, #larchives ul, #lresources ul{ margin:0; padding:0 25px 20px 17px; background:url(left_bottom.gif) bottom no-repeat; } /* css Zen Garden submission - 'CSS Co., Ltd.', by Benjamin Klemm, http://www.re-bloom.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2007, Benjamin Klemm */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ * { margin: 0; padding: 0; } body { background: #DADADA url(bg_body.gif) left top repeat-x; margin: 0 auto; font-family: Arial, Helvetica, sans-serif; } #container { margin: 0 auto; width: 776px; position: relative; background: transparent url(bg_container.gif) left top repeat-y; z-index: 1; margin-bottom: 50px; } /* Formatierung des Intro Blocks -----------------------------------------------------------------------*/ #intro { background: transparent url(bg_intro.jpg) right top no-repeat; position: relative; padding: 1px; } #pageHeader { display: inline; height: 0; left: -1000px; overflow: hidden; position: absolute; top: -1000px; width: 0; } #pageHeader h1{ font: bold 154%/25px Arial, Helvetica, sans-serif; } #pageHeader h2{ font: bold 90%/25px Arial, Helvetica, sans-serif; } #quickSummary { color: #000; font: normal 75%/18px Arial, Helvetica, sans-serif; right: 60px; position: absolute; top: 25px; } #quickSummary .p1 { display: inline; height: 0; left: -1000px; overflow: hidden; position: absolute; top: -1000px; width: 0; } #quickSummary a, #quickSummary a:link, #quickSummary a:visited { color: #F29E00; font-weight: bold; } #quickSummary a:hover, #quickSummary a:active, #quickSummary a:focus { text-decoration: none; } #preamble { background: transparent url(bg_preamble.jpg) right top no-repeat; color: #fff; font: normal 80%/18px Arial, Helvetica, sans-serif; padding: 80px 30px 15px 15px; margin-left: 210px; margin-top: 192px; height: 100%; } #preamble h3 { background: transparent url(hl_roadto.gif) left top no-repeat; height: 37px; margin: 0 0 10px 0; width: 508px; } #preamble acronym { border-bottom:1px dotted #F29E00; color: #F29E00; font-weight: normal; font-size: 85%; } #preamble p { padding-left: 30px; } /* Formatierung des Content Blocks (supportingText) -----------------------------------------------------------------------*/ #supportingText { color: #fff; margin-left: 210px; font: normal 80%/18px Arial, Helvetica, sans-serif; padding: 15px 35px 15px 15px; position: relative; height: 100%; } #supportingText acronym { border-bottom:1px dotted #F29E00; color: #F29E00; font-size: 85%; font-weight: normal; } #supportingText a, #supportingText a:link, #supportingText a:visited { color: #F29E00; font-weight: bold; text-decoration: underline; } #supportingText a:hover, #supportingText a:active, #supportingText a:focus { text-decoration: none } #supportingText p { padding-left: 30px; } #explanation { width: 250px; float: left; } #explanation h3 { background: transparent url(hl_sowhat.gif) left top no-repeat; height: 37px; margin: 0 0 10px 1px; width: 260px; } #explanation .p1 { background: transparent url(cont_img_01.jpg) 30px 0px no-repeat; padding-top: 130px; } #participation { margin-left: 265px; margin-top: -23px; width: 240px; } #participation h3 { background: transparent url(hl_participation.gif) left top no-repeat; height: 37px; margin: 23px 0 10px 1px; width: 247px; } #participation .p1 { background: transparent url(cont_img_02.jpg) 30px 0px no-repeat; padding-top: 130px; } #benefits h3 { background: transparent url(hl_benefits.gif) left top no-repeat; height: 37px; margin: 23px 0 10px 1px; width: 508px; } #requirements { margin-bottom: 50px; } #requirements h3 { background: transparent url(hl_requirements.gif) left top no-repeat; height: 37px; margin: 23px 0 10px 1px; width: 508px; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display: inline; height: 0; left: -1000px; overflow: hidden; position: absolute; top: -1000px; width: 0; } /* Die Linklisten -----------------------------------------------------------------------*/ #linkList { background: transparent url(bg_linkList.gif) 0px 2px repeat-y; color: #fff; font-weight: normal; padding: 15px 10px 0 0; position: absolute; top: 193px; width: 221px; } #linkList h3 { padding-left: 10px; } #linkList a, #linkList a:link, #linkList a:visited { color: #000; text-decoration: underline; } #linkList a:hover, #linkList a:active, #linkList a:focus { text-decoration: none; } #linkList ul li { font-size: 70%; list-style: square; } #lselect { background: transparent url(bg_lselect.gif) left bottom no-repeat; padding-bottom: 25px; } .select { background: transparent url(h1_lselect.gif) left top no-repeat; display: block; margin: 0 auto; height: 29px; width: 185px; } #lselect ul li a { display: block; font: bold 110%/19px Arial, Helvetica, sans-serif; } #lselect ul li a.c { color: #fff; display: inline; font: normal 90%/19px Arial, Helvetica, sans-serif; } #larchives { background: transparent url(bg_lselect.gif) left bottom no-repeat; padding: 15px 0 40px 0; } .archives { background: transparent url(h1_larchives.gif) left top no-repeat; display: block; margin: 0 auto; height: 29px; width: 185px; } #lresources { background: transparent url(bg_lresources.gif) left bottom no-repeat; padding-bottom: 30px; } .resources { background: transparent url(h1_lresources.gif) left top no-repeat; display: block; margin: 15px auto; height: 29px; width: 185px; } #larchives ul li a, #lresources ul li a { font-weight: bold; } #lresources ul li, #larchives ul li, #lselect ul li { margin: 14px 0 14px 35px; } .resources span, .archives span, .select span { display: inline; height: 0; left: -1000px; overflow: hidden; position: absolute; top: -1000px; width: 0; } /* Footer Formatierung -----------------------------------------------------------------------*/ #footer { background: transparent url(bg_footer.gif) left top no-repeat; bottom: -27px; left: 25px; height: 54px; line-height: 50px; position: absolute; width: 312px; padding-left: 37px; } #footer a, #footer a:link, #footer a:visited { color: #000; padding: 0 6px; } * html #footer { bottom: -28px; } /* css Zen Garden submission 210 - 'Oceanscape', by Justin Gray, http://www.pixel-house.com.au/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2007, Justin Gray */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /*------ basic elements -------------------------------------------------------------*/ body { font-family: Arial, Helvetica, sans-serif; background: #122981 url(gradient_bg.jpg) repeat-x; margin: 0px; } p { text-align: justify; color: #fff; font-size: 0.70em; line-height: 1.25em; } a:link, a:visited { text-decoration: underline; color: #a5bcff; } a:hover, a:active { text-decoration: none; color: #ff9600; } li { text-decoration: none; list-style-type: none; display: block; color: #fff; } /*------ specific divs --------------------------------------------------------------*/ #container { width: 536px; padding-left: 20px; padding-right: 20px; margin: 200px auto 0px auto; position: relative; z-index: 6; } #intro { width: 356px; float: left; } #pageHeader { margin-bottom: 20px; float: left; } /* using an image to replace text in an h1. This trick courtesy Douglas Bowman, http://www.stopdesign.com/articles/css/replace-text/ */ #pageHeader h1 { background: transparent url(h1.gif) no-repeat top left; width: 355px; height: 29px; float: left; margin: 0px; } #pageHeader h2 { background: transparent url(h2.gif) no-repeat top left; width: 167px; height: 12px; float: right; margin: 2px 0 0 0; } #quickSummary { background: transparent url(divider01.jpg) no-repeat; float: left; padding-top: 50px; } #quickSummary p.p1 { background: transparent url(summary.gif) no-repeat; width: 356px; height: 49px; margin: 0px 0px 6px 0px; } #quickSummary p.p1 span, #pageHeader h2 span, #pageHeader h1 span { display: none; } #quickSummary p.p2 { width: 355px; display: block; } /*-----------------------------------------------------------------------------------*/ #supportingText { width: 356px; float: left; } #supportingText h3, #intro h3 { letter-spacing: 1px; margin: 0px 0px 20px 0px; color: #7D775C; width: 355px; height: 18px; } #preamble, #explanation, #participation, #benefits, #requirements { padding-top: 60px; margin-top: 6px; float: left; } #preamble { background: transparent url(divider02.jpg) no-repeat; } #explanation { background: transparent url(divider03.jpg) no-repeat; } #participation { background: transparent url(divider04.jpg) no-repeat; } #benefits { background: transparent url(divider05.jpg) no-repeat; } #requirements { background: transparent url(divider06.jpg) no-repeat; } #linkList { width: 141px; position: absolute; top: 101px; left: 410px; margin: 0px; padding: 0px; } #linkList2 { font-size: 0.70em; background: transparent url(paper-bg.jpg) top left repeat-y; padding: 10px; width: 141px; } #linkList ul { margin: 0px; padding: 0px; } #linkList a.c { display: inline; color: #ff9600; text-decoration: none; font-weight: normal; text-transform: capitalize; } #linkList li a { color: #fff; text-decoration: none; } #linkList li a:hover { text-decoration: underline; } #lselect li { line-height: 16px; padding: 5px 0px; border-bottom: 1px solid #003d90; } #lselect li a { font-weight: bold; color: #fff; display: block; text-transform: uppercase; text-decoration: none; } #larchives li, #lresources li { line-height: 16px; padding: 1px 0px; color: #fff; } /*------ Image Replacement for headings----------------------------------------------*/ #linkList h3 { width: 141px; height: 20px; display: block; margin: 0px; } #preamble h3 { background: transparent url(h3_road.gif) no-repeat; } #explanation h3 { background: transparent url(h3_about.gif) no-repeat; } #participation h3 { background: transparent url(h3_participation.gif) no-repeat; } #benefits h3 { background: transparent url(h3_benefits.gif) no-repeat; } #requirements h3 { background: transparent url(h3_requirements.gif) no-repeat; } #linkList h3.select { background: transparent url(h3_select.gif) no-repeat; } #linkList h3.archives { margin-top: 22px; background: transparent url(h3_archives.gif) no-repeat; } #linkList h3.resources { margin-top: 22px; background: transparent url(h3_resources.gif) no-repeat; } #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span, #linkList h3.select span, #linkList h3.archives span, #linkList h3.resources span { display: none; } /*------ footer ---------------------------------------------------------------------*/ #footer { margin-top: 20px; margin-bottom: 25px; } #footer a:link, #footer a:visited { margin-right: 6px; color: #ff9600; } /*------ main images -----------------------------------------------------------------*/ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv3 span, #extraDiv4, #extraDiv5, #extraDiv6, #extraDiv6 span { position: absolute; } #extraDiv1 { background: url(clouds.jpg) repeat-x; top: 0px; right: 0px; width: 100%; height: 104px; } #extraDiv2 { background: url(water_edge.jpg) repeat-x; top: 104px; right: 0px; width: 100%; height: 75px; } #extraDiv3 { background: url(fish01.jpg) no-repeat right top; z-index: 3; top: 960px; right: 4%; width: 300px; height: 123px; } #extraDiv3 span { background: url(fish_bottom.gif) no-repeat; z-index: 3; top: 1000px; width: 224px; height: 108px; } #extraDiv4 { background: url(sunlight.jpg) no-repeat; z-index: 3; top: 0px; left: 0px; width: 472px; height: 481px; } #extraDiv5 { background: url(fish_top.gif) no-repeat; z-index: 7; top: 220px; left: 20px; width: 180px; height: 80px; } #extraDiv6 { z-index: 2; top: 125em; left: 0px; width: 100%; height: 426px; background: url(seafloor_bg.jpg) repeat-x left bottom; } #extraDiv6 span { z-index: 2; top: 0px; left: 0px; width: 633px; height: 426px; background: url(seafloor.jpg) no-repeat; } /* css Zen Garden submission 211 - 'Orchid Beauty', by Kevin Addison, http://www.kevinaddison.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2006, Kevin Addison */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* Orchid Beauty Style Sheet */ /* --------------------------*/ a:link { color: #6D2542; text-decoration: none; } a:visited { color: #999999; text-decoration: none; } a:hover { color: #999999; text-decoration: underline; } a:active { color: #999999; text-decoration: none; } body { margin:0 0 0 0; padding:0 0 0 0; } #container { width:630px; margin: auto; padding: 0 0 100px 0; background-image:url(rounded.jpg); background-repeat: no-repeat; background-position:bottom; border:0px dotted #999999; position:relative; } #pageHeader { background: transparent url(header.jpg) no-repeat center top; border:0px dotted #999999; width:630px; height:387px; } #intro { width:400px; margin:0 0 0 0; border:0px dotted #999999; } #quickSummary .p2 { border:0px solid #000000; margin:-110px 0 95px 288px; padding: 0 0 0 15px; text-transform: uppercase; width:290px; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:10px; font-weight:normal; color:#999999; background: transparent url(bullet.jpg) no-repeat 0% 28%; } #supportingText { width:350px; margin:0 0 0 0; } #preamble, #explanation, #participation, #benefits, #requirements { border-bottom:0px dotted #999999; position:relative; width:350px; margin:0 0 0 60px; } #requirements { margin-bottom:35px; } #preamble h3 { background-image: url(title01.jpg); background-repeat: no-repeat; background-position: left top; width:286px; height:64px; margin-bottom:-5px; } #explanation h3 { background-image: url(title02.jpg); background-repeat: no-repeat; background-position: left top; width:286px; height:66px; margin-bottom:-5px; } #participation h3 { background-image: url(title03.jpg); background-repeat: no-repeat; background-position: left top; width:286px; height:66px; margin-bottom:-5px; } #benefits h3 { background-image: url(title04.jpg); background-repeat: no-repeat; background-position: left top; width:286px; height:66px; margin-bottom:-5px; } #requirements h3 { background-image: url(title05.jpg); background-repeat: no-repeat; background-position: left top; width:286px; height:66px; margin-bottom:-5px; } #pageHeader h1, #pageHeader h2, #quickSummary .p1, #preamble h3 span, #explanation h3 span, #participation h3 span, #benefits h3 span, #requirements h3 span { display:none; } p { color: #999999; font-size:11px; font-weight:normal; line-height:1.4em; font-family: Geneva, Arial, Helvetica, sans-serif; } #linkList { position: absolute; left:160px; right:auto; top: 400px; padding:0 0 0 0; margin-left: 270px; width: 180px; border:0px dotted #666666; background: transparent url(orchid.jpg) no-repeat bottom; height:810px; } #linkList ul { text-align: left; list-style: none; margin: 0 0 0 0; padding:0 0 15px 35px; font-size:10px; font-family:Geneva, Arial, Helvetica, sans-serif; border:0px dotted #666666; width:120px; } #linkList ul li{ margin: 0; padding: 3px 0 3px 0; border-bottom: 1px dotted #999999; } #linkList ul li a, #linkList ul li a:visited { border-bottom: none; outline:0; } #linkList ul li a:hover { color: #999999; text-decoration: underline; } #lselect { font-size: 0.9em; } #lselect ul li { padding: 3px 0 3px 20px; background: transparent url(bullet.jpg) no-repeat 2% 25%; color:#999999; } #lselect a { display: block; font-size: 1.1em; color: #6D2542; } #lselect a.c { display:inline; line-height:5px; margin:0; padding:0; font: normal 1.0em/0.9em Geneva, Arial, Tahoma, sans-serif; color: #999999; letter-spacing: -1px; } #lselect, #larchives { margin-bottom: 5px; border:0px solid #000000; } #larchives ul li a, #lresources ul li a { color:#6D2542; } #lselect h3, #larchives h3, #lresources h3 { width: 196px; height: 40px; margin-bottom:-20px; padding:10px 0 0 35px; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:11px; font-weight:normal; text-transform: uppercase; color:#999999; } #footer{ text-align: left; padding:0 0 0 0; margin:0 0 0 60px; } #footer a, #footer a:visited { padding: 5px; border: 1px solid #eeeeee; background-color: #fff; color: #666666; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:10px; } #footer a:hover { padding: 5px; border: 1px solid #eeeeee; background-color: #eeeeee; color: #999999; font-family:Geneva, Arial, Helvetica, sans-serif; font-size:10px; text-decoration: none; } #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6{ display:none; } /* css Zen Garden submission 212 - 'Make em Proud!', by Michael McAghon and Scotty Reifsnyder, http://skybased.com/ */ /* css released under Creative Commons License - http://creativecommons.org/licenses/by-nc-sa/1.0/ */ /* All associated graphics copyright 2007, Michael McAghon and Scotty Reifsnyder */ /* IMPORTANT */ /* This design is not a template. You may not reproduce it elsewhere without the designer's written permission. However, feel free to study the CSS and use techniques you learn from it elsewhere. */ /* hi, and welcome */ /* Make'em Proud! */ /* CSS Zen Garden */ /* 2007 */ /* meyer reset */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } /* remember to define focus styles! */ :focus { outline: 0; } body { line-height: 1; color: black; background: white; } ol, ul { list-style: none; } /* tables still need 'cellspacing="0"' in the markup */ table { border-collapse: separate; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after { content: ""; } blockquote, q { quotes: "" ""; } /* end meyer reset */ body#css-zen-garden { font: 62.5%/1.6 Georgia, Times, "Times New Roman", serif; color: #3C1700; position: relative; background: #edefd0 url("bg.jpg") top left repeat; margin-top: 75px; } p { font-size: 1.4em; margin: 0 0 1.6em; padding: 0 24px; clear: both; } abbr, acronym { cursor: help; } span.accesskey { border-bottom: 1px dotted #fff; } :link, :visited { font-weight: bold; text-decoration: none; color: #1e0c00; } a:active { color: #f00; } a:hover { color: #000; font-weight: bold; text-decoration: underline; } a img { border: 0; } #container { width: 645px; padding: 0 30px 0 180px; float: left; background: url("bg_container.gif") 0 50px repeat-y; } h1 { position: absolute; z-index: 101; top: -75px; left: 0; width: 179px; height: 152px; text-indent: -10001px; background: url("zen-troop-seal.gif") top left no-repeat; } h2 { margin: 0 0 2.5em -95px; width: 770px; height: 352px; text-indent: -10001px; display: block; background: url("make-em-proud.jpg") top left no-repeat; border-bottom: 4px solid #f7fad9; } h3 { text-align: center; color: #472101; height: 27px; text-indent: -10001px; background-position: 50% 0; background-repeat: no-repeat; margin: 0 0 .8em; } #preamble h3 { background-image: url("h_path-to-achieve.gif"); } #explanation h3 { background-image: url("h_what-is-about.gif"); } #participation h3 { background-image: url("h_participation.gif"); } #benefits h3 { background-image: url("h_merit-benefits.gif"); } #requirements h3 { background-image: url("h_requirements.gif"); width: 621px; margin-left: -633px; } #intro #quickSummary { background: #3C1700 url("leader.gif") 54% 15px no-repeat; color: #fff; position: absolute; top: 110px; left: 10px; width: 150px; padding: 125px 0 0; } #intro #quickSummary p.p1 { font-size: 1.2em !important; font-style: italic; padding: 0 11px 0 14px; } #intro #quickSummary p.p2 { background: #2d1100 url("h_get-started.gif") 50% 1.5em no-repeat; padding: 5em 15px 1.6em; margin: 0; font-size: 1.2em !important; } #intro #quickSummary a { color: #fff; } #linkList { width: 130px; background-color: #3c1700; position: absolute; top: 53.5em; left: 10px; padding: 2.4em 10px .8em; color: #cec5bf; } #linkList a { color: #ebe7e5; } #linkList h3 { display: block; margin: 0 0 1.2em; } #linkList ul { margin: 0 0 2.4em; font-size: 1em; text-align: center; line-height: 1.2em; } #linkList ul li { margin-bottom: .8em; text-align: center; } #lselect h3 { background-image: url("h_other-scouts.gif"); } #lselect ul li { margin: 0 0 1.2em; } #lselect ul li a { background-color: #2d1100; display: block; padding: .5em 5px .6em; font-size: 1.1em; margin-bottom: .3em; color: #fff; } #lselect ul li a.c { background-color: transparent; display: inline; padding: 0; font-size: 1em; margin-bottom: 0; color: #ebe7e5; } #larchives h3 { background-image: url("h_archives.gif"); } #lresources h3 { background-image: url("h_resources.gif"); } #supportingText { padding: .5em 0 0; position: relative; } #benefits { margin-bottom: 1em; } #requirements { float: right; width: 1px; margin: 145px -1px 0 0; display: inline; } #requirements p { width: 598px; margin-left: -646px; } #footer { float: left; background: url("merit-badges.gif") top left no-repeat; width: 645px; height: 130px; overflow: visible; position:relative; display: inline; } #footer a { text-indent: -10001px; float: right; display: block; width: 114px; height: 114px; margin: 0 7px; } #extraDiv1 { width: 855px; height: 100px; display: block; float: left; background: url("bg_req.gif") top left no-repeat; } /* don't need'em */ #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 { display: none; } /* IE6 help for repositioning of badges, overall weirdness */ * html #container { float: left; height: 170em; } * html #requirements { height: 1px; width: 1px; position: relative; margin-right: -30px; } * html #requirements p, * html #requirements h3 { position: relative; } /* end sad IE6 */ /* thanks, */ /* skybased */netsurf-all-3.2/libcss/test/data/css/malformed.css0000644000175000017500000000113112377676736021247 0ustar vincevincep { color:green } p { color:green; color } /* malformed declaration missing ':', value */ p { color:red; color; color:green } /* same with expected recovery */ p { color:green; color: } /* malformed declaration missing value */ p { color:red; color:; color:green } /* same with expected recovery */ p { color:green; color{;color:maroon} } /* unexpected tokens { } */ p { color:red; color{;color:maroon}; color:green } /* same with recovery */ p { color:red; !important; color:green } @blah { moose } "Foo bar baz p ( { ) color: green } ) p {color:green} p { color: green; } netsurf-all-3.2/libcss/test/data/css/fontface.css0000644000175000017500000001103212377676736021067 0ustar vincevince@font-face { invalid-descriptor: name; src: invalid-src; } /* To use a downloadable font called Gentium */ @font-face { font-family: Gentium; src: url(http://example.com/fonts/Gentium.ttf); } p { font-family: Gentium, serif; } /* load WOFF font if possible, otherwise use OpenType font */ @font-face { font-family: bodytext; src: url(ideal-sans-serif.woff) format("woff"), url(basic-sans-serif.ttf) format("opentype"); } /* regular face of Gentium */ @font-face { font-family: MyGentium; src: local(Gentium), /* use locally available Gentium */ url(Gentium.ttf); /* otherwise, download it */ } /* bold face of Gentium */ @font-face { font-family: MyGentium; src: local(Gentium Bold), /* full font name */ local(Gentium-Bold), /* Postscript name */ url(GentiumBold.ttf); /* otherwise, download it */ font-weight: bold; } /* Use a local font or reference an SVG font in another document: */ @font-face { font-family: Headline; src: local(Futura-Medium), url(fonts.svg#MyGeometricModern) format("svg"); } /* Create an alias for local Japanese fonts on different platforms: */ @font-face { font-family: jpgothic; src: local(HiraKakuPro-W3), local(Meiryo), local(IPAPGothic); } /* Reference a font face that cannot be matched within a larger family: */ @font-face { font-family: Hoefler Text Ornaments; /* has the same font properties as Hoefler Text Regular */ src: local(HoeflerText-Ornaments); } /* Since localized fullnames should never match, a document with the header style rules below would always render using the default serif font, regardless whether a particular system locale parameter is set to Finnish or not: */ @font-face { font-family: SectionHeader; src: local("Arial Lihavoitu"); /* Finnish fullname for Arial Bold, matching should fail */ font-weight: bold; } h2 { font-family: SectionHeader, serif; } /* A conformant user agent should never load the font gentium.eot in the example below, since it is included in the first definition of the src descriptor which is overridden by the second definition in the same @font-face rule: */ @font-face { font-family: MainText; src: url(gentium.eot); /* for compatibility with older non-conformant user agents */ src: local("Gentium"), url(gentium.ttf); /* Overrides src definition */ } /* The BBC provides news services in a wide variety of languages, many that are not well supported across all platforms. Using an @font-face rule, the BBC could provide a font for any of these languages, as it already does via a manual font download. */ @font-face { font-family: BBCBengali; src: url(fonts/BBCBengali.ttf) format("opentype"); unicode-range: U+00-FF, U+980-9FF; } /* Technical documents often require a wide range of symbols. The STIX Fonts project is one project aimed at providing fonts to support a wide range of technical typesetting in a standardized way. The example below shows the use of a font that provides glyphs for many of the mathematical and technical symbol ranges within Unicode: */ @font-face { font-family: STIXGeneral; src: local(STIXGeneral), url(/stixfonts/STIXGeneral.otf); unicode-range: U+000-49F, U+2000-27FF, U+2900-2BFF, U+1D400-1D7FF; } @font-face { font-family: JapaneseWithGentium; src: local(MSMincho); /* no range specified, defaults to entire range */ } @font-face { font-family: JapaneseWithGentium; src: url(../fonts/Gentium.ttf); unicode-range: U+0-2FF; } /* Consider a family constructed to optimize bandwidth by separating out Latin, Japanese and other characters into different font files: */ /* fallback font - size: 4.5MB */ @font-face { font-family: DroidSans; src: url(DroidSansFallback.ttf); /* no range specified, defaults to entire range */ } /* Japanese glyphs - size: 1.2MB */ @font-face { font-family: DroidSans; src: url(DroidSansJapanese.ttf); unicode-range: U+3000-9FFF, U+ff??; } /* Latin, Greek, Cyrillic along with some punctuation and symbols - size: 190KB */ @font-face { font-family: DroidSans; src: url(DroidSans.ttf); unicode-range: U+000-5FF, U+1e00-1fff, U+2000-2300; } /* The first src: should be used because the second is invalid. */ @font-face { font-family: BadSrc; src: url(http://example.com/fonts/Gentium.ttf); src: fhgwgads; font-style: oblique; } /* The third src: should be used because the second is invalid, but the thirsd is valid, overriding the first. */ @font-face { font-family: ThirdSrc; src: url(http://example.com/fonts/Gentium.ttf); src: fhgwgads; font-style: italic; src: local(gentium); } netsurf-all-3.2/libcss/test/data/css/badcomment.css0000644000175000017500000000136412377676736021422 0ustar vincevince.icon-app-medium, .icon-archive-medium, .icon-document-medium, .icon-folder-medium, .icon-folder-apps-medium, .icon-folder-download-medium, .icon-folder-dev-medium, .icon-folder-haiku-medium, .icon-folder-mail-medium, .icon-folder-people-medium, .icon-folder-search-medium, .icon-hdd-medium, .icon-html-medium, .icon-ide-project-medium, .icon-news-medium, .icon-pdf-medium, .icon-video-medium, .icon-people-medium, .icon-person-medium, .icon-screen-medium, .icon-styled-edit-medium, .icon-terminal-medium, .icon-vmware-medium { background-repeat: no-repeat; list-style: none !important; padding-left: 36px; padding-top: 10px; Increased from 15 to 20 to avoid icon chop off */ line-height: 150% !important; list-style-image: none !important; } netsurf-all-3.2/libcss/test/data/css/simple.css0000644000175000017500000000105712377676736020601 0ustar vincevince url(foo); "foo)"; "foo'"; 'foo"'; "foo\""; 'foo\''; url("foo)"); url("foo'"); url('foo"'); url("foo\""); url('foo\''); .blah #foo /********/ html { color: green; } U+2022-2023 U+??33-40fa U+x U+01234599 U+??????-000012f 0.575 .825 15 20% .05% 0.1% 0.% 5em .5em 0.4px .% \.moo\se {} bla\2022 f {} @import url('foo.css'); @\hello; @.bad {} body { font-family: "Bitstream Vera Sans"; } body { font-family: "foo \ bar"; } /** */ body { font-family: "unterminated string foo } blah { baz: bat; foo: bar !important; } foo { bar: ""; }{ color: green; } netsurf-all-3.2/libcss/test/parse.c0000644000175000017500000000464012377676736016354 0ustar vincevince#include #include #include #include "charset/detect.h" #include "utils/utils.h" #include "lex/lex.h" #include "parse/parse.h" #include "testutils.h" #define ITERATIONS (1) #define DUMP_EVENTS (0) #if DUMP_EVENTS static const char *event_names[] = { "START_STYLESHEET", "END_STYLESHEET", "START_RULESET", "END_RULESET", "START_ATRULE", "END_ATRULE", "START_BLOCK", "END_BLOCK", "BLOCK_CONTENT", "DECLARATION" }; #endif static css_error event_handler(css_parser_event type, const parserutils_vector *tokens, void *pw) { #if !DUMP_EVENTS UNUSED(type); UNUSED(tokens); UNUSED(pw); #else int32_t ctx = 0; const css_token *token; UNUSED(pw); printf("%s%s", tokens != NULL ? " " : "", event_names[type]); if (tokens == NULL) { printf("\n"); return CSS_OK; } do { token = parserutils_vector_iterate(tokens, &ctx); if (token == NULL) break; printf("\n %d", token->type); if (token->data.data != NULL) printf(" %.*s", (int) token->data.len, token->data.data); } while (token != NULL); printf("\n"); #endif return CSS_OK; } int main(int argc, char **argv) { css_parser_optparams params; css_parser *parser; FILE *fp; size_t len; #define CHUNK_SIZE (4096) uint8_t buf[CHUNK_SIZE]; css_error error; int i; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } for (i = 0; i < ITERATIONS; i++) { assert(css__parser_create("UTF-8", CSS_CHARSET_DICTATED, &parser) == CSS_OK); params.event_handler.handler = event_handler; params.event_handler.pw = NULL; assert(css__parser_setopt(parser, CSS_PARSER_EVENT_HANDLER, ¶ms) == CSS_OK); fp = fopen(argv[1], "rb"); if (fp == NULL) { printf("Failed opening %s\n", argv[1]); return 1; } fseek(fp, 0, SEEK_END); len = ftell(fp); fseek(fp, 0, SEEK_SET); while (len >= CHUNK_SIZE) { size_t read = fread(buf, 1, CHUNK_SIZE, fp); assert(read == CHUNK_SIZE); error = css__parser_parse_chunk(parser, buf, CHUNK_SIZE); assert(error == CSS_OK || error == CSS_NEEDDATA); len -= CHUNK_SIZE; } if (len > 0) { size_t read = fread(buf, 1, len, fp); assert(read == len); error = css__parser_parse_chunk(parser, buf, len); assert(error == CSS_OK || error == CSS_NEEDDATA); len = 0; } fclose(fp); assert(css__parser_completed(parser) == CSS_OK); css__parser_destroy(parser); } printf("PASS\n"); return 0; } netsurf-all-3.2/libcss/test/README0000644000175000017500000000450212377676736015753 0ustar vincevinceLibCSS testcases =============== Testcases for LibCSS are self-contained binaries which test various parts of the CSS library. These may make use of external data files to drive the testing. Testcase command lines ---------------------- Testcase command lines are in a unified format, thus: [ ] The aliases file parameter will always be specified (as it is required for the library to work at all). The data file parameter is optional and may be provided on a test-by-test basis. Testcase output --------------- Testcases may output anything at all to stdout. The final line of the output must begin with either PASS or FAIL (case sensitive), indicating the success status of the test. Test Index ---------- In the test sources directory, is a file, named INDEX, which provides an index of all available test binaries. Any new test applications should be added to this index as they are created. The test index file format is as follows: file = *line line = ( entry / comment / blank ) LF entry = testname 1*HTAB description [ 1*HTAB datadir ] comment = "#" *non-newline blank = 0 testname = 1*non-reserved description = 1*non-reserved datadir = 1*non-reserved non-newline = VCHAR / WSP non-reserved = VCHAR / SP Each entry contains a mandatory binary name and description followed by an optional data directory specifier. The data directory specifier is used to state the name of the directory containing data files for the test name. This directory will be searched for within the "data" directory in the source tree. If a data directory is specified, the test binary will be invoked for each data file listed within the data directory INDEX, passing the filename as the second parameter (, above). Data Index ---------- Each test data directory contains a file, named INDEX, which provides an index of all available test data files. The data index file format is as follows: file = *line line = ( entry / comment / blank ) LF entry = dataname 1*HTAB description comment = "#" *non-newline blank = 0 dataname = 1*non-reserved description = 1*non-reserved non-newline = VCHAR / WSP non-reserved = VCHAR / SP Each entry contains a mandatory data file name and description. netsurf-all-3.2/libcss/test/INDEX0000644000175000017500000000107712377676736015671 0ustar vincevince# Index of testcases # # Test Description DataDir csdetect Character set detection csdetect #lex Lexing css lex-auto Automated lexer tests lex number Conversion of numbers to fixed point number #parse Parsing (core syntax) css #css21 Parsing (CSS2.1 specifics) css parse-auto Automated parser tests (bytecode) parse parse2-auto Automated parser tests (om & invalid) parse2 select-no-nd Automated selection engine tests (no node_data) select select-nd Automated selection engine tests (with node_data) select # Regression tests netsurf-all-3.2/libcss/test/select-nd.c0000644000175000017500000000037312377676736017117 0ustar vincevince #include "select-common.c" static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data) { node *node = n; UNUSED(pw); /* Pass any node data back to libcss */ *libcss_node_data = node->libcss_node_data; return CSS_OK; } netsurf-all-3.2/libcss/test/parse-auto.c0000644000175000017500000004260612377676736017326 0ustar vincevince#include #include #include #include #include #include #include #include "stylesheet.h" #include "utils/utils.h" #include "testutils.h" /** \todo at some point, we need to extend this to handle nested blocks */ typedef struct exp_entry { int type; #define MAX_RULE_NAME_LEN (128) char name[MAX_RULE_NAME_LEN]; size_t bclen; size_t bcused; uint8_t *bytecode; size_t stlen; size_t stused; struct stentry { size_t off; char *string; } *stringtab; } exp_entry; typedef struct line_ctx { size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; exp_entry *exp; bool indata; bool inerrors; bool inexp; bool inrule; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen); static bool validate_rule_selector(css_rule_selector *s, exp_entry *e); static void validate_rule_charset(css_rule_charset *s, exp_entry *e, int testnum); static void validate_rule_import(css_rule_import *s, exp_entry *e, int testnum); static void dump_selector_list(css_selector *list, char **ptr); static void dump_selector(css_selector *selector, char **ptr); static void dump_selector_detail(css_selector_detail *detail, char **ptr); static void dump_string(lwc_string *string, char **ptr); static css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs) { UNUSED(pw); UNUSED(base); /* About as useless as possible */ *abs = lwc_string_ref(rel); return CSS_OK; } static bool fail_because_lwc_leaked = false; static void printing_lwc_iterator(lwc_string *str, void *pw) { UNUSED(pw); printf(" DICT: %*s\n", (int)(lwc_string_length(str)), lwc_string_data(str)); fail_because_lwc_leaked = true; } static void destroy_expected(line_ctx *ctx) { while (ctx->expused > 0) { exp_entry *victim = &ctx->exp[--ctx->expused]; if (victim->bytecode != NULL) free(victim->bytecode); while (victim->stused > 0) { free(victim->stringtab[--victim->stused].string); } free(victim->stringtab); } } int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.buf[0] = '\0'; ctx.bufused = 0; ctx.explen = 0; ctx.expused = 0; ctx.exp = NULL; ctx.indata = false; ctx.inerrors = false; ctx.inexp = false; assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) run_test(ctx.buf, ctx.bufused, ctx.exp, ctx.expused); free(ctx.buf); destroy_expected(&ctx); free(ctx.exp); lwc_iterate_strings(printing_lwc_iterator, NULL); assert(fail_because_lwc_leaked == false); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ run_test(ctx->buf, ctx->bufused, ctx->exp, ctx->expused); ctx->buf[0] = '\0'; ctx->bufused = 0; destroy_expected(ctx); } if (ctx->indata && strncasecmp(data+1, "errors", 6) == 0) { ctx->indata = false; ctx->inerrors = true; ctx->inexp = false; } else if (ctx->inerrors && strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inerrors = false; ctx->inexp = true; ctx->inrule = false; } else if (ctx->inexp && strncasecmp(data+1, "data", 4) == 0) { ctx->indata = true; ctx->inerrors = false; ctx->inexp = false; } else if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } else { ctx->indata = (strncasecmp(data+1, "data", 4) == 0); ctx->inerrors = (strncasecmp(data+1, "errors", 6) == 0); ctx->inexp = (strncasecmp(data+1, "expected", 8) == 0); } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { if (data[datalen - 1] == '\n') datalen -= 1; css__parse_expected(ctx, data, datalen); } } return true; } void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { /* Ignore blanks or lines that don't start with | */ if (len == 0 || data[0] != '|') return; if (ctx->inrule == false) { char *name; int type; start_rule: type = strtol(data + 1, &name, 10); while (isspace(*name)) name++; /* Append to list of expected rules */ if (ctx->expused == ctx->explen) { size_t num = ctx->explen == 0 ? 4 : ctx->explen; exp_entry *temp = realloc(ctx->exp, num * 2 * sizeof(exp_entry)); if (temp == NULL) { assert(0 && "No memory for expected rules"); } ctx->exp = temp; ctx->explen = num * 2; } ctx->exp[ctx->expused].type = type; memcpy(ctx->exp[ctx->expused].name, name, min(len - (name - data), MAX_RULE_NAME_LEN)); ctx->exp[ctx->expused].name[min(len - (name - data), MAX_RULE_NAME_LEN - 1)] = '\0'; ctx->exp[ctx->expused].bclen = 0; ctx->exp[ctx->expused].bcused = 0; ctx->exp[ctx->expused].bytecode = NULL; ctx->exp[ctx->expused].stlen = 0; ctx->exp[ctx->expused].stused = 0; ctx->exp[ctx->expused].stringtab = NULL; ctx->expused++; ctx->inrule = true; } else { char *next = (char *) data + 1; exp_entry *rule = &ctx->exp[ctx->expused - 1]; if (data[2] != ' ') { ctx->inrule = false; goto start_rule; } while (next < data + len) { /* Skip whitespace */ while (next < data + len && isspace(*next)) next++; if (next == data + len) break; if (rule->bcused >= rule->bclen) { size_t num = rule->bcused == 0 ? 4 : rule->bcused; uint8_t *temp = realloc(rule->bytecode, num * 2); if (temp == NULL) { assert(0 && "No memory for bytecode"); } rule->bytecode = temp; rule->bclen = num * 2; } if (*next == 'P') { /* Pointer */ const char *str; while (next < data + len && *next != '(') next++; str = next + 1; while (next < data + len && *next != ')') next++; next++; if (rule->stused >= rule->stlen) { size_t num = rule->stused == 0 ? 4 : rule->stused; struct stentry *temp = realloc( rule->stringtab, num * 2 * sizeof(struct stentry)); if (temp == NULL) { assert(0 && "No memory for string table"); } rule->stringtab = temp; rule->stlen = num * 2; } rule->stringtab[rule->stused].off = rule->bcused; rule->stringtab[rule->stused].string = malloc(next - str); assert(rule->stringtab[rule->stused].string != NULL); memcpy(rule->stringtab[rule->stused].string, str, next - str - 1); rule->stringtab[rule->stused].string[ next - str - 1] = '\0'; rule->bcused += sizeof(css_code_t); rule->stused++; } else { /* Assume hexnum */ uint32_t val = strtoul(next, &next, 16); /* Append to bytecode */ memcpy(rule->bytecode + rule->bcused, &val, sizeof(val)); rule->bcused += sizeof(val); } } } } static void report_fail(const uint8_t *data, size_t datalen, exp_entry *e) { uint32_t bcoff; printf(" Data: %.*s\n", (int)datalen, data); printf(" Expected entry:\n"); printf(" entry type:%d name:%s\n", e->type, e->name); printf(" bytecode len:%" PRIuMAX " used:%" PRIuMAX "\n", (uintmax_t) e->bclen, (uintmax_t) e->bcused); printf(" bytecode "); for (bcoff = 0; bcoff < e->bcused; bcoff++) { printf("%.2x ", ((uint8_t *) e->bytecode)[bcoff]); } printf("\n string table len:%" PRIuMAX " used %" PRIuMAX "\n", (uintmax_t) e->stlen, (uintmax_t) e->stused); /* struct stentry { size_t off; char *string; } *stringtab; */ } void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen) { css_stylesheet_params params; css_stylesheet *sheet; css_rule *rule; css_error error; size_t e; static int testnum; bool failed; params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1; params.level = CSS_LEVEL_21; params.charset = "UTF-8"; params.url = "foo"; params.title = NULL; params.allow_quirks = false; params.inline_style = false; params.resolve = resolve_url; params.resolve_pw = NULL; params.import = NULL; params.import_pw = NULL; params.color = NULL; params.color_pw = NULL; params.font = NULL; params.font_pw = NULL; assert(css_stylesheet_create(¶ms, &sheet) == CSS_OK); error = css_stylesheet_append_data(sheet, data, len); if (error != CSS_OK && error != CSS_NEEDDATA) { printf("Failed appending data: %d\n", error); assert(0); } error = css_stylesheet_data_done(sheet); assert(error == CSS_OK || error == CSS_IMPORTS_PENDING); while (error == CSS_IMPORTS_PENDING) { lwc_string *url; uint64_t media; error = css_stylesheet_next_pending_import(sheet, &url, &media); assert(error == CSS_OK || error == CSS_INVALID); if (error == CSS_OK) { css_stylesheet *import; char *buf = malloc(lwc_string_length(url) + 1); memcpy(buf, lwc_string_data(url), lwc_string_length(url)); buf[lwc_string_length(url)] = '\0'; params.url = buf; assert(css_stylesheet_create(¶ms, &import) == CSS_OK); assert(css_stylesheet_register_import(sheet, import) == CSS_OK); error = CSS_IMPORTS_PENDING; lwc_string_unref(url); free(buf); } } e = 0; testnum++; printf("Test %d: ", testnum); if (sheet->rule_count != explen) { printf("%d: Got %d rules. Expected %u\n", testnum, sheet->rule_count, (int) explen); assert(0 && "Unexpected number of rules"); } for (rule = sheet->rule_list; rule != NULL; rule = rule->next, e++) { if (rule->type != exp[e].type) { printf("%d: Got type %d. Expected %d\n", testnum, rule->type, exp[e].type); assert(0 && "Types differ"); } switch (rule->type) { case CSS_RULE_SELECTOR: failed = validate_rule_selector((css_rule_selector *) rule, &exp[e]); break; case CSS_RULE_CHARSET: validate_rule_charset((css_rule_charset *) rule, &exp[e], testnum); failed = false; break; case CSS_RULE_IMPORT: validate_rule_import((css_rule_import *) rule, &exp[e], testnum); failed = false; break; default: printf("%d: Unhandled rule type %d\n", testnum, rule->type); failed = false; break; } if (failed) { report_fail(data, len, &exp[e]); assert(0); } } assert(e == explen); css_stylesheet_destroy(sheet); printf("PASS\n"); } bool validate_rule_selector(css_rule_selector *s, exp_entry *e) { char name[MAX_RULE_NAME_LEN]; char *ptr = name; uint32_t i; /* Build selector string */ for (i = 0; i < s->base.items; i++) { dump_selector_list(s->selectors[i], &ptr); if (i != (uint32_t) (s->base.items - 1)) { memcpy(ptr, ", ", 2); ptr += 2; } } *ptr = '\0'; /* Compare with expected selector */ if (strcmp(e->name, name) != 0) { printf("FAIL Mismatched names\n" " Got name '%s'. Expected '%s'\n", name, e->name); return true; } /* Now compare bytecode */ if (e->bytecode != NULL && s->style == NULL) { printf("FAIL No bytecode\n" " Expected bytecode but none created\n"); return true; } else if (e->bytecode == NULL && s->style != NULL) { printf("FAIL Unexpected bytecode\n" " No bytecode expected but some created\n"); return true; } else if (e->bytecode != NULL && s->style != NULL) { size_t i; if ((s->style->used * sizeof(css_code_t)) != e->bcused) { printf("FAIL Bytecode lengths differ\n" " Got length %" PRIuMAX ", Expected %" PRIuMAX "\n", (uintmax_t) (s->style->used * sizeof(css_code_t)), (uintmax_t) e->bcused); return true; } for (i = 0; i < e->bcused; i++) { size_t j; for (j = 0; j < e->stused; j++) { if (e->stringtab[j].off == i) break; } if (j != e->stused) { /* String */ lwc_string *p; css__stylesheet_string_get(s->style->sheet, (s->style->bytecode[i / sizeof(css_code_t)]), &p); if (lwc_string_length(p) != strlen(e->stringtab[j].string) || memcmp(lwc_string_data(p), e->stringtab[j].string, lwc_string_length(p)) != 0) { printf("FAIL Strings differ\n" " Got string '%.*s'. " "Expected '%s'\n", (int) lwc_string_length(p), lwc_string_data(p), e->stringtab[j].string); return true; } i += sizeof (css_code_t) - 1; } else if (((uint8_t *) s->style->bytecode)[i] != e->bytecode[i]) { printf("FAIL Bytecode differs\n" " Bytecode differs at %u\n ", (int) i); while (i < e->bcused) { printf("%.2x ", ((uint8_t *) s->style->bytecode)[i]); i++; } printf("\n"); return true; } } } return false; } void validate_rule_charset(css_rule_charset *s, exp_entry *e, int testnum) { char name[MAX_RULE_NAME_LEN]; char *ptr = name; dump_string(s->encoding, &ptr); *ptr = '\0'; if (strcmp(name, e->name) != 0) { printf("%d: Got charset '%s'. Expected '%s'\n", testnum, name, e->name); assert(0 && "Mismatched charsets"); } } void validate_rule_import(css_rule_import *s, exp_entry *e, int testnum) { if (strncmp(lwc_string_data(s->url), e->name, lwc_string_length(s->url)) != 0) { printf("%d: Got URL '%.*s'. Expected '%s'\n", testnum, (int) lwc_string_length(s->url), lwc_string_data(s->url), e->name); assert(0 && "Mismatched URLs"); } css_stylesheet_destroy(s->sheet); } void dump_selector_list(css_selector *list, char **ptr) { if (list->combinator != NULL) { dump_selector_list(list->combinator, ptr); } switch (list->data.comb) { case CSS_COMBINATOR_NONE: break; case CSS_COMBINATOR_ANCESTOR: (*ptr)[0] = ' '; *ptr += 1; break; case CSS_COMBINATOR_PARENT: memcpy(*ptr, " > ", 3); *ptr += 3; break; case CSS_COMBINATOR_SIBLING: memcpy(*ptr, " + ", 3); *ptr += 3; break; case CSS_COMBINATOR_GENERIC_SIBLING: memcpy(*ptr, " ~ ", 3); *ptr += 3; break; } dump_selector(list, ptr); } void dump_selector(css_selector *selector, char **ptr) { css_selector_detail *d = &selector->data; while (true) { dump_selector_detail(d, ptr); if (d->next == 0) break; d++; } } void dump_selector_detail(css_selector_detail *detail, char **ptr) { if (detail->negate) *ptr += sprintf(*ptr, ":not("); switch (detail->type) { case CSS_SELECTOR_ELEMENT: if (lwc_string_length(detail->qname.name) == 1 && lwc_string_data(detail->qname.name)[0] == '*' && detail->next == 0) { dump_string(detail->qname.name, ptr); } else if (lwc_string_length(detail->qname.name) != 1 || lwc_string_data(detail->qname.name)[0] != '*') { dump_string(detail->qname.name, ptr); } break; case CSS_SELECTOR_CLASS: **ptr = '.'; *ptr += 1; dump_string(detail->qname.name, ptr); break; case CSS_SELECTOR_ID: **ptr = '#'; *ptr += 1; dump_string(detail->qname.name, ptr); break; case CSS_SELECTOR_PSEUDO_CLASS: case CSS_SELECTOR_PSEUDO_ELEMENT: **ptr = ':'; *ptr += 1; dump_string(detail->qname.name, ptr); if (detail->value_type == CSS_SELECTOR_DETAIL_VALUE_STRING) { if (detail->value.string != NULL) { **ptr = '('; *ptr += 1; dump_string(detail->value.string, ptr); **ptr = ')'; *ptr += 1; } } else { *ptr += sprintf(*ptr, "(%dn+%d)", detail->value.nth.a, detail->value.nth.b); } break; case CSS_SELECTOR_ATTRIBUTE: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); **ptr = ']'; *ptr += 1; break; case CSS_SELECTOR_ATTRIBUTE_EQUAL: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '='; (*ptr)[1] = '"'; *ptr += 2; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_DASHMATCH: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '|'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_INCLUDES: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '~'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_PREFIX: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '^'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_SUFFIX: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '$'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_SUBSTRING: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '*'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; } if (detail->negate) *ptr += sprintf(*ptr, ")"); } void dump_string(lwc_string *string, char **ptr) { *ptr += sprintf(*ptr, "%.*s", (int) lwc_string_length(string), lwc_string_data(string)); } netsurf-all-3.2/libcss/test/lex.c0000644000175000017500000000771712377676736016042 0ustar vincevince#include #include #include #include #include #include "charset/detect.h" #include "utils/utils.h" #include "lex/lex.h" #include "testutils.h" #define ITERATIONS (1) #define DUMP_TOKENS (0) static void printToken(const css_token *token) { #if !DUMP_TOKENS UNUSED(token); #else printf("[%d, %d] : ", token->line, token->col); switch (token->type) { case CSS_TOKEN_IDENT: printf("IDENT(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_ATKEYWORD: printf("ATKEYWORD(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_STRING: printf("STRING(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_INVALID_STRING: printf("INVALID(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_HASH: printf("HASH(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_NUMBER: printf("NUMBER(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_PERCENTAGE: printf("PERCENTAGE(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_DIMENSION: printf("DIMENSION(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_URI: printf("URI(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_UNICODE_RANGE: printf("UNICODE-RANGE(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_CDO: printf("CDO"); break; case CSS_TOKEN_CDC: printf("CDC"); break; case CSS_TOKEN_S: printf("S"); break; case CSS_TOKEN_COMMENT: printf("COMMENT(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_FUNCTION: printf("FUNCTION(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_INCLUDES: printf("INCLUDES"); break; case CSS_TOKEN_DASHMATCH: printf("DASHMATCH"); break; case CSS_TOKEN_PREFIXMATCH: printf("PREFIXMATCH"); break; case CSS_TOKEN_SUFFIXMATCH: printf("SUFFIXMATCH"); break; case CSS_TOKEN_SUBSTRINGMATCH: printf("SUBSTRINGMATCH"); break; case CSS_TOKEN_CHAR: printf("CHAR(%.*s)", (int) token->data.len, token->data.data); break; case CSS_TOKEN_EOF: printf("EOF"); break; case CSS_TOKEN_LAST_INTERN_LOWER: case CSS_TOKEN_LAST_INTERN: break; } printf("\n"); #endif } int main(int argc, char **argv) { parserutils_inputstream *stream; css_lexer *lexer; FILE *fp; size_t len; #define CHUNK_SIZE (4096) uint8_t buf[CHUNK_SIZE]; css_token *tok; css_error error; int i; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } for (i = 0; i < ITERATIONS; i++) { assert(parserutils_inputstream_create("UTF-8", CSS_CHARSET_DICTATED,css__charset_extract, &stream) == PARSERUTILS_OK); assert(css__lexer_create(stream, &lexer) == CSS_OK); fp = fopen(argv[1], "rb"); if (fp == NULL) { printf("Failed opening %s\n", argv[1]); return 1; } fseek(fp, 0, SEEK_END); len = ftell(fp); fseek(fp, 0, SEEK_SET); while (len >= CHUNK_SIZE) { size_t read = fread(buf, 1, CHUNK_SIZE, fp); assert(read == CHUNK_SIZE); assert(parserutils_inputstream_append(stream, buf, CHUNK_SIZE) == PARSERUTILS_OK); len -= CHUNK_SIZE; while ((error = css__lexer_get_token(lexer, &tok)) == CSS_OK) { printToken(tok); if (tok->type == CSS_TOKEN_EOF) break; } } if (len > 0) { size_t read = fread(buf, 1, len, fp); assert(read == len); assert(parserutils_inputstream_append(stream, buf, len) == PARSERUTILS_OK); len = 0; } fclose(fp); assert(parserutils_inputstream_append(stream, NULL, 0) == PARSERUTILS_OK); while ((error = css__lexer_get_token(lexer, &tok)) == CSS_OK) { printToken(tok); if (tok->type == CSS_TOKEN_EOF) break; } css__lexer_destroy(lexer); parserutils_inputstream_destroy(stream); } printf("PASS\n"); return 0; } netsurf-all-3.2/libcss/test/lex-auto.c0000644000175000017500000001731612377676736017004 0ustar vincevince#include #include #include #include #include #include #include #include "charset/detect.h" #include "lex/lex.h" #include "utils/utils.h" #include "testutils.h" typedef struct exp_entry { css_token_type type; #define EXP_ENTRY_TEXT_LEN (128) char text[EXP_ENTRY_TEXT_LEN]; size_t textLen; bool hasText; } exp_entry; typedef struct line_ctx { size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; exp_entry *exp; bool indata; bool inexp; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void css__parse_expected(line_ctx *ctx, const char *data, size_t len); static const char *string_from_type(css_token_type type); static css_token_type string_to_type(const char *data, size_t len); static void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen); int main(int argc, char **argv) { line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } ctx.buflen = css__parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.buf[0] = '\0'; ctx.bufused = 0; ctx.explen = 0; ctx.expused = 0; ctx.exp = NULL; ctx.indata = false; ctx.inexp = false; assert(css__parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0) run_test(ctx.buf, ctx.bufused, ctx.exp, ctx.expused); free(ctx.buf); free(ctx.exp); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ run_test(ctx->buf, ctx->bufused, ctx->exp, ctx->expused); ctx->buf[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; } if (ctx->indata && strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; } else if (!ctx->indata) { ctx->indata = (strncasecmp(data+1, "data", 4) == 0); ctx->inexp = (strncasecmp(data+1, "expected", 8) == 0); } else { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { if (data[datalen - 1] == '\n') datalen -= 1; css__parse_expected(ctx, data, datalen); } } return true; } void css__parse_expected(line_ctx *ctx, const char *data, size_t len) { css_token_type type; const char *colon = css__parse_strnchr(data, len, ':'); if (colon == NULL) colon = data + len; type = string_to_type(data, colon - data); /* Append to list of expected tokens */ if (ctx->expused == ctx->explen) { size_t num = ctx->explen == 0 ? 4 : ctx->explen; exp_entry *temp = realloc(ctx->exp, num * 2 * sizeof(exp_entry)); if (temp == NULL) { assert(0 && "No memory for expected tokens"); } ctx->exp = temp; ctx->explen = num * 2; } ctx->exp[ctx->expused].type = type; ctx->exp[ctx->expused].textLen = 0; ctx->exp[ctx->expused].hasText = (colon != data + len); if (colon != data + len) { const char *p = colon + 1; bool escape = false; for (len = len - (colon + 1 - data); len > 0; len--, p++) { char c; if (escape == false && *p == '\\') { escape = true; continue; } if (escape) { switch (*p) { case 'n': c = 0xa; break; case 't': c = 0x9; break; default: c = *p; break; } escape = false; } else { c = *p; } ctx->exp[ctx->expused].text[ ctx->exp[ctx->expused].textLen] = c; ctx->exp[ctx->expused].textLen++; assert(ctx->exp[ctx->expused].textLen < EXP_ENTRY_TEXT_LEN); } } ctx->expused++; } const char *string_from_type(css_token_type type) { const char *names[] = { "IDENT", "ATKEYWORD", "HASH", "FUNCTION", "STRING", "INVALID", "URI", "UNICODE-RANGE", "CHAR", "NUMBER", "PERCENTAGE", "DIMENSION", "last_intern", "CDO", "CDC", "S", "COMMENT", "INCLUDES", "DASHMATCH", "PREFIXMATCH", "SUFFIXMATCH", "SUBSTRINGMATCH", "EOF" }; return names[type]; } css_token_type string_to_type(const char *data, size_t len) { if (len == 5 && strncasecmp(data, "IDENT", len) == 0) return CSS_TOKEN_IDENT; else if (len == 9 && strncasecmp(data, "ATKEYWORD", len) == 0) return CSS_TOKEN_ATKEYWORD; else if (len == 6 && strncasecmp(data, "STRING", len) == 0) return CSS_TOKEN_STRING; else if (len == 7 && strncasecmp(data, "INVALID", len) == 0) return CSS_TOKEN_INVALID_STRING; else if (len == 4 && strncasecmp(data, "HASH", len) == 0) return CSS_TOKEN_HASH; else if (len == 6 && strncasecmp(data, "NUMBER", len) == 0) return CSS_TOKEN_NUMBER; else if (len == 10 && strncasecmp(data, "PERCENTAGE", len) == 0) return CSS_TOKEN_PERCENTAGE; else if (len == 9 && strncasecmp(data, "DIMENSION", len) == 0) return CSS_TOKEN_DIMENSION; else if (len == 3 && strncasecmp(data, "URI", len) == 0) return CSS_TOKEN_URI; else if (len == 13 && strncasecmp(data, "UNICODE-RANGE", len) == 0) return CSS_TOKEN_UNICODE_RANGE; else if (len == 3 && strncasecmp(data, "CDO", len) == 0) return CSS_TOKEN_CDO; else if (len == 3 && strncasecmp(data, "CDC", len) == 0) return CSS_TOKEN_CDC; else if (len == 1 && strncasecmp(data, "S", len) == 0) return CSS_TOKEN_S; else if (len == 7 && strncasecmp(data, "COMMENT", len) == 0) return CSS_TOKEN_COMMENT; else if (len == 8 && strncasecmp(data, "FUNCTION", len) == 0) return CSS_TOKEN_FUNCTION; else if (len == 8 && strncasecmp(data, "INCLUDES", len) == 0) return CSS_TOKEN_INCLUDES; else if (len == 9 && strncasecmp(data, "DASHMATCH", len) == 0) return CSS_TOKEN_DASHMATCH; else if (len == 11 && strncasecmp(data, "PREFIXMATCH", len) == 0) return CSS_TOKEN_PREFIXMATCH; else if (len == 11 && strncasecmp(data, "SUFFIXMATCH", len) == 0) return CSS_TOKEN_SUFFIXMATCH; else if (len == 14 && strncasecmp(data, "SUBSTRINGMATCH", len) == 0) return CSS_TOKEN_SUBSTRINGMATCH; else if (len == 4 && strncasecmp(data, "CHAR", len) == 0) return CSS_TOKEN_CHAR; else return CSS_TOKEN_EOF; } void run_test(const uint8_t *data, size_t len, exp_entry *exp, size_t explen) { parserutils_inputstream *input; css_lexer *lexer; css_error error; css_token *tok; size_t e; static int testnum; assert(parserutils_inputstream_create("UTF-8", CSS_CHARSET_DICTATED, css__charset_extract, &input) == PARSERUTILS_OK); assert(css__lexer_create(input, &lexer) == CSS_OK); assert(parserutils_inputstream_append(input, data, len) == PARSERUTILS_OK); assert(parserutils_inputstream_append(input, NULL, 0) == PARSERUTILS_OK); e = 0; testnum++; while ((error = css__lexer_get_token(lexer, &tok)) == CSS_OK) { if (tok->type != exp[e].type) { printf("%d: Got token %s, Expected %s [%d, %d]\n", testnum, string_from_type(tok->type), string_from_type(exp[e].type), tok->line, tok->col); assert(0 && "Types differ"); } if (exp[e].hasText) { if (tok->data.len != exp[e].textLen) { printf("%d: Got length %d, Expected %d\n", testnum, (int) tok->data.len, (int) exp[e].textLen); assert(0 && "Text lengths differ"); } if (strncmp((char *) tok->data.data, exp[e].text, tok->data.len) != 0) { printf("%d: Got data '%.*s', Expected '%.*s'\n", testnum, (int) tok->data.len, tok->data.data, (int) exp[e].textLen, exp[e].text); assert(0 && "Text differs"); } } e++; if (tok->type == CSS_TOKEN_EOF) break; } assert(e == explen); css__lexer_destroy(lexer); parserutils_inputstream_destroy(input); printf("Test %d: PASS\n", testnum); } netsurf-all-3.2/libcss/test/dump.h0000644000175000017500000020122712377676736016214 0ustar vincevince#ifndef test_dump_h_ #define test_dump_h_ #include #include #include "stylesheet.h" #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/font_face.h" #include "testutils.h" static void dump_sheet(css_stylesheet *sheet, char *buf, size_t *len); static void dump_rule_selector(css_rule_selector *s, char **buf, size_t *buflen, uint32_t depth); static void dump_rule_charset(css_rule_charset *s, char **buf, size_t *buflen); static void dump_rule_import(css_rule_import *s, char **buf, size_t *buflen); static void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen); static void dump_rule_page(css_rule_page *s, char **buf, size_t *buflen); static void dump_rule_font_face(css_rule_font_face *s, char **buf, size_t *buflen); static void dump_selector_list(css_selector *list, char **ptr); static void dump_selector(css_selector *selector, char **ptr); static void dump_selector_detail(css_selector_detail *detail, char **ptr); static void dump_bytecode(css_style *style, char **ptr, uint32_t depth); static void dump_string(lwc_string *string, char **ptr); static void dump_font_face(css_font_face *font_face, char**ptr); void dump_sheet(css_stylesheet *sheet, char *buf, size_t *buflen) { css_rule *rule; for (rule = sheet->rule_list; rule != NULL; rule = rule->next) { switch (rule->type) { case CSS_RULE_SELECTOR: dump_rule_selector((css_rule_selector *) rule, &buf, buflen, 1); break; case CSS_RULE_CHARSET: dump_rule_charset((css_rule_charset *) rule, &buf, buflen); break; case CSS_RULE_IMPORT: dump_rule_import((css_rule_import *) rule, &buf, buflen); break; case CSS_RULE_MEDIA: dump_rule_media((css_rule_media *) rule, &buf, buflen); break; case CSS_RULE_PAGE: dump_rule_page((css_rule_page *) rule, &buf, buflen); break; case CSS_RULE_FONT_FACE: dump_rule_font_face((css_rule_font_face *) rule, &buf, buflen); break; default: { int written = sprintf(buf, "Unhandled rule type %d\n", rule->type); *buflen -= written; buf += written; } break; } } } void dump_rule_selector(css_rule_selector *s, char **buf, size_t *buflen, uint32_t depth) { uint32_t i; char *ptr = *buf; *ptr++ = '|'; for (i = 0; i < depth; i++) *ptr++ = ' '; /* Build selector string */ for (i = 0; i < s->base.items; i++) { dump_selector_list(s->selectors[i], &ptr); if (i != (uint32_t) (s->base.items - 1)) { memcpy(ptr, ", ", 2); ptr += 2; } } *ptr++ = '\n'; if (s->style != NULL) dump_bytecode(s->style, &ptr, depth + 1); *buflen -= ptr - *buf; *buf = ptr; } void dump_rule_charset(css_rule_charset *s, char **buf, size_t *buflen) { char *ptr = *buf; ptr += sprintf(ptr, "| @charset("); dump_string(s->encoding, &ptr); *ptr++ = ')'; *ptr++ = '\n'; *buflen -= ptr - *buf; *buf = ptr; } void dump_rule_import(css_rule_import *s, char **buf, size_t *buflen) { char *ptr = *buf; ptr += sprintf(ptr, "| @import url(\"%.*s\")", (int) lwc_string_length(s->url), lwc_string_data(s->url)); /** \todo media list */ *ptr++ = '\n'; *buflen -= ptr - *buf; *buf = ptr; } void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen) { char *ptr = *buf; css_rule *rule; ptr += sprintf(ptr, "| @media "); /* \todo media list */ *ptr++ = '\n'; for (rule = s->first_child; rule != NULL; rule = rule->next) { size_t len = *buflen - (ptr - *buf); dump_rule_selector((css_rule_selector *) rule, &ptr, &len, 2); } *buflen -= ptr - *buf; *buf = ptr; } void dump_rule_page(css_rule_page *s, char **buf, size_t *buflen) { char *ptr = *buf; ptr += sprintf(ptr, "| @page "); if (s->selector != NULL) dump_selector_list(s->selector, &ptr); *ptr++ = '\n'; if (s->style != NULL) dump_bytecode(s->style, &ptr, 2); *buflen -= ptr - *buf; *buf = ptr; } void dump_rule_font_face(css_rule_font_face *s, char **buf, size_t *buflen) { char *ptr = *buf; ptr += sprintf(ptr, "| @font-face "); if (s->font_face != NULL) { dump_font_face(s->font_face, &ptr); } *ptr++ = '\n'; *buflen -= ptr - *buf; *buf = ptr; } void dump_selector_list(css_selector *list, char **ptr) { if (list->combinator != NULL) { dump_selector_list(list->combinator, ptr); } switch (list->data.comb) { case CSS_COMBINATOR_NONE: break; case CSS_COMBINATOR_ANCESTOR: (*ptr)[0] = ' '; *ptr += 1; break; case CSS_COMBINATOR_PARENT: memcpy(*ptr, " > ", 3); *ptr += 3; break; case CSS_COMBINATOR_SIBLING: memcpy(*ptr, " + ", 3); *ptr += 3; break; case CSS_COMBINATOR_GENERIC_SIBLING: memcpy(*ptr, " + ", 3); *ptr += 3; break; } dump_selector(list, ptr); } void dump_selector(css_selector *selector, char **ptr) { css_selector_detail *d = &selector->data; while (true) { dump_selector_detail(d, ptr); if (d->next == 0) break; d++; } } void dump_selector_detail(css_selector_detail *detail, char **ptr) { if (detail->negate) *ptr += sprintf(*ptr, ":not("); switch (detail->type) { case CSS_SELECTOR_ELEMENT: if (lwc_string_length(detail->qname.name) == 1 && lwc_string_data(detail->qname.name)[0] == '*' && detail->next == 0) { dump_string(detail->qname.name, ptr); } else if (lwc_string_length(detail->qname.name) != 1 || lwc_string_data(detail->qname.name)[0] != '*') { dump_string(detail->qname.name, ptr); } break; case CSS_SELECTOR_CLASS: **ptr = '.'; *ptr += 1; dump_string(detail->qname.name, ptr); break; case CSS_SELECTOR_ID: **ptr = '#'; *ptr += 1; dump_string(detail->qname.name, ptr); break; case CSS_SELECTOR_PSEUDO_CLASS: case CSS_SELECTOR_PSEUDO_ELEMENT: **ptr = ':'; *ptr += 1; dump_string(detail->qname.name, ptr); if (detail->value_type == CSS_SELECTOR_DETAIL_VALUE_STRING) { if (detail->value.string != NULL) { **ptr = '('; *ptr += 1; dump_string(detail->value.string, ptr); **ptr = ')'; *ptr += 1; } } else { *ptr += sprintf(*ptr, "(%dn+%d)", detail->value.nth.a, detail->value.nth.b); } break; case CSS_SELECTOR_ATTRIBUTE: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); **ptr = ']'; *ptr += 1; break; case CSS_SELECTOR_ATTRIBUTE_EQUAL: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '='; (*ptr)[1] = '"'; *ptr += 2; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_DASHMATCH: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '|'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_INCLUDES: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '~'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_PREFIX: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '^'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_SUFFIX: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '$'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; case CSS_SELECTOR_ATTRIBUTE_SUBSTRING: **ptr = '['; *ptr += 1; dump_string(detail->qname.name, ptr); (*ptr)[0] = '*'; (*ptr)[1] = '='; (*ptr)[2] = '"'; *ptr += 3; dump_string(detail->value.string, ptr); (*ptr)[0] = '"'; (*ptr)[1] = ']'; *ptr += 2; break; } if (detail->negate) *ptr += sprintf(*ptr, ")"); } /** * Opcode names, indexed by opcode */ static const char *opcode_names[] = { "azimuth", "background-attachment", "background-color", "background-image", "background-position", "background-repeat", "border-collapse", "border-spacing", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", "bottom", "caption-side", "clear", "clip", "color", "content", "counter-increment", "counter-reset", "cue-after", "cue-before", "cursor", "direction", "display", "elevation", "empty-cells", "float", "font-family", "font-size", "font-style", "font-variant", "font-weight", "height", "left", "letter-spacing", "line-height", "list-style-image", "list-style-position", "list-style-type", "margin-top", "margin-right", "margin-bottom", "margin-left", "max-height", "max-width", "min-height", "min-width", "orphans", "outline-color", "outline-style", "outline-width", "overflow-x", "padding-top", "padding-right", "padding-bottom", "padding-left", "page-break-after", "page-break-before", "page-break-inside", "pause-after", "pause-before", "pitch-range", "pitch", "play-during", "position", "quotes", "richness", "right", "speak-header", "speak-numeral", "speak-punctuation", "speak", "speech-rate", "stress", "table-layout", "text-align", "text-decoration", "text-indent", "text-transform", "top", "unicode-bidi", "vertical-align", "visibility", "voice-family", "volume", "white-space", "widows", "width", "word-spacing", "z-index", "opacity", "break-after", "break-before", "break-inside", "column-count", "column-fill", "column-gap", "column-rule-color", "column-rule-style", "column-rule-width", "column-span", "column-width", "writing-mode", "overflow-y", }; static void dump_css_fixed(css_fixed f, char **ptr) { #define ABS(x) (uint32_t)((x) < 0 ? -(x) : (x)) uint32_t uintpart = FIXTOINT(ABS(f)); /* + 500 to ensure round to nearest (division will truncate) */ uint32_t fracpart = ((ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10); #undef ABS size_t flen = 0; char tmp[20]; size_t tlen = 0; char *buf = *ptr; if (f < 0) { buf[0] = '-'; buf++; } do { tmp[tlen] = "0123456789"[uintpart % 10]; tlen++; uintpart /= 10; } while (tlen < 20 && uintpart != 0); while (tlen > 0) { buf[0] = tmp[--tlen]; buf++; } buf[0] = '.'; buf++; do { tmp[tlen] = "0123456789"[fracpart % 10]; tlen++; fracpart /= 10; } while (tlen < 20 && fracpart != 0); while (tlen > 0) { buf[0] = tmp[--tlen]; buf++; flen++; } while (flen < 3) { buf[0] = '0'; buf++; flen++; } buf[0] = '\0'; *ptr = buf; } static void dump_number(css_fixed val, char **ptr) { if (INTTOFIX(FIXTOINT(val)) == val) *ptr += sprintf(*ptr, "%d", FIXTOINT(val)); else dump_css_fixed(val, ptr); } static void dump_unit(css_fixed val, uint32_t unit, char **ptr) { dump_number(val, ptr); switch (unit) { case UNIT_PX: *ptr += sprintf(*ptr, "px"); break; case UNIT_EX: *ptr += sprintf(*ptr, "ex"); break; case UNIT_EM: *ptr += sprintf(*ptr, "em"); break; case UNIT_IN: *ptr += sprintf(*ptr, "in"); break; case UNIT_CM: *ptr += sprintf(*ptr, "cm"); break; case UNIT_MM: *ptr += sprintf(*ptr, "mm"); break; case UNIT_PT: *ptr += sprintf(*ptr, "pt"); break; case UNIT_PC: *ptr += sprintf(*ptr, "pc"); break; case UNIT_PCT: *ptr += sprintf(*ptr, "%%"); break; case UNIT_DEG: *ptr += sprintf(*ptr, "deg"); break; case UNIT_GRAD: *ptr += sprintf(*ptr, "grad"); break; case UNIT_RAD: *ptr += sprintf(*ptr, "rad"); break; case UNIT_MS: *ptr += sprintf(*ptr, "ms"); break; case UNIT_S: *ptr += sprintf(*ptr, "s"); break; case UNIT_HZ: *ptr += sprintf(*ptr, "Hz"); break; case UNIT_KHZ: *ptr += sprintf(*ptr, "kHz"); break; } } static void dump_counter(lwc_string *name, uint32_t value, char **ptr) { *ptr += sprintf(*ptr, "counter(%.*s", (int) lwc_string_length(name), lwc_string_data(name)); value >>= CONTENT_COUNTER_STYLE_SHIFT; switch (value) { case LIST_STYLE_TYPE_DISC: *ptr += sprintf(*ptr, ", disc"); break; case LIST_STYLE_TYPE_CIRCLE: *ptr += sprintf(*ptr, ", circle"); break; case LIST_STYLE_TYPE_SQUARE: *ptr += sprintf(*ptr, ", square"); break; case LIST_STYLE_TYPE_DECIMAL: break; case LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO: *ptr += sprintf(*ptr, ", decimal-leading-zero"); break; case LIST_STYLE_TYPE_LOWER_ROMAN: *ptr += sprintf(*ptr, ", lower-roman"); break; case LIST_STYLE_TYPE_UPPER_ROMAN: *ptr += sprintf(*ptr, ", upper-roman"); break; case LIST_STYLE_TYPE_LOWER_GREEK: *ptr += sprintf(*ptr, ", lower-greek"); break; case LIST_STYLE_TYPE_LOWER_LATIN: *ptr += sprintf(*ptr, ", lower-latin"); break; case LIST_STYLE_TYPE_UPPER_LATIN: *ptr += sprintf(*ptr, ", upper-latin"); break; case LIST_STYLE_TYPE_ARMENIAN: *ptr += sprintf(*ptr, ", armenian"); break; case LIST_STYLE_TYPE_GEORGIAN: *ptr += sprintf(*ptr, ", georgian"); break; case LIST_STYLE_TYPE_LOWER_ALPHA: *ptr += sprintf(*ptr, ", lower-alpha"); break; case LIST_STYLE_TYPE_UPPER_ALPHA: *ptr += sprintf(*ptr, ", upper-alpha"); break; case LIST_STYLE_TYPE_NONE: *ptr += sprintf(*ptr, ", none"); break; } *ptr += sprintf(*ptr, ")"); } static void dump_counters(lwc_string *name, lwc_string *separator, uint32_t value, char **ptr) { *ptr += sprintf(*ptr, "counter(%.*s, %.*s", (int) lwc_string_length(name), lwc_string_data(name), (int) lwc_string_length(separator), lwc_string_data(separator)); value >>= CONTENT_COUNTER_STYLE_SHIFT; switch (value) { case LIST_STYLE_TYPE_DISC: *ptr += sprintf(*ptr, ", disc"); break; case LIST_STYLE_TYPE_CIRCLE: *ptr += sprintf(*ptr, ", circle"); break; case LIST_STYLE_TYPE_SQUARE: *ptr += sprintf(*ptr, ", square"); break; case LIST_STYLE_TYPE_DECIMAL: break; case LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO: *ptr += sprintf(*ptr, ", decimal-leading-zero"); break; case LIST_STYLE_TYPE_LOWER_ROMAN: *ptr += sprintf(*ptr, ", lower-roman"); break; case LIST_STYLE_TYPE_UPPER_ROMAN: *ptr += sprintf(*ptr, ", upper-roman"); break; case LIST_STYLE_TYPE_LOWER_GREEK: *ptr += sprintf(*ptr, ", lower-greek"); break; case LIST_STYLE_TYPE_LOWER_LATIN: *ptr += sprintf(*ptr, ", lower-latin"); break; case LIST_STYLE_TYPE_UPPER_LATIN: *ptr += sprintf(*ptr, ", upper-latin"); break; case LIST_STYLE_TYPE_ARMENIAN: *ptr += sprintf(*ptr, ", armenian"); break; case LIST_STYLE_TYPE_GEORGIAN: *ptr += sprintf(*ptr, ", georgian"); break; case LIST_STYLE_TYPE_LOWER_ALPHA: *ptr += sprintf(*ptr, ", lower-alpha"); break; case LIST_STYLE_TYPE_UPPER_ALPHA: *ptr += sprintf(*ptr, ", upper-alpha"); break; case LIST_STYLE_TYPE_NONE: *ptr += sprintf(*ptr, ", none"); break; } *ptr += sprintf(*ptr, ")"); } void dump_bytecode(css_style *style, char **ptr, uint32_t depth) { void *bytecode = style->bytecode; size_t length = (style->used * sizeof(css_code_t)); uint32_t offset = 0; #define ADVANCE(n) do { \ offset += (n); \ bytecode = ((uint8_t *) bytecode) + (n); \ } while(0) while (offset < length) { opcode_t op; uint32_t value; uint32_t opv = *((uint32_t *) bytecode); ADVANCE(sizeof(opv)); op = getOpcode(opv); *((*ptr)++) = '|'; for (uint32_t i = 0; i < depth; i++) *((*ptr)++) = ' '; *ptr += sprintf(*ptr, "%s: ", opcode_names[op]); if (isInherit(opv)) { *ptr += sprintf(*ptr, "inherit"); } else { value = getValue(opv); switch (op) { case CSS_PROP_AZIMUTH: switch (value & ~AZIMUTH_BEHIND) { case AZIMUTH_ANGLE: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case AZIMUTH_LEFTWARDS: *ptr += sprintf(*ptr, "leftwards"); break; case AZIMUTH_RIGHTWARDS: *ptr += sprintf(*ptr, "rightwards"); break; case AZIMUTH_LEFT_SIDE: *ptr += sprintf(*ptr, "left-side"); break; case AZIMUTH_FAR_LEFT: *ptr += sprintf(*ptr, "far-left"); break; case AZIMUTH_LEFT: *ptr += sprintf(*ptr, "left"); break; case AZIMUTH_CENTER_LEFT: *ptr += sprintf(*ptr, "center-left"); break; case AZIMUTH_CENTER: *ptr += sprintf(*ptr, "center"); break; case AZIMUTH_CENTER_RIGHT: *ptr += sprintf(*ptr, "center-right"); break; case AZIMUTH_RIGHT: *ptr += sprintf(*ptr, "right"); break; case AZIMUTH_FAR_RIGHT: *ptr += sprintf(*ptr, "far-right"); break; case AZIMUTH_RIGHT_SIDE: *ptr += sprintf(*ptr, "right-side"); break; } if (value & AZIMUTH_BEHIND) *ptr += sprintf(*ptr, " behind"); break; case CSS_PROP_BACKGROUND_ATTACHMENT: switch (value) { case BACKGROUND_ATTACHMENT_FIXED: *ptr += sprintf(*ptr, "fixed"); break; case BACKGROUND_ATTACHMENT_SCROLL: *ptr += sprintf(*ptr, "scroll"); break; } break; case CSS_PROP_BORDER_TOP_COLOR: case CSS_PROP_BORDER_RIGHT_COLOR: case CSS_PROP_BORDER_BOTTOM_COLOR: case CSS_PROP_BORDER_LEFT_COLOR: case CSS_PROP_BACKGROUND_COLOR: case CSS_PROP_COLUMN_RULE_COLOR: assert(BACKGROUND_COLOR_TRANSPARENT == (enum op_background_color) BORDER_COLOR_TRANSPARENT); assert(BACKGROUND_COLOR_CURRENT_COLOR == (enum op_background_color) BORDER_COLOR_CURRENT_COLOR); assert(BACKGROUND_COLOR_SET == (enum op_background_color) BORDER_COLOR_SET); switch (value) { case BACKGROUND_COLOR_TRANSPARENT: *ptr += sprintf(*ptr, "transparent"); break; case BACKGROUND_COLOR_CURRENT_COLOR: *ptr += sprintf(*ptr, "currentColor"); break; case BACKGROUND_COLOR_SET: { uint32_t colour = *((uint32_t *) bytecode); ADVANCE(sizeof(colour)); *ptr += sprintf(*ptr, "#%08x", colour); } break; } break; case CSS_PROP_BACKGROUND_IMAGE: case CSS_PROP_CUE_AFTER: case CSS_PROP_CUE_BEFORE: case CSS_PROP_LIST_STYLE_IMAGE: assert(BACKGROUND_IMAGE_NONE == (enum op_background_image) CUE_AFTER_NONE); assert(BACKGROUND_IMAGE_URI == (enum op_background_image) CUE_AFTER_URI); assert(BACKGROUND_IMAGE_NONE == (enum op_background_image) CUE_BEFORE_NONE); assert(BACKGROUND_IMAGE_URI == (enum op_background_image) CUE_BEFORE_URI); assert(BACKGROUND_IMAGE_NONE == (enum op_background_image) LIST_STYLE_IMAGE_NONE); assert(BACKGROUND_IMAGE_URI == (enum op_background_image) LIST_STYLE_IMAGE_URI); switch (value) { case BACKGROUND_IMAGE_NONE: *ptr += sprintf(*ptr, "none"); break; case BACKGROUND_IMAGE_URI: { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "url('%.*s')", (int) lwc_string_length(he), lwc_string_data(he)); } break; } break; case CSS_PROP_BACKGROUND_POSITION: switch (value & 0xf0) { case BACKGROUND_POSITION_HORZ_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case BACKGROUND_POSITION_HORZ_CENTER: *ptr += sprintf(*ptr, "center"); break; case BACKGROUND_POSITION_HORZ_RIGHT: *ptr += sprintf(*ptr, "right"); break; case BACKGROUND_POSITION_HORZ_LEFT: *ptr += sprintf(*ptr, "left"); break; } *ptr += sprintf(*ptr, " "); switch (value & 0x0f) { case BACKGROUND_POSITION_VERT_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case BACKGROUND_POSITION_VERT_CENTER: *ptr += sprintf(*ptr, "center"); break; case BACKGROUND_POSITION_VERT_BOTTOM: *ptr += sprintf(*ptr, "bottom"); break; case BACKGROUND_POSITION_VERT_TOP: *ptr += sprintf(*ptr, "top"); break; } break; case CSS_PROP_BACKGROUND_REPEAT: switch (value) { case BACKGROUND_REPEAT_NO_REPEAT: *ptr += sprintf(*ptr, "no-repeat"); break; case BACKGROUND_REPEAT_REPEAT_X: *ptr += sprintf(*ptr, "repeat-x"); break; case BACKGROUND_REPEAT_REPEAT_Y: *ptr += sprintf(*ptr, "repeat-y"); break; case BACKGROUND_REPEAT_REPEAT: *ptr += sprintf(*ptr, "repeat"); break; } break; case CSS_PROP_BORDER_COLLAPSE: switch (value) { case BORDER_COLLAPSE_SEPARATE: *ptr += sprintf(*ptr, "separate"); break; case BORDER_COLLAPSE_COLLAPSE: *ptr += sprintf(*ptr, "collapse"); break; } break; case CSS_PROP_BORDER_SPACING: switch (value) { case BORDER_SPACING_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; } break; case CSS_PROP_BORDER_TOP_STYLE: case CSS_PROP_BORDER_RIGHT_STYLE: case CSS_PROP_BORDER_BOTTOM_STYLE: case CSS_PROP_BORDER_LEFT_STYLE: case CSS_PROP_COLUMN_RULE_STYLE: case CSS_PROP_OUTLINE_STYLE: assert(BORDER_STYLE_NONE == (enum op_border_style) OUTLINE_STYLE_NONE); assert(BORDER_STYLE_NONE == (enum op_border_style) COLUMN_RULE_STYLE_NONE); assert(BORDER_STYLE_HIDDEN == (enum op_border_style) OUTLINE_STYLE_HIDDEN); assert(BORDER_STYLE_HIDDEN == (enum op_border_style) COLUMN_RULE_STYLE_HIDDEN); assert(BORDER_STYLE_DOTTED == (enum op_border_style) OUTLINE_STYLE_DOTTED); assert(BORDER_STYLE_DOTTED == (enum op_border_style) COLUMN_RULE_STYLE_DOTTED); assert(BORDER_STYLE_DASHED == (enum op_border_style) OUTLINE_STYLE_DASHED); assert(BORDER_STYLE_DASHED == (enum op_border_style) COLUMN_RULE_STYLE_DASHED); assert(BORDER_STYLE_SOLID == (enum op_border_style) OUTLINE_STYLE_SOLID); assert(BORDER_STYLE_SOLID == (enum op_border_style) COLUMN_RULE_STYLE_SOLID); assert(BORDER_STYLE_DOUBLE == (enum op_border_style) OUTLINE_STYLE_DOUBLE); assert(BORDER_STYLE_DOUBLE == (enum op_border_style) COLUMN_RULE_STYLE_DOUBLE); assert(BORDER_STYLE_GROOVE == (enum op_border_style) OUTLINE_STYLE_GROOVE); assert(BORDER_STYLE_GROOVE == (enum op_border_style) COLUMN_RULE_STYLE_GROOVE); assert(BORDER_STYLE_RIDGE == (enum op_border_style) OUTLINE_STYLE_RIDGE); assert(BORDER_STYLE_RIDGE == (enum op_border_style) COLUMN_RULE_STYLE_RIDGE); assert(BORDER_STYLE_INSET == (enum op_border_style) OUTLINE_STYLE_INSET); assert(BORDER_STYLE_INSET == (enum op_border_style) COLUMN_RULE_STYLE_INSET); assert(BORDER_STYLE_OUTSET == (enum op_border_style) OUTLINE_STYLE_OUTSET); assert(BORDER_STYLE_OUTSET == (enum op_border_style) COLUMN_RULE_STYLE_OUTSET); switch (value) { case BORDER_STYLE_NONE: *ptr += sprintf(*ptr, "none"); break; case BORDER_STYLE_HIDDEN: *ptr += sprintf(*ptr, "hidden"); break; case BORDER_STYLE_DOTTED: *ptr += sprintf(*ptr, "dotted"); break; case BORDER_STYLE_DASHED: *ptr += sprintf(*ptr, "dashed"); break; case BORDER_STYLE_SOLID: *ptr += sprintf(*ptr, "solid"); break; case BORDER_STYLE_DOUBLE: *ptr += sprintf(*ptr, "double"); break; case BORDER_STYLE_GROOVE: *ptr += sprintf(*ptr, "groove"); break; case BORDER_STYLE_RIDGE: *ptr += sprintf(*ptr, "ridge"); break; case BORDER_STYLE_INSET: *ptr += sprintf(*ptr, "inset"); break; case BORDER_STYLE_OUTSET: *ptr += sprintf(*ptr, "outset"); break; } break; case CSS_PROP_BORDER_TOP_WIDTH: case CSS_PROP_BORDER_RIGHT_WIDTH: case CSS_PROP_BORDER_BOTTOM_WIDTH: case CSS_PROP_BORDER_LEFT_WIDTH: case CSS_PROP_COLUMN_RULE_WIDTH: case CSS_PROP_OUTLINE_WIDTH: assert(BORDER_WIDTH_SET == (enum op_border_width) OUTLINE_WIDTH_SET); assert(BORDER_WIDTH_THIN == (enum op_border_width) OUTLINE_WIDTH_THIN); assert(BORDER_WIDTH_MEDIUM == (enum op_border_width) OUTLINE_WIDTH_MEDIUM); assert(BORDER_WIDTH_THICK == (enum op_border_width) OUTLINE_WIDTH_THICK); switch (value) { case BORDER_WIDTH_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case BORDER_WIDTH_THIN: *ptr += sprintf(*ptr, "thin"); break; case BORDER_WIDTH_MEDIUM: *ptr += sprintf(*ptr, "medium"); break; case BORDER_WIDTH_THICK: *ptr += sprintf(*ptr, "thick"); break; } break; case CSS_PROP_MARGIN_TOP: case CSS_PROP_MARGIN_RIGHT: case CSS_PROP_MARGIN_BOTTOM: case CSS_PROP_MARGIN_LEFT: case CSS_PROP_BOTTOM: case CSS_PROP_LEFT: case CSS_PROP_RIGHT: case CSS_PROP_TOP: case CSS_PROP_HEIGHT: case CSS_PROP_WIDTH: case CSS_PROP_COLUMN_WIDTH: assert(BOTTOM_SET == (enum op_bottom) LEFT_SET); assert(BOTTOM_AUTO == (enum op_bottom) LEFT_AUTO); assert(BOTTOM_SET == (enum op_bottom) RIGHT_SET); assert(BOTTOM_AUTO == (enum op_bottom) RIGHT_AUTO); assert(BOTTOM_SET == (enum op_bottom) TOP_SET); assert(BOTTOM_AUTO == (enum op_bottom) TOP_AUTO); assert(BOTTOM_SET == (enum op_bottom) HEIGHT_SET); assert(BOTTOM_AUTO == (enum op_bottom) HEIGHT_AUTO); assert(BOTTOM_SET == (enum op_bottom) MARGIN_SET); assert(BOTTOM_AUTO == (enum op_bottom) MARGIN_AUTO); assert(BOTTOM_SET == (enum op_bottom) WIDTH_SET); assert(BOTTOM_AUTO == (enum op_bottom) WIDTH_AUTO); assert(BOTTOM_SET == (enum op_bottom) COLUMN_WIDTH_SET); assert(BOTTOM_AUTO == (enum op_bottom) COLUMN_WIDTH_AUTO); switch (value) { case BOTTOM_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case BOTTOM_AUTO: *ptr += sprintf(*ptr, "auto"); break; } break; case CSS_PROP_BREAK_AFTER: case CSS_PROP_BREAK_BEFORE: assert(BREAK_AFTER_AUTO == (enum op_break_after) BREAK_BEFORE_AUTO); assert(BREAK_AFTER_ALWAYS == (enum op_break_after) BREAK_BEFORE_ALWAYS); assert(BREAK_AFTER_AVOID == (enum op_break_after) BREAK_BEFORE_AVOID); assert(BREAK_AFTER_LEFT == (enum op_break_after) BREAK_BEFORE_LEFT); assert(BREAK_AFTER_RIGHT == (enum op_break_after) BREAK_BEFORE_RIGHT); assert(BREAK_AFTER_PAGE == (enum op_break_after) BREAK_BEFORE_PAGE); assert(BREAK_AFTER_COLUMN == (enum op_break_after) BREAK_BEFORE_COLUMN); assert(BREAK_AFTER_AVOID_PAGE == (enum op_break_after) BREAK_BEFORE_AVOID_PAGE); assert(BREAK_AFTER_AVOID_COLUMN == (enum op_break_after) BREAK_BEFORE_AVOID_COLUMN); switch (value) { case BREAK_AFTER_AUTO: *ptr += sprintf(*ptr, "auto"); break; case BREAK_AFTER_ALWAYS: *ptr += sprintf(*ptr, "always"); break; case BREAK_AFTER_AVOID: *ptr += sprintf(*ptr, "avoid"); break; case BREAK_AFTER_LEFT: *ptr += sprintf(*ptr, "left"); break; case BREAK_AFTER_RIGHT: *ptr += sprintf(*ptr, "right"); break; case BREAK_AFTER_PAGE: *ptr += sprintf(*ptr, "page"); break; case BREAK_AFTER_COLUMN: *ptr += sprintf(*ptr, "column"); break; case BREAK_AFTER_AVOID_PAGE: *ptr += sprintf(*ptr, "avoid-page"); break; case BREAK_AFTER_AVOID_COLUMN: *ptr += sprintf(*ptr, "avoid-column"); break; } break; case CSS_PROP_BREAK_INSIDE: switch (value) { case BREAK_INSIDE_AUTO: *ptr += sprintf(*ptr, "auto"); break; case BREAK_INSIDE_AVOID: *ptr += sprintf(*ptr, "avoid"); break; case BREAK_INSIDE_AVOID_PAGE: *ptr += sprintf(*ptr, "avoid-page"); break; case BREAK_INSIDE_AVOID_COLUMN: *ptr += sprintf(*ptr, "avoid-column"); break; } break; case CSS_PROP_CAPTION_SIDE: switch (value) { case CAPTION_SIDE_TOP: *ptr += sprintf(*ptr, "top"); break; case CAPTION_SIDE_BOTTOM: *ptr += sprintf(*ptr, "bottom"); break; } break; case CSS_PROP_CLEAR: switch (value) { case CLEAR_NONE: *ptr += sprintf(*ptr, "none"); break; case CLEAR_LEFT: *ptr += sprintf(*ptr, "left"); break; case CLEAR_RIGHT: *ptr += sprintf(*ptr, "right"); break; case CLEAR_BOTH: *ptr += sprintf(*ptr, "both"); break; } break; case CSS_PROP_CLIP: if ((value & CLIP_SHAPE_MASK) == CLIP_SHAPE_RECT) { *ptr += sprintf(*ptr, "rect("); if (value & CLIP_RECT_TOP_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } *ptr += sprintf(*ptr, ", "); if (value & CLIP_RECT_RIGHT_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } *ptr += sprintf(*ptr, ", "); if (value & CLIP_RECT_BOTTOM_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } *ptr += sprintf(*ptr, ", "); if (value & CLIP_RECT_LEFT_AUTO) { *ptr += sprintf(*ptr, "auto"); } else { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } *ptr += sprintf(*ptr, ")"); } else *ptr += sprintf(*ptr, "auto"); break; case CSS_PROP_COLOR: switch (value) { case COLOR_TRANSPARENT: *ptr += sprintf(*ptr, "transparent"); break; case COLOR_CURRENT_COLOR: *ptr += sprintf(*ptr, "currentColor"); break; case COLOR_SET: { uint32_t colour = *((uint32_t *) bytecode); ADVANCE(sizeof(colour)); *ptr += sprintf(*ptr, "#%08x", colour); } break; } break; case CSS_PROP_COLUMN_COUNT: switch (value) { case COLUMN_COUNT_SET: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case COLUMN_COUNT_AUTO: *ptr += sprintf(*ptr, "auto"); break; } break; case CSS_PROP_COLUMN_FILL: switch (value) { case COLUMN_FILL_BALANCE: *ptr += sprintf(*ptr, "balance"); break; case COLUMN_FILL_AUTO: *ptr += sprintf(*ptr, "auto"); break; } break; case CSS_PROP_COLUMN_GAP: switch (value) { case COLUMN_GAP_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case COLUMN_GAP_NORMAL: *ptr += sprintf(*ptr, "normal"); break; } break; case CSS_PROP_COLUMN_SPAN: switch (value) { case COLUMN_SPAN_NONE: *ptr += sprintf(*ptr, "none"); break; case COLUMN_SPAN_ALL: *ptr += sprintf(*ptr, "all"); break; } break; case CSS_PROP_CONTENT: if (value == CONTENT_NORMAL) { *ptr += sprintf(*ptr, "normal"); break; } else if (value == CONTENT_NONE) { *ptr += sprintf(*ptr, "none"); break; } while (value != CONTENT_NORMAL) { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; const char *end = ""; switch (value & 0xff) { case CONTENT_COUNTER: css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); dump_counter(he, value, ptr); break; case CONTENT_COUNTERS: { lwc_string *sep; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); sep = *((lwc_string **) bytecode); ADVANCE(sizeof(sep)); dump_counters(he, sep, value, ptr); } break; case CONTENT_URI: case CONTENT_ATTR: case CONTENT_STRING: css__stylesheet_string_get(style->sheet, snum, &he); if (value == CONTENT_URI) *ptr += sprintf(*ptr, "url("); if (value == CONTENT_ATTR) *ptr += sprintf(*ptr, "attr("); if (value != CONTENT_STRING) end = ")"; ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "'%.*s'%s", (int) lwc_string_length(he), lwc_string_data(he), end); break; case CONTENT_OPEN_QUOTE: *ptr += sprintf(*ptr, "open-quote"); break; case CONTENT_CLOSE_QUOTE: *ptr += sprintf(*ptr, "close-quote"); break; case CONTENT_NO_OPEN_QUOTE: *ptr += sprintf(*ptr, "no-open-quote"); break; case CONTENT_NO_CLOSE_QUOTE: *ptr += sprintf(*ptr, "no-close-quote"); break; } value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); if (value != CONTENT_NORMAL) *ptr += sprintf(*ptr, " "); } break; case CSS_PROP_COUNTER_INCREMENT: case CSS_PROP_COUNTER_RESET: assert(COUNTER_INCREMENT_NONE == (enum op_counter_increment) COUNTER_RESET_NONE); assert(COUNTER_INCREMENT_NAMED == (enum op_counter_increment) COUNTER_RESET_NAMED); switch (value) { case COUNTER_INCREMENT_NAMED: while (value != COUNTER_INCREMENT_NONE) { css_fixed val; uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "%.*s ", (int)lwc_string_length(he), lwc_string_data(he)); val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); if (value != COUNTER_INCREMENT_NONE) *ptr += sprintf(*ptr, " "); } break; case COUNTER_INCREMENT_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_CURSOR: while (value == CURSOR_URI) { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "url('%.*s'), ", (int) lwc_string_length(he), lwc_string_data(he)); value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); } switch (value) { case CURSOR_AUTO: *ptr += sprintf(*ptr, "auto"); break; case CURSOR_CROSSHAIR: *ptr += sprintf(*ptr, "crosshair"); break; case CURSOR_DEFAULT: *ptr += sprintf(*ptr, "default"); break; case CURSOR_POINTER: *ptr += sprintf(*ptr, "pointer"); break; case CURSOR_MOVE: *ptr += sprintf(*ptr, "move"); break; case CURSOR_E_RESIZE: *ptr += sprintf(*ptr, "e-resize"); break; case CURSOR_NE_RESIZE: *ptr += sprintf(*ptr, "ne-resize"); break; case CURSOR_NW_RESIZE: *ptr += sprintf(*ptr, "nw-resize"); break; case CURSOR_N_RESIZE: *ptr += sprintf(*ptr, "n-resize"); break; case CURSOR_SE_RESIZE: *ptr += sprintf(*ptr, "se-resize"); break; case CURSOR_SW_RESIZE: *ptr += sprintf(*ptr, "sw-resize"); break; case CURSOR_S_RESIZE: *ptr += sprintf(*ptr, "s-resize"); break; case CURSOR_W_RESIZE: *ptr += sprintf(*ptr, "w-resize"); break; case CURSOR_TEXT: *ptr += sprintf(*ptr, "text"); break; case CURSOR_WAIT: *ptr += sprintf(*ptr, "wait"); break; case CURSOR_HELP: *ptr += sprintf(*ptr, "help"); break; case CURSOR_PROGRESS: *ptr += sprintf(*ptr, "progress"); break; } break; case CSS_PROP_DIRECTION: switch (value) { case DIRECTION_LTR: *ptr += sprintf(*ptr, "ltr"); break; case DIRECTION_RTL: *ptr += sprintf(*ptr, "rtl"); break; } break; case CSS_PROP_DISPLAY: switch (value) { case DISPLAY_INLINE: *ptr += sprintf(*ptr, "inline"); break; case DISPLAY_BLOCK: *ptr += sprintf(*ptr, "block"); break; case DISPLAY_LIST_ITEM: *ptr += sprintf(*ptr, "list-item"); break; case DISPLAY_RUN_IN: *ptr += sprintf(*ptr, "run-in"); break; case DISPLAY_INLINE_BLOCK: *ptr += sprintf(*ptr, "inline-block"); break; case DISPLAY_TABLE: *ptr += sprintf(*ptr, "table"); break; case DISPLAY_INLINE_TABLE: *ptr += sprintf(*ptr, "inline-table"); break; case DISPLAY_TABLE_ROW_GROUP: *ptr += sprintf(*ptr, "table-row-group"); break; case DISPLAY_TABLE_HEADER_GROUP: *ptr += sprintf(*ptr, "table-header-group"); break; case DISPLAY_TABLE_FOOTER_GROUP: *ptr += sprintf(*ptr, "table-footer-group"); break; case DISPLAY_TABLE_ROW: *ptr += sprintf(*ptr, "table-row"); break; case DISPLAY_TABLE_COLUMN_GROUP: *ptr += sprintf(*ptr, "table-column-group"); break; case DISPLAY_TABLE_COLUMN: *ptr += sprintf(*ptr, "table-column"); break; case DISPLAY_TABLE_CELL: *ptr += sprintf(*ptr, "table-cell"); break; case DISPLAY_TABLE_CAPTION: *ptr += sprintf(*ptr, "table-caption"); break; case DISPLAY_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_ELEVATION: switch (value) { case ELEVATION_ANGLE: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case ELEVATION_BELOW: *ptr += sprintf(*ptr, "below"); break; case ELEVATION_LEVEL: *ptr += sprintf(*ptr, "level"); break; case ELEVATION_ABOVE: *ptr += sprintf(*ptr, "above"); break; case ELEVATION_HIGHER: *ptr += sprintf(*ptr, "higher"); break; case ELEVATION_LOWER: *ptr += sprintf(*ptr, "lower"); break; } break; case CSS_PROP_EMPTY_CELLS: switch (value) { case EMPTY_CELLS_SHOW: *ptr += sprintf(*ptr, "show"); break; case EMPTY_CELLS_HIDE: *ptr += sprintf(*ptr, "hide"); break; } break; case CSS_PROP_FLOAT: switch (value) { case FLOAT_LEFT: *ptr += sprintf(*ptr, "left"); break; case FLOAT_RIGHT: *ptr += sprintf(*ptr, "right"); break; case FLOAT_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_FONT_FAMILY: while (value != FONT_FAMILY_END) { switch (value) { case FONT_FAMILY_STRING: case FONT_FAMILY_IDENT_LIST: { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "'%.*s'", (int) lwc_string_length(he), lwc_string_data(he)); } break; case FONT_FAMILY_SERIF: *ptr += sprintf(*ptr, "serif"); break; case FONT_FAMILY_SANS_SERIF: *ptr += sprintf(*ptr, "sans-serif"); break; case FONT_FAMILY_CURSIVE: *ptr += sprintf(*ptr, "cursive"); break; case FONT_FAMILY_FANTASY: *ptr += sprintf(*ptr, "fantasy"); break; case FONT_FAMILY_MONOSPACE: *ptr += sprintf(*ptr, "monospace"); break; } value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); if (value != FONT_FAMILY_END) *ptr += sprintf(*ptr, ", "); } break; case CSS_PROP_FONT_SIZE: switch (value) { case FONT_SIZE_DIMENSION: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case FONT_SIZE_XX_SMALL: *ptr += sprintf(*ptr, "xx-small"); break; case FONT_SIZE_X_SMALL: *ptr += sprintf(*ptr, "x-small"); break; case FONT_SIZE_SMALL: *ptr += sprintf(*ptr, "small"); break; case FONT_SIZE_MEDIUM: *ptr += sprintf(*ptr, "medium"); break; case FONT_SIZE_LARGE: *ptr += sprintf(*ptr, "large"); break; case FONT_SIZE_X_LARGE: *ptr += sprintf(*ptr, "x-large"); break; case FONT_SIZE_XX_LARGE: *ptr += sprintf(*ptr, "xx-large"); break; case FONT_SIZE_LARGER: *ptr += sprintf(*ptr, "larger"); break; case FONT_SIZE_SMALLER: *ptr += sprintf(*ptr, "smaller"); break; } break; case CSS_PROP_FONT_STYLE: switch (value) { case FONT_STYLE_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case FONT_STYLE_ITALIC: *ptr += sprintf(*ptr, "italic"); break; case FONT_STYLE_OBLIQUE: *ptr += sprintf(*ptr, "oblique"); break; } break; case CSS_PROP_FONT_VARIANT: switch (value) { case FONT_VARIANT_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case FONT_VARIANT_SMALL_CAPS: *ptr += sprintf(*ptr, "small-caps"); break; } break; case CSS_PROP_FONT_WEIGHT: switch (value) { case FONT_WEIGHT_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case FONT_WEIGHT_BOLD: *ptr += sprintf(*ptr, "bold"); break; case FONT_WEIGHT_BOLDER: *ptr += sprintf(*ptr, "bolder"); break; case FONT_WEIGHT_LIGHTER: *ptr += sprintf(*ptr, "lighter"); break; case FONT_WEIGHT_100: *ptr += sprintf(*ptr, "100"); break; case FONT_WEIGHT_200: *ptr += sprintf(*ptr, "200"); break; case FONT_WEIGHT_300: *ptr += sprintf(*ptr, "300"); break; case FONT_WEIGHT_400: *ptr += sprintf(*ptr, "400"); break; case FONT_WEIGHT_500: *ptr += sprintf(*ptr, "500"); break; case FONT_WEIGHT_600: *ptr += sprintf(*ptr, "600"); break; case FONT_WEIGHT_700: *ptr += sprintf(*ptr, "700"); break; case FONT_WEIGHT_800: *ptr += sprintf(*ptr, "800"); break; case FONT_WEIGHT_900: *ptr += sprintf(*ptr, "900"); break; } break; case CSS_PROP_LETTER_SPACING: case CSS_PROP_WORD_SPACING: assert(LETTER_SPACING_SET == (enum op_letter_spacing) WORD_SPACING_SET); assert(LETTER_SPACING_NORMAL == (enum op_letter_spacing) WORD_SPACING_NORMAL); switch (value) { case LETTER_SPACING_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case LETTER_SPACING_NORMAL: *ptr += sprintf(*ptr, "normal"); break; } break; case CSS_PROP_LINE_HEIGHT: switch (value) { case LINE_HEIGHT_NUMBER: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case LINE_HEIGHT_DIMENSION: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case LINE_HEIGHT_NORMAL: *ptr += sprintf(*ptr, "normal"); break; } break; case CSS_PROP_LIST_STYLE_POSITION: switch (value) { case LIST_STYLE_POSITION_INSIDE: *ptr += sprintf(*ptr, "inside"); break; case LIST_STYLE_POSITION_OUTSIDE: *ptr += sprintf(*ptr, "outside"); break; } break; case CSS_PROP_LIST_STYLE_TYPE: switch (value) { case LIST_STYLE_TYPE_DISC: *ptr += sprintf(*ptr, "disc"); break; case LIST_STYLE_TYPE_CIRCLE: *ptr += sprintf(*ptr, "circle"); break; case LIST_STYLE_TYPE_SQUARE: *ptr += sprintf(*ptr, "square"); break; case LIST_STYLE_TYPE_DECIMAL: *ptr += sprintf(*ptr, "decimal"); break; case LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO: *ptr += sprintf(*ptr, "decimal-leading-zero"); break; case LIST_STYLE_TYPE_LOWER_ROMAN: *ptr += sprintf(*ptr, "lower-roman"); break; case LIST_STYLE_TYPE_UPPER_ROMAN: *ptr += sprintf(*ptr, "upper-roman"); break; case LIST_STYLE_TYPE_LOWER_GREEK: *ptr += sprintf(*ptr, "lower-greek"); break; case LIST_STYLE_TYPE_LOWER_LATIN: *ptr += sprintf(*ptr, "lower-latin"); break; case LIST_STYLE_TYPE_UPPER_LATIN: *ptr += sprintf(*ptr, "upper-latin"); break; case LIST_STYLE_TYPE_ARMENIAN: *ptr += sprintf(*ptr, "armenian"); break; case LIST_STYLE_TYPE_GEORGIAN: *ptr += sprintf(*ptr, "georgian"); break; case LIST_STYLE_TYPE_LOWER_ALPHA: *ptr += sprintf(*ptr, "lower-alpha"); break; case LIST_STYLE_TYPE_UPPER_ALPHA: *ptr += sprintf(*ptr, "upper-alpha"); break; case LIST_STYLE_TYPE_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_MAX_HEIGHT: case CSS_PROP_MAX_WIDTH: assert(MAX_HEIGHT_SET == (enum op_max_height) MAX_WIDTH_SET); assert(MAX_HEIGHT_NONE == (enum op_max_height) MAX_WIDTH_NONE); switch (value) { case MAX_HEIGHT_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case MAX_HEIGHT_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_OPACITY: switch (value) { case OPACITY_SET: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; } break; case CSS_PROP_PADDING_TOP: case CSS_PROP_PADDING_RIGHT: case CSS_PROP_PADDING_BOTTOM: case CSS_PROP_PADDING_LEFT: case CSS_PROP_MIN_HEIGHT: case CSS_PROP_MIN_WIDTH: case CSS_PROP_PAUSE_AFTER: case CSS_PROP_PAUSE_BEFORE: case CSS_PROP_TEXT_INDENT: assert(MIN_HEIGHT_SET == (enum op_min_height) MIN_WIDTH_SET); assert(MIN_HEIGHT_SET == (enum op_min_height) PADDING_SET); assert(MIN_HEIGHT_SET == (enum op_min_height) PAUSE_AFTER_SET); assert(MIN_HEIGHT_SET == (enum op_min_height) PAUSE_BEFORE_SET); assert(MIN_HEIGHT_SET == (enum op_min_height) TEXT_INDENT_SET); switch (value) { case MIN_HEIGHT_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; } break; case CSS_PROP_ORPHANS: case CSS_PROP_PITCH_RANGE: case CSS_PROP_RICHNESS: case CSS_PROP_STRESS: case CSS_PROP_WIDOWS: assert(ORPHANS_SET == (enum op_orphans) PITCH_RANGE_SET); assert(ORPHANS_SET == (enum op_orphans) RICHNESS_SET); assert(ORPHANS_SET == (enum op_orphans) STRESS_SET); assert(ORPHANS_SET == (enum op_orphans) WIDOWS_SET); switch (value) { case ORPHANS_SET: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; } break; case CSS_PROP_OUTLINE_COLOR: switch (value) { case OUTLINE_COLOR_TRANSPARENT: *ptr += sprintf(*ptr, "transparent"); break; case OUTLINE_COLOR_CURRENT_COLOR: *ptr += sprintf(*ptr, "currentColor"); break; case OUTLINE_COLOR_SET: { uint32_t colour = *((uint32_t *) bytecode); ADVANCE(sizeof(colour)); *ptr += sprintf(*ptr, "#%08x", colour); } break; case OUTLINE_COLOR_INVERT: *ptr += sprintf(*ptr, "invert"); break; } break; case CSS_PROP_OVERFLOW_X: case CSS_PROP_OVERFLOW_Y: switch (value) { case OVERFLOW_VISIBLE: *ptr += sprintf(*ptr, "visible"); break; case OVERFLOW_HIDDEN: *ptr += sprintf(*ptr, "hidden"); break; case OVERFLOW_SCROLL: *ptr += sprintf(*ptr, "scroll"); break; case OVERFLOW_AUTO: *ptr += sprintf(*ptr, "auto"); break; } break; case CSS_PROP_PAGE_BREAK_AFTER: case CSS_PROP_PAGE_BREAK_BEFORE: assert(PAGE_BREAK_AFTER_AUTO == (enum op_page_break_after) PAGE_BREAK_BEFORE_AUTO); assert(PAGE_BREAK_AFTER_ALWAYS == (enum op_page_break_after) PAGE_BREAK_BEFORE_ALWAYS); assert(PAGE_BREAK_AFTER_AVOID == (enum op_page_break_after) PAGE_BREAK_BEFORE_AVOID); assert(PAGE_BREAK_AFTER_LEFT == (enum op_page_break_after) PAGE_BREAK_BEFORE_LEFT); assert(PAGE_BREAK_AFTER_RIGHT == (enum op_page_break_after) PAGE_BREAK_BEFORE_RIGHT); switch (value) { case PAGE_BREAK_AFTER_AUTO: *ptr += sprintf(*ptr, "auto"); break; case PAGE_BREAK_AFTER_ALWAYS: *ptr += sprintf(*ptr, "always"); break; case PAGE_BREAK_AFTER_AVOID: *ptr += sprintf(*ptr, "avoid"); break; case PAGE_BREAK_AFTER_LEFT: *ptr += sprintf(*ptr, "left"); break; case PAGE_BREAK_AFTER_RIGHT: *ptr += sprintf(*ptr, "right"); break; } break; case CSS_PROP_PAGE_BREAK_INSIDE: switch (value) { case PAGE_BREAK_INSIDE_AUTO: *ptr += sprintf(*ptr, "auto"); break; case PAGE_BREAK_INSIDE_AVOID: *ptr += sprintf(*ptr, "avoid"); break; } break; case CSS_PROP_PITCH: switch (value) { case PITCH_FREQUENCY: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case PITCH_X_LOW: *ptr += sprintf(*ptr, "x-low"); break; case PITCH_LOW: *ptr += sprintf(*ptr, "low"); break; case PITCH_MEDIUM: *ptr += sprintf(*ptr, "medium"); break; case PITCH_HIGH: *ptr += sprintf(*ptr, "high"); break; case PITCH_X_HIGH: *ptr += sprintf(*ptr, "x-high"); break; } break; case CSS_PROP_PLAY_DURING: switch (value) { case PLAY_DURING_URI: { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "'%.*s'", (int) lwc_string_length(he), lwc_string_data(he)); } break; case PLAY_DURING_AUTO: *ptr += sprintf(*ptr, "auto"); break; case PLAY_DURING_NONE: *ptr += sprintf(*ptr, "none"); break; } if (value & PLAY_DURING_MIX) *ptr += sprintf(*ptr, " mix"); if (value & PLAY_DURING_REPEAT) *ptr += sprintf(*ptr, " repeat"); break; case CSS_PROP_POSITION: switch (value) { case POSITION_STATIC: *ptr += sprintf(*ptr, "static"); break; case POSITION_RELATIVE: *ptr += sprintf(*ptr, "relative"); break; case POSITION_ABSOLUTE: *ptr += sprintf(*ptr, "absolute"); break; case POSITION_FIXED: *ptr += sprintf(*ptr, "fixed"); break; } break; case CSS_PROP_QUOTES: switch (value) { case QUOTES_STRING: while (value != QUOTES_NONE) { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, " '%.*s' ", (int) lwc_string_length(he), lwc_string_data(he)); css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(he)); *ptr += sprintf(*ptr, " '%.*s' ", (int) lwc_string_length(he), lwc_string_data(he)); value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); } break; case QUOTES_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_SPEAK_HEADER: switch (value) { case SPEAK_HEADER_ONCE: *ptr += sprintf(*ptr, "once"); break; case SPEAK_HEADER_ALWAYS: *ptr += sprintf(*ptr, "always"); break; } break; case CSS_PROP_SPEAK_NUMERAL: switch (value) { case SPEAK_NUMERAL_DIGITS: *ptr += sprintf(*ptr, "digits"); break; case SPEAK_NUMERAL_CONTINUOUS: *ptr += sprintf(*ptr, "continuous"); break; } break; case CSS_PROP_SPEAK_PUNCTUATION: switch (value) { case SPEAK_PUNCTUATION_CODE: *ptr += sprintf(*ptr, "code"); break; case SPEAK_PUNCTUATION_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_SPEAK: switch (value) { case SPEAK_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case SPEAK_NONE: *ptr += sprintf(*ptr, "none"); break; case SPEAK_SPELL_OUT: *ptr += sprintf(*ptr, "spell-out"); break; } break; case CSS_PROP_SPEECH_RATE: switch (value) { case SPEECH_RATE_SET: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case SPEECH_RATE_X_SLOW: *ptr += sprintf(*ptr, "x-slow"); break; case SPEECH_RATE_SLOW: *ptr += sprintf(*ptr, "slow"); break; case SPEECH_RATE_MEDIUM: *ptr += sprintf(*ptr, "medium"); break; case SPEECH_RATE_FAST: *ptr += sprintf(*ptr, "fast"); break; case SPEECH_RATE_X_FAST: *ptr += sprintf(*ptr, "x-fast"); break; case SPEECH_RATE_FASTER: *ptr += sprintf(*ptr, "faster"); break; case SPEECH_RATE_SLOWER: *ptr += sprintf(*ptr, "slower"); break; } break; case CSS_PROP_TABLE_LAYOUT: switch (value) { case TABLE_LAYOUT_AUTO: *ptr += sprintf(*ptr, "auto"); break; case TABLE_LAYOUT_FIXED: *ptr += sprintf(*ptr, "fixed"); break; } break; case CSS_PROP_TEXT_ALIGN: switch (value) { case TEXT_ALIGN_LEFT: *ptr += sprintf(*ptr, "left"); break; case TEXT_ALIGN_RIGHT: *ptr += sprintf(*ptr, "right"); break; case TEXT_ALIGN_CENTER: *ptr += sprintf(*ptr, "center"); break; case TEXT_ALIGN_JUSTIFY: *ptr += sprintf(*ptr, "justify"); break; case TEXT_ALIGN_LIBCSS_LEFT: *ptr += sprintf(*ptr, "-libcss-left"); break; case TEXT_ALIGN_LIBCSS_CENTER: *ptr += sprintf(*ptr, "-libcss-center"); break; case TEXT_ALIGN_LIBCSS_RIGHT: *ptr += sprintf(*ptr, "-libcss-right"); break; } break; case CSS_PROP_TEXT_DECORATION: if (value == TEXT_DECORATION_NONE) *ptr += sprintf(*ptr, "none"); if (value & TEXT_DECORATION_UNDERLINE) *ptr += sprintf(*ptr, " underline"); if (value & TEXT_DECORATION_OVERLINE) *ptr += sprintf(*ptr, " overline"); if (value & TEXT_DECORATION_LINE_THROUGH) *ptr += sprintf(*ptr, " line-through"); if (value & TEXT_DECORATION_BLINK) *ptr += sprintf(*ptr, " blink"); break; case CSS_PROP_TEXT_TRANSFORM: switch (value) { case TEXT_TRANSFORM_CAPITALIZE: *ptr += sprintf(*ptr, "capitalize"); break; case TEXT_TRANSFORM_UPPERCASE: *ptr += sprintf(*ptr, "uppercase"); break; case TEXT_TRANSFORM_LOWERCASE: *ptr += sprintf(*ptr, "lowercase"); break; case TEXT_TRANSFORM_NONE: *ptr += sprintf(*ptr, "none"); break; } break; case CSS_PROP_UNICODE_BIDI: switch (value) { case UNICODE_BIDI_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case UNICODE_BIDI_EMBED: *ptr += sprintf(*ptr, "embed"); break; case UNICODE_BIDI_BIDI_OVERRIDE: *ptr += sprintf(*ptr, "bidi-override"); break; } break; case CSS_PROP_VERTICAL_ALIGN: switch (value) { case VERTICAL_ALIGN_SET: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case VERTICAL_ALIGN_BASELINE: *ptr += sprintf(*ptr, "baseline"); break; case VERTICAL_ALIGN_SUB: *ptr += sprintf(*ptr, "sub"); break; case VERTICAL_ALIGN_SUPER: *ptr += sprintf(*ptr, "super"); break; case VERTICAL_ALIGN_TOP: *ptr += sprintf(*ptr, "top"); break; case VERTICAL_ALIGN_TEXT_TOP: *ptr += sprintf(*ptr, "text-top"); break; case VERTICAL_ALIGN_MIDDLE: *ptr += sprintf(*ptr, "middle"); break; case VERTICAL_ALIGN_BOTTOM: *ptr += sprintf(*ptr, "bottom"); break; case VERTICAL_ALIGN_TEXT_BOTTOM: *ptr += sprintf(*ptr, "text-bottom"); break; } break; case CSS_PROP_VISIBILITY: switch (value) { case VISIBILITY_VISIBLE: *ptr += sprintf(*ptr, "visible"); break; case VISIBILITY_HIDDEN: *ptr += sprintf(*ptr, "hidden"); break; case VISIBILITY_COLLAPSE: *ptr += sprintf(*ptr, "collapse"); break; } break; case CSS_PROP_VOICE_FAMILY: while (value != VOICE_FAMILY_END) { switch (value) { case VOICE_FAMILY_STRING: case VOICE_FAMILY_IDENT_LIST: { uint32_t snum = *((uint32_t *) bytecode); lwc_string *he; css__stylesheet_string_get(style->sheet, snum, &he); ADVANCE(sizeof(snum)); *ptr += sprintf(*ptr, "'%.*s'", (int) lwc_string_length(he), lwc_string_data(he)); } break; case VOICE_FAMILY_MALE: *ptr += sprintf(*ptr, "male"); break; case VOICE_FAMILY_FEMALE: *ptr += sprintf(*ptr, "female"); break; case VOICE_FAMILY_CHILD: *ptr += sprintf(*ptr, "child"); break; } value = *((uint32_t *) bytecode); ADVANCE(sizeof(value)); if (value != VOICE_FAMILY_END) *ptr += sprintf(*ptr, ", "); } break; case CSS_PROP_VOLUME: switch (value) { case VOLUME_NUMBER: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case VOLUME_DIMENSION: { uint32_t unit; css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); unit = *((uint32_t *) bytecode); ADVANCE(sizeof(unit)); dump_unit(val, unit, ptr); } break; case VOLUME_SILENT: *ptr += sprintf(*ptr, "silent"); break; case VOLUME_X_SOFT: *ptr += sprintf(*ptr, "x-soft"); break; case VOLUME_SOFT: *ptr += sprintf(*ptr, "soft"); break; case VOLUME_MEDIUM: *ptr += sprintf(*ptr, "medium"); break; case VOLUME_LOUD: *ptr += sprintf(*ptr, "loud"); break; case VOLUME_X_LOUD: *ptr += sprintf(*ptr, "x-loud"); break; } break; case CSS_PROP_WHITE_SPACE: switch (value) { case WHITE_SPACE_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case WHITE_SPACE_PRE: *ptr += sprintf(*ptr, "pre"); break; case WHITE_SPACE_NOWRAP: *ptr += sprintf(*ptr, "nowrap"); break; case WHITE_SPACE_PRE_WRAP: *ptr += sprintf(*ptr, "pre-wrap"); break; case WHITE_SPACE_PRE_LINE: *ptr += sprintf(*ptr, "pre-line"); break; } break; case CSS_PROP_WRITING_MODE: switch (value) { case WRITING_MODE_HORIZONTAL_TB: *ptr += sprintf(*ptr, "horizontal-tb"); break; case WRITING_MODE_VERTICAL_RL: *ptr += sprintf(*ptr, "vertical-rl"); break; case WRITING_MODE_VERTICAL_LR: *ptr += sprintf(*ptr, "vertical-lr"); break; } break; case CSS_PROP_Z_INDEX: switch (value) { case Z_INDEX_SET: { css_fixed val = *((css_fixed *) bytecode); ADVANCE(sizeof(val)); dump_number(val, ptr); } break; case Z_INDEX_AUTO: *ptr += sprintf(*ptr, "auto"); break; } break; default: *ptr += sprintf(*ptr, "Unknown opcode %x", op); return; } } if (isImportant(opv)) *ptr += sprintf(*ptr, " !important"); *ptr += sprintf(*ptr, "\n"); } #undef ADVANCE } void dump_string(lwc_string *string, char **ptr) { *ptr += sprintf(*ptr, "%.*s", (int) lwc_string_length(string), lwc_string_data(string)); } void dump_font_face(css_font_face *font_face, char **ptr) { uint8_t style, weight; if (font_face->font_family != NULL) { *(*ptr)++ = '\n'; *ptr += sprintf(*ptr, "| font-family: %.*s", (int) lwc_string_length(font_face->font_family), lwc_string_data(font_face->font_family)); } *ptr += sprintf(*ptr, "\n| font-style: "); style = css_font_face_font_style(font_face); switch (style) { case CSS_FONT_STYLE_INHERIT: *ptr += sprintf(*ptr, "unspecified"); break; case CSS_FONT_STYLE_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case CSS_FONT_STYLE_ITALIC: *ptr += sprintf(*ptr, "italic"); break; case CSS_FONT_STYLE_OBLIQUE: *ptr += sprintf(*ptr, "oblique"); break; } *ptr += sprintf(*ptr, "\n| font-weight: "); weight = css_font_face_font_weight(font_face); switch (weight) { case CSS_FONT_WEIGHT_INHERIT: *ptr += sprintf(*ptr, "unspecified"); break; case CSS_FONT_WEIGHT_NORMAL: *ptr += sprintf(*ptr, "normal"); break; case CSS_FONT_WEIGHT_BOLD: *ptr += sprintf(*ptr, "bold"); break; case CSS_FONT_WEIGHT_100: *ptr += sprintf(*ptr, "100"); break; case CSS_FONT_WEIGHT_200: *ptr += sprintf(*ptr, "200"); break; case CSS_FONT_WEIGHT_300: *ptr += sprintf(*ptr, "300"); break; case CSS_FONT_WEIGHT_400: *ptr += sprintf(*ptr, "400"); break; case CSS_FONT_WEIGHT_500: *ptr += sprintf(*ptr, "500"); break; case CSS_FONT_WEIGHT_600: *ptr += sprintf(*ptr, "600"); break; case CSS_FONT_WEIGHT_700: *ptr += sprintf(*ptr, "700"); break; case CSS_FONT_WEIGHT_800: *ptr += sprintf(*ptr, "800"); break; case CSS_FONT_WEIGHT_900: *ptr += sprintf(*ptr, "900"); break; default: *ptr += sprintf(*ptr, "Unhandled weight %d\n", (int)weight); break; } if (font_face->srcs != NULL) { uint32_t i; css_font_face_src *srcs = font_face->srcs; for (i = 0; i < font_face->n_srcs; ++i) { *ptr += sprintf(*ptr, "\n| src: "); css_font_face_format format = css_font_face_src_format(&srcs[i]); *ptr += sprintf(*ptr, "\n| format: "); switch (format) { case CSS_FONT_FACE_FORMAT_UNSPECIFIED: *ptr += sprintf(*ptr, "unspecified"); break; case CSS_FONT_FACE_FORMAT_WOFF: *ptr += sprintf(*ptr, "WOFF"); break; case CSS_FONT_FACE_FORMAT_OPENTYPE: *ptr += sprintf(*ptr, "OTF"); break; case CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE: *ptr += sprintf(*ptr, "EOTF"); break; case CSS_FONT_FACE_FORMAT_SVG: *ptr += sprintf(*ptr, "SVG"); break; case CSS_FONT_FACE_FORMAT_UNKNOWN: *ptr += sprintf(*ptr, "unknown"); break; default: *ptr += sprintf(*ptr, "UNEXPECTED"); break; } if (srcs[i].location != NULL) { *ptr += sprintf(*ptr, "\n| location: "); switch (css_font_face_src_location_type( &srcs[i])) { case CSS_FONT_FACE_LOCATION_TYPE_LOCAL: *ptr += sprintf(*ptr, "local"); break; case CSS_FONT_FACE_LOCATION_TYPE_URI: *ptr += sprintf(*ptr, "url"); break; default: *ptr += sprintf(*ptr, "UNKNOWN"); break; } *ptr += sprintf(*ptr, "(%.*s)", (int) lwc_string_length( srcs[i].location), lwc_string_data(srcs[i].location)); } } } } #endif netsurf-all-3.2/libcss/test/testutils.h0000644000175000017500000000762212377676736017312 0ustar vincevince#ifndef test_testutils_h_ #define test_testutils_h_ #include #include #include #include #include #ifndef UNUSED #define UNUSED(x) ((x) = (x)) #endif /* Redefine assert, so we can simply use the standard assert mechanism * within testcases and exit with the right output for the testrunner * to do the right thing. */ void __assert2(const char *expr, const char *function, const char *file, int line); void __assert2(const char *expr, const char *function, const char *file, int line) { UNUSED(function); UNUSED(file); printf("FAIL - %s at line %d\n", expr, line); exit(EXIT_FAILURE); } #define assert(expr) \ ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0))) typedef bool (*line_func)(const char *data, size_t datalen, void *pw); static size_t css__parse_strlen(const char *str, size_t limit); char *css__parse_strnchr(const char *str, size_t len, int chr); bool css__parse_testfile(const char *filename, line_func callback, void *pw); size_t css__parse_filesize(const char *filename); /** * Testcase datafile parser driver * * \param filename Name of file to parse * \param callback Pointer to function to handle each line of input data * \param pw Pointer to client-specific private data * \return true on success, false otherwise. */ bool css__parse_testfile(const char *filename, line_func callback, void *pw) { FILE *fp; char buf[300]; fp = fopen(filename, "rb"); if (fp == NULL) { printf("Failed opening %s\n", filename); return false; } while (fgets(buf, sizeof buf, fp)) { if (buf[0] == '\n') continue; if (!callback(buf, css__parse_strlen(buf, sizeof buf - 1), pw)) { fclose(fp); return false; } } fclose(fp); return true; } /** * Utility string length measurer; assumes strings are '\n' terminated * * \param str String to measure length of * \param limit Upper bound on string length * \return String length */ size_t css__parse_strlen(const char *str, size_t limit) { size_t len = 0; if (str == NULL) return 0; while (len < limit - 1 && *str != '\n') { len++; str++; } len++; return len; } /** * Length-limited strchr * * \param str String to search in * \param len Length of string * \param chr Character to search for * \return Pointer to character in string, or NULL if not found */ char *css__parse_strnchr(const char *str, size_t len, int chr) { size_t i; if (str == NULL) return NULL; for (i = 0; i < len; i++) { if (str[i] == chr) break; } if (i == len) return NULL; return (char *) str + i; } /** * Read the size of a file * * \param filename Name of file to read size of * \return File size (in bytes), or 0 on error */ size_t css__parse_filesize(const char *filename) { FILE *fp; size_t len = 0; fp = fopen(filename, "rb"); if (fp == NULL) { printf("Failed opening %s\n", filename); return 0; } fseek(fp, 0, SEEK_END); len = ftell(fp); fclose(fp); return len; } /** * Convert a string representation of an error name to a LibCSS error code * * \param str String containing error name * \param len Length of string (bytes) * \return LibCSS error code, or CSS_OK if unknown */ css_error css_error_from_string(const char *str, size_t len); css_error css_error_from_string(const char *str, size_t len) { if (strncmp(str, "CSS_OK", len) == 0) { return CSS_OK; } else if (strncmp(str, "CSS_NOMEM", len) == 0) { return CSS_NOMEM; } else if (strncmp(str, "CSS_BADPARM", len) == 0) { return CSS_BADPARM; } else if (strncmp(str, "CSS_INVALID", len) == 0) { return CSS_INVALID; } else if (strncmp(str, "CSS_FILENOTFOUND", len) == 0) { return CSS_FILENOTFOUND; } else if (strncmp(str, "CSS_NEEDDATA", len) == 0) { return CSS_NEEDDATA; } else if (strncmp(str, "CSS_BADCHARSET", len) == 0) { return CSS_BADCHARSET; } else if (strncmp(str, "CSS_EOF", len) == 0) { return CSS_EOF; } return CSS_OK; } #endif netsurf-all-3.2/libcss/test/Makefile0000644000175000017500000000041112377676736016526 0ustar vincevince# Tests DIR_TEST_ITEMS := csdetect:csdetect.c css21:css21.c lex:lex.c \ lex-auto:lex-auto.c number:number.c \ parse:parse.c parse-auto:parse-auto.c parse2-auto:parse2-auto.c \ select-no-nd:select-no-nd.c select-nd:select-nd.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/test/css21.c0000644000175000017500000000623212377676736016174 0ustar vincevince#include #include #include #include "stylesheet.h" #define ITERATIONS (1) #define DUMP_CSS (1) #if DUMP_CSS #include "dump.h" #endif #include "testutils.h" static css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs) { UNUSED(pw); UNUSED(base); /* About as useless as possible */ *abs = lwc_string_ref(rel); return CSS_OK; } int main(int argc, char **argv) { css_stylesheet_params params; css_stylesheet *sheet; FILE *fp; size_t len, origlen; #define CHUNK_SIZE (4096) uint8_t buf[CHUNK_SIZE]; css_error error; int count; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1; params.level = CSS_LEVEL_21; params.charset = "UTF-8"; params.url = argv[1]; params.title = NULL; params.allow_quirks = false; params.inline_style = false; params.resolve = resolve_url; params.resolve_pw = NULL; params.import = NULL; params.import_pw = NULL; params.color = NULL; params.color_pw = NULL; params.font = NULL; params.font_pw = NULL; for (count = 0; count < ITERATIONS; count++) { assert(css_stylesheet_create(¶ms, &sheet) == CSS_OK); fp = fopen(argv[1], "rb"); if (fp == NULL) { printf("Failed opening %s\n", argv[1]); return 1; } fseek(fp, 0, SEEK_END); origlen = len = ftell(fp); fseek(fp, 0, SEEK_SET); while (len >= CHUNK_SIZE) { size_t read = fread(buf, 1, CHUNK_SIZE, fp); assert(read == CHUNK_SIZE); error = css_stylesheet_append_data(sheet, buf, CHUNK_SIZE); assert(error == CSS_OK || error == CSS_NEEDDATA); len -= CHUNK_SIZE; } if (len > 0) { size_t read = fread(buf, 1, len, fp); assert(read == len); error = css_stylesheet_append_data(sheet, buf, len); assert(error == CSS_OK || error == CSS_NEEDDATA); len = 0; } fclose(fp); error = css_stylesheet_data_done(sheet); assert(error == CSS_OK || error == CSS_IMPORTS_PENDING); while (error == CSS_IMPORTS_PENDING) { lwc_string *url; uint64_t media; error = css_stylesheet_next_pending_import(sheet, &url, &media); assert(error == CSS_OK || error == CSS_INVALID); if (error == CSS_OK) { css_stylesheet *import; char *buf = malloc(lwc_string_length(url) + 1); memcpy(buf, lwc_string_data(url), lwc_string_length(url)); buf[lwc_string_length(url)] = '\0'; params.url = buf; assert(css_stylesheet_create(¶ms, &import) == CSS_OK); assert(css_stylesheet_data_done(import) == CSS_OK); assert(css_stylesheet_register_import(sheet, import) == CSS_OK); css_stylesheet_destroy(import); error = CSS_IMPORTS_PENDING; free(buf); } } #if DUMP_CSS { #ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) #endif char *out; size_t outsize = max(16384, origlen * 8); size_t outlen = outsize; size_t written; out = malloc(outsize); assert(out != NULL); dump_sheet(sheet, out, &outlen); written = fwrite(out, 1, outsize - outlen, stdout); assert(written == outsize - outlen); free(out); } #endif css_stylesheet_destroy(sheet); } printf("PASS\n"); return 0; } netsurf-all-3.2/libcss/build/0000755000175000017500000000000012377713347015200 5ustar vincevincenetsurf-all-3.2/libcss/build/mkprops.pl0000755000175000017500000000466512377676736017260 0ustar vincevince#!/usr/bin/perl use warnings; use strict; # Auto-generate stub handlers for CSS properties. my @PROPS = split(/ /, "azimuth background_attachment background_color background_image background_position background_repeat border_bottom_color border_bottom_style border_bottom_width border_collapse border_left_color border_left_style border_left_width border_right_color border_right_style border_right_width border_spacing border_top_color border_top_style border_top_width bottom caption_side clear clip color content counter_increment counter_reset cue_after cue_before cursor direction display elevation empty_cells float font_family font_size font_style font_variant font_weight height left letter_spacing line_height list_style_image list_style_position list_style_type margin_bottom margin_left margin_right margin_top max_height max_width min_height min_width orphans outline_color outline_style outline_width overflow padding_bottom padding_left padding_right padding_top page_break_after page_break_before page_break_inside pause_after pause_before pitch_range pitch play_during position quotes richness right speak_header speak_numeral speak_punctuation speak speech_rate stress table_layout text_align text_decoration text_indent text_transform top unicode_bidi vertical_align visibility voice_family volume white_space widows width word_spacing z_index"); print < */ #ifndef css_parse_css21props_c_ #define css_parse_css21props_c_ EOF ; foreach my $prop (@PROPS) { print < #include #include /* The entire API is available through this header. */ #include /* This macro is used to silence compiler warnings about unused function * arguments. */ #define UNUSED(x) ((x) = (x)) /* Function declarations. */ static css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs); static void die(const char *text, css_error code); static css_error node_name(void *pw, void *node, css_qname *qname); static css_error node_classes(void *pw, void *node, lwc_string ***classes, uint32_t *n_classes); static css_error node_id(void *pw, void *node, lwc_string **id); static css_error named_ancestor_node(void *pw, void *node, const css_qname *qname, void **ancestor); static css_error named_parent_node(void *pw, void *node, const css_qname *qname, void **parent); static css_error named_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); static css_error named_generic_sibling_node(void *pw, void *node, const css_qname *qname, void **sibling); static css_error parent_node(void *pw, void *node, void **parent); static css_error sibling_node(void *pw, void *node, void **sibling); static css_error node_has_name(void *pw, void *node, const css_qname *qname, bool *match); static css_error node_has_class(void *pw, void *node, lwc_string *name, bool *match); static css_error node_has_id(void *pw, void *node, lwc_string *name, bool *match); static css_error node_has_attribute(void *pw, void *node, const css_qname *qname, bool *match); static css_error node_has_attribute_equal(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_dashmatch(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_includes(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_prefix(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_suffix(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_has_attribute_substring(void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match); static css_error node_is_root(void *pw, void *node, bool *match); static css_error node_count_siblings(void *pw, void *node, bool same_name, bool after, int32_t *count); static css_error node_is_empty(void *pw, void *node, bool *match); static css_error node_is_link(void *pw, void *node, bool *match); static css_error node_is_visited(void *pw, void *node, bool *match); static css_error node_is_hover(void *pw, void *node, bool *match); static css_error node_is_active(void *pw, void *node, bool *match); static css_error node_is_focus(void *pw, void *node, bool *match); static css_error node_is_enabled(void *pw, void *node, bool *match); static css_error node_is_disabled(void *pw, void *node, bool *match); static css_error node_is_checked(void *pw, void *node, bool *match); static css_error node_is_target(void *pw, void *node, bool *match); static css_error node_is_lang(void *pw, void *node, lwc_string *lang, bool *match); static css_error node_presentational_hint(void *pw, void *node, uint32_t property, css_hint *hint); static css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint); static css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size); static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data); static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data); /* Table of function pointers for the LibCSS Select API. */ static css_select_handler select_handler = { CSS_SELECT_HANDLER_VERSION_1, node_name, node_classes, node_id, named_ancestor_node, named_parent_node, named_sibling_node, named_generic_sibling_node, parent_node, sibling_node, node_has_name, node_has_class, node_has_id, node_has_attribute, node_has_attribute_equal, node_has_attribute_dashmatch, node_has_attribute_includes, node_has_attribute_prefix, node_has_attribute_suffix, node_has_attribute_substring, node_is_root, node_count_siblings, node_is_empty, node_is_link, node_is_visited, node_is_hover, node_is_active, node_is_focus, node_is_enabled, node_is_disabled, node_is_checked, node_is_target, node_is_lang, node_presentational_hint, ua_default_for_property, compute_font_size, set_libcss_node_data, get_libcss_node_data }; int main(int argc, char **argv) { css_error code; css_stylesheet *sheet; size_t size; const char data[] = "h1 { color: red } " "h4 { color: #321; } " "h4, h5 { color: #123456; }"; css_select_ctx *select_ctx; uint32_t count; unsigned int hh; css_stylesheet_params params; UNUSED(argc); UNUSED(argv); params.params_version = CSS_STYLESHEET_PARAMS_VERSION_1; params.level = CSS_LEVEL_21; params.charset = "UTF-8"; params.url = "foo"; params.title = "foo"; params.allow_quirks = false; params.inline_style = false; params.resolve = resolve_url; params.resolve_pw = NULL; params.import = NULL; params.import_pw = NULL; params.color = NULL; params.color_pw = NULL; params.font = NULL; params.font_pw = NULL; /* create a stylesheet */ code = css_stylesheet_create(¶ms, &sheet); if (code != CSS_OK) die("css_stylesheet_create", code); code = css_stylesheet_size(sheet, &size); if (code != CSS_OK) die("css_stylesheet_size", code); printf("created stylesheet, size %zu\n", size); /* parse some CSS source */ code = css_stylesheet_append_data(sheet, (const uint8_t *) data, sizeof data); if (code != CSS_OK && code != CSS_NEEDDATA) die("css_stylesheet_append_data", code); code = css_stylesheet_data_done(sheet); if (code != CSS_OK) die("css_stylesheet_data_done", code); code = css_stylesheet_size(sheet, &size); if (code != CSS_OK) die("css_stylesheet_size", code); printf("appended data, size now %zu\n", size); /* prepare a selection context containing the stylesheet */ code = css_select_ctx_create(&select_ctx); if (code != CSS_OK) die("css_select_ctx_create", code); code = css_select_ctx_append_sheet(select_ctx, sheet, CSS_ORIGIN_AUTHOR, CSS_MEDIA_ALL); if (code != CSS_OK) die("css_select_ctx_append_sheet", code); code = css_select_ctx_count_sheets(select_ctx, &count); if (code != CSS_OK) die("css_select_ctx_count_sheets", code); printf("created selection context with %i sheets\n", count); /* select style for each of h1 to h6 */ for (hh = 1; hh != 7; hh++) { css_select_results *style; char element[20]; lwc_string *element_name; uint8_t color_type; css_color color_shade; /* in this very simple example our "document tree" is just one * node and is in fact a libwapcaplet string containing the * element name */ snprintf(element, sizeof element, "h%i", hh); lwc_intern_string(element, strlen(element), &element_name); code = css_select_style(select_ctx, element_name, CSS_MEDIA_SCREEN, NULL, &select_handler, 0, &style); if (code != CSS_OK) die("css_select_style", code); lwc_string_unref(element_name); color_type = css_computed_color( style->styles[CSS_PSEUDO_ELEMENT_NONE], &color_shade); if (color_type == CSS_COLOR_INHERIT) printf("color of h%i is 'inherit'\n", hh); else printf("color of h%i is %x\n", hh, color_shade); code = css_select_results_destroy(style); if (code != CSS_OK) die("css_computed_style_destroy", code); } /* free everything and shut down libcss */ code = css_select_ctx_destroy(select_ctx); if (code != CSS_OK) die("css_select_ctx_destroy", code); code = css_stylesheet_destroy(sheet); if (code != CSS_OK) die("css_stylesheet_destroy", code); return 0; } css_error resolve_url(void *pw, const char *base, lwc_string *rel, lwc_string **abs) { UNUSED(pw); UNUSED(base); /* About as useless as possible */ *abs = lwc_string_ref(rel); return CSS_OK; } void die(const char *text, css_error code) { fprintf(stderr, "ERROR: %s: %i: %s\n", text, code, css_error_to_string(code)); exit(EXIT_FAILURE); } /* Select handlers. Our "document tree" is actually just a single node, which is * a libwapcaplet string containing the element name. Therefore all the * functions below except those getting or testing the element name return empty * data or false attributes. */ css_error node_name(void *pw, void *n, css_qname *qname) { lwc_string *node = n; UNUSED(pw); qname->name = lwc_string_ref(node); return CSS_OK; } css_error node_classes(void *pw, void *n, lwc_string ***classes, uint32_t *n_classes) { UNUSED(pw); UNUSED(n); *classes = NULL; *n_classes = 0; return CSS_OK; } css_error node_id(void *pw, void *n, lwc_string **id) { UNUSED(pw); UNUSED(n); *id = NULL; return CSS_OK; } css_error named_ancestor_node(void *pw, void *n, const css_qname *qname, void **ancestor) { UNUSED(pw); UNUSED(n); UNUSED(qname); *ancestor = NULL; return CSS_OK; } css_error named_parent_node(void *pw, void *n, const css_qname *qname, void **parent) { UNUSED(pw); UNUSED(n); UNUSED(qname); *parent = NULL; return CSS_OK; } css_error named_generic_sibling_node(void *pw, void *n, const css_qname *qname, void **sibling) { UNUSED(pw); UNUSED(n); UNUSED(qname); *sibling = NULL; return CSS_OK; } css_error named_sibling_node(void *pw, void *n, const css_qname *qname, void **sibling) { UNUSED(pw); UNUSED(n); UNUSED(qname); *sibling = NULL; return CSS_OK; } css_error parent_node(void *pw, void *n, void **parent) { UNUSED(pw); UNUSED(n); *parent = NULL; return CSS_OK; } css_error sibling_node(void *pw, void *n, void **sibling) { UNUSED(pw); UNUSED(n); *sibling = NULL; return CSS_OK; } css_error node_has_name(void *pw, void *n, const css_qname *qname, bool *match) { lwc_string *node = n; UNUSED(pw); assert(lwc_string_caseless_isequal(node, qname->name, match) == lwc_error_ok); return CSS_OK; } css_error node_has_class(void *pw, void *n, lwc_string *name, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(name); *match = false; return CSS_OK; } css_error node_has_id(void *pw, void *n, lwc_string *name, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(name); *match = false; return CSS_OK; } css_error node_has_attribute(void *pw, void *n, const css_qname *qname, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); *match = false; return CSS_OK; } css_error node_has_attribute_equal(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_has_attribute_dashmatch(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_has_attribute_includes(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_has_attribute_prefix(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_has_attribute_suffix(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_has_attribute_substring(void *pw, void *n, const css_qname *qname, lwc_string *value, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(qname); UNUSED(value); *match = false; return CSS_OK; } css_error node_is_first_child(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_root(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_count_siblings(void *pw, void *n, bool same_name, bool after, int32_t *count) { UNUSED(pw); UNUSED(n); UNUSED(same_name); UNUSED(after); *count = 1; return CSS_OK; } css_error node_is_empty(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_link(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_visited(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_hover(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_active(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_focus(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_enabled(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_disabled(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_checked(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_target(void *pw, void *n, bool *match) { UNUSED(pw); UNUSED(n); *match = false; return CSS_OK; } css_error node_is_lang(void *pw, void *n, lwc_string *lang, bool *match) { UNUSED(pw); UNUSED(n); UNUSED(lang); *match = false; return CSS_OK; } css_error node_presentational_hint(void *pw, void *node, uint32_t property, css_hint *hint) { UNUSED(pw); UNUSED(node); UNUSED(property); UNUSED(hint); return CSS_PROPERTY_NOT_SET; } css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint) { UNUSED(pw); if (property == CSS_PROP_COLOR) { hint->data.color = 0x00000000; hint->status = CSS_COLOR_COLOR; } else if (property == CSS_PROP_FONT_FAMILY) { hint->data.strings = NULL; hint->status = CSS_FONT_FAMILY_SANS_SERIF; } else if (property == CSS_PROP_QUOTES) { /* Not exactly useful :) */ hint->data.strings = NULL; hint->status = CSS_QUOTES_NONE; } else if (property == CSS_PROP_VOICE_FAMILY) { /** \todo Fix this when we have voice-family done */ hint->data.strings = NULL; hint->status = 0; } else { return CSS_INVALID; } return CSS_OK; } css_error compute_font_size(void *pw, const css_hint *parent, css_hint *size) { static css_hint_length sizes[] = { { FLTTOFIX(6.75), CSS_UNIT_PT }, { FLTTOFIX(7.50), CSS_UNIT_PT }, { FLTTOFIX(9.75), CSS_UNIT_PT }, { FLTTOFIX(12.0), CSS_UNIT_PT }, { FLTTOFIX(13.5), CSS_UNIT_PT }, { FLTTOFIX(18.0), CSS_UNIT_PT }, { FLTTOFIX(24.0), CSS_UNIT_PT } }; const css_hint_length *parent_size; UNUSED(pw); /* Grab parent size, defaulting to medium if none */ if (parent == NULL) { parent_size = &sizes[CSS_FONT_SIZE_MEDIUM - 1]; } else { assert(parent->status == CSS_FONT_SIZE_DIMENSION); assert(parent->data.length.unit != CSS_UNIT_EM); assert(parent->data.length.unit != CSS_UNIT_EX); parent_size = &parent->data.length; } assert(size->status != CSS_FONT_SIZE_INHERIT); if (size->status < CSS_FONT_SIZE_LARGER) { /* Keyword -- simple */ size->data.length = sizes[size->status - 1]; } else if (size->status == CSS_FONT_SIZE_LARGER) { /** \todo Step within table, if appropriate */ size->data.length.value = FMUL(parent_size->value, FLTTOFIX(1.2)); size->data.length.unit = parent_size->unit; } else if (size->status == CSS_FONT_SIZE_SMALLER) { /** \todo Step within table, if appropriate */ size->data.length.value = FMUL(parent_size->value, FLTTOFIX(1.2)); size->data.length.unit = parent_size->unit; } else if (size->data.length.unit == CSS_UNIT_EM || size->data.length.unit == CSS_UNIT_EX) { size->data.length.value = FMUL(size->data.length.value, parent_size->value); if (size->data.length.unit == CSS_UNIT_EX) { size->data.length.value = FMUL(size->data.length.value, FLTTOFIX(0.6)); } size->data.length.unit = parent_size->unit; } else if (size->data.length.unit == CSS_UNIT_PCT) { size->data.length.value = FDIV(FMUL(size->data.length.value, parent_size->value), FLTTOFIX(100)); size->data.length.unit = parent_size->unit; } size->status = CSS_FONT_SIZE_DIMENSION; return CSS_OK; } static css_error set_libcss_node_data(void *pw, void *n, void *libcss_node_data) { UNUSED(pw); UNUSED(n); /* Since we're not storing it, ensure node data gets deleted */ css_libcss_node_data_handler(&select_handler, CSS_NODE_DELETED, pw, n, NULL, libcss_node_data); return CSS_OK; } static css_error get_libcss_node_data(void *pw, void *n, void **libcss_node_data) { UNUSED(pw); UNUSED(n); *libcss_node_data = NULL; return CSS_OK; } netsurf-all-3.2/libcss/src/0000755000175000017500000000000012377713347014670 5ustar vincevincenetsurf-all-3.2/libcss/src/charset/0000755000175000017500000000000012377713347016321 5ustar vincevincenetsurf-all-3.2/libcss/src/charset/detect.c0000644000175000017500000002711312377676736017753 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include "charset/detect.h" #include "utils/utils.h" static parserutils_error css_charset_read_bom_or_charset(const uint8_t *data, size_t len, uint16_t *mibenum); static parserutils_error try_utf32_charset(const uint8_t *data, size_t len, uint16_t *result); static parserutils_error try_utf16_charset(const uint8_t *data, size_t len, uint16_t *result); static parserutils_error try_ascii_compatible_charset(const uint8_t *data, size_t len, uint16_t *result); /** * Extract a charset from a chunk of data * * \param data Pointer to buffer containing data * \param len Buffer length * \param mibenum Pointer to location containing current MIB enum * \param source Pointer to location containing current charset source * \return PARSERUTILS_OK on success, appropriate error otherwise * * ::mibenum and ::source will be updated on exit * * CSS 2.1 $4.4 */ parserutils_error css__charset_extract(const uint8_t *data, size_t len, uint16_t *mibenum, uint32_t *source) { parserutils_error error; uint16_t charset = 0; if (data == NULL || mibenum == NULL || source == NULL) return PARSERUTILS_BADPARM; /* If the charset was dictated by the client, we've nothing to detect */ if (*source == CSS_CHARSET_DICTATED) return PARSERUTILS_OK; /* Look for a BOM and/or @charset */ error = css_charset_read_bom_or_charset(data, len, &charset); if (error != PARSERUTILS_OK) return error; if (charset != 0) { *mibenum = charset; *source = CSS_CHARSET_DOCUMENT; return PARSERUTILS_OK; } /* If we've already got a charset from the linking mechanism or * referring document, then we've nothing further to do */ if (*source != CSS_CHARSET_DEFAULT) return PARSERUTILS_OK; /* We've not yet found a charset, so use the default fallback */ charset = parserutils_charset_mibenum_from_name("UTF-8", SLEN("UTF-8")); *mibenum = charset; *source = CSS_CHARSET_DEFAULT; return PARSERUTILS_OK; } /** * Inspect the beginning of a buffer of data for the presence of a * UTF Byte Order Mark and/or an @charset rule * * \param data Pointer to buffer containing data * \param len Buffer length * \param mibenum Pointer to location to receive MIB enum * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error css_charset_read_bom_or_charset(const uint8_t *data, size_t len, uint16_t *mibenum) { parserutils_error error; uint16_t charset = 0; if (data == NULL) return PARSERUTILS_BADPARM; /* We require at least 4 bytes of data */ if (len < 4) return PARSERUTILS_NEEDDATA; /* Look for BOM */ if (data[0] == 0x00 && data[1] == 0x00 && data[2] == 0xFE && data[3] == 0xFF) { charset = parserutils_charset_mibenum_from_name("UTF-32BE", SLEN("UTF-32BE")); } else if (data[0] == 0xFF && data[1] == 0xFE && data[2] == 0x00 && data[3] == 0x00) { charset = parserutils_charset_mibenum_from_name("UTF-32LE", SLEN("UTF-32LE")); } else if (data[0] == 0xFE && data[1] == 0xFF) { charset = parserutils_charset_mibenum_from_name("UTF-16BE", SLEN("UTF-16BE")); } else if (data[0] == 0xFF && data[1] == 0xFE) { charset = parserutils_charset_mibenum_from_name("UTF-16LE", SLEN("UTF-16LE")); } else if (data[0] == 0xEF && data[1] == 0xBB && data[2] == 0xBF) { charset = parserutils_charset_mibenum_from_name("UTF-8", SLEN("UTF-8")); } /* BOM beats @charset. * UAs differ here, but none appear to match the spec. * The spec indicates that any @charset present in conjunction with a * BOM, should match the BOM. In reality, it appears UAs just take the * BOM as gospel and ignore any @charset rule. The w3c CSS validator * appears to do the same (at the least, it doesn't complain about a * mismatch). */ if (charset != 0) { *mibenum = charset; return PARSERUTILS_OK; } error = try_utf32_charset(data, len, &charset); if (error == PARSERUTILS_OK && charset != 0) { *mibenum = charset; return PARSERUTILS_OK; } error = try_utf16_charset(data, len, &charset); if (error == PARSERUTILS_OK && charset != 0) { *mibenum = charset; return PARSERUTILS_OK; } error = try_ascii_compatible_charset(data, len, &charset); if (error == PARSERUTILS_OK) *mibenum = charset; return PARSERUTILS_OK; } static parserutils_error try_utf32_charset(const uint8_t *data, size_t len, uint16_t *result) { uint16_t charset = 0; #define CHARSET_BE "\0\0\0@\0\0\0c\0\0\0h\0\0\0a\0\0\0r\0\0\0s\0\0\0e\0\0\0t\0\0\0 \0\0\0\"" #define CHARSET_LE "@\0\0\0c\0\0\0h\0\0\0a\0\0\0r\0\0\0s\0\0\0e\0\0\0t\0\0\0 \0\0\0\"\0\0\0" if (len <= SLEN(CHARSET_LE)) return PARSERUTILS_NEEDDATA; /* Look for @charset, assuming UTF-32 source data */ if (memcmp(data, CHARSET_LE, SLEN(CHARSET_LE)) == 0) { const uint8_t *start = data + SLEN(CHARSET_LE); const uint8_t *end; char buf[8]; char *ptr = buf; /* Look for "; at end of charset declaration */ for (end = start; end < data + len - 4; end += 4) { uint32_t c = end[0] | (end[1] << 8) | (end[2] << 16) | (end[3] << 24); /* Bail if non-ASCII */ if (c > 0x007f) break; /* Reached the end? */ if (c == '"' && end < data + len - 8) { uint32_t d = end[4] | (end[5] << 8) | (end[6] << 16) | (end[7] << 24); if (d == ';') break; } /* Append to buf, if there's space */ if ((size_t) (ptr - buf) < sizeof(buf)) { /* Uppercase */ if ('a' <= c && c <= 'z') *ptr++ = c & ~0x20; else *ptr++ = c; } } if (end == data + len - 4) { /* Ran out of input */ return PARSERUTILS_NEEDDATA; } /* Ensure we have something that looks like UTF-32(LE)? */ if ((ptr - buf == SLEN("UTF-32LE") && memcmp(buf, "UTF-32LE", ptr - buf) == 0) || (ptr - buf == SLEN("UTF-32") && memcmp(buf, "UTF-32", ptr - buf) == 0)) { /* Convert to MIB enum */ charset = parserutils_charset_mibenum_from_name( "UTF-32LE", SLEN("UTF-32LE")); } } else if (memcmp(data, CHARSET_BE, SLEN(CHARSET_BE)) == 0) { const uint8_t *start = data + SLEN(CHARSET_BE); const uint8_t *end; char buf[8]; char *ptr = buf; /* Look for "; at end of charset declaration */ for (end = start; end < data + len - 4; end += 4) { uint32_t c = end[3] | (end[2] << 8) | (end[1] << 16) | (end[0] << 24); /* Bail if non-ASCII */ if (c > 0x007f) break; /* Reached the end? */ if (c == '"' && end < data + len - 8) { uint32_t d = end[7] | (end[6] << 8) | (end[5] << 16) | (end[4] << 24); if (d == ';') break; } /* Append to buf, if there's space */ if ((size_t) (ptr - buf) < sizeof(buf)) { /* Uppercase */ if ('a' <= c && c <= 'z') *ptr++ = c & ~0x20; else *ptr++ = c; } } if (end == data + len - 4) { /* Ran out of input */ return PARSERUTILS_NEEDDATA; } /* Ensure we have something that looks like UTF-32(BE)? */ if ((ptr - buf == SLEN("UTF-32BE") && memcmp(buf, "UTF-32BE", ptr - buf) == 0) || (ptr - buf == SLEN("UTF-32") && memcmp(buf, "UTF-32", ptr - buf) == 0)) { /* Convert to MIB enum */ charset = parserutils_charset_mibenum_from_name( "UTF-32BE", SLEN("UTF-32BE")); } } #undef CHARSET_LE #undef CHARSET_BE *result = charset; return PARSERUTILS_OK; } static parserutils_error try_utf16_charset(const uint8_t *data, size_t len, uint16_t *result) { uint16_t charset = 0; #define CHARSET_BE "\0@\0c\0h\0a\0r\0s\0e\0t\0 \0\"" #define CHARSET_LE "@\0c\0h\0a\0r\0s\0e\0t\0 \0\"\0" if (len <= SLEN(CHARSET_LE)) return PARSERUTILS_NEEDDATA; /* Look for @charset, assuming UTF-16 source data */ if (memcmp(data, CHARSET_LE, SLEN(CHARSET_LE)) == 0) { const uint8_t *start = data + SLEN(CHARSET_LE); const uint8_t *end; char buf[8]; char *ptr = buf; /* Look for "; at end of charset declaration */ for (end = start; end < data + len - 2; end += 2) { uint32_t c = end[0] | (end[1] << 8); /* Bail if non-ASCII */ if (c > 0x007f) break; /* Reached the end? */ if (c == '"' && end < data + len - 4) { uint32_t d = end[2] | (end[3] << 8); if (d == ';') break; } /* Append to buf, if there's space */ if ((size_t) (ptr - buf) < sizeof(buf)) { /* Uppercase */ if ('a' <= c && c <= 'z') *ptr++ = c & ~0x20; else *ptr++ = c; } } if (end == data + len - 2) { /* Ran out of input */ return PARSERUTILS_NEEDDATA; } /* Ensure we have something that looks like UTF-16(LE)? */ if ((ptr - buf == SLEN("UTF-16LE") && memcmp(buf, "UTF-16LE", ptr - buf) == 0) || (ptr - buf == SLEN("UTF-16") && memcmp(buf, "UTF-16", ptr - buf) == 0)) { /* Convert to MIB enum */ charset = parserutils_charset_mibenum_from_name( "UTF-16LE", SLEN("UTF-16LE")); } } else if (memcmp(data, CHARSET_BE, SLEN(CHARSET_BE)) == 0) { const uint8_t *start = data + SLEN(CHARSET_BE); const uint8_t *end; char buf[8]; char *ptr = buf; /* Look for "; at end of charset declaration */ for (end = start; end < data + len - 2; end += 2) { uint32_t c = end[1] | (end[0] << 8); /* Bail if non-ASCII */ if (c > 0x007f) break; /* Reached the end? */ if (c == '"' && end < data + len - 4) { uint32_t d = end[3] | (end[2] << 8); if (d == ';') break; } /* Append to buf, if there's space */ if ((size_t) (ptr - buf) < sizeof(buf)) { /* Uppercase */ if ('a' <= c && c <= 'z') *ptr++ = c & ~0x20; else *ptr++ = c; } } if (end == data + len - 2) { /* Ran out of input */ return PARSERUTILS_NEEDDATA; } /* Ensure we have something that looks like UTF-16(BE)? */ if ((ptr - buf == SLEN("UTF-16BE") && memcmp(buf, "UTF-16BE", ptr - buf) == 0) || (ptr - buf == SLEN("UTF-16") && memcmp(buf, "UTF-16", ptr - buf) == 0)) { /* Convert to MIB enum */ charset = parserutils_charset_mibenum_from_name( "UTF-16BE", SLEN("UTF-16BE")); } } #undef CHARSET_LE #undef CHARSET_BE *result = charset; return PARSERUTILS_OK; } parserutils_error try_ascii_compatible_charset(const uint8_t *data, size_t len, uint16_t *result) { uint16_t charset = 0; #define CHARSET "@charset \"" if (len <= SLEN(CHARSET)) return PARSERUTILS_NEEDDATA; /* Look for @charset, assuming ASCII-compatible source data */ if (memcmp(data, CHARSET, SLEN(CHARSET)) == 0) { const uint8_t *start = data + SLEN(CHARSET); const uint8_t *end; /* Look for "; at end of charset declaration */ for (end = start; end < data + len; end++) { if (*end == '"' && end < data + len - 1 && *(end + 1) == ';') break; } if (end == data + len) { /* Ran out of input */ return PARSERUTILS_NEEDDATA; } /* Convert to MIB enum */ charset = parserutils_charset_mibenum_from_name( (const char *) start, end - start); /* Any non-ASCII compatible charset must be ignored, as * we've just used an ASCII parser to read it. */ if (charset == parserutils_charset_mibenum_from_name( "UTF-32", SLEN("UTF-32")) || charset == parserutils_charset_mibenum_from_name( "UTF-32LE", SLEN("UTF-32LE")) || charset == parserutils_charset_mibenum_from_name( "UTF-32BE", SLEN("UTF-32BE")) || charset == parserutils_charset_mibenum_from_name( "UTF-16", SLEN("UTF-16")) || charset == parserutils_charset_mibenum_from_name( "UTF-16LE", SLEN("UTF-16LE")) || charset == parserutils_charset_mibenum_from_name( "UTF-16BE", SLEN("UTF-16BE"))) { charset = 0; } } #undef CHARSET *result = charset; return PARSERUTILS_OK; } netsurf-all-3.2/libcss/src/charset/detect.h0000644000175000017500000000107212377676736017754 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef css_charset_detect_h_ #define css_charset_detect_h_ #include #include #include #include #include /* Extract a charset from a chunk of data */ parserutils_error css__charset_extract(const uint8_t *data, size_t len, uint16_t *mibenum, uint32_t *source); #endif netsurf-all-3.2/libcss/src/charset/Makefile0000644000175000017500000000010612377676736017770 0ustar vincevince# Sources DIR_SOURCES := detect.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/stylesheet.h0000644000175000017500000002045012377676736017245 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_stylesheet_h_ #define css_stylesheet_h_ #include #include #include #include #include #include #include #include "bytecode/bytecode.h" #include "parse/parse.h" #include "select/hash.h" typedef struct css_rule css_rule; typedef struct css_selector css_selector; typedef struct css_style { css_code_t *bytecode; /**< Pointer to bytecode */ uint32_t used; /**< number of code entries used */ uint32_t allocated; /**< number of allocated code entries */ struct css_stylesheet *sheet; /**< containing sheet */ } css_style; typedef enum css_selector_type { CSS_SELECTOR_ELEMENT, CSS_SELECTOR_CLASS, CSS_SELECTOR_ID, CSS_SELECTOR_PSEUDO_CLASS, CSS_SELECTOR_PSEUDO_ELEMENT, CSS_SELECTOR_ATTRIBUTE, CSS_SELECTOR_ATTRIBUTE_EQUAL, CSS_SELECTOR_ATTRIBUTE_DASHMATCH, CSS_SELECTOR_ATTRIBUTE_INCLUDES, CSS_SELECTOR_ATTRIBUTE_PREFIX, CSS_SELECTOR_ATTRIBUTE_SUFFIX, CSS_SELECTOR_ATTRIBUTE_SUBSTRING } css_selector_type; typedef enum css_combinator { CSS_COMBINATOR_NONE, CSS_COMBINATOR_ANCESTOR, CSS_COMBINATOR_PARENT, CSS_COMBINATOR_SIBLING, CSS_COMBINATOR_GENERIC_SIBLING } css_combinator; typedef enum css_selector_detail_value_type { CSS_SELECTOR_DETAIL_VALUE_STRING, CSS_SELECTOR_DETAIL_VALUE_NTH } css_selector_detail_value_type; typedef union css_selector_detail_value { lwc_string *string; /**< Interned string, or NULL */ struct { int32_t a; int32_t b; } nth; /**< Data for x = an + b */ } css_selector_detail_value; typedef struct css_selector_detail { css_qname qname; /**< Interned name */ css_selector_detail_value value; /**< Detail value */ unsigned int type : 4, /**< Type of selector */ comb : 3, /**< Type of combinator */ next : 1, /**< Another selector detail * follows */ value_type : 1, /**< Type of value field */ negate : 1; /**< Detail match is inverted */ } css_selector_detail; struct css_selector { css_selector *combinator; /**< Combining selector */ css_rule *rule; /**< Owning rule */ #define CSS_SPECIFICITY_A 0x01000000 #define CSS_SPECIFICITY_B 0x00010000 #define CSS_SPECIFICITY_C 0x00000100 #define CSS_SPECIFICITY_D 0x00000001 uint32_t specificity; /**< Specificity of selector */ css_selector_detail data; /**< Selector data */ }; typedef enum css_rule_type { CSS_RULE_UNKNOWN, CSS_RULE_SELECTOR, CSS_RULE_CHARSET, CSS_RULE_IMPORT, CSS_RULE_MEDIA, CSS_RULE_FONT_FACE, CSS_RULE_PAGE } css_rule_type; typedef enum css_rule_parent_type { CSS_RULE_PARENT_STYLESHEET, CSS_RULE_PARENT_RULE } css_rule_parent_type; struct css_rule { void *parent; /**< containing rule or owning * stylesheet (defined by ptype) */ css_rule *next; /**< next in list */ css_rule *prev; /**< previous in list */ unsigned int type : 4, /**< css_rule_type */ index : 16, /**< index in sheet */ items : 8, /**< # items in rule */ ptype : 1; /**< css_rule_parent_type */ } _ALIGNED; typedef struct css_rule_selector { css_rule base; css_selector **selectors; css_style *style; } css_rule_selector; typedef struct css_rule_media { css_rule base; uint64_t media; css_rule *first_child; css_rule *last_child; } css_rule_media; typedef struct css_rule_font_face { css_rule base; css_font_face *font_face; } css_rule_font_face; typedef struct css_rule_page { css_rule base; css_selector *selector; css_style *style; } css_rule_page; typedef struct css_rule_import { css_rule base; lwc_string *url; uint64_t media; css_stylesheet *sheet; } css_rule_import; typedef struct css_rule_charset { css_rule base; lwc_string *encoding; /** \todo use MIB enum? */ } css_rule_charset; struct css_stylesheet { css_selector_hash *selectors; /**< Hashtable of selectors */ uint32_t rule_count; /**< Number of rules in sheet */ css_rule *rule_list; /**< List of rules in sheet */ css_rule *last_rule; /**< Last rule in list */ bool disabled; /**< Whether this sheet is * disabled */ char *url; /**< URL of this sheet */ char *title; /**< Title of this sheet */ css_language_level level; /**< Language level of sheet */ css_parser *parser; /**< Core parser for sheet */ void *parser_frontend; /**< Frontend parser */ lwc_string **propstrings; /**< Property strings, for parser */ bool quirks_allowed; /**< Quirks permitted */ bool quirks_used; /**< Quirks actually used */ bool inline_style; /**< Is an inline style */ size_t size; /**< Size, in bytes */ css_import_notification_fn import; /**< Import notification function */ void *import_pw; /**< Private word */ css_url_resolution_fn resolve; /**< URL resolution function */ void *resolve_pw; /**< Private word */ css_color_resolution_fn color; /**< Colour resolution function */ void *color_pw; /**< Private word */ /** System font resolution function */ css_font_resolution_fn font; void *font_pw; /**< Private word */ css_style *cached_style; /**< Cache for style parsing */ lwc_string **string_vector; /**< Bytecode string vector */ uint32_t string_vector_l; /**< The string vector allocated * length in entries */ uint32_t string_vector_c; /**< The number of string * vector entries used */ }; css_error css__stylesheet_style_create(css_stylesheet *sheet, css_style **style); css_error css__stylesheet_style_append(css_style *style, css_code_t code); css_error css__stylesheet_style_vappend(css_style *style, uint32_t style_count, ...); css_error css__stylesheet_style_destroy(css_style *style); css_error css__stylesheet_merge_style(css_style *target, css_style *style); /** Helper function to avoid distinct buildOPV call */ static inline css_error css__stylesheet_style_appendOPV(css_style *style, opcode_t opcode, uint8_t flags, uint16_t value) { return css__stylesheet_style_append(style, buildOPV(opcode, flags, value)); } /** Helper function to set inherit flag */ static inline css_error css_stylesheet_style_inherit(css_style *style, opcode_t opcode) { return css__stylesheet_style_append(style, buildOPV(opcode, FLAG_INHERIT, 0)); } css_error css__stylesheet_selector_create(css_stylesheet *sheet, css_qname *qname, css_selector **selector); css_error css__stylesheet_selector_destroy(css_stylesheet *sheet, css_selector *selector); css_error css__stylesheet_selector_detail_init(css_stylesheet *sheet, css_selector_type type, css_qname *qname, css_selector_detail_value value, css_selector_detail_value_type value_type, bool negate, css_selector_detail *detail); css_error css__stylesheet_selector_append_specific(css_stylesheet *sheet, css_selector **parent, const css_selector_detail *specific); css_error css__stylesheet_selector_combine(css_stylesheet *sheet, css_combinator type, css_selector *a, css_selector *b); css_error css__stylesheet_rule_create(css_stylesheet *sheet, css_rule_type type, css_rule **rule); css_error css__stylesheet_rule_destroy(css_stylesheet *sheet, css_rule *rule); css_error css__stylesheet_rule_add_selector(css_stylesheet *sheet, css_rule *rule, css_selector *selector); css_error css__stylesheet_rule_append_style(css_stylesheet *sheet, css_rule *rule, css_style *style); css_error css__stylesheet_rule_set_charset(css_stylesheet *sheet, css_rule *rule, lwc_string *charset); css_error css__stylesheet_rule_set_nascent_import(css_stylesheet *sheet, css_rule *rule, lwc_string *url, uint64_t media); css_error css__stylesheet_rule_set_media(css_stylesheet *sheet, css_rule *rule, uint64_t media); css_error css__stylesheet_rule_set_page_selector(css_stylesheet *sheet, css_rule *rule, css_selector *sel); css_error css__stylesheet_add_rule(css_stylesheet *sheet, css_rule *rule, css_rule *parent); css_error css__stylesheet_remove_rule(css_stylesheet *sheet, css_rule *rule); css_error css__stylesheet_string_get(css_stylesheet *sheet, uint32_t string_number, lwc_string **string); css_error css__stylesheet_string_add(css_stylesheet *sheet, lwc_string *string, uint32_t *string_number); #endif netsurf-all-3.2/libcss/src/bytecode/0000755000175000017500000000000012377713347016466 5ustar vincevincenetsurf-all-3.2/libcss/src/bytecode/opcodes.h0000644000175000017500000003661112377676736020314 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_bytecode_opcodes_h_ #define css_bytecode_opcodes_h_ #include enum op_azimuth { AZIMUTH_ANGLE = 0x0080, AZIMUTH_LEFTWARDS = 0x0040, AZIMUTH_RIGHTWARDS = 0x0041, AZIMUTH_BEHIND = (1<<5), AZIMUTH_LEFT_SIDE = 0x0000, AZIMUTH_FAR_LEFT = 0x0001, AZIMUTH_LEFT = 0x0002, AZIMUTH_CENTER_LEFT = 0x0003, AZIMUTH_CENTER = 0x0004, AZIMUTH_CENTER_RIGHT = 0x0005, AZIMUTH_RIGHT = 0x0006, AZIMUTH_FAR_RIGHT = 0x0007, AZIMUTH_RIGHT_SIDE = 0x0008 }; enum op_background_attachment { BACKGROUND_ATTACHMENT_FIXED = 0x0000, BACKGROUND_ATTACHMENT_SCROLL = 0x0001 }; enum op_background_color { BACKGROUND_COLOR_TRANSPARENT = 0x0000, BACKGROUND_COLOR_CURRENT_COLOR = 0x0001, BACKGROUND_COLOR_SET = 0x0080 }; enum op_background_image { BACKGROUND_IMAGE_URI = 0x0080, BACKGROUND_IMAGE_NONE = 0x0000 }; enum op_background_position { BACKGROUND_POSITION_HORZ_SET = 0x0080, BACKGROUND_POSITION_HORZ_CENTER = 0x0000, BACKGROUND_POSITION_HORZ_RIGHT = 0x0010, BACKGROUND_POSITION_HORZ_LEFT = 0x0020, BACKGROUND_POSITION_VERT_SET = 0x0008, BACKGROUND_POSITION_VERT_CENTER = 0x0000, BACKGROUND_POSITION_VERT_BOTTOM = 0x0001, BACKGROUND_POSITION_VERT_TOP = 0x0002 }; enum op_background_repeat { BACKGROUND_REPEAT_NO_REPEAT = 0x0000, BACKGROUND_REPEAT_REPEAT_X = 0x0001, BACKGROUND_REPEAT_REPEAT_Y = 0x0002, BACKGROUND_REPEAT_REPEAT = 0x0003 }; enum op_border_collapse { BORDER_COLLAPSE_SEPARATE = 0x0000, BORDER_COLLAPSE_COLLAPSE = 0x0001 }; enum op_border_spacing { BORDER_SPACING_SET = 0x0080 }; enum op_border_color { BORDER_COLOR_TRANSPARENT = 0x0000, BORDER_COLOR_CURRENT_COLOR = 0x0001, BORDER_COLOR_SET = 0x0080 }; enum op_border_style { BORDER_STYLE_NONE = 0x0000, BORDER_STYLE_HIDDEN = 0x0001, BORDER_STYLE_DOTTED = 0x0002, BORDER_STYLE_DASHED = 0x0003, BORDER_STYLE_SOLID = 0x0004, BORDER_STYLE_DOUBLE = 0x0005, BORDER_STYLE_GROOVE = 0x0006, BORDER_STYLE_RIDGE = 0x0007, BORDER_STYLE_INSET = 0x0008, BORDER_STYLE_OUTSET = 0x0009 }; enum op_border_width { BORDER_WIDTH_SET = 0x0080, BORDER_WIDTH_THIN = 0x0000, BORDER_WIDTH_MEDIUM = 0x0001, BORDER_WIDTH_THICK = 0x0002 }; enum op_bottom { BOTTOM_SET = 0x0080, BOTTOM_AUTO = 0x0000 }; enum op_break_after { BREAK_AFTER_AUTO = 0x0000, BREAK_AFTER_ALWAYS = 0x0001, BREAK_AFTER_AVOID = 0x0002, BREAK_AFTER_LEFT = 0x0003, BREAK_AFTER_RIGHT = 0x0004, BREAK_AFTER_PAGE = 0x0005, BREAK_AFTER_COLUMN = 0x0006, BREAK_AFTER_AVOID_PAGE = 0x0007, BREAK_AFTER_AVOID_COLUMN = 0x0008 }; enum op_break_before { BREAK_BEFORE_AUTO = 0x0000, BREAK_BEFORE_ALWAYS = 0x0001, BREAK_BEFORE_AVOID = 0x0002, BREAK_BEFORE_LEFT = 0x0003, BREAK_BEFORE_RIGHT = 0x0004, BREAK_BEFORE_PAGE = 0x0005, BREAK_BEFORE_COLUMN = 0x0006, BREAK_BEFORE_AVOID_PAGE = 0x0007, BREAK_BEFORE_AVOID_COLUMN = 0x0008 }; enum op_break_inside { BREAK_INSIDE_AUTO = 0x0000, BREAK_INSIDE_AVOID = 0x0001, BREAK_INSIDE_AVOID_PAGE = 0x0002, BREAK_INSIDE_AVOID_COLUMN = 0x0003 }; enum op_caption_side { CAPTION_SIDE_TOP = 0x0000, CAPTION_SIDE_BOTTOM = 0x0001 }; enum op_clear { CLEAR_NONE = 0x0000, CLEAR_LEFT = 0x0001, CLEAR_RIGHT = 0x0002, CLEAR_BOTH = 0x0003 }; enum op_clip { CLIP_SHAPE_MASK = 0x0087, CLIP_SHAPE_RECT = 0x0080, CLIP_RECT_TOP_AUTO = 0x0008, CLIP_RECT_RIGHT_AUTO = 0x0010, CLIP_RECT_BOTTOM_AUTO = 0x0020, CLIP_RECT_LEFT_AUTO = 0x0040, CLIP_AUTO = 0x0000 }; enum op_color { COLOR_TRANSPARENT = 0x0000, COLOR_CURRENT_COLOR = 0x0001, COLOR_SET = 0x0080 }; enum op_column_count { COLUMN_COUNT_AUTO = 0x0000, COLUMN_COUNT_SET = 0x0080 }; enum op_column_fill { COLUMN_FILL_BALANCE = 0x0000, COLUMN_FILL_AUTO = 0x0001 }; enum op_column_gap { COLUMN_GAP_NORMAL = 0x0000, COLUMN_GAP_SET = 0x0080 }; enum op_column_rule_color { COLUMN_RULE_COLOR_TRANSPARENT = 0x0000, COLUMN_RULE_COLOR_CURRENT_COLOR = 0x0001, COLUMN_RULE_COLOR_INVERT = 0x0002, COLUMN_RULE_COLOR_SET = 0x0080 }; enum op_column_rule_style { COLUMN_RULE_STYLE_NONE = BORDER_STYLE_NONE, COLUMN_RULE_STYLE_HIDDEN = BORDER_STYLE_HIDDEN, COLUMN_RULE_STYLE_DOTTED = BORDER_STYLE_DOTTED, COLUMN_RULE_STYLE_DASHED = BORDER_STYLE_DASHED, COLUMN_RULE_STYLE_SOLID = BORDER_STYLE_SOLID, COLUMN_RULE_STYLE_DOUBLE = BORDER_STYLE_DOUBLE, COLUMN_RULE_STYLE_GROOVE = BORDER_STYLE_GROOVE, COLUMN_RULE_STYLE_RIDGE = BORDER_STYLE_RIDGE, COLUMN_RULE_STYLE_INSET = BORDER_STYLE_INSET, COLUMN_RULE_STYLE_OUTSET = BORDER_STYLE_OUTSET }; enum op_column_rule_width { COLUMN_RULE_WIDTH_SET = BORDER_WIDTH_SET, COLUMN_RULE_WIDTH_THIN = BORDER_WIDTH_THIN, COLUMN_RULE_WIDTH_MEDIUM = BORDER_WIDTH_MEDIUM, COLUMN_RULE_WIDTH_THICK = BORDER_WIDTH_THICK }; enum op_column_span { COLUMN_SPAN_NONE = 0x0000, COLUMN_SPAN_ALL = 0x0001 }; enum op_column_width { COLUMN_WIDTH_AUTO = 0x0000, COLUMN_WIDTH_SET = 0x0080 }; enum op_content { CONTENT_STRING = 0x0080, CONTENT_URI = 0x0081, CONTENT_COUNTER = 0x0082, CONTENT_COUNTERS = 0x0083, CONTENT_ATTR = 0x0084, CONTENT_COUNTER_STYLE_SHIFT = 8, CONTENT_COUNTERS_STYLE_SHIFT = 8, CONTENT_NORMAL = 0x0000, CONTENT_NONE = 0x0001, CONTENT_OPEN_QUOTE = 0x0002, CONTENT_CLOSE_QUOTE = 0x0003, CONTENT_NO_OPEN_QUOTE = 0x0004, CONTENT_NO_CLOSE_QUOTE = 0x0005 }; enum op_counter_increment { COUNTER_INCREMENT_NAMED = 0x0080, COUNTER_INCREMENT_NONE = 0x0000 }; enum op_counter_reset { COUNTER_RESET_NAMED = 0x0080, COUNTER_RESET_NONE = 0x0000 }; enum op_cue_after { CUE_AFTER_URI = 0x0080, CUE_AFTER_NONE = 0x0000 }; enum op_cue_before { CUE_BEFORE_URI = 0x0080, CUE_BEFORE_NONE = 0x0000 }; enum op_cursor { CURSOR_URI = 0x0080, CURSOR_AUTO = 0x0000, CURSOR_CROSSHAIR = 0x0001, CURSOR_DEFAULT = 0x0002, CURSOR_POINTER = 0x0003, CURSOR_MOVE = 0x0004, CURSOR_E_RESIZE = 0x0005, CURSOR_NE_RESIZE = 0x0006, CURSOR_NW_RESIZE = 0x0007, CURSOR_N_RESIZE = 0x0008, CURSOR_SE_RESIZE = 0x0009, CURSOR_SW_RESIZE = 0x000a, CURSOR_S_RESIZE = 0x000b, CURSOR_W_RESIZE = 0x000c, CURSOR_TEXT = 0x000d, CURSOR_WAIT = 0x000e, CURSOR_HELP = 0x000f, CURSOR_PROGRESS = 0x0010 }; enum op_direction { DIRECTION_LTR = 0x0000, DIRECTION_RTL = 0x0001 }; enum op_display { DISPLAY_INLINE = 0x0000, DISPLAY_BLOCK = 0x0001, DISPLAY_LIST_ITEM = 0x0002, DISPLAY_RUN_IN = 0x0003, DISPLAY_INLINE_BLOCK = 0x0004, DISPLAY_TABLE = 0x0005, DISPLAY_INLINE_TABLE = 0x0006, DISPLAY_TABLE_ROW_GROUP = 0x0007, DISPLAY_TABLE_HEADER_GROUP = 0x0008, DISPLAY_TABLE_FOOTER_GROUP = 0x0009, DISPLAY_TABLE_ROW = 0x000a, DISPLAY_TABLE_COLUMN_GROUP = 0x000b, DISPLAY_TABLE_COLUMN = 0x000c, DISPLAY_TABLE_CELL = 0x000d, DISPLAY_TABLE_CAPTION = 0x000e, DISPLAY_NONE = 0x000f }; enum op_elevation { ELEVATION_ANGLE = 0x0080, ELEVATION_BELOW = 0x0000, ELEVATION_LEVEL = 0x0001, ELEVATION_ABOVE = 0x0002, ELEVATION_HIGHER = 0x0003, ELEVATION_LOWER = 0x0004 }; enum op_empty_cells { EMPTY_CELLS_SHOW = 0x0000, EMPTY_CELLS_HIDE = 0x0001 }; enum op_float { FLOAT_LEFT = 0x0000, FLOAT_RIGHT = 0x0001, FLOAT_NONE = 0x0002 }; enum op_font_family { FONT_FAMILY_STRING = 0x0080, FONT_FAMILY_IDENT_LIST = 0x0081, FONT_FAMILY_END = 0x0000, FONT_FAMILY_SERIF = 0x0001, FONT_FAMILY_SANS_SERIF = 0x0002, FONT_FAMILY_CURSIVE = 0x0003, FONT_FAMILY_FANTASY = 0x0004, FONT_FAMILY_MONOSPACE = 0x0005 }; enum op_font_size { FONT_SIZE_DIMENSION = 0x0080, FONT_SIZE_XX_SMALL = 0x0000, FONT_SIZE_X_SMALL = 0x0001, FONT_SIZE_SMALL = 0x0002, FONT_SIZE_MEDIUM = 0x0003, FONT_SIZE_LARGE = 0x0004, FONT_SIZE_X_LARGE = 0x0005, FONT_SIZE_XX_LARGE = 0x0006, FONT_SIZE_LARGER = 0x0007, FONT_SIZE_SMALLER = 0x0008 }; enum op_font_style { FONT_STYLE_NORMAL = 0x0000, FONT_STYLE_ITALIC = 0x0001, FONT_STYLE_OBLIQUE = 0x0002 }; enum op_font_variant { FONT_VARIANT_NORMAL = 0x0000, FONT_VARIANT_SMALL_CAPS = 0x0001 }; enum op_font_weight { FONT_WEIGHT_NORMAL = 0x0000, FONT_WEIGHT_BOLD = 0x0001, FONT_WEIGHT_BOLDER = 0x0002, FONT_WEIGHT_LIGHTER = 0x0003, FONT_WEIGHT_100 = 0x0004, FONT_WEIGHT_200 = 0x0005, FONT_WEIGHT_300 = 0x0006, FONT_WEIGHT_400 = 0x0007, FONT_WEIGHT_500 = 0x0008, FONT_WEIGHT_600 = 0x0009, FONT_WEIGHT_700 = 0x000a, FONT_WEIGHT_800 = 0x000b, FONT_WEIGHT_900 = 0x000c }; enum op_height { HEIGHT_SET = 0x0080, HEIGHT_AUTO = 0x0000 }; enum op_left { LEFT_SET = BOTTOM_SET, LEFT_AUTO = BOTTOM_AUTO }; enum op_letter_spacing { LETTER_SPACING_SET = 0x0080, LETTER_SPACING_NORMAL = 0x0000 }; enum op_line_height { LINE_HEIGHT_NUMBER = 0x0080, LINE_HEIGHT_DIMENSION = 0x0081, LINE_HEIGHT_NORMAL = 0x0000 }; enum op_list_style_image { LIST_STYLE_IMAGE_URI = 0x0080, LIST_STYLE_IMAGE_NONE = 0x0000 }; enum op_list_style_position { LIST_STYLE_POSITION_INSIDE = 0x0000, LIST_STYLE_POSITION_OUTSIDE = 0x0001 }; enum op_list_style_type { LIST_STYLE_TYPE_DISC = 0x0000, LIST_STYLE_TYPE_CIRCLE = 0x0001, LIST_STYLE_TYPE_SQUARE = 0x0002, LIST_STYLE_TYPE_DECIMAL = 0x0003, LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO = 0x0004, LIST_STYLE_TYPE_LOWER_ROMAN = 0x0005, LIST_STYLE_TYPE_UPPER_ROMAN = 0x0006, LIST_STYLE_TYPE_LOWER_GREEK = 0x0007, LIST_STYLE_TYPE_LOWER_LATIN = 0x0008, LIST_STYLE_TYPE_UPPER_LATIN = 0x0009, LIST_STYLE_TYPE_ARMENIAN = 0x000a, LIST_STYLE_TYPE_GEORGIAN = 0x000b, LIST_STYLE_TYPE_LOWER_ALPHA = 0x000c, LIST_STYLE_TYPE_UPPER_ALPHA = 0x000d, LIST_STYLE_TYPE_NONE = 0x000e }; enum op_margin { MARGIN_SET = 0x0080, MARGIN_AUTO = 0x0000 }; enum op_max_height { MAX_HEIGHT_SET = 0x0080, MAX_HEIGHT_NONE = 0x0000 }; enum op_max_width { MAX_WIDTH_SET = 0x0080, MAX_WIDTH_NONE = 0x0000 }; enum op_min_height { MIN_HEIGHT_SET = 0x0080 }; enum op_min_width { MIN_WIDTH_SET = 0x0080 }; enum op_opacity { OPACITY_SET = 0x0080 }; enum op_orphans { ORPHANS_SET = 0x0080 }; enum op_outline_color { OUTLINE_COLOR_TRANSPARENT = 0x0000, OUTLINE_COLOR_CURRENT_COLOR = 0x0001, OUTLINE_COLOR_INVERT = 0x0002, OUTLINE_COLOR_SET = 0x0080 }; enum op_outline_style { OUTLINE_STYLE_NONE = BORDER_STYLE_NONE, OUTLINE_STYLE_HIDDEN = BORDER_STYLE_HIDDEN, OUTLINE_STYLE_DOTTED = BORDER_STYLE_DOTTED, OUTLINE_STYLE_DASHED = BORDER_STYLE_DASHED, OUTLINE_STYLE_SOLID = BORDER_STYLE_SOLID, OUTLINE_STYLE_DOUBLE = BORDER_STYLE_DOUBLE, OUTLINE_STYLE_GROOVE = BORDER_STYLE_GROOVE, OUTLINE_STYLE_RIDGE = BORDER_STYLE_RIDGE, OUTLINE_STYLE_INSET = BORDER_STYLE_INSET, OUTLINE_STYLE_OUTSET = BORDER_STYLE_OUTSET }; enum op_outline_width { OUTLINE_WIDTH_SET = BORDER_WIDTH_SET, OUTLINE_WIDTH_THIN = BORDER_WIDTH_THIN, OUTLINE_WIDTH_MEDIUM = BORDER_WIDTH_MEDIUM, OUTLINE_WIDTH_THICK = BORDER_WIDTH_THICK }; enum op_overflow { OVERFLOW_VISIBLE = 0x0000, OVERFLOW_HIDDEN = 0x0001, OVERFLOW_SCROLL = 0x0002, OVERFLOW_AUTO = 0x0003 }; enum op_padding { PADDING_SET = 0x0080 }; enum op_page_break_after { PAGE_BREAK_AFTER_AUTO = 0x0000, PAGE_BREAK_AFTER_ALWAYS = 0x0001, PAGE_BREAK_AFTER_AVOID = 0x0002, PAGE_BREAK_AFTER_LEFT = 0x0003, PAGE_BREAK_AFTER_RIGHT = 0x0004 }; enum op_page_break_before { PAGE_BREAK_BEFORE_AUTO = 0x0000, PAGE_BREAK_BEFORE_ALWAYS = 0x0001, PAGE_BREAK_BEFORE_AVOID = 0x0002, PAGE_BREAK_BEFORE_LEFT = 0x0003, PAGE_BREAK_BEFORE_RIGHT = 0x0004 }; enum op_page_break_inside { PAGE_BREAK_INSIDE_AUTO = 0x0000, PAGE_BREAK_INSIDE_AVOID = 0x0001 }; enum op_pause_after { PAUSE_AFTER_SET = 0x0080 }; enum op_pause_before { PAUSE_BEFORE_SET = 0x0080 }; enum op_pitch_range { PITCH_RANGE_SET = 0x0080 }; enum op_pitch { PITCH_FREQUENCY = 0x0080, PITCH_X_LOW = 0x0000, PITCH_LOW = 0x0001, PITCH_MEDIUM = 0x0002, PITCH_HIGH = 0x0003, PITCH_X_HIGH = 0x0004 }; enum op_play_during { PLAY_DURING_TYPE_MASK = 0x009f, PLAY_DURING_URI = 0x0080, PLAY_DURING_MIX = (1<<6), PLAY_DURING_REPEAT = (1<<5), PLAY_DURING_AUTO = 0x0000, PLAY_DURING_NONE = 0x0001 }; enum op_position { POSITION_STATIC = 0x0000, POSITION_RELATIVE = 0x0001, POSITION_ABSOLUTE = 0x0002, POSITION_FIXED = 0x0003 }; enum op_quotes { QUOTES_STRING = 0x0080, QUOTES_NONE = 0x0000 }; enum op_richness { RICHNESS_SET = 0x0080 }; enum op_right { RIGHT_SET = BOTTOM_SET, RIGHT_AUTO = BOTTOM_AUTO }; enum op_speak_header { SPEAK_HEADER_ONCE = 0x0000, SPEAK_HEADER_ALWAYS = 0x0001 }; enum op_speak_numeral { SPEAK_NUMERAL_DIGITS = 0x0000, SPEAK_NUMERAL_CONTINUOUS = 0x0001 }; enum op_speak_punctuation { SPEAK_PUNCTUATION_CODE = 0x0000, SPEAK_PUNCTUATION_NONE = 0x0001 }; enum op_speak { SPEAK_NORMAL = 0x0000, SPEAK_NONE = 0x0001, SPEAK_SPELL_OUT = 0x0002 }; enum op_speech_rate { SPEECH_RATE_SET = 0x0080, SPEECH_RATE_X_SLOW = 0x0000, SPEECH_RATE_SLOW = 0x0001, SPEECH_RATE_MEDIUM = 0x0002, SPEECH_RATE_FAST = 0x0003, SPEECH_RATE_X_FAST = 0x0004, SPEECH_RATE_FASTER = 0x0005, SPEECH_RATE_SLOWER = 0x0006 }; enum op_stress { STRESS_SET = 0x0080 }; enum op_table_layout { TABLE_LAYOUT_AUTO = 0x0000, TABLE_LAYOUT_FIXED = 0x0001 }; enum op_text_align { TEXT_ALIGN_LEFT = 0x0000, TEXT_ALIGN_RIGHT = 0x0001, TEXT_ALIGN_CENTER = 0x0002, TEXT_ALIGN_JUSTIFY = 0x0003, TEXT_ALIGN_LIBCSS_LEFT = 0x0004, TEXT_ALIGN_LIBCSS_CENTER = 0x0005, TEXT_ALIGN_LIBCSS_RIGHT = 0x0006 }; enum op_text_decoration { TEXT_DECORATION_NONE = 0x0000, TEXT_DECORATION_BLINK = (1<<3), TEXT_DECORATION_LINE_THROUGH = (1<<2), TEXT_DECORATION_OVERLINE = (1<<1), TEXT_DECORATION_UNDERLINE = (1<<0) }; enum op_text_indent { TEXT_INDENT_SET = 0x0080 }; enum op_text_transform { TEXT_TRANSFORM_CAPITALIZE = 0x0000, TEXT_TRANSFORM_UPPERCASE = 0x0001, TEXT_TRANSFORM_LOWERCASE = 0x0002, TEXT_TRANSFORM_NONE = 0x0003 }; enum op_top { TOP_SET = BOTTOM_SET, TOP_AUTO = BOTTOM_AUTO }; enum op_unicode_bidi { UNICODE_BIDI_NORMAL = 0x0000, UNICODE_BIDI_EMBED = 0x0001, UNICODE_BIDI_BIDI_OVERRIDE = 0x0002 }; enum op_vertical_align { VERTICAL_ALIGN_SET = 0x0080, VERTICAL_ALIGN_BASELINE = 0x0000, VERTICAL_ALIGN_SUB = 0x0001, VERTICAL_ALIGN_SUPER = 0x0002, VERTICAL_ALIGN_TOP = 0x0003, VERTICAL_ALIGN_TEXT_TOP = 0x0004, VERTICAL_ALIGN_MIDDLE = 0x0005, VERTICAL_ALIGN_BOTTOM = 0x0006, VERTICAL_ALIGN_TEXT_BOTTOM = 0x0007 }; enum op_visibility { VISIBILITY_VISIBLE = 0x0000, VISIBILITY_HIDDEN = 0x0001, VISIBILITY_COLLAPSE = 0x0002 }; enum op_voice_family { VOICE_FAMILY_STRING = 0x0080, VOICE_FAMILY_IDENT_LIST = 0x0081, VOICE_FAMILY_END = 0x0000, VOICE_FAMILY_MALE = 0x0001, VOICE_FAMILY_FEMALE = 0x0002, VOICE_FAMILY_CHILD = 0x0003 }; enum op_volume { VOLUME_NUMBER = 0x0080, VOLUME_DIMENSION = 0x0081, VOLUME_SILENT = 0x0000, VOLUME_X_SOFT = 0x0001, VOLUME_SOFT = 0x0002, VOLUME_MEDIUM = 0x0003, VOLUME_LOUD = 0x0004, VOLUME_X_LOUD = 0x0005 }; enum op_white_space { WHITE_SPACE_NORMAL = 0x0000, WHITE_SPACE_PRE = 0x0001, WHITE_SPACE_NOWRAP = 0x0002, WHITE_SPACE_PRE_WRAP = 0x0003, WHITE_SPACE_PRE_LINE = 0x0004 }; enum op_widows { WIDOWS_SET = 0x0080 }; enum op_width { WIDTH_SET = 0x0080, WIDTH_AUTO = 0x0000 }; enum op_word_spacing { WORD_SPACING_SET = 0x0080, WORD_SPACING_NORMAL = 0x0000 }; enum op_writing_mode { WRITING_MODE_HORIZONTAL_TB = 0x0000, WRITING_MODE_VERTICAL_RL = 0x0001, WRITING_MODE_VERTICAL_LR = 0x0002 }; enum op_z_index { Z_INDEX_SET = 0x0080, Z_INDEX_AUTO = 0x0000 }; #endif netsurf-all-3.2/libcss/src/bytecode/bytecode.h0000644000175000017500000000306712377676736020455 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_bytecode_bytecode_h_ #define css_bytecode_bytecode_h_ #include #include #include #include typedef uint32_t css_code_t; typedef enum css_properties_e opcode_t; enum flag { FLAG_IMPORTANT = (1<<0), FLAG_INHERIT = (1<<1) }; typedef enum unit { UNIT_PX = 0, UNIT_EX = 1, UNIT_EM = 2, UNIT_IN = 3, UNIT_CM = 4, UNIT_MM = 5, UNIT_PT = 6, UNIT_PC = 7, UNIT_PCT = (1 << 8), UNIT_ANGLE = (1 << 9), UNIT_DEG = (1 << 9) + 0, UNIT_GRAD = (1 << 9) + 1, UNIT_RAD = (1 << 9) + 2, UNIT_TIME = (1 << 10), UNIT_MS = (1 << 10) + 0, UNIT_S = (1 << 10) + 1, UNIT_FREQ = (1 << 11), UNIT_HZ = (1 << 11) + 0, UNIT_KHZ = (1 << 11) + 1 } unit; typedef uint32_t colour; typedef enum shape { SHAPE_RECT = 0 } shape; static inline css_code_t buildOPV(opcode_t opcode, uint8_t flags, uint16_t value) { return (opcode & 0x3ff) | (flags << 10) | ((value & 0x3fff) << 18); } static inline opcode_t getOpcode(css_code_t OPV) { return (OPV & 0x3ff); } static inline uint8_t getFlags(css_code_t OPV) { return ((OPV >> 10) & 0xff); } static inline uint16_t getValue(css_code_t OPV) { return (OPV >> 18); } static inline bool isImportant(css_code_t OPV) { return getFlags(OPV) & 0x1; } static inline bool isInherit(css_code_t OPV) { return getFlags(OPV) & 0x2; } #endif netsurf-all-3.2/libcss/src/bytecode/Makefile0000644000175000017500000000005612377676736020141 0ustar vincevince# Sources include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/parse/0000755000175000017500000000000012377713347016002 5ustar vincevincenetsurf-all-3.2/libcss/src/parse/important.h0000644000175000017500000000076612377676736020213 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_css__parse_important_h_ #define css_css__parse_important_h_ #include "stylesheet.h" #include "parse/language.h" css_error css__parse_important(css_language *c, const parserutils_vector *vector, int *ctx, uint8_t *result); void css__make_style_important(css_style *style); #endif netsurf-all-3.2/libcss/src/parse/font_face.c0000644000175000017500000002714712377676736020117 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 Things Made Out Of Other Things Ltd. * Written by James Montgomerie */ #include "parse/font_face.h" #include #include #include "parse/propstrings.h" #include "parse/properties/utils.h" #include "select/font_face.h" static bool font_rule_font_family_reserved(css_language *c, const css_token *ident) { bool match; return (lwc_string_caseless_isequal(ident->idata, c->strings[SERIF], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[SANS_SERIF], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[CURSIVE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[FANTASY], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[MONOSPACE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[INHERIT], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[INITIAL], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal(ident->idata, c->strings[DEFAULT], &match) == lwc_error_ok && match); } static css_error font_face_parse_font_family(css_language *c, const parserutils_vector *vector, int *ctx, css_font_face *font_face) { css_error error; lwc_string *string; error = css__ident_list_or_string_to_string(c, vector, ctx, font_rule_font_family_reserved, &string); if (error != CSS_OK) return error; css__font_face_set_font_family(font_face, string); lwc_string_unref(string); return CSS_OK; } static css_error font_face_src_parse_format(css_language *c, const parserutils_vector *vector, int *ctx, css_font_face_format *format) { bool match; const css_token *token; *format = CSS_FONT_FACE_FORMAT_UNSPECIFIED; /* 'format(' STRING [ ',' STRING ]* ')' * * 'format(' already consumed */ do { consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_STRING) return CSS_INVALID; if (lwc_string_isequal(token->idata, c->strings[WOFF], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_WOFF; } else if ((lwc_string_isequal(token->idata, c->strings[TRUETYPE], &match) == lwc_error_ok && match) || (lwc_string_isequal(token->idata, c->strings[OPENTYPE], &match) == lwc_error_ok && match)) { *format |= CSS_FONT_FACE_FORMAT_OPENTYPE; } else if (lwc_string_isequal(token->idata, c->strings[EMBEDDED_OPENTYPE], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_EMBEDDED_OPENTYPE; } else if (lwc_string_isequal(token->idata, c->strings[SVG], &match) == lwc_error_ok && match) { *format |= CSS_FONT_FACE_FORMAT_SVG; } else { /* The spec gives a list of possible strings, which * hints that unknown strings should be parse errors, * but it also talks about "unknown font formats", * so we treat any string we don't know not as a parse * error, but as indicating an "unknown font format". */ *format |= CSS_FONT_FACE_FORMAT_UNKNOWN; } consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); } while (token != NULL && tokenIsChar(token, ',')); if (token == NULL || tokenIsChar(token, ')') == false) return CSS_INVALID; return CSS_OK; } static css_error font_face_src_parse_spec_or_name(css_language *c, const parserutils_vector *vector, int *ctx, lwc_string **location, css_font_face_location_type *location_type, css_font_face_format *format) { const css_token *token; css_error error; bool match; /* spec-or-name ::= font-face-spec | font-face-name * font-face-spec ::= URI [ 'format(' STRING [ ',' STRING ]* ')' ]? * font-face-name ::= 'local(' ident-list-or-string ')' * ident-list-or-string ::= IDENT IDENT* | STRING */ consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_URI) { error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, token->idata, location); if (error != CSS_OK) return error; *location_type = CSS_FONT_FACE_LOCATION_TYPE_URI; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token != NULL && token->type == CSS_TOKEN_FUNCTION && lwc_string_caseless_isequal(token->idata, c->strings[FORMAT], &match) == lwc_error_ok && match) { parserutils_vector_iterate(vector, ctx); error = font_face_src_parse_format(c, vector, ctx, format); if (error != CSS_OK) { lwc_string_unref(*location); return error; } } } else if (token->type == CSS_TOKEN_FUNCTION && lwc_string_caseless_isequal(token->idata, c->strings[LOCAL], &match) == lwc_error_ok && match) { consumeWhitespace(vector, ctx); error = css__ident_list_or_string_to_string( c, vector, ctx, NULL, location); if (error != CSS_OK) return error; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { lwc_string_unref(*location); return CSS_INVALID; } *location_type = CSS_FONT_FACE_LOCATION_TYPE_LOCAL; } else { return CSS_INVALID; } return CSS_OK; } static css_error font_face_parse_src(css_language *c, const parserutils_vector *vector, int *ctx, css_font_face *font_face) { int orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; css_font_face_src *srcs = NULL, *new_srcs = NULL; uint32_t n_srcs = 0; /* src ::= spec-or-name [ ',' spec-or-name ]* * spec-or-name ::= font-face-spec | font-face-name * font-face-spec ::= URI [ 'format(' STRING [ ',' STRING ]* ')' ]? * font-face-name ::= 'local(' ident-list-or-string ')' * ident-list-or-string ::= IDENT IDENT* | STRING */ /* Create one css_font_face_src for each consecutive location and * [potentially] type pair in the comma-separated list */ do { lwc_string *location; css_font_face_location_type location_type = CSS_FONT_FACE_LOCATION_TYPE_UNSPECIFIED; css_font_face_format format = CSS_FONT_FACE_FORMAT_UNSPECIFIED; error = font_face_src_parse_spec_or_name(c, vector, ctx, &location, &location_type, &format); if (error != CSS_OK) goto cleanup; /* This will be inefficient if there are a lot of locations - * probably not a problem in practice. */ new_srcs = realloc(srcs, (n_srcs + 1) * sizeof(css_font_face_src)); if (new_srcs == NULL) { error = CSS_NOMEM; goto cleanup; } srcs = new_srcs; srcs[n_srcs].location = location; srcs[n_srcs].bits[0] = format << 2 | location_type; ++n_srcs; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); } while (token != NULL && tokenIsChar(token, ',')); error = css__font_face_set_srcs(font_face, srcs, n_srcs); cleanup: if (error != CSS_OK) { *ctx = orig_ctx; if (srcs != NULL) free(srcs); } return error; } static css_error font_face_parse_font_style(css_language *c, const parserutils_vector *vector, int *ctx, css_font_face *font_face) { int orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; enum css_font_style_e style = 0; bool match; /* IDENT(normal, italic, oblique) */ token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) { *ctx = orig_ctx; return CSS_INVALID; } if ((lwc_string_caseless_isequal(token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_NORMAL; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[ITALIC], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_ITALIC; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[OBLIQUE], &match) == lwc_error_ok && match)) { style = CSS_FONT_STYLE_OBLIQUE; } else { error = CSS_INVALID; } if (error == CSS_OK) { font_face->bits[0] = (font_face->bits[0] & 0xfc) | style; } else { *ctx = orig_ctx; } return error; } static css_error font_face_parse_font_weight(css_language *c, const parserutils_vector *vector, int *ctx, css_font_face *font_face) { int orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; enum css_font_weight_e weight = 0; bool match; /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | * IDENT (normal, bold) */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_NUMBER)) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_NUMBER) { size_t consumed = 0; css_fixed num = css__number_from_lwc_string(token->idata, true, &consumed); /* Invalid if there are trailing characters */ if (consumed != lwc_string_length(token->idata)) { *ctx = orig_ctx; return CSS_INVALID; } switch (FIXTOINT(num)) { case 100: weight = CSS_FONT_WEIGHT_100; break; case 200: weight = CSS_FONT_WEIGHT_200; break; case 300: weight = CSS_FONT_WEIGHT_300; break; case 400: weight = CSS_FONT_WEIGHT_400; break; case 500: weight = CSS_FONT_WEIGHT_500; break; case 600: weight = CSS_FONT_WEIGHT_600; break; case 700: weight = CSS_FONT_WEIGHT_700; break; case 800: weight = CSS_FONT_WEIGHT_800; break; case 900: weight = CSS_FONT_WEIGHT_900; break; default: error = CSS_INVALID; } } else if ((lwc_string_caseless_isequal(token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { weight = CSS_FONT_WEIGHT_NORMAL; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[BOLD], &match) == lwc_error_ok && match)) { weight = CSS_FONT_WEIGHT_BOLD; } else { error = CSS_INVALID; } if (error == CSS_OK) { font_face->bits[0] = (font_face->bits[0] & 0xc3) | (weight << 2); } else { *ctx = orig_ctx; } return error; } /** * Parse a descriptor in an @font-face rule * * \param c Parsing context * \param descriptor Token for this descriptor * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param rule Rule to process descriptor into * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_INVALID on invalid syntax, * CSS_NOMEM on memory exhaustion */ css_error css__parse_font_descriptor(css_language *c, const css_token *descriptor, const parserutils_vector *vector, int *ctx, css_rule_font_face *rule) { css_font_face *font_face = rule->font_face; css_error error; bool match; if (font_face == NULL) { error = css__font_face_create(&font_face); if (error != CSS_OK) { return error; } rule->font_face = font_face; } if (lwc_string_caseless_isequal(descriptor->idata, c->strings[FONT_FAMILY], &match) == lwc_error_ok && match) { return font_face_parse_font_family(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, c->strings[SRC], &match) == lwc_error_ok && match) { return font_face_parse_src(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, c->strings[FONT_STYLE], &match) == lwc_error_ok && match) { return font_face_parse_font_style(c, vector, ctx, font_face); } else if (lwc_string_caseless_isequal(descriptor->idata, c->strings[FONT_WEIGHT], &match) == lwc_error_ok && match) { return font_face_parse_font_weight(c, vector, ctx, font_face); } return CSS_INVALID; } netsurf-all-3.2/libcss/src/parse/properties/0000755000175000017500000000000012377713347020176 5ustar vincevincenetsurf-all-3.2/libcss/src/parse/properties/background_position.c0000644000175000017500000001343312377676736024423 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse background-position * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_background_position(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; uint8_t flags = 0; uint16_t value[2] = { 0 }; css_fixed length[2] = { 0 }; uint32_t unit[2] = { 0 }; bool match; /* [length | percentage | IDENT(left, right, top, bottom, center)]{1,2} * | IDENT(inherit) */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); flags = FLAG_INHERIT; } else { int i; for (i = 0; i < 2; i++) { token = parserutils_vector_peek(vector, *ctx); if (token == NULL) break; if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT], &match) == lwc_error_ok && match)) { value[i] = BACKGROUND_POSITION_HORZ_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT], &match) == lwc_error_ok && match)) { value[i] = BACKGROUND_POSITION_HORZ_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[TOP], &match) == lwc_error_ok && match)) { value[i] = BACKGROUND_POSITION_VERT_TOP; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[BOTTOM], &match) == lwc_error_ok && match)) { value[i] = BACKGROUND_POSITION_VERT_BOTTOM; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER], &match) == lwc_error_ok && match)) { /* We'll fix this up later */ value[i] = BACKGROUND_POSITION_VERT_CENTER; } else if (i == 1) { /* Second pass, so ignore this one */ break; } else { /* First pass, so invalid */ *ctx = orig_ctx; return CSS_INVALID; } parserutils_vector_iterate(vector, ctx); } else if (token->type == CSS_TOKEN_DIMENSION || token->type == CSS_TOKEN_NUMBER || token->type == CSS_TOKEN_PERCENTAGE) { error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[i], &unit[i]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if (unit[i] & UNIT_ANGLE || unit[i] & UNIT_TIME || unit[i] & UNIT_FREQ) { *ctx = orig_ctx; return CSS_INVALID; } /* We'll fix this up later, too */ value[i] = BACKGROUND_POSITION_VERT_SET; } else { if (i == 1) { /* Second pass, so ignore */ break; } else { /* First pass, so invalid */ *ctx = orig_ctx; return CSS_INVALID; } } consumeWhitespace(vector, ctx); } assert(i != 0); /* Now, sort out the mess we've got */ if (i == 1) { assert(BACKGROUND_POSITION_VERT_CENTER == BACKGROUND_POSITION_HORZ_CENTER); /* Only one value, so the other is center */ switch (value[0]) { case BACKGROUND_POSITION_HORZ_LEFT: case BACKGROUND_POSITION_HORZ_RIGHT: case BACKGROUND_POSITION_VERT_CENTER: case BACKGROUND_POSITION_VERT_TOP: case BACKGROUND_POSITION_VERT_BOTTOM: break; case BACKGROUND_POSITION_VERT_SET: value[0] = BACKGROUND_POSITION_HORZ_SET; break; } value[1] = BACKGROUND_POSITION_VERT_CENTER; } else if (value[0] != BACKGROUND_POSITION_VERT_SET && value[1] != BACKGROUND_POSITION_VERT_SET) { /* Two keywords. Verify the axes differ */ if (((value[0] & 0xf) != 0 && (value[1] & 0xf) != 0) || ((value[0] & 0xf0) != 0 && (value[1] & 0xf0) != 0)) { *ctx = orig_ctx; return CSS_INVALID; } } else { /* One or two non-keywords. First is horizontal */ if (value[0] == BACKGROUND_POSITION_VERT_SET) value[0] = BACKGROUND_POSITION_HORZ_SET; /* Verify the axes differ */ if (((value[0] & 0xf) != 0 && (value[1] & 0xf) != 0) || ((value[0] & 0xf0) != 0 && (value[1] & 0xf0) != 0)) { *ctx = orig_ctx; return CSS_INVALID; } } } error = css__stylesheet_style_appendOPV(result, CSS_PROP_BACKGROUND_POSITION, flags, value[0] | value[1]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if ((flags & FLAG_INHERIT) == false) { if (value[0] == BACKGROUND_POSITION_HORZ_SET) { error = css__stylesheet_style_append(result, length[0]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, unit[0]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } if (value[1] == BACKGROUND_POSITION_VERT_SET) { error = css__stylesheet_style_append(result, length[1]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, unit[1]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/elevation.c0000644000175000017500000000721512377676736022347 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse elevation * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_elevation(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; uint8_t flags = 0; uint16_t value = 0; css_fixed length = 0; uint32_t unit = 0; bool match; /* angle | IDENT(below, level, above, higher, lower, inherit) */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); flags = FLAG_INHERIT; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[BELOW], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = ELEVATION_BELOW; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[LEVEL], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = ELEVATION_LEVEL; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[ABOVE], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = ELEVATION_ABOVE; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[HIGHER], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = ELEVATION_HIGHER; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[LOWER], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = ELEVATION_LOWER; } else { error = css__parse_unit_specifier(c, vector, ctx, UNIT_DEG, &length, &unit); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if ((unit & UNIT_ANGLE) == false) { *ctx = orig_ctx; return CSS_INVALID; } /* Valid angles lie between -90 and 90 degrees */ if (unit == UNIT_DEG) { if (length < -F_90 || length > F_90) { *ctx = orig_ctx; return CSS_INVALID; } } else if (unit == UNIT_GRAD) { if (length < -F_100 || length > F_100) { *ctx = orig_ctx; return CSS_INVALID; } } else if (unit == UNIT_RAD) { if (length < -F_PI_2 || length > F_PI_2) { *ctx = orig_ctx; return CSS_INVALID; } } value = ELEVATION_ANGLE; } error = css__stylesheet_style_appendOPV(result, CSS_PROP_ELEVATION, flags, value); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if (((flags & FLAG_INHERIT) == false) && (value == ELEVATION_ANGLE)) { error = css__stylesheet_style_vappend(result, 2, length, unit); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/properties.gen0000644000175000017500000004071612377676736023107 0ustar vincevince##Common templates # #property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:) #property:CSS_PROP_ENUM IDENT:INHERIT NUMBER:( false: RANGE: NUMBER:) #property:CSS_PROP_ENUM IDENT:INHERIT LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:) #property:CSS_PROP_ENUM IDENT:( INHERIT: IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:) #property:CSS_PROP_ENUM WRAP: background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:) border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE IDENT:) cue_after:CSS_PROP_CUE_AFTER IDENT:( INHERIT: NONE:0,CUE_AFTER_NONE IDENT:) URI:CUE_AFTER_URI cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: NONE:0,CUE_BEFORE_NONE IDENT:) URI:CUE_BEFORE_URI direction:CSS_PROP_DIRECTION IDENT:( INHERIT: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:) display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE IDENT:) empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:) float:CSS_PROP_FLOAT IDENT:( INHERIT: LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:) font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( UNIT_PX:FONT_SIZE_DIMENSION DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:) font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:) height:CSS_PROP_HEIGHT IDENT:( INHERIT: AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:LETTER_SPACING_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) min_height:CSS_PROP_MIN_HEIGHT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) min_width:CSS_PROP_MIN_WIDTH IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET #generic for padding_{top, bottom, left, right}.c padding_side:op GENERIC: IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:PADDING_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side padding_top:CSS_PROP_PADDING_TOP WRAP:css__parse_padding_side padding_right:CSS_PROP_PADDING_RIGHT WRAP:css__parse_padding_side #generic for margin_{top, bottom, left, right}.c margin_side:op GENERIC IDENT:( INHERIT: AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ LENGTH_UNIT:) margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side #generic for {top, bottom, left, right}.c side:op GENERIC: IDENT:( INHERIT: AUTO:0,BOTTOM_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ LENGTH_UNIT:) top:CSS_PROP_TOP WRAP:css__parse_side bottom:CSS_PROP_BOTTOM WRAP:css__parse_side left:CSS_PROP_LEFT WRAP:css__parse_side right:CSS_PROP_RIGHT WRAP:css__parse_side #generic for border_{top, bottom, left, right}_width.c border_side_width:op GENERIC: IDENT:( INHERIT: THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET DISALLOW:unit==UNIT_PCT||unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH WRAP:css__parse_border_side_width border_left_width:CSS_PROP_BORDER_LEFT_WIDTH WRAP:css__parse_border_side_width border_right_width:CSS_PROP_BORDER_RIGHT_WIDTH WRAP:css__parse_border_side_width #generic for border_{top, bottom, left, right}_style.c border_side_style:op GENERIC: IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:) border_top_style:CSS_PROP_BORDER_TOP_STYLE WRAP:css__parse_border_side_style border_bottom_style:CSS_PROP_BORDER_BOTTOM_STYLE WRAP:css__parse_border_side_style border_left_style:CSS_PROP_BORDER_LEFT_STYLE WRAP:css__parse_border_side_style border_right_style:CSS_PROP_BORDER_RIGHT_STYLE WRAP:css__parse_border_side_style #generic for border_{top, bottom, left, right}_color.c border_side_color:op GENERIC: IDENT:( INHERIT: IDENT:) COLOR:BORDER_COLOR_SET border_top_color:CSS_PROP_BORDER_TOP_COLOR WRAP:css__parse_border_side_color border_bottom_color:CSS_PROP_BORDER_BOTTOM_COLOR WRAP:css__parse_border_side_color border_left_color:CSS_PROP_BORDER_LEFT_COLOR WRAP:css__parse_border_side_color border_right_color:CSS_PROP_BORDER_RIGHT_COLOR WRAP:css__parse_border_side_color counter_increment:CSS_PROP_COUNTER_INCREMENT IDENT:( INHERIT: NONE:0,COUNTER_INCREMENT_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_INCREMENT_NAMED 1:COUNTER_INCREMENT_NONE IDENT_LIST:) counter_reset:CSS_PROP_COUNTER_RESET IDENT:( INHERIT: NONE:0,COUNTER_RESET_NONE IDENT:) IDENT_LIST:( STRING_OPTNUM:COUNTER_RESET_NAMED 0:COUNTER_RESET_NONE IDENT_LIST:) background_attachment:CSS_PROP_BACKGROUND_ATTACHMENT IDENT:( INHERIT: FIXED:0,BACKGROUND_ATTACHMENT_FIXED SCROLL:0,BACKGROUND_ATTACHMENT_SCROLL IDENT:) background_color:CSS_PROP_BACKGROUND_COLOR IDENT:( INHERIT: IDENT:) COLOR:BACKGROUND_COLOR_SET caption_side:CSS_PROP_CAPTION_SIDE IDENT:( INHERIT: TOP:0,CAPTION_SIDE_TOP BOTTOM:0,CAPTION_SIDE_BOTTOM IDENT:) clear:CSS_PROP_CLEAR IDENT:( INHERIT: RIGHT:0,CLEAR_RIGHT LEFT:0,CLEAR_LEFT BOTH:0,CLEAR_BOTH NONE:0,CLEAR_NONE IDENT:) background_image:CSS_PROP_BACKGROUND_IMAGE IDENT:( INHERIT: NONE:0,BACKGROUND_IMAGE_NONE IDENT:) URI:BACKGROUND_IMAGE_URI list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:) orphans:CSS_PROP_ORPHANS IDENT:INHERIT NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:) outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:) outline_width:CSS_PROP_OUTLINE_WIDTH WRAP:css__parse_border_side_width overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:) page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:) page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:) pause_after:CSS_PROP_PAUSE_AFTER IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET DISALLOW:(unit&UNIT_TIME)==false&&(unit&UNIT_PCT)==false RANGE:<0 LENGTH_UNIT:) pause_before:CSS_PROP_PAUSE_BEFORE IDENT:INHERIT LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET DISALLOW:(unit&UNIT_TIME)==false&&(unit&UNIT_PCT)==false RANGE:<0 LENGTH_UNIT:) pitch:CSS_PROP_PITCH IDENT:( INHERIT: X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW:unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) pitch_range:CSS_PROP_PITCH_RANGE IDENT:INHERIT NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) position:CSS_PROP_POSITION IDENT:( INHERIT: LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED IDENT:) richness:CSS_PROP_RICHNESS IDENT:INHERIT NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:) speak:CSS_PROP_SPEAK IDENT:( INHERIT: NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:) speak_header:CSS_PROP_SPEAK_HEADER IDENT:( INHERIT: ONCE:0,SPEAK_HEADER_ONCE ALWAYS:0,SPEAK_HEADER_ALWAYS IDENT:) speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: DIGITS:0,SPEAK_NUMERAL_DIGITS CONTINUOUS:0,SPEAK_NUMERAL_CONTINUOUS IDENT:) speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:) speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 NUMBER:) stress:CSS_PROP_STRESS IDENT:INHERIT NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:) table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:) text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT IDENT:) text_indent:CSS_PROP_TEXT_INDENT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ LENGTH_UNIT:) text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE NONE:0,TEXT_TRANSFORM_NONE IDENT:) unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:) vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ LENGTH_UNIT:) visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:) volume:CSS_PROP_VOLUME IDENT:( INHERIT: SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( UNIT_PX:VOLUME_DIMENSION ALLOW:unit&UNIT_PCT RANGE:<0 LENGTH_UNIT:) white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE IDENT:) widows:CSS_PROP_WIDOWS IDENT:INHERIT NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:) width:CSS_PROP_WIDTH IDENT:( INHERIT: AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:) word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:) break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: AUTO:0,BREAK_BEFORE_AUTO ALWAYS:0,BREAK_BEFORE_ALWAYS AVOID:0,BREAK_BEFORE_AVOID LEFT:0,BREAK_BEFORE_LEFT RIGHT:0,BREAK_BEFORE_RIGHT PAGE:0,BREAK_BEFORE_PAGE COLUMN:0,BREAK_BEFORE_COLUMN AVOID_PAGE:0,BREAK_BEFORE_AVOID_PAGE AVOID_COLUMN:0,BREAK_BEFORE_AVOID_COLUMN IDENT:) break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN IDENT:) column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 NUMBER:) column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:) column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET RANGE:<0 DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: IDENT:) COLOR:COLUMN_RULE_COLOR_SET column_rule_style:CSS_PROP_COLUMN_RULE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE HIDDEN:0,BORDER_STYLE_HIDDEN DOTTED:0,BORDER_STYLE_DOTTED DASHED:0,BORDER_STYLE_DASHED SOLID:0,BORDER_STYLE_SOLID LIBCSS_DOUBLE:0,BORDER_STYLE_DOUBLE GROOVE:0,BORDER_STYLE_GROOVE RIDGE:0,BORDER_STYLE_RIDGE INSET:0,BORDER_STYLE_INSET OUTSET:0,BORDER_STYLE_OUTSET IDENT:) column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH WRAP:css__parse_border_side_width column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:) column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ||unit&UNIT_PCT LENGTH_UNIT:) writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:) netsurf-all-3.2/libcss/src/parse/properties/font_family.c0000644000175000017500000001013312377676736022661 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Determine if a given font-family ident is reserved * * \param c Parsing context * \param ident IDENT to consider * \return True if IDENT is reserved, false otherwise */ static bool font_family_reserved(css_language *c, const css_token *ident) { bool match; return (lwc_string_caseless_isequal( ident->idata, c->strings[SERIF], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[SANS_SERIF], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[CURSIVE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[FANTASY], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[MONOSPACE], &match) == lwc_error_ok && match); } /** * Convert a font-family token into a bytecode value * * \param c Parsing context * \param token Token to consider * \param first Whether the token is the first * \return Bytecode value */ static css_code_t font_family_value(css_language *c, const css_token *token, bool first) { uint16_t value; bool match; if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[SERIF], &match) == lwc_error_ok && match)) value = FONT_FAMILY_SERIF; else if ((lwc_string_caseless_isequal( token->idata, c->strings[SANS_SERIF], &match) == lwc_error_ok && match)) value = FONT_FAMILY_SANS_SERIF; else if ((lwc_string_caseless_isequal( token->idata, c->strings[CURSIVE], &match) == lwc_error_ok && match)) value = FONT_FAMILY_CURSIVE; else if ((lwc_string_caseless_isequal( token->idata, c->strings[FANTASY], &match) == lwc_error_ok && match)) value = FONT_FAMILY_FANTASY; else if ((lwc_string_caseless_isequal( token->idata, c->strings[MONOSPACE], &match) == lwc_error_ok && match)) value = FONT_FAMILY_MONOSPACE; else value = FONT_FAMILY_IDENT_LIST; } else { value = FONT_FAMILY_STRING; } return first ? buildOPV(CSS_PROP_FONT_FAMILY, 0, value) : value; } /** * Parse font-family * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font_family(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; bool match; /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space * * \todo Mozilla makes the comma optional. * Perhaps this is a quirk we should inherit? */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_STRING)) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY); } else { *ctx = orig_ctx; error = css__comma_list_to_style(c, vector, ctx, font_family_reserved, font_family_value, result); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, FONT_FAMILY_END); } if (error != CSS_OK) { *ctx = orig_ctx; return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/columns.c0000644000175000017500000000665412377676736022047 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse columns shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_columns(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error = CSS_OK; bool width = true; bool count = true; css_style *width_style; css_style *count_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_COLUMN_WIDTH); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_COLUMN_COUNT); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Allocate for styles */ error = css__stylesheet_style_create(c->sheet, &width_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &count_style); if (error != CSS_OK) { css__stylesheet_style_destroy(width_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; if (is_css_inherit(c, token)) { /* Can't have another inherit */ error = CSS_INVALID; goto css__parse_columns_cleanup; } /* Try each property parser in turn, but only if we * haven't already got a value for this property. */ if ((width) && (error = css__parse_column_width(c, vector, ctx, width_style)) == CSS_OK) { width = false; } else if ((count) && (error = css__parse_column_count(c, vector, ctx, count_style)) == CSS_OK) { count = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); /* Set unset properties to initial values */ if (width) { error = css__stylesheet_style_appendOPV(width_style, CSS_PROP_COLUMN_WIDTH, 0, COLUMN_WIDTH_AUTO); if (error != CSS_OK) goto css__parse_columns_cleanup; } if (count) { error = css__stylesheet_style_appendOPV(count_style, CSS_PROP_COLUMN_COUNT, 0, COLUMN_COUNT_AUTO); if (error != CSS_OK) goto css__parse_columns_cleanup; } /* Merge styles into the result */ error = css__stylesheet_merge_style(result, width_style); if (error != CSS_OK) goto css__parse_columns_cleanup; error = css__stylesheet_merge_style(result, count_style); css__parse_columns_cleanup: css__stylesheet_style_destroy(width_style); css__stylesheet_style_destroy(count_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/border_style.c0000644000175000017500000001153412377676736023055 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse border-style shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; uint16_t side_val[4]; uint32_t side_count = 0; bool match; css_error error; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_STYLE); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Attempt to parse up to 4 styles */ do { prev_ctx = *ctx; if ((token != NULL) && is_css_inherit(c, token)) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type != CSS_TOKEN_IDENT) break; if ((lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_NONE; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[HIDDEN], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_HIDDEN; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[DOTTED], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_DOTTED; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[DASHED], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_DASHED; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[SOLID], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_SOLID; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[LIBCSS_DOUBLE], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_DOUBLE; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[GROOVE], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_GROOVE; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[RIDGE], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_RIDGE; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[INSET], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_INSET; } else if ((lwc_string_caseless_isequal(token->idata, c->strings[OUTSET], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_STYLE_OUTSET; } else { break; } side_count++; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } while ((*ctx != prev_ctx) && (token != NULL) && (side_count < 4)); #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, side_val[(NUM)]); \ if (error != CSS_OK) \ break switch (side_count) { case 1: SIDE_APPEND(CSS_PROP_BORDER_TOP_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_STYLE, 0); break; case 2: SIDE_APPEND(CSS_PROP_BORDER_TOP_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_STYLE, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_STYLE, 1); break; case 3: SIDE_APPEND(CSS_PROP_BORDER_TOP_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_STYLE, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_STYLE, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_STYLE, 1); break; case 4: SIDE_APPEND(CSS_PROP_BORDER_TOP_STYLE, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_STYLE, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_STYLE, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_STYLE, 3); break; default: error = CSS_INVALID; break; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/play_during.c0000644000175000017500000000674212377676736022702 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse play-during * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_play_during(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; uint8_t flags = 0; uint16_t value = 0; lwc_string *uri; bool match; uint32_t uri_snumber; /* URI [ IDENT(mix) || IDENT(repeat) ]? | IDENT(auto,none,inherit) */ token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_URI))) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { flags |= FLAG_INHERIT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { value = PLAY_DURING_NONE; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) { value = PLAY_DURING_AUTO; } else { *ctx = orig_ctx; return CSS_INVALID; } } else { int modifiers; value = PLAY_DURING_URI; error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, token->idata, &uri); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_string_add(c->sheet, uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } for (modifiers = 0; modifiers < 2; modifiers++) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token != NULL && token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[MIX], &match) == lwc_error_ok && match)) { if ((value & PLAY_DURING_MIX) == 0) value |= PLAY_DURING_MIX; else { *ctx = orig_ctx; return CSS_INVALID; } } else if (lwc_string_caseless_isequal( token->idata, c->strings[REPEAT], &match) == lwc_error_ok && match) { if ((value & PLAY_DURING_REPEAT) == 0) value |= PLAY_DURING_REPEAT; else { *ctx = orig_ctx; return CSS_INVALID; } } else { *ctx = orig_ctx; return CSS_INVALID; } parserutils_vector_iterate(vector, ctx); } } } error = css__stylesheet_style_appendOPV(result, CSS_PROP_PLAY_DURING, flags, value); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if ((flags & FLAG_INHERIT) == false && (value & PLAY_DURING_TYPE_MASK) == PLAY_DURING_URI) { error = css__stylesheet_style_append(result, uri_snumber); } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/properties.c0000644000175000017500000000722012377676736022551 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include "parse/properties/properties.h" /** * Dispatch table of property handlers, indexed by property enum */ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = { css__parse_azimuth, css__parse_background, css__parse_background_attachment, css__parse_background_color, css__parse_background_image, css__parse_background_position, css__parse_background_repeat, css__parse_border, css__parse_border_bottom, css__parse_border_bottom_color, css__parse_border_bottom_style, css__parse_border_bottom_width, css__parse_border_collapse, css__parse_border_color, css__parse_border_left, css__parse_border_left_color, css__parse_border_left_style, css__parse_border_left_width, css__parse_border_right, css__parse_border_right_color, css__parse_border_right_style, css__parse_border_right_width, css__parse_border_spacing, css__parse_border_style, css__parse_border_top, css__parse_border_top_color, css__parse_border_top_style, css__parse_border_top_width, css__parse_border_width, css__parse_bottom, css__parse_break_after, css__parse_break_before, css__parse_break_inside, css__parse_caption_side, css__parse_clear, css__parse_clip, css__parse_color, css__parse_columns, css__parse_column_count, css__parse_column_fill, css__parse_column_gap, css__parse_column_rule, css__parse_column_rule_color, css__parse_column_rule_style, css__parse_column_rule_width, css__parse_column_span, css__parse_column_width, css__parse_content, css__parse_counter_increment, css__parse_counter_reset, css__parse_cue, css__parse_cue_after, css__parse_cue_before, css__parse_cursor, css__parse_direction, css__parse_display, css__parse_elevation, css__parse_empty_cells, css__parse_float, css__parse_font, css__parse_font_family, css__parse_font_size, css__parse_font_style, css__parse_font_variant, css__parse_font_weight, css__parse_height, css__parse_left, css__parse_letter_spacing, css__parse_line_height, css__parse_list_style, css__parse_list_style_image, css__parse_list_style_position, css__parse_list_style_type, css__parse_margin, css__parse_margin_bottom, css__parse_margin_left, css__parse_margin_right, css__parse_margin_top, css__parse_max_height, css__parse_max_width, css__parse_min_height, css__parse_min_width, css__parse_opacity, css__parse_orphans, css__parse_outline, css__parse_outline_color, css__parse_outline_style, css__parse_outline_width, css__parse_overflow, css__parse_overflow_x, css__parse_overflow_y, css__parse_padding, css__parse_padding_bottom, css__parse_padding_left, css__parse_padding_right, css__parse_padding_top, css__parse_page_break_after, css__parse_page_break_before, css__parse_page_break_inside, css__parse_pause, css__parse_pause_after, css__parse_pause_before, css__parse_pitch_range, css__parse_pitch, css__parse_play_during, css__parse_position, css__parse_quotes, css__parse_richness, css__parse_right, css__parse_speak_header, css__parse_speak_numeral, css__parse_speak_punctuation, css__parse_speak, css__parse_speech_rate, css__parse_stress, css__parse_table_layout, css__parse_text_align, css__parse_text_decoration, css__parse_text_indent, css__parse_text_transform, css__parse_top, css__parse_unicode_bidi, css__parse_vertical_align, css__parse_visibility, css__parse_voice_family, css__parse_volume, css__parse_white_space, css__parse_widows, css__parse_width, css__parse_word_spacing, css__parse_writing_mode, css__parse_z_index }; netsurf-all-3.2/libcss/src/parse/properties/pause.c0000644000175000017500000000431312377676736021472 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse pause shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_pause(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *first_token; const css_token *token; /* one or two tokens follow: * if one emit for both BEFORE and AFTER * if two first is before second is after * tokens are either IDENT:none or URI */ first_token = parserutils_vector_peek(vector, *ctx); error = css__parse_pause_before(c, vector, ctx, result); if (error == CSS_OK) { /* first token parsed */ consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { /* no second token, re-parse the first */ *ctx = orig_ctx; error = css__parse_pause_after(c, vector, ctx, result); } else { /* second token - might be useful */ if (is_css_inherit(c, token)) { /* another bogus inherit */ error = CSS_INVALID; } else { error = css__parse_pause_after(c, vector, ctx, result); if (error == CSS_OK) { /* second token parsed */ if (is_css_inherit(c, first_token)) { /* valid second token after inherit */ error = CSS_INVALID; } } else { /* second token appears to be junk re-try with first */ *ctx = orig_ctx; error = css__parse_pause_after(c, vector, ctx, result); } } } } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/voice_family.c0000644000175000017500000000666012377676736023032 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Determine if a given voice-family ident is reserved * * \param c Parsing context * \param ident IDENT to consider * \return True if IDENT is reserved, false otherwise */ static bool voice_family_reserved(css_language *c, const css_token *ident) { bool match; return (lwc_string_caseless_isequal( ident->idata, c->strings[MALE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[FEMALE], &match) == lwc_error_ok && match) || (lwc_string_caseless_isequal( ident->idata, c->strings[CHILD], &match) == lwc_error_ok && match); } /** * Convert a voice-family token into a bytecode value * * \param c Parsing context * \param token Token to consider * \return Bytecode value */ static css_code_t voice_family_value(css_language *c, const css_token *token, bool first) { uint16_t value; bool match; if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[MALE], &match) == lwc_error_ok && match)) value = VOICE_FAMILY_MALE; else if ((lwc_string_caseless_isequal( token->idata, c->strings[FEMALE], &match) == lwc_error_ok && match)) value = VOICE_FAMILY_FEMALE; else if ((lwc_string_caseless_isequal( token->idata, c->strings[CHILD], &match) == lwc_error_ok && match)) value = VOICE_FAMILY_CHILD; else value = VOICE_FAMILY_IDENT_LIST; } else { value = VOICE_FAMILY_STRING; } return first ? buildOPV(CSS_PROP_VOICE_FAMILY, 0, value) : value; } /** * Parse voice-family * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_voice_family(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; bool match; /* [ IDENT+ | STRING ] [ ',' [ IDENT+ | STRING ] ]* | IDENT(inherit) * * In the case of IDENT+, any whitespace between tokens is collapsed to * a single space */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_STRING)) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_VOICE_FAMILY); } else { *ctx = orig_ctx; error = css__comma_list_to_style(c, vector, ctx, voice_family_reserved, voice_family_value, result); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, VOICE_FAMILY_END); } if (error != CSS_OK) { *ctx = orig_ctx; return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/column_rule.c0000644000175000017500000001104712377676736022703 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse column-rule shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_column_rule(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error; bool color = true; bool style = true; bool width = true; css_style *color_style; css_style *style_style; css_style *width_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_COLUMN_RULE_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_COLUMN_RULE_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_COLUMN_RULE_WIDTH); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Allocate for styles */ error = css__stylesheet_style_create(c->sheet, &color_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &style_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); return error; } error = css__stylesheet_style_create(c->sheet, &width_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(style_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if (token != NULL && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_column_rule_cleanup; } if ((color) && (error = css__parse_column_rule_color(c, vector, ctx, color_style)) == CSS_OK) { color = false; } else if ((style) && (error = css__parse_column_rule_style(c, vector, ctx, style_style)) == CSS_OK) { style = false; } else if ((width) && (error = css__parse_column_rule_width(c, vector, ctx, width_style)) == CSS_OK) { width = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); /* Set unset properties to initial values */ if (color) { error = css__stylesheet_style_appendOPV(color_style, CSS_PROP_COLUMN_RULE_COLOR, 0, COLUMN_RULE_COLOR_SET); if (error != CSS_OK) goto css__parse_column_rule_cleanup; /** TODO: initial colour should be the UA-defined initial * value of the "color" property, not "0" */ error = css__stylesheet_style_append(color_style, 0x00000000); if (error != CSS_OK) goto css__parse_column_rule_cleanup; } if (style) { error = css__stylesheet_style_appendOPV(style_style, CSS_PROP_COLUMN_RULE_STYLE, 0, COLUMN_RULE_STYLE_NONE); if (error != CSS_OK) goto css__parse_column_rule_cleanup; } if (width) { error = css__stylesheet_style_appendOPV(width_style, CSS_PROP_COLUMN_RULE_WIDTH, 0, COLUMN_RULE_WIDTH_MEDIUM); if (error != CSS_OK) goto css__parse_column_rule_cleanup; } /* Merge styles into the result */ error = css__stylesheet_merge_style(result, color_style); if (error != CSS_OK) goto css__parse_column_rule_cleanup; error = css__stylesheet_merge_style(result, style_style); if (error != CSS_OK) goto css__parse_column_rule_cleanup; error = css__stylesheet_merge_style(result, width_style); css__parse_column_rule_cleanup: css__stylesheet_style_destroy(width_style); css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(color_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/quotes.c0000644000175000017500000000655612377676736021710 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse quotes * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_quotes(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error = CSS_INVALID; const css_token *token; bool match; /* [ STRING STRING ]+ | IDENT(none,inherit) */ token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_STRING))) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_QUOTES); } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_QUOTES, 0, QUOTES_NONE); } else if (token->type == CSS_TOKEN_STRING) { bool first = true; /* Macro to output the value marker, awkward because we need to check * first to determine how the value is constructed. */ #define CSS_FIRST_APPEND(CSSVAL) css__stylesheet_style_append(result, first?buildOPV(CSS_PROP_QUOTES, 0, CSSVAL):CSSVAL) /* [ STRING STRING ]+ */ while ((token != NULL) && (token->type == CSS_TOKEN_STRING)) { uint32_t open_snumber; uint32_t close_snumber; error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &open_snumber); if (error != CSS_OK) break; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_STRING)) { error = CSS_INVALID; break; } error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &close_snumber); if (error != CSS_OK) break; consumeWhitespace(vector, ctx); error = CSS_FIRST_APPEND(QUOTES_STRING); if (error != CSS_OK) break; error = css__stylesheet_style_append(result, open_snumber); if (error != CSS_OK) break; error = css__stylesheet_style_append(result, close_snumber); if (error != CSS_OK) break; first = false; token = parserutils_vector_peek(vector, *ctx); if (token == NULL || token->type != CSS_TOKEN_STRING) break; token = parserutils_vector_iterate(vector, ctx); } if (error == CSS_OK) { /* AddTerminator */ error = css__stylesheet_style_append(result, QUOTES_NONE); } } else { error = CSS_INVALID; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/content.c0000644000175000017500000002530212377676736022030 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse content * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_content(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; bool match; /* IDENT(normal, none, inherit) | [ ... ]+ */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_CONTENT); } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_CONTENT, 0, CONTENT_NORMAL); } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_CONTENT, 0, CONTENT_NONE); } else { /* Macro to output the value marker, awkward because we need to check * first to determine how the value is constructed. */ #define CSS_APPEND(CSSVAL) css__stylesheet_style_append(result, first?buildOPV(CSS_PROP_CONTENT, 0, CSSVAL):CSSVAL) bool first = true; int prev_ctx = orig_ctx; /* [ * IDENT(open-quote, close-quote, no-open-quote, * no-close-quote) | * STRING | * URI | * FUNCTION(attr) IDENT ')' | * FUNCTION(counter) IDENT IDENT? ')' | * FUNCTION(counters) IDENT STRING IDENT? ')' * ]+ */ while (token != NULL) { if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal( token->idata, c->strings[OPEN_QUOTE], &match) == lwc_error_ok && match)) { error = CSS_APPEND(CONTENT_OPEN_QUOTE); } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[CLOSE_QUOTE], &match) == lwc_error_ok && match)) { error = CSS_APPEND(CONTENT_CLOSE_QUOTE); } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[NO_OPEN_QUOTE], &match) == lwc_error_ok && match)) { error = CSS_APPEND(CONTENT_NO_OPEN_QUOTE); } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[NO_CLOSE_QUOTE], &match) == lwc_error_ok && match)) { error = CSS_APPEND(CONTENT_NO_CLOSE_QUOTE); } else if (token->type == CSS_TOKEN_STRING) { uint32_t snumber; error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(CONTENT_STRING); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, snumber); } else if (token->type == CSS_TOKEN_URI) { lwc_string *uri; uint32_t uri_snumber; error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, token->idata, &uri); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_string_add(c->sheet, uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(CONTENT_URI); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, uri_snumber); } else if (token->type == CSS_TOKEN_FUNCTION && (lwc_string_caseless_isequal( token->idata, c->strings[ATTR], &match) == lwc_error_ok && match)) { uint32_t snumber; consumeWhitespace(vector, ctx); /* Expect IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(CONTENT_ATTR); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, snumber); consumeWhitespace(vector, ctx); /* Expect ')' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { *ctx = orig_ctx; return CSS_INVALID; } } else if (token->type == CSS_TOKEN_FUNCTION && (lwc_string_caseless_isequal( token->idata, c->strings[COUNTER], &match) == lwc_error_ok && match)) { lwc_string *name; uint32_t snumber; uint32_t opv; opv = CONTENT_COUNTER; consumeWhitespace(vector, ctx); /* Expect IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } name = token->idata; consumeWhitespace(vector, ctx); /* Possible ',' */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL || (tokenIsChar(token, ',') == false && tokenIsChar(token, ')') == false)) { *ctx = orig_ctx; return CSS_INVALID; } if (tokenIsChar(token, ',')) { uint16_t v; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); /* Expect IDENT */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } error = css__parse_list_style_type_value(c, token, &v); if (error != CSS_OK) { *ctx = orig_ctx; return error; } opv |= v << CONTENT_COUNTER_STYLE_SHIFT; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); } else { opv |= LIST_STYLE_TYPE_DECIMAL << CONTENT_COUNTER_STYLE_SHIFT; } /* Expect ')' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { *ctx = orig_ctx; return CSS_INVALID; } error = css__stylesheet_string_add(c->sheet, lwc_string_ref(name), &snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(opv); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, snumber); } else if (token->type == CSS_TOKEN_FUNCTION && (lwc_string_caseless_isequal( token->idata, c->strings[COUNTERS], &match) == lwc_error_ok && match)) { lwc_string *name; lwc_string *sep; uint32_t name_snumber; uint32_t sep_snumber; uint32_t opv; opv = CONTENT_COUNTERS; consumeWhitespace(vector, ctx); /* Expect IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } name = token->idata; consumeWhitespace(vector, ctx); /* Expect ',' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ',') == false) { *ctx = orig_ctx; return CSS_INVALID; } consumeWhitespace(vector, ctx); /* Expect STRING */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_STRING) { *ctx = orig_ctx; return CSS_INVALID; } sep = token->idata; consumeWhitespace(vector, ctx); /* Possible ',' */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL || (tokenIsChar(token, ',') == false && tokenIsChar(token, ')') == false)) { *ctx = orig_ctx; return CSS_INVALID; } if (tokenIsChar(token, ',')) { uint16_t v; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); /* Expect IDENT */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } error = css__parse_list_style_type_value(c, token, &v); if (error != CSS_OK) { *ctx = orig_ctx; return error; } opv |= v << CONTENT_COUNTERS_STYLE_SHIFT; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); } else { opv |= LIST_STYLE_TYPE_DECIMAL << CONTENT_COUNTERS_STYLE_SHIFT; } /* Expect ')' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { *ctx = orig_ctx; return CSS_INVALID; } error = css__stylesheet_string_add(c->sheet, lwc_string_ref(name), &name_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_string_add(c->sheet, lwc_string_ref(sep), &sep_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(opv); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, name_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, sep_snumber); } else if (first) { /* Invalid if this is the first iteration */ error = CSS_INVALID; } else { /* Give up, ensuring current token is reprocessed */ *ctx = prev_ctx; error = CSS_OK; break; } /* if there was an error bail */ if (error != CSS_OK) { *ctx = orig_ctx; return error; } first = false; consumeWhitespace(vector, ctx); prev_ctx = *ctx; token = parserutils_vector_iterate(vector, ctx); } /* while */ /* Write list terminator */ css__stylesheet_style_append(result, CONTENT_NORMAL); } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/border.c0000644000175000017500000000311512377676736021631 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse border shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_TOP); if (error != CSS_OK) { *ctx = orig_ctx; return error; } *ctx = orig_ctx; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_RIGHT); if (error != CSS_OK) { *ctx = orig_ctx; return error; } *ctx = orig_ctx; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_BOTTOM); if (error != CSS_OK) { *ctx = orig_ctx; return error; } *ctx = orig_ctx; error = css__parse_border_side(c, vector, ctx, result, BORDER_SIDE_LEFT); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/cursor.c0000644000175000017500000001403112377676736021670 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse cursor * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_cursor(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error = CSS_OK; const css_token *token; bool match; /* [ (URI ',')* IDENT(auto, crosshair, default, pointer, move, e-resize, * ne-resize, nw-resize, n-resize, se-resize, sw-resize, * s-resize, w-resize, text, wait, help, progress) ] * | IDENT(inherit) */ token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_URI)) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_CURSOR); } else { bool first = true; /* Macro to output the value marker, awkward because we need to check * first to determine how the value is constructed. */ #define CSS_APPEND(CSSVAL) css__stylesheet_style_append(result, first?buildOPV(CSS_PROP_CURSOR, 0, CSSVAL):CSSVAL) /* URI* */ while (token != NULL && token->type == CSS_TOKEN_URI) { lwc_string *uri; uint32_t uri_snumber; error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, token->idata, &uri); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_string_add(c->sheet, uri, &uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = CSS_APPEND(CURSOR_URI); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, uri_snumber); if (error != CSS_OK) { *ctx = orig_ctx; return error; } consumeWhitespace(vector, ctx); /* Expect ',' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ',') == false) { *ctx = orig_ctx; return CSS_INVALID; } consumeWhitespace(vector, ctx); /* Expect either URI or IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_URI)) { *ctx = orig_ctx; return CSS_INVALID; } first = false; } /* IDENT */ if (token != NULL && token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_AUTO); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CROSSHAIR], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_CROSSHAIR); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[DEFAULT], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_DEFAULT); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[POINTER], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_POINTER); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[MOVE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_MOVE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[E_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_E_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[NE_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_NE_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[NW_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_NW_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[N_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_N_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[SE_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_SE_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[SW_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_SW_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[S_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_S_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[W_RESIZE], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_W_RESIZE); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[LIBCSS_TEXT], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_TEXT); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[WAIT], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_WAIT); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[HELP], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_HELP); } else if ((lwc_string_caseless_isequal( token->idata, c->strings[PROGRESS], &match) == lwc_error_ok && match)) { error=CSS_APPEND(CURSOR_PROGRESS); } else { error = CSS_INVALID; } } } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/utils.c0000644000175000017500000010732112377676736021520 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "stylesheet.h" #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" #include "utils/parserutilserror.h" /** * Parse list-style-type value * * \param c Parsing context * \param ident Identifier to consider * \param value Pointer to location to receive value * \return CSS_OK on success, * CSS_INVALID if the input is not valid */ css_error css__parse_list_style_type_value(css_language *c, const css_token *ident, uint16_t *value) { bool match; /* IDENT (disc, circle, square, decimal, decimal-leading-zero, * lower-roman, upper-roman, lower-greek, lower-latin, * upper-latin, armenian, georgian, lower-alpha, upper-alpha, * none) */ if ((lwc_string_caseless_isequal( ident->idata, c->strings[DISC], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_DISC; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[CIRCLE], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_CIRCLE; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[SQUARE], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_SQUARE; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[DECIMAL], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_DECIMAL; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[DECIMAL_LEADING_ZERO], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[LOWER_ROMAN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_LOWER_ROMAN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[UPPER_ROMAN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_UPPER_ROMAN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[LOWER_GREEK], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_LOWER_GREEK; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[LOWER_LATIN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_LOWER_LATIN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[UPPER_LATIN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_UPPER_LATIN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[ARMENIAN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_ARMENIAN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[GEORGIAN], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_GEORGIAN; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[LOWER_ALPHA], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_LOWER_ALPHA; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[UPPER_ALPHA], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_UPPER_ALPHA; } else if ((lwc_string_caseless_isequal( ident->idata, c->strings[NONE], &match) == lwc_error_ok && match)) { *value = LIST_STYLE_TYPE_NONE; } else return CSS_INVALID; return CSS_OK; } /** * Parse border-{top,right,bottom,left} shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param side The side we're parsing for * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum border_side_e side) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error = CSS_OK; bool color = true; bool style = true; bool width = true; css_style *color_style; css_style *style_style; css_style *width_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR + side); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_STYLE + side); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH + side); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &color_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &style_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); return error; } error = css__stylesheet_style_create(c->sheet, &width_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(style_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if (token != NULL && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_border_side_cleanup; } /* Try each property parser in turn, but only if we * haven't already got a value for this property. */ if ((color) && (error = css__parse_border_side_color(c, vector, ctx, color_style, CSS_PROP_BORDER_TOP_COLOR + side)) == CSS_OK) { color = false; } else if ((style) && (error = css__parse_border_side_style(c, vector, ctx, style_style, CSS_PROP_BORDER_TOP_STYLE + side)) == CSS_OK) { style = false; } else if ((width) && (error = css__parse_border_side_width(c, vector, ctx, width_style, CSS_PROP_BORDER_TOP_WIDTH + side)) == CSS_OK) { width = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); if (style) { error = css__stylesheet_style_appendOPV(style_style, CSS_PROP_BORDER_TOP_STYLE + side, 0, BORDER_STYLE_NONE); if (error != CSS_OK) goto css__parse_border_side_cleanup; } if (width) { error = css__stylesheet_style_appendOPV(width_style, CSS_PROP_BORDER_TOP_WIDTH + side, 0, BORDER_WIDTH_MEDIUM); if (error != CSS_OK) goto css__parse_border_side_cleanup; } if (color) { error = css__stylesheet_style_appendOPV(color_style, CSS_PROP_BORDER_TOP_COLOR + side, 0, BORDER_COLOR_CURRENT_COLOR); if (error != CSS_OK) goto css__parse_border_side_cleanup; } error = css__stylesheet_merge_style(result, color_style); if (error != CSS_OK) goto css__parse_border_side_cleanup; error = css__stylesheet_merge_style(result, style_style); if (error != CSS_OK) goto css__parse_border_side_cleanup; error = css__stylesheet_merge_style(result, width_style); css__parse_border_side_cleanup: css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(width_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } /** * Convert Hue Saturation Lightness value to RGB. * * \param hue Hue in degrees 0..360 * \param sat Saturation value in percent 0..100 * \param lit Lightness value in percent 0..100 * \param r red component * \param g green component * \param b blue component */ static void HSL_to_RGB(css_fixed hue, css_fixed sat, css_fixed lit, uint8_t *r, uint8_t *g, uint8_t *b) { css_fixed min_rgb, max_rgb, chroma; css_fixed relative_hue, scaled_hue, mid1, mid2; int sextant; #define ORGB(R, G, B) \ *r = FIXTOINT(FDIV(FMUL((R), F_255), F_100)); \ *g = FIXTOINT(FDIV(FMUL((G), F_255), F_100)); \ *b = FIXTOINT(FDIV(FMUL((B), F_255), F_100)) /* If saturation is zero there is no hue and r = g = b = lit */ if (sat == INTTOFIX(0)) { ORGB(lit, lit, lit); return; } /* Compute max(r,g,b) */ if (lit <= INTTOFIX(50)) { max_rgb = FDIV(FMUL(lit, FADD(sat, F_100)), F_100); } else { max_rgb = FDIV(FSUB(FMUL(FADD(lit, sat), F_100), FMUL(lit, sat)), F_100); } /* Compute min(r,g,b) */ min_rgb = FSUB(FMUL(lit, INTTOFIX(2)), max_rgb); /* We know that the value of at least one of the components is * max(r,g,b) and that the value of at least one of the other * components is min(r,g,b). * * We can determine which components have these values by * considering which the sextant of the hexcone the hue lies * in: * * Sextant: max(r,g,b): min(r,g,b): * * 0 r b * 1 g b * 2 g r * 3 b r * 4 b g * 5 r g * * Thus, we need only compute the value of the third component */ /* Chroma is the difference between min and max */ chroma = FSUB(max_rgb, min_rgb); /* Compute which sextant the hue lies in (truncates result) */ hue = FDIV(FMUL(hue, INTTOFIX(6)), F_360); sextant = FIXTOINT(hue); /* Compute offset of hue from start of sextant */ relative_hue = FSUB(hue, INTTOFIX(sextant)); /* Scale offset by chroma */ scaled_hue = FMUL(relative_hue, chroma); /* Compute potential values of the third colour component */ mid1 = FADD(min_rgb, scaled_hue); mid2 = FSUB(max_rgb, scaled_hue); /* Populate result */ switch (sextant) { case 0: ORGB(max_rgb, mid1, min_rgb); break; case 1: ORGB(mid2, max_rgb, min_rgb); break; case 2: ORGB(min_rgb, max_rgb, mid1); break; case 3: ORGB(min_rgb, mid2, max_rgb); break; case 4: ORGB(mid1, min_rgb, max_rgb); break; case 5: ORGB(max_rgb, min_rgb, mid2); break; } #undef ORGB } /** * Parse a colour specifier * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param value Pointer to location to receive value * \param result Pointer to location to receive result (AARRGGBB) * \return CSS_OK on success, * CSS_INVALID if the input is invalid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_colour_specifier(css_language *c, const parserutils_vector *vector, int *ctx, uint16_t *value, uint32_t *result) { int orig_ctx = *ctx; const css_token *token; bool match; css_error error; consumeWhitespace(vector, ctx); /* IDENT() | * HASH(rgb | rrggbb) | * FUNCTION(rgb) [ [ NUMBER | PERCENTAGE ] ',' ] {3} ')' * FUNCTION(rgba) [ [ NUMBER | PERCENTAGE ] ',' ] {4} ')' * FUNCTION(hsl) ANGLE ',' PERCENTAGE ',' PERCENTAGE ')' * FUNCTION(hsla) ANGLE ',' PERCENTAGE ',' PERCENTAGE ',' NUMBER ')' * * For quirks, NUMBER | DIMENSION | IDENT, too * I.E. "123456" -> NUMBER, "1234f0" -> DIMENSION, "f00000" -> IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_HASH && token->type != CSS_TOKEN_FUNCTION)) { if (c->sheet->quirks_allowed == false || token == NULL || (token->type != CSS_TOKEN_NUMBER && token->type != CSS_TOKEN_DIMENSION)) goto invalid; } if (token->type == CSS_TOKEN_IDENT) { if ((lwc_string_caseless_isequal( token->idata, c->strings[TRANSPARENT], &match) == lwc_error_ok && match)) { *value = COLOR_TRANSPARENT; *result = 0; /* black transparent */ return CSS_OK; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CURRENTCOLOR], &match) == lwc_error_ok && match)) { *value = COLOR_CURRENT_COLOR; *result = 0; return CSS_OK; } error = css__parse_named_colour(c, token->idata, result); if (error != CSS_OK && c->sheet->quirks_allowed) { error = css__parse_hash_colour(token->idata, result); if (error == CSS_OK) c->sheet->quirks_used = true; } if (error != CSS_OK) goto invalid; } else if (token->type == CSS_TOKEN_HASH) { error = css__parse_hash_colour(token->idata, result); if (error != CSS_OK) goto invalid; } else if (c->sheet->quirks_allowed && token->type == CSS_TOKEN_NUMBER) { error = css__parse_hash_colour(token->idata, result); if (error == CSS_OK) c->sheet->quirks_used = true; else goto invalid; } else if (c->sheet->quirks_allowed && token->type == CSS_TOKEN_DIMENSION) { error = css__parse_hash_colour(token->idata, result); if (error == CSS_OK) c->sheet->quirks_used = true; else goto invalid; } else if (token->type == CSS_TOKEN_FUNCTION) { uint8_t r = 0, g = 0, b = 0, a = 0xff; int colour_channels = 0; if ((lwc_string_caseless_isequal( token->idata, c->strings[RGB], &match) == lwc_error_ok && match)) { colour_channels = 3; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RGBA], &match) == lwc_error_ok && match)) { colour_channels = 4; } if ((lwc_string_caseless_isequal( token->idata, c->strings[HSL], &match) == lwc_error_ok && match)) { colour_channels = 5; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[HSLA], &match) == lwc_error_ok && match)) { colour_channels = 6; } if (colour_channels == 3 || colour_channels == 4) { int i; css_token_type valid = CSS_TOKEN_NUMBER; uint8_t *components[4] = { &r, &g, &b, &a }; for (i = 0; i < colour_channels; i++) { uint8_t *component; css_fixed num; size_t consumed = 0; int32_t intval; bool int_only; component = components[i]; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL || (token->type != CSS_TOKEN_NUMBER && token->type != CSS_TOKEN_PERCENTAGE)) goto invalid; if (i == 0) valid = token->type; else if (i < 3 && token->type != valid) goto invalid; /* The alpha channel may be a float */ if (i < 3) int_only = (valid == CSS_TOKEN_NUMBER); else int_only = false; num = css__number_from_lwc_string(token->idata, int_only, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; if (valid == CSS_TOKEN_NUMBER) { if (i == 3) { /* alpha channel */ intval = FIXTOINT( FMUL(num, F_255)); } else { /* colour channels */ intval = FIXTOINT(num); } } else { intval = FIXTOINT( FDIV(FMUL(num, F_255), F_100)); } if (intval > 255) *component = 255; else if (intval < 0) *component = 0; else *component = intval; parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL) goto invalid; if (i != (colour_channels - 1) && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, ctx); } else if (i == (colour_channels - 1) && tokenIsChar(token, ')')) { parserutils_vector_iterate(vector, ctx); } else { goto invalid; } } } else if (colour_channels == 5 || colour_channels == 6) { /* hue - saturation - lightness */ size_t consumed = 0; css_fixed hue, sat, lit; int32_t alpha = 255; /* hue is a number without a unit representing an * angle (0-360) degrees */ consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_NUMBER)) goto invalid; hue = css__number_from_lwc_string(token->idata, false, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; /* failed to consume the whole string as a number */ /* Normalise hue to the range [0, 360) */ while (hue < 0) hue += F_360; while (hue >= F_360) hue -= F_360; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (!tokenIsChar(token, ',')) goto invalid; /* saturation */ consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_PERCENTAGE)) goto invalid; sat = css__number_from_lwc_string(token->idata, false, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; /* failed to consume the whole string as a number */ /* Normalise saturation to the range [0, 100] */ if (sat < INTTOFIX(0)) sat = INTTOFIX(0); else if (sat > INTTOFIX(100)) sat = INTTOFIX(100); consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (!tokenIsChar(token, ',')) goto invalid; /* lightness */ consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_PERCENTAGE)) goto invalid; lit = css__number_from_lwc_string(token->idata, false, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; /* failed to consume the whole string as a number */ /* Normalise lightness to the range [0, 100] */ if (lit < INTTOFIX(0)) lit = INTTOFIX(0); else if (lit > INTTOFIX(100)) lit = INTTOFIX(100); consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (colour_channels == 6) { /* alpha */ if (!tokenIsChar(token, ',')) goto invalid; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_NUMBER)) goto invalid; alpha = css__number_from_lwc_string(token->idata, false, &consumed); if (consumed != lwc_string_length(token->idata)) goto invalid; /* failed to consume the whole string as a number */ alpha = FIXTOINT(FMUL(alpha, F_255)); consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); } if (!tokenIsChar(token, ')')) goto invalid; /* have a valid HSV entry, convert to RGB */ HSL_to_RGB(hue, sat, lit, &r, &g, &b); /* apply alpha */ if (alpha > 255) a = 255; else if (alpha < 0) a = 0; else a = alpha; } else { goto invalid; } *result = (a << 24) | (r << 16) | (g << 8) | b; } *value = COLOR_SET; return CSS_OK; invalid: *ctx = orig_ctx; return CSS_INVALID; } /** * Parse a named colour * * \param c Parsing context * \param data Colour name string * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_INVALID if the colour name is unknown */ css_error css__parse_named_colour(css_language *c, lwc_string *data, uint32_t *result) { static const uint32_t colourmap[LAST_COLOUR + 1 - FIRST_COLOUR] = { 0xfff0f8ff, /* ALICEBLUE */ 0xfffaebd7, /* ANTIQUEWHITE */ 0xff00ffff, /* AQUA */ 0xff7fffd4, /* AQUAMARINE */ 0xfff0ffff, /* AZURE */ 0xfff5f5dc, /* BEIGE */ 0xffffe4c4, /* BISQUE */ 0xff000000, /* BLACK */ 0xffffebcd, /* BLANCHEDALMOND */ 0xff0000ff, /* BLUE */ 0xff8a2be2, /* BLUEVIOLET */ 0xffa52a2a, /* BROWN */ 0xffdeb887, /* BURLYWOOD */ 0xff5f9ea0, /* CADETBLUE */ 0xff7fff00, /* CHARTREUSE */ 0xffd2691e, /* CHOCOLATE */ 0xffff7f50, /* CORAL */ 0xff6495ed, /* CORNFLOWERBLUE */ 0xfffff8dc, /* CORNSILK */ 0xffdc143c, /* CRIMSON */ 0xff00ffff, /* CYAN */ 0xff00008b, /* DARKBLUE */ 0xff008b8b, /* DARKCYAN */ 0xffb8860b, /* DARKGOLDENROD */ 0xffa9a9a9, /* DARKGRAY */ 0xff006400, /* DARKGREEN */ 0xffa9a9a9, /* DARKGREY */ 0xffbdb76b, /* DARKKHAKI */ 0xff8b008b, /* DARKMAGENTA */ 0xff556b2f, /* DARKOLIVEGREEN */ 0xffff8c00, /* DARKORANGE */ 0xff9932cc, /* DARKORCHID */ 0xff8b0000, /* DARKRED */ 0xffe9967a, /* DARKSALMON */ 0xff8fbc8f, /* DARKSEAGREEN */ 0xff483d8b, /* DARKSLATEBLUE */ 0xff2f4f4f, /* DARKSLATEGRAY */ 0xff2f4f4f, /* DARKSLATEGREY */ 0xff00ced1, /* DARKTURQUOISE */ 0xff9400d3, /* DARKVIOLET */ 0xffff1493, /* DEEPPINK */ 0xff00bfff, /* DEEPSKYBLUE */ 0xff696969, /* DIMGRAY */ 0xff696969, /* DIMGREY */ 0xff1e90ff, /* DODGERBLUE */ 0xffd19275, /* FELDSPAR */ 0xffb22222, /* FIREBRICK */ 0xfffffaf0, /* FLORALWHITE */ 0xff228b22, /* FORESTGREEN */ 0xffff00ff, /* FUCHSIA */ 0xffdcdcdc, /* GAINSBORO */ 0xfff8f8ff, /* GHOSTWHITE */ 0xffffd700, /* GOLD */ 0xffdaa520, /* GOLDENROD */ 0xff808080, /* GRAY */ 0xff008000, /* GREEN */ 0xffadff2f, /* GREENYELLOW */ 0xff808080, /* GREY */ 0xfff0fff0, /* HONEYDEW */ 0xffff69b4, /* HOTPINK */ 0xffcd5c5c, /* INDIANRED */ 0xff4b0082, /* INDIGO */ 0xfffffff0, /* IVORY */ 0xfff0e68c, /* KHAKI */ 0xffe6e6fa, /* LAVENDER */ 0xfffff0f5, /* LAVENDERBLUSH */ 0xff7cfc00, /* LAWNGREEN */ 0xfffffacd, /* LEMONCHIFFON */ 0xffadd8e6, /* LIGHTBLUE */ 0xfff08080, /* LIGHTCORAL */ 0xffe0ffff, /* LIGHTCYAN */ 0xfffafad2, /* LIGHTGOLDENRODYELLOW */ 0xffd3d3d3, /* LIGHTGRAY */ 0xff90ee90, /* LIGHTGREEN */ 0xffd3d3d3, /* LIGHTGREY */ 0xffffb6c1, /* LIGHTPINK */ 0xffffa07a, /* LIGHTSALMON */ 0xff20b2aa, /* LIGHTSEAGREEN */ 0xff87cefa, /* LIGHTSKYBLUE */ 0xff8470ff, /* LIGHTSLATEBLUE */ 0xff778899, /* LIGHTSLATEGRAY */ 0xff778899, /* LIGHTSLATEGREY */ 0xffb0c4de, /* LIGHTSTEELBLUE */ 0xffffffe0, /* LIGHTYELLOW */ 0xff00ff00, /* LIME */ 0xff32cd32, /* LIMEGREEN */ 0xfffaf0e6, /* LINEN */ 0xffff00ff, /* MAGENTA */ 0xff800000, /* MAROON */ 0xff66cdaa, /* MEDIUMAQUAMARINE */ 0xff0000cd, /* MEDIUMBLUE */ 0xffba55d3, /* MEDIUMORCHID */ 0xff9370db, /* MEDIUMPURPLE */ 0xff3cb371, /* MEDIUMSEAGREEN */ 0xff7b68ee, /* MEDIUMSLATEBLUE */ 0xff00fa9a, /* MEDIUMSPRINGGREEN */ 0xff48d1cc, /* MEDIUMTURQUOISE */ 0xffc71585, /* MEDIUMVIOLETRED */ 0xff191970, /* MIDNIGHTBLUE */ 0xfff5fffa, /* MINTCREAM */ 0xffffe4e1, /* MISTYROSE */ 0xffffe4b5, /* MOCCASIN */ 0xffffdead, /* NAVAJOWHITE */ 0xff000080, /* NAVY */ 0xfffdf5e6, /* OLDLACE */ 0xff808000, /* OLIVE */ 0xff6b8e23, /* OLIVEDRAB */ 0xffffa500, /* ORANGE */ 0xffff4500, /* ORANGERED */ 0xffda70d6, /* ORCHID */ 0xffeee8aa, /* PALEGOLDENROD */ 0xff98fb98, /* PALEGREEN */ 0xffafeeee, /* PALETURQUOISE */ 0xffdb7093, /* PALEVIOLETRED */ 0xffffefd5, /* PAPAYAWHIP */ 0xffffdab9, /* PEACHPUFF */ 0xffcd853f, /* PERU */ 0xffffc0cb, /* PINK */ 0xffdda0dd, /* PLUM */ 0xffb0e0e6, /* POWDERBLUE */ 0xff800080, /* PURPLE */ 0xffff0000, /* RED */ 0xffbc8f8f, /* ROSYBROWN */ 0xff4169e1, /* ROYALBLUE */ 0xff8b4513, /* SADDLEBROWN */ 0xfffa8072, /* SALMON */ 0xfff4a460, /* SANDYBROWN */ 0xff2e8b57, /* SEAGREEN */ 0xfffff5ee, /* SEASHELL */ 0xffa0522d, /* SIENNA */ 0xffc0c0c0, /* SILVER */ 0xff87ceeb, /* SKYBLUE */ 0xff6a5acd, /* SLATEBLUE */ 0xff708090, /* SLATEGRAY */ 0xff708090, /* SLATEGREY */ 0xfffffafa, /* SNOW */ 0xff00ff7f, /* SPRINGGREEN */ 0xff4682b4, /* STEELBLUE */ 0xffd2b48c, /* TAN */ 0xff008080, /* TEAL */ 0xffd8bfd8, /* THISTLE */ 0xffff6347, /* TOMATO */ 0xff40e0d0, /* TURQUOISE */ 0xffee82ee, /* VIOLET */ 0xffd02090, /* VIOLETRED */ 0xfff5deb3, /* WHEAT */ 0xffffffff, /* WHITE */ 0xfff5f5f5, /* WHITESMOKE */ 0xffffff00, /* YELLOW */ 0xff9acd32 /* YELLOWGREEN */ }; int i; bool match; for (i = FIRST_COLOUR; i <= LAST_COLOUR; i++) { if (lwc_string_caseless_isequal(data, c->strings[i], &match) == lwc_error_ok && match) break; } if (i <= LAST_COLOUR) { /* Known named colour */ *result = colourmap[i - FIRST_COLOUR]; return CSS_OK; } /* We don't know this colour name; ask the client */ if (c->sheet->color != NULL) return c->sheet->color(c->sheet->color_pw, data, result); /* Invalid colour name */ return CSS_INVALID; } /** * Parse a hash colour (#rgb or #rrggbb) * * \param data Pointer to colour string * \param result Pointer to location to receive result (AARRGGBB) * \return CSS_OK on success, * CSS_INVALID if the input is invalid */ css_error css__parse_hash_colour(lwc_string *data, uint32_t *result) { uint8_t r = 0, g = 0, b = 0, a = 0xff; size_t len = lwc_string_length(data); const char *input = lwc_string_data(data); if (len == 3 && isHex(input[0]) && isHex(input[1]) && isHex(input[2])) { r = charToHex(input[0]); g = charToHex(input[1]); b = charToHex(input[2]); r |= (r << 4); g |= (g << 4); b |= (b << 4); } else if (len == 6 && isHex(input[0]) && isHex(input[1]) && isHex(input[2]) && isHex(input[3]) && isHex(input[4]) && isHex(input[5])) { r = (charToHex(input[0]) << 4); r |= charToHex(input[1]); g = (charToHex(input[2]) << 4); g |= charToHex(input[3]); b = (charToHex(input[4]) << 4); b |= charToHex(input[5]); } else return CSS_INVALID; *result = (a << 24) | (r << 16) | (g << 8) | b; return CSS_OK; } /** * Parse a unit specifier * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to current vector iteration context * \param default_unit The default unit to use if none specified * \param length Pointer to location to receive length * \param unit Pointer to location to receive unit * \return CSS_OK on success, * CSS_INVALID if the tokens do not form a valid unit * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_unit_specifier(css_language *c, const parserutils_vector *vector, int *ctx, uint32_t default_unit, css_fixed *length, uint32_t *unit) { int orig_ctx = *ctx; const css_token *token; css_fixed num; size_t consumed = 0; css_error error; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_DIMENSION && token->type != CSS_TOKEN_NUMBER && token->type != CSS_TOKEN_PERCENTAGE)) { *ctx = orig_ctx; return CSS_INVALID; } num = css__number_from_lwc_string(token->idata, false, &consumed); if (token->type == CSS_TOKEN_DIMENSION) { size_t len = lwc_string_length(token->idata); const char *data = lwc_string_data(token->idata); css_unit temp_unit = CSS_UNIT_PX; error = css__parse_unit_keyword(data + consumed, len - consumed, &temp_unit); if (error != CSS_OK) { *ctx = orig_ctx; return error; } *unit = (uint32_t) temp_unit; } else if (token->type == CSS_TOKEN_NUMBER) { /* Non-zero values are permitted in quirks mode */ if (num != 0) { if (c->sheet->quirks_allowed) { c->sheet->quirks_used = true; } else { *ctx = orig_ctx; return CSS_INVALID; } } *unit = default_unit; if (c->sheet->quirks_allowed) { /* Also, in quirks mode, we need to cater for * dimensions separated from their units by whitespace * (e.g. "0 px") */ int temp_ctx = *ctx; css_unit temp_unit; consumeWhitespace(vector, &temp_ctx); /* Try to parse the unit keyword, ignoring errors */ token = parserutils_vector_iterate(vector, &temp_ctx); if (token != NULL && token->type == CSS_TOKEN_IDENT) { error = css__parse_unit_keyword( lwc_string_data(token->idata), lwc_string_length(token->idata), &temp_unit); if (error == CSS_OK) { c->sheet->quirks_used = true; *ctx = temp_ctx; *unit = (uint32_t) temp_unit; } } } } else { /* Percentage -- number must be entire token data */ if (consumed != lwc_string_length(token->idata)) { *ctx = orig_ctx; return CSS_INVALID; } *unit = UNIT_PCT; } *length = num; return CSS_OK; } /** * Parse a unit keyword * * \param ptr Pointer to keyword string * \param len Length, in bytes, of string * \param unit Pointer to location to receive computed unit * \return CSS_OK on success, * CSS_INVALID on encountering an unknown keyword */ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) { if (len == 4) { if (strncasecmp(ptr, "grad", 4) == 0) *unit = UNIT_GRAD; else return CSS_INVALID; } else if (len == 3) { if (strncasecmp(ptr, "kHz", 3) == 0) *unit = UNIT_KHZ; else if (strncasecmp(ptr, "deg", 3) == 0) *unit = UNIT_DEG; else if (strncasecmp(ptr, "rad", 3) == 0) *unit = UNIT_RAD; else return CSS_INVALID; } else if (len == 2) { if (strncasecmp(ptr, "Hz", 2) == 0) *unit = UNIT_HZ; else if (strncasecmp(ptr, "ms", 2) == 0) *unit = UNIT_MS; else if (strncasecmp(ptr, "px", 2) == 0) *unit = UNIT_PX; else if (strncasecmp(ptr, "ex", 2) == 0) *unit = UNIT_EX; else if (strncasecmp(ptr, "em", 2) == 0) *unit = UNIT_EM; else if (strncasecmp(ptr, "in", 2) == 0) *unit = UNIT_IN; else if (strncasecmp(ptr, "cm", 2) == 0) *unit = UNIT_CM; else if (strncasecmp(ptr, "mm", 2) == 0) *unit = UNIT_MM; else if (strncasecmp(ptr, "pt", 2) == 0) *unit = UNIT_PT; else if (strncasecmp(ptr, "pc", 2) == 0) *unit = UNIT_PC; else return CSS_INVALID; } else if (len == 1) { if (strncasecmp(ptr, "s", 1) == 0) *unit = UNIT_S; else return CSS_INVALID; } else return CSS_INVALID; return CSS_OK; } /** * Create a string from a list of IDENT/S tokens if the next token is IDENT * or references the next token's string if it is a STRING * * \param c Parsing context * \param vector Vector containing tokens * \param ctx Vector iteration context * \param reserved Callback to determine if an identifier is reserved * \param result Pointer to location to receive resulting string * \return CSS_OK on success, appropriate error otherwise. * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. * * The resulting string's reference is passed to the caller */ css_error css__ident_list_or_string_to_string(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result) { const css_token *token; token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_STRING) { token = parserutils_vector_iterate(vector, ctx); *result = lwc_string_ref(token->idata); return CSS_OK; } else if(token->type == CSS_TOKEN_IDENT) { return css__ident_list_to_string(c, vector, ctx, reserved, result); } return CSS_INVALID; } /** * Create a string from a list of IDENT/S tokens * * \param c Parsing context * \param vector Vector containing tokens * \param ctx Vector iteration context * \param reserved Callback to determine if an identifier is reserved * \param result Pointer to location to receive resulting string * \return CSS_OK on success, appropriate error otherwise. * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. * * The resulting string's reference is passed to the caller */ css_error css__ident_list_to_string(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result) { int orig_ctx = *ctx; const css_token *token; css_error error = CSS_OK; parserutils_buffer *buffer; parserutils_error perror; lwc_string *interned; lwc_error lerror; perror = parserutils_buffer_create(&buffer); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); /* We know this token exists, and is an IDENT */ token = parserutils_vector_iterate(vector, ctx); /* Consume all subsequent IDENT or S tokens */ while (token != NULL && (token->type == CSS_TOKEN_IDENT || token->type == CSS_TOKEN_S)) { if (token->type == CSS_TOKEN_IDENT) { /* IDENT -- if reserved, reject style */ if (reserved != NULL && reserved(c, token)) { error = CSS_INVALID; goto cleanup; } perror = parserutils_buffer_append(buffer, (const uint8_t *) lwc_string_data(token->idata), lwc_string_length(token->idata)); } else { /* S */ perror = parserutils_buffer_append(buffer, (const uint8_t *) " ", 1); } if (perror != PARSERUTILS_OK) { error = css_error_from_parserutils_error(perror); goto cleanup; } token = parserutils_vector_iterate(vector, ctx); } /* Rewind context by one step if we consumed an unacceptable token */ if (token != NULL) *ctx = *ctx - 1; /* Strip trailing whitespace */ while (buffer->length > 0 && buffer->data[buffer->length - 1] == ' ') buffer->length--; /* Intern the buffer contents */ lerror = lwc_intern_string((char *) buffer->data, buffer->length, &interned); if (lerror != lwc_error_ok) { error = css_error_from_lwc_error(lerror); goto cleanup; } *result = interned; cleanup: parserutils_buffer_destroy(buffer); if (error != CSS_OK) *ctx = orig_ctx; return error; } /** * Parse a comma separated list, converting to bytecode * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param reserved Callback to determine if an identifier is reserved * \param get_value Callback to retrieve bytecode value for a token * \param style Pointer to output style * \return CSS_OK on success, * CSS_INVALID if the input is invalid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__comma_list_to_style(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), css_code_t (*get_value)(css_language *c, const css_token *token, bool first), css_style *result) { int orig_ctx = *ctx; int prev_ctx = orig_ctx; const css_token *token; bool first = true; css_error error = CSS_OK; token = parserutils_vector_iterate(vector, ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } while (token != NULL) { if (token->type == CSS_TOKEN_IDENT) { css_code_t value = get_value(c, token, first); if (reserved(c, token) == false) { lwc_string *str = NULL; uint32_t snumber; *ctx = prev_ctx; error = css__ident_list_to_string(c, vector, ctx, reserved, &str); if (error != CSS_OK) goto cleanup; error = css__stylesheet_string_add(c->sheet, str, &snumber); if (error != CSS_OK) goto cleanup; error = css__stylesheet_style_append(result, value); if (error != CSS_OK) goto cleanup; error = css__stylesheet_style_append(result, snumber); if (error != CSS_OK) goto cleanup; } else { error = css__stylesheet_style_append(result, value); if (error != CSS_OK) goto cleanup; } } else if (token->type == CSS_TOKEN_STRING) { css_code_t value = get_value(c, token, first); uint32_t snumber; error = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &snumber); if (error != CSS_OK) goto cleanup; error = css__stylesheet_style_append(result, value); if (error != CSS_OK) goto cleanup; error = css__stylesheet_style_append(result, snumber); if (error != CSS_OK) goto cleanup; } else { error = CSS_INVALID; goto cleanup; } consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token != NULL && tokenIsChar(token, ',')) { parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_STRING)) { error = CSS_INVALID; goto cleanup; } } else { break; } first = false; prev_ctx = *ctx; token = parserutils_vector_iterate(vector, ctx); } cleanup: if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/margin.c0000644000175000017500000001011512377676736021627 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse margin shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_margin(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; uint16_t side_val[4]; css_fixed side_length[4]; uint32_t side_unit[4]; uint32_t side_count = 0; bool match; css_error error; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_TOP); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_RIGHT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_BOTTOM); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_MARGIN_LEFT); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Attempt to parse up to 4 widths */ do { prev_ctx = *ctx; if ((token != NULL) && is_css_inherit(c, token)) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) { side_val[side_count] = MARGIN_AUTO; parserutils_vector_iterate(vector, ctx); error = CSS_OK; } else { side_val[side_count] = MARGIN_SET; error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &side_length[side_count], &side_unit[side_count]); if (error == CSS_OK) { if (side_unit[side_count] & UNIT_ANGLE|| side_unit[side_count] & UNIT_TIME|| side_unit[side_count] & UNIT_FREQ) { *ctx = orig_ctx; return CSS_INVALID; } } } if (error == CSS_OK) { side_count++; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while ((*ctx != prev_ctx) && (token != NULL) && (side_count < 4)); #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, side_val[(NUM)]); \ if (error != CSS_OK) \ break; \ if (side_val[(NUM)] == MARGIN_SET) { \ error = css__stylesheet_style_append(result, side_length[(NUM)]); \ if (error != CSS_OK) \ break; \ error = css__stylesheet_style_append(result, side_unit[(NUM)]); \ if (error != CSS_OK) \ break; \ } switch (side_count) { case 1: SIDE_APPEND(CSS_PROP_MARGIN_TOP, 0); SIDE_APPEND(CSS_PROP_MARGIN_RIGHT, 0); SIDE_APPEND(CSS_PROP_MARGIN_BOTTOM, 0); SIDE_APPEND(CSS_PROP_MARGIN_LEFT, 0); break; case 2: SIDE_APPEND(CSS_PROP_MARGIN_TOP, 0); SIDE_APPEND(CSS_PROP_MARGIN_RIGHT, 1); SIDE_APPEND(CSS_PROP_MARGIN_BOTTOM, 0); SIDE_APPEND(CSS_PROP_MARGIN_LEFT, 1); break; case 3: SIDE_APPEND(CSS_PROP_MARGIN_TOP, 0); SIDE_APPEND(CSS_PROP_MARGIN_RIGHT, 1); SIDE_APPEND(CSS_PROP_MARGIN_BOTTOM, 2); SIDE_APPEND(CSS_PROP_MARGIN_LEFT, 1); break; case 4: SIDE_APPEND(CSS_PROP_MARGIN_TOP, 0); SIDE_APPEND(CSS_PROP_MARGIN_RIGHT, 1); SIDE_APPEND(CSS_PROP_MARGIN_BOTTOM, 2); SIDE_APPEND(CSS_PROP_MARGIN_LEFT, 3); break; default: error = CSS_INVALID; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/border_width.c0000644000175000017500000001157412377676736023040 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse border-width shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; uint16_t side_val[4]; css_fixed side_length[4]; uint32_t side_unit[4]; uint32_t side_count = 0; bool match; css_error error; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_WIDTH); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_WIDTH); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_WIDTH); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_WIDTH); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Attempt to parse up to 4 widths */ do { prev_ctx = *ctx; if ((token != NULL) && is_css_inherit(c, token)) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[THIN], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_WIDTH_THIN; parserutils_vector_iterate(vector, ctx); error = CSS_OK; } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[MEDIUM], &match) == lwc_error_ok && match)) { side_val[side_count] = BORDER_WIDTH_MEDIUM; parserutils_vector_iterate(vector, ctx); error = CSS_OK; } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[THICK], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); error = CSS_OK; side_val[side_count] = BORDER_WIDTH_THICK; } else { side_val[side_count] = BORDER_WIDTH_SET; error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &side_length[side_count], &side_unit[side_count]); if (error == CSS_OK) { if (side_unit[side_count] == UNIT_PCT || side_unit[side_count] & UNIT_ANGLE || side_unit[side_count] & UNIT_TIME || side_unit[side_count] & UNIT_FREQ) { *ctx = orig_ctx; return CSS_INVALID; } if (side_length[side_count] < 0) { *ctx = orig_ctx; return CSS_INVALID; } } } if (error == CSS_OK) { side_count++; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while ((*ctx != prev_ctx) && (token != NULL) && (side_count < 4)); #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, side_val[(NUM)]); \ if (error != CSS_OK) \ break; \ if (side_val[(NUM)] == BORDER_WIDTH_SET) { \ error = css__stylesheet_style_append(result, side_length[(NUM)]); \ if (error != CSS_OK) \ break; \ error = css__stylesheet_style_append(result, side_unit[(NUM)]); \ if (error != CSS_OK) \ break; \ } switch (side_count) { case 1: SIDE_APPEND(CSS_PROP_BORDER_TOP_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_WIDTH, 0); break; case 2: SIDE_APPEND(CSS_PROP_BORDER_TOP_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_WIDTH, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_WIDTH, 1); break; case 3: SIDE_APPEND(CSS_PROP_BORDER_TOP_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_WIDTH, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_WIDTH, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_WIDTH, 1); break; case 4: SIDE_APPEND(CSS_PROP_BORDER_TOP_WIDTH, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_WIDTH, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_WIDTH, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_WIDTH, 3); break; default: error = CSS_INVALID; break; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/list_style_type.c0000644000175000017500000000354112377676736023613 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse list-style-type * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_list_style_type(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *ident; uint8_t flags = 0; uint16_t value = 0; bool match; /* IDENT (disc, circle, square, decimal, decimal-leading-zero, * lower-roman, upper-roman, lower-greek, lower-latin, * upper-latin, armenian, georgian, lower-alpha, upper-alpha, * none, inherit) */ ident = parserutils_vector_iterate(vector, ctx); if (ident == NULL || ident->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } if ((lwc_string_caseless_isequal( ident->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { flags |= FLAG_INHERIT; } else { error = css__parse_list_style_type_value(c, ident, &value); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } error = css__stylesheet_style_appendOPV(result, CSS_PROP_LIST_STYLE_TYPE, flags, value); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/padding.c0000644000175000017500000000741712377676736021773 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse padding shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_padding(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_fixed side_length[4]; uint32_t side_unit[4]; uint32_t side_count = 0; css_error error; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_TOP); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_RIGHT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_BOTTOM); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_PADDING_LEFT); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Attempt to parse up to 4 widths */ do { prev_ctx = *ctx; if ((token != NULL) && is_css_inherit(c, token)) { *ctx = orig_ctx; return CSS_INVALID; } error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &side_length[side_count], &side_unit[side_count]); if (error == CSS_OK) { if (side_unit[side_count] & UNIT_ANGLE || side_unit[side_count] & UNIT_TIME || side_unit[side_count] & UNIT_FREQ) { *ctx = orig_ctx; return CSS_INVALID; } if (side_length[side_count] < 0) { *ctx = orig_ctx; return CSS_INVALID; } side_count++; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while ((*ctx != prev_ctx) && (token != NULL) && (side_count < 4)); #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, PADDING_SET); \ if (error != CSS_OK) \ break; \ error = css__stylesheet_style_append(result, side_length[(NUM)]); \ if (error != CSS_OK) \ break; \ error = css__stylesheet_style_append(result, side_unit[(NUM)]); \ if (error != CSS_OK) \ break; switch (side_count) { case 1: SIDE_APPEND(CSS_PROP_PADDING_TOP, 0); SIDE_APPEND(CSS_PROP_PADDING_RIGHT, 0); SIDE_APPEND(CSS_PROP_PADDING_BOTTOM, 0); SIDE_APPEND(CSS_PROP_PADDING_LEFT, 0); break; case 2: SIDE_APPEND(CSS_PROP_PADDING_TOP, 0); SIDE_APPEND(CSS_PROP_PADDING_RIGHT, 1); SIDE_APPEND(CSS_PROP_PADDING_BOTTOM, 0); SIDE_APPEND(CSS_PROP_PADDING_LEFT, 1); break; case 3: SIDE_APPEND(CSS_PROP_PADDING_TOP, 0); SIDE_APPEND(CSS_PROP_PADDING_RIGHT, 1); SIDE_APPEND(CSS_PROP_PADDING_BOTTOM, 2); SIDE_APPEND(CSS_PROP_PADDING_LEFT, 1); break; case 4: SIDE_APPEND(CSS_PROP_PADDING_TOP, 0); SIDE_APPEND(CSS_PROP_PADDING_RIGHT, 1); SIDE_APPEND(CSS_PROP_PADDING_BOTTOM, 2); SIDE_APPEND(CSS_PROP_PADDING_LEFT, 3); break; default: error = CSS_INVALID; break; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/background.c0000644000175000017500000001433612377676736022502 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse background * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_background(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error = CSS_OK; bool attachment = true; bool color = true; bool image = true; bool position = true; bool repeat = true; css_style * attachment_style; css_style * color_style; css_style * image_style; css_style * position_style; css_style * repeat_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_ATTACHMENT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_IMAGE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_POSITION); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BACKGROUND_REPEAT); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &attachment_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &color_style); if (error != CSS_OK) { css__stylesheet_style_destroy(attachment_style); return error; } error = css__stylesheet_style_create(c->sheet, &image_style); if (error != CSS_OK) { css__stylesheet_style_destroy(attachment_style); css__stylesheet_style_destroy(color_style); return error; } error = css__stylesheet_style_create(c->sheet, &position_style); if (error != CSS_OK) { css__stylesheet_style_destroy(attachment_style); css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(image_style); return error; } error = css__stylesheet_style_create(c->sheet, &repeat_style); if (error != CSS_OK) { css__stylesheet_style_destroy(attachment_style); css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(image_style); css__stylesheet_style_destroy(position_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; if (is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_background_cleanup; } /* Try each property parser in turn, but only if we * haven't already got a value for this property. */ if ((attachment) && (error = css__parse_background_attachment(c, vector, ctx, attachment_style)) == CSS_OK) { attachment = false; } else if ((color) && (error = css__parse_background_color(c, vector, ctx, color_style)) == CSS_OK) { color = false; } else if ((image) && (error = css__parse_background_image(c, vector, ctx, image_style)) == CSS_OK) { image = false; } else if ((position) && (error = css__parse_background_position(c, vector, ctx, position_style)) == CSS_OK) { position = false; } else if ((repeat) && (error = css__parse_background_repeat(c, vector, ctx, repeat_style)) == CSS_OK) { repeat = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); if (attachment) { error = css__stylesheet_style_appendOPV(attachment_style, CSS_PROP_BACKGROUND_ATTACHMENT, 0, BACKGROUND_ATTACHMENT_SCROLL); if (error != CSS_OK) goto css__parse_background_cleanup; } if (color) { error = css__stylesheet_style_appendOPV(color_style, CSS_PROP_BACKGROUND_COLOR, 0, BACKGROUND_COLOR_TRANSPARENT); if (error != CSS_OK) goto css__parse_background_cleanup; } if (image) { error = css__stylesheet_style_appendOPV(image_style, CSS_PROP_BACKGROUND_IMAGE, 0, BACKGROUND_IMAGE_NONE); if (error != CSS_OK) goto css__parse_background_cleanup; } if (position) { error = css__stylesheet_style_appendOPV(position_style, CSS_PROP_BACKGROUND_POSITION, 0, BACKGROUND_POSITION_HORZ_LEFT | BACKGROUND_POSITION_VERT_TOP); if (error != CSS_OK) goto css__parse_background_cleanup; } if (repeat) { error = css__stylesheet_style_appendOPV(repeat_style, CSS_PROP_BACKGROUND_REPEAT, 0, BACKGROUND_REPEAT_REPEAT); if (error != CSS_OK) goto css__parse_background_cleanup; } error = css__stylesheet_merge_style(result, attachment_style); if (error != CSS_OK) goto css__parse_background_cleanup; error = css__stylesheet_merge_style(result, color_style); if (error != CSS_OK) goto css__parse_background_cleanup; error = css__stylesheet_merge_style(result, image_style); if (error != CSS_OK) goto css__parse_background_cleanup; error = css__stylesheet_merge_style(result, position_style); if (error != CSS_OK) goto css__parse_background_cleanup; error = css__stylesheet_merge_style(result, repeat_style); css__parse_background_cleanup: css__stylesheet_style_destroy(attachment_style); css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(image_style); css__stylesheet_style_destroy(position_style); css__stylesheet_style_destroy(repeat_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/cue.c0000644000175000017500000000431512377676736021133 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse cue shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_cue(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *first_token; const css_token *token; /* one or two tokens follow: * if one emit for both BEFORE and AFTER * if two first is before second is after * tokens are either IDENT:none or URI */ first_token = parserutils_vector_peek(vector, *ctx); error = css__parse_cue_before(c, vector, ctx, result); if (error == CSS_OK) { /* first token parsed */ consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { /* no second token, re-parse the first */ *ctx = orig_ctx; error = css__parse_cue_after(c, vector, ctx, result); } else { /* second token - might be useful */ if (is_css_inherit(c, token)) { /* another inherit which is bogus */ error = CSS_INVALID; } else { error = css__parse_cue_after(c, vector, ctx, result); if (error == CSS_OK) { /* second token parsed */ if (is_css_inherit(c, first_token)) { /* valid second token after inherit */ error = CSS_INVALID; } } else { /* second token appears to be junk re-try with first */ *ctx = orig_ctx; error = css__parse_cue_after(c, vector, ctx, result); } } } } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/overflow.c0000644000175000017500000000547212377676736022227 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse overflow shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_overflow(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error1, error2 = CSS_OK; const css_token *token; bool match; token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) { *ctx = orig_ctx; return CSS_INVALID; } if ((lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error1 = css_stylesheet_style_inherit(result, CSS_PROP_OVERFLOW_X); error2 = css_stylesheet_style_inherit(result, CSS_PROP_OVERFLOW_Y); } else if ((lwc_string_caseless_isequal(token->idata, c->strings[VISIBLE], &match) == lwc_error_ok && match)) { error1 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_X, 0, OVERFLOW_VISIBLE); error2 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_VISIBLE); } else if ((lwc_string_caseless_isequal(token->idata, c->strings[HIDDEN], &match) == lwc_error_ok && match)) { error1 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_X, 0, OVERFLOW_HIDDEN); error2 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_HIDDEN); } else if ((lwc_string_caseless_isequal(token->idata, c->strings[SCROLL], &match) == lwc_error_ok && match)) { error1 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_X, 0, OVERFLOW_SCROLL); error2 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_SCROLL); } else if ((lwc_string_caseless_isequal(token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) { error1 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_X, 0, OVERFLOW_AUTO); error2 = css__stylesheet_style_appendOPV(result, CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_AUTO); } else { error1 = CSS_INVALID; } if (error2 != CSS_OK) error1 = error2; if (error1 != CSS_OK) *ctx = orig_ctx; return error1; } netsurf-all-3.2/libcss/src/parse/properties/border_color.c0000644000175000017500000000704412377676736023034 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse border-color shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; uint16_t side_val[4]; uint32_t side_color[4]; uint32_t side_count = 0; css_error error; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_TOP_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_RIGHT_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_BOTTOM_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_BORDER_LEFT_COLOR); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Attempt to parse up to 4 colours */ do { prev_ctx = *ctx; if ((token != NULL) && is_css_inherit(c, token)) { *ctx = orig_ctx; return CSS_INVALID; } error = css__parse_colour_specifier(c, vector, ctx, &side_val[side_count], &side_color[side_count]); if (error == CSS_OK) { side_count++; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while ((*ctx != prev_ctx) && (token != NULL) && (side_count < 4)); #define SIDE_APPEND(OP,NUM) \ error = css__stylesheet_style_appendOPV(result, (OP), 0, side_val[(NUM)]); \ if (error != CSS_OK) \ break; \ if (side_val[(NUM)] == BORDER_COLOR_SET) \ error = css__stylesheet_style_append(result, side_color[(NUM)]); \ if (error != CSS_OK) \ break; switch (side_count) { case 1: SIDE_APPEND(CSS_PROP_BORDER_TOP_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_COLOR, 0); break; case 2: SIDE_APPEND(CSS_PROP_BORDER_TOP_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_COLOR, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_LEFT_COLOR, 1); break; case 3: SIDE_APPEND(CSS_PROP_BORDER_TOP_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_COLOR, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_COLOR, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_COLOR, 1); break; case 4: SIDE_APPEND(CSS_PROP_BORDER_TOP_COLOR, 0); SIDE_APPEND(CSS_PROP_BORDER_RIGHT_COLOR, 1); SIDE_APPEND(CSS_PROP_BORDER_BOTTOM_COLOR, 2); SIDE_APPEND(CSS_PROP_BORDER_LEFT_COLOR, 3); break; default: error = CSS_INVALID; break; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/border_spacing.c0000644000175000017500000000631712377676736023344 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse border-spacing * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_spacing(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; css_fixed length[2] = { 0 }; uint32_t unit[2] = { 0 }; bool match; /* length length? | IDENT(inherit) */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); /* inherit */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_BORDER_SPACING, FLAG_INHERIT, 0); } else { int num_lengths = 0; error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[0], &unit[0]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if (unit[0] & UNIT_ANGLE || unit[0] & UNIT_TIME || unit[0] & UNIT_FREQ || unit[0] & UNIT_PCT) { *ctx = orig_ctx; return CSS_INVALID; } num_lengths = 1; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token != NULL) { /* Attempt second length, ignoring errors. * The core !important parser will ensure * any remaining junk is thrown out. * Ctx will be preserved on error, as usual */ error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[1], &unit[1]); if (error == CSS_OK) { if (unit[1] & UNIT_ANGLE || unit[1] & UNIT_TIME || unit[1] & UNIT_FREQ || unit[1] & UNIT_PCT) { *ctx = orig_ctx; return CSS_INVALID; } num_lengths = 2; } } if (num_lengths == 1) { /* Only one length specified. Use for both axes. */ length[1] = length[0]; unit[1] = unit[0]; } /* Lengths must not be negative */ if (length[0] < 0 || length[1] < 0) { *ctx = orig_ctx; return CSS_INVALID; } error = css__stylesheet_style_appendOPV(result, CSS_PROP_BORDER_SPACING, 0, BORDER_SPACING_SET); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_vappend(result, 4, length[0], unit[0], length[1], unit[1]); } if (error != CSS_OK) { *ctx = orig_ctx; return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/azimuth.c0000644000175000017500000001605012377676736022037 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse azimuth * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result style to place resulting bytcode in * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_azimuth(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; uint8_t flags = 0; uint16_t value = 0; css_fixed length = 0; uint32_t unit = 0; bool match; /* angle | [ IDENT(left-side, far-left, left, center-left, center, * center-right, right, far-right, right-side) || * IDENT(behind) * ] * | IDENT(leftwards, rightwards, inherit) */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); flags = FLAG_INHERIT; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal(token->idata, c->strings[LEFTWARDS], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = AZIMUTH_LEFTWARDS; } else if (token->type == CSS_TOKEN_IDENT && (lwc_string_caseless_isequal(token->idata, c->strings[RIGHTWARDS], &match) == lwc_error_ok && match)) { parserutils_vector_iterate(vector, ctx); value = AZIMUTH_RIGHTWARDS; } else if (token->type == CSS_TOKEN_IDENT) { parserutils_vector_iterate(vector, ctx); /* Now, we may have one of the other keywords or behind, * potentially followed by behind or other keyword, * respectively */ if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT_SIDE], &match) == lwc_error_ok && match)) { value = AZIMUTH_LEFT_SIDE; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[FAR_LEFT], &match) == lwc_error_ok && match)) { value = AZIMUTH_FAR_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT], &match) == lwc_error_ok && match)) { value = AZIMUTH_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER_LEFT], &match) == lwc_error_ok && match)) { value = AZIMUTH_CENTER_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER], &match) == lwc_error_ok && match)) { value = AZIMUTH_CENTER; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER_RIGHT], &match) == lwc_error_ok && match)) { value = AZIMUTH_CENTER_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT], &match) == lwc_error_ok && match)) { value = AZIMUTH_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[FAR_RIGHT], &match) == lwc_error_ok && match)) { value = AZIMUTH_FAR_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT_SIDE], &match) == lwc_error_ok && match)) { value = AZIMUTH_RIGHT_SIDE; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[BEHIND], &match) == lwc_error_ok && match)) { value = AZIMUTH_BEHIND; } else { *ctx = orig_ctx; return CSS_INVALID; } consumeWhitespace(vector, ctx); /* Get potential following token */ token = parserutils_vector_peek(vector, *ctx); if (token != NULL && token->type == CSS_TOKEN_IDENT && value == AZIMUTH_BEHIND) { parserutils_vector_iterate(vector, ctx); if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT_SIDE], &match) == lwc_error_ok && match)) { value |= AZIMUTH_LEFT_SIDE; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[FAR_LEFT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_FAR_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[LEFT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER_LEFT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_CENTER_LEFT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER], &match) == lwc_error_ok && match)) { value |= AZIMUTH_CENTER; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[CENTER_RIGHT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_CENTER_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[FAR_RIGHT], &match) == lwc_error_ok && match)) { value |= AZIMUTH_FAR_RIGHT; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[RIGHT_SIDE], &match) == lwc_error_ok && match)) { value |= AZIMUTH_RIGHT_SIDE; } else { *ctx = orig_ctx; return CSS_INVALID; } } else if (token != NULL && token->type == CSS_TOKEN_IDENT && value != AZIMUTH_BEHIND) { parserutils_vector_iterate(vector, ctx); if ((lwc_string_caseless_isequal( token->idata, c->strings[BEHIND], &match) == lwc_error_ok && match)) { value |= AZIMUTH_BEHIND; } else { *ctx = orig_ctx; return CSS_INVALID; } } else if ((token == NULL || token->type != CSS_TOKEN_IDENT) && value == AZIMUTH_BEHIND) { value |= AZIMUTH_CENTER; } } else { error = css__parse_unit_specifier(c, vector, ctx, UNIT_DEG, &length, &unit); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if ((unit & UNIT_ANGLE) == false) { *ctx = orig_ctx; return CSS_INVALID; } /* Valid angles lie between -360 and 360 degrees */ if (unit == UNIT_DEG) { if ((length < -F_360) || (length > F_360)) { *ctx = orig_ctx; return CSS_INVALID; } } else if (unit == UNIT_GRAD) { if ((length < -F_400) || (length > F_400)) { *ctx = orig_ctx; return CSS_INVALID; } } else if (unit == UNIT_RAD) { if ((length < -F_2PI) || (length > F_2PI)) { *ctx = orig_ctx; return CSS_INVALID; } } value = AZIMUTH_ANGLE; } error = css__stylesheet_style_appendOPV(result, CSS_PROP_AZIMUTH, flags, value); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if (((flags & FLAG_INHERIT) == false) && (value == AZIMUTH_ANGLE)) { error = css__stylesheet_style_vappend(result, 2, length, unit); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } return CSS_OK; } netsurf-all-3.2/libcss/src/parse/properties/font_weight.c0000644000175000017500000000610312377676736022671 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse font-weight * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font_weight(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; uint8_t flags = 0; uint16_t value = 0; bool match; /* NUMBER (100, 200, 300, 400, 500, 600, 700, 800, 900) | * IDENT (normal, bold, bolder, lighter, inherit) */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_NUMBER)) { *ctx = orig_ctx; return CSS_INVALID; } if ((lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { flags |= FLAG_INHERIT; } else if (token->type == CSS_TOKEN_NUMBER) { size_t consumed = 0; css_fixed num = css__number_from_lwc_string(token->idata, true, &consumed); /* Invalid if there are trailing characters */ if (consumed != lwc_string_length(token->idata)) { *ctx = orig_ctx; return CSS_INVALID; } switch (FIXTOINT(num)) { case 100: value = FONT_WEIGHT_100; break; case 200: value = FONT_WEIGHT_200; break; case 300: value = FONT_WEIGHT_300; break; case 400: value = FONT_WEIGHT_400; break; case 500: value = FONT_WEIGHT_500; break; case 600: value = FONT_WEIGHT_600; break; case 700: value = FONT_WEIGHT_700; break; case 800: value = FONT_WEIGHT_800; break; case 900: value = FONT_WEIGHT_900; break; default: *ctx = orig_ctx; return CSS_INVALID; } } else if ((lwc_string_caseless_isequal( token->idata, c->strings[NORMAL], &match) == lwc_error_ok && match)) { value = FONT_WEIGHT_NORMAL; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[BOLD], &match) == lwc_error_ok && match)) { value = FONT_WEIGHT_BOLD; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[BOLDER], &match) == lwc_error_ok && match)) { value = FONT_WEIGHT_BOLDER; } else if ((lwc_string_caseless_isequal( token->idata, c->strings[LIGHTER], &match) == lwc_error_ok && match)) { value = FONT_WEIGHT_LIGHTER; } else { *ctx = orig_ctx; return CSS_INVALID; } error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, flags, value); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/opacity.c0000644000175000017500000000404012377676736022022 0ustar vincevince/* * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2010 The NetSurf Browser Project. */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse opacity * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_opacity(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; bool match; token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) && (token->type != CSS_TOKEN_NUMBER))) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css_stylesheet_style_inherit(result, CSS_PROP_OPACITY); } else if (token->type == CSS_TOKEN_NUMBER) { css_fixed num = 0; size_t consumed = 0; num = css__number_from_lwc_string(token->idata, false, &consumed); /* Invalid if there are trailing characters */ if (consumed != lwc_string_length(token->idata)) { *ctx = orig_ctx; return CSS_INVALID; } /* Clamp to range [0,1] */ if (num < 0) num = 0; if (num > INTTOFIX(1)) num = INTTOFIX(1); error = css__stylesheet_style_appendOPV(result, CSS_PROP_OPACITY, 0, OPACITY_SET); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_style_append(result, num); } else { error = CSS_INVALID; } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/utils.h0000644000175000017500000001510612377676736021524 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_css__parse_properties_utils_h_ #define css_css__parse_properties_utils_h_ #include "parse/language.h" static inline bool is_css_inherit(css_language *c, const css_token *token) { bool match; return ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)); } enum border_side_e { BORDER_SIDE_TOP = 0, BORDER_SIDE_RIGHT = 1, BORDER_SIDE_BOTTOM = 2, BORDER_SIDE_LEFT = 3 }; /** * Parse border-{top,right,bottom,left} shorthand * * \param c Parsing context. * \param vector Vector of tokens to process. * \param ctx Pointer to vector iteration context. * \param result Result style. * \param side The side we're parsing for. * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum border_side_e side); /** * Parse border-{top,right,bottom,left}-color * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \param op Opcode to parse for (encodes side) * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); /** * Parse border-{top,right,bottom,left}-style * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \param op Opcode to parse for (encodes side) * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); /** * Parse border-{top,right,bottom,left}-width * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \param op Opcode to parse for (encodes side) * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_border_side_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); /** * Parse {top,right,bottom,left} * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param op Opcode to parse for * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); /** * Parse margin-{top,right,bottom,left} * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_margin_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); /** * Parse padding-{top,right,bottom,left} * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_padding_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result, enum css_properties_e op); css_error css__parse_list_style_type_value(css_language *c, const css_token *token, uint16_t *value); css_error css__parse_colour_specifier(css_language *c, const parserutils_vector *vector, int *ctx, uint16_t *value, uint32_t *result); css_error css__parse_named_colour(css_language *c, lwc_string *data, uint32_t *result); css_error css__parse_hash_colour(lwc_string *data, uint32_t *result); css_error css__parse_unit_specifier(css_language *c, const parserutils_vector *vector, int *ctx, uint32_t default_unit, css_fixed *length, uint32_t *unit); css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit); css_error css__ident_list_or_string_to_string(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result); css_error css__ident_list_to_string(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), lwc_string **result); css_error css__comma_list_to_style(css_language *c, const parserutils_vector *vector, int *ctx, bool (*reserved)(css_language *c, const css_token *ident), css_code_t (*get_value)(css_language *c, const css_token *token, bool first), css_style *result); #endif netsurf-all-3.2/libcss/src/parse/properties/list_style.c0000644000175000017500000001012012377676736022541 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse list-style * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_list_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error; bool image = true; bool position = true; bool type = true; css_style *image_style; css_style *position_style; css_style *type_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_IMAGE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_POSITION); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LIST_STYLE_TYPE); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &image_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &position_style); if (error != CSS_OK) { css__stylesheet_style_destroy(image_style); return error; } error = css__stylesheet_style_create(c->sheet, &type_style); if (error != CSS_OK) { css__stylesheet_style_destroy(image_style); css__stylesheet_style_destroy(position_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if (token != NULL && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_list_style_cleanup; } if ((type) && (error = css__parse_list_style_type(c, vector, ctx, type_style)) == CSS_OK) { type = false; } else if ((position) && (error = css__parse_list_style_position(c, vector, ctx, position_style)) == CSS_OK) { position = false; } else if ((image) && (error = css__parse_list_style_image(c, vector, ctx, image_style)) == CSS_OK) { image = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); /* defaults */ if (image) { error = css__stylesheet_style_appendOPV(image_style, CSS_PROP_LIST_STYLE_IMAGE, 0, LIST_STYLE_IMAGE_NONE); } if (position) { error = css__stylesheet_style_appendOPV(position_style, CSS_PROP_LIST_STYLE_POSITION, 0, LIST_STYLE_POSITION_OUTSIDE); } if (type) { error = css__stylesheet_style_appendOPV(type_style, CSS_PROP_LIST_STYLE_TYPE, 0, LIST_STYLE_TYPE_DISC); } error = css__stylesheet_merge_style(result, image_style); if (error != CSS_OK) goto css__parse_list_style_cleanup; error = css__stylesheet_merge_style(result, position_style); if (error != CSS_OK) goto css__parse_list_style_cleanup; error = css__stylesheet_merge_style(result, type_style); css__parse_list_style_cleanup: css__stylesheet_style_destroy(type_style); css__stylesheet_style_destroy(position_style); css__stylesheet_style_destroy(image_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/Makefile0000644000175000017500000000306312377676736021652 0ustar vincevince# Sources AUTOGEN_PARSERS := $(shell $(PERL) -pe'$$_="" unless /^([^\#][^:]+):/;$$_=$$1 . " "' $(DIR)properties.gen) # Dodgy use of define/eval to bypass DIR changing define build_gen_parser $(BUILDDIR)/gen_parser: $(DIR)css_property_parser_gen.c $$(VQ)$$(ECHO) $$(ECHOFLAGS) " PREPARE: $$@" $$(Q)$$(HOST_CC) -o $$@ $$^ endef $(eval $(build_gen_parser)) define gen_prop_parser $(DIR)autogenerated_$1.c: $(DIR)properties.gen $(BUILDDIR)/gen_parser $$(VQ)$$(ECHO) $$(ECHOFLAGS) "GENERATE: $$@" $$(Q)$$(BUILDDIR)/gen_parser -o $$@ '$(shell $(GREP) "^$1:" $(DIR)properties.gen)' AUTOGEN_SOURCES := $$(AUTOGEN_SOURCES) autogenerated_$1.c endef AUTOGEN_SOURCES := $(eval $(foreach PROP,$(AUTOGEN_PARSERS),$(call gen_prop_parser,$(PROP)))) DIR_SOURCES := \ azimuth.c \ background.c \ background_position.c \ border.c \ border_color.c \ border_spacing.c \ border_style.c \ border_width.c \ clip.c \ columns.c \ column_rule.c \ content.c \ cue.c \ cursor.c \ elevation.c \ font.c \ font_family.c \ font_weight.c \ list_style.c \ list_style_type.c \ margin.c \ opacity.c \ outline.c \ overflow.c \ padding.c \ pause.c \ play_during.c \ properties.c \ quotes.c \ text_decoration.c \ utils.c \ voice_family.c DIR_SOURCES := $(DIR_SOURCES) $(AUTOGEN_SOURCES) PRE_TARGETS := $(foreach AP,$(AUTOGEN_PARSERS),src/parse/properties/autogenerated_$(AP).c) DISTCLEAN_ITEMS := $(foreach AP,$(AUTOGEN_PARSERS),src/parse/properties/autogenerated_$(AP).c) include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/parse/properties/css_property_parser_gen.c0000644000175000017500000004020412377676736025315 0ustar vincevince/* * This file generates parts of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2010 Vincent Sanders */ #include #include #include #include /* Descriptors are space separated key:value pairs brackets () are * used to quote in values. * * Examples: * list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: NONE:0,LIST_STYLE_IMAGE_NONE IDENT:) URI:LIST_STYLE_IMAGE_URI * * list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:) */ struct keyval { char *key; char *val; }; struct keyval_list { struct keyval *item[100]; int count; }; struct keyval *get_keyval(char **pos) { char *endpos; struct keyval *nkeyval; int kvlen; endpos = strchr(*pos, ' '); /* single space separated pairs */ if (endpos == NULL) { /* no space, but might be the end of the input */ kvlen = strlen(*pos); if (kvlen == 0) return NULL; endpos = *pos + kvlen; } else { kvlen = (endpos - *pos); } nkeyval = calloc(1, sizeof(struct keyval) + kvlen + 1); memcpy(nkeyval + 1, *pos, kvlen); nkeyval->key = (char *)nkeyval + sizeof(struct keyval); endpos = strchr(nkeyval->key, ':'); /* split key and value on : */ if (endpos != NULL) { endpos[0] = 0; /* change : to null terminator */ nkeyval->val = endpos + 1; /* skip : */ } *pos += kvlen; /* update position */ /* skip spaces */ while ((*pos[0] != 0) && (*pos[0] == ' ')) { (*pos)++; } return nkeyval; } void output_header(FILE *outputf, const char *descriptor, struct keyval *parser_id, bool is_generic) { fprintf(outputf, "/*\n" " * This file was generated by LibCSS gen_parser \n" " * \n" " * Generated from:\n" " *\n" " * %s\n" " * \n" " * Licensed under the MIT License,\n" " * http://www.opensource.org/licenses/mit-license.php\n" " * Copyright 2010 The NetSurf Browser Project.\n" " */\n" "\n" "#include \n" "#include \n" "\n" "#include \"bytecode/bytecode.h\"\n" "#include \"bytecode/opcodes.h\"\n" "#include \"parse/properties/properties.h\"\n" "#include \"parse/properties/utils.h\"\n" "\n" "/**\n" " * Parse %s\n" " *\n" " * \\param c Parsing context\n" " * \\param vector Vector of tokens to process\n" " * \\param ctx Pointer to vector iteration context\n" " * \\param result resulting style\n" "%s" " * \\return CSS_OK on success,\n" " * CSS_NOMEM on memory exhaustion,\n" " * CSS_INVALID if the input is not valid\n" " *\n" " * Post condition: \\a *ctx is updated with the next token to process\n" " * If the input is invalid, then \\a *ctx remains unchanged.\n" " */\n" "css_error css__parse_%s(css_language *c,\n" " const parserutils_vector *vector, int *ctx,\n" " css_style *result%s)\n" "{\n", descriptor, parser_id->key, is_generic ? " * \\param op Bytecode OpCode for CSS property to encode\n" : "", parser_id->key, is_generic ? ", enum css_properties_e op" : ""); } void output_token_type_check(FILE *outputf, bool do_token_check, struct keyval_list *IDENT, struct keyval_list *URI, struct keyval_list *NUMBER) { fprintf(outputf, " int orig_ctx = *ctx;\n" " css_error error;\n" " const css_token *token;\n" " bool match;\n\n" " token = parserutils_vector_iterate(vector, ctx);\n" " if (%stoken == NULL%s", do_token_check ? "(" : "", do_token_check ? ")" : ""); if (do_token_check) { bool prev = false; /* there was a previous check - add && */ fprintf(outputf," || ("); if (IDENT->count > 0) { fprintf(outputf,"(token->type != CSS_TOKEN_IDENT)"); prev = true; } if (URI->count > 0) { if (prev) fprintf(outputf," && "); fprintf(outputf,"(token->type != CSS_TOKEN_URI)"); prev = true; } if (NUMBER->count > 0) { if (prev) fprintf(outputf," && "); fprintf(outputf,"(token->type != CSS_TOKEN_NUMBER)"); prev = true; } fprintf(outputf,")"); } fprintf(outputf, ") {\n" "\t\t*ctx = orig_ctx;\n" "\t\treturn CSS_INVALID;\n" "\t}\n\n\t"); } void output_ident(FILE *outputf, bool only_ident, struct keyval *parseid, struct keyval_list *IDENT) { int ident_count; for (ident_count = 0 ; ident_count < IDENT->count; ident_count++) { struct keyval *ckv = IDENT->item[ident_count]; fprintf(outputf, "if ("); if (!only_ident) { fprintf(outputf, "(token->type == CSS_TOKEN_IDENT) && "); } fprintf(outputf, "(lwc_string_caseless_isequal(token->idata, c->strings[%s], &match) == lwc_error_ok && match)) {\n", ckv->key); if (strcmp(ckv->key,"INHERIT") == 0) { fprintf(outputf, "\t\t\terror = css_stylesheet_style_inherit(result, %s);\n", parseid->val); } else { fprintf(outputf, "\t\t\terror = css__stylesheet_style_appendOPV(result, %s, %s);\n", parseid->val, ckv->val); } fprintf(outputf, "\t} else "); } } void output_uri(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; fprintf(outputf, "if (token->type == CSS_TOKEN_URI) {\n" " lwc_string *uri = NULL;\n" " uint32_t uri_snumber;\n" "\n" " error = c->sheet->resolve(c->sheet->resolve_pw,\n" " c->sheet->url,\n" " token->idata, &uri);\n" " if (error != CSS_OK) {\n" " *ctx = orig_ctx;\n" " return error;\n" " }\n" "\n" " error = css__stylesheet_string_add(c->sheet, uri, &uri_snumber);\n" " if (error != CSS_OK) {\n" " *ctx = orig_ctx;\n" " return error;\n" " }\n" "\n" " error = css__stylesheet_style_appendOPV(result, %s, 0, %s);\n" " if (error != CSS_OK) {\n" " *ctx = orig_ctx;\n" " return error;\n" " }\n" "\n" " error = css__stylesheet_style_append(result, uri_snumber);\n" " } else ", parseid->val, ckv->val); } void output_number(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; int ident_count; fprintf(outputf, "if (token->type == CSS_TOKEN_NUMBER) {\n" "\t\tcss_fixed num = 0;\n" "\t\tsize_t consumed = 0;\n\n" "\t\tnum = css__number_from_lwc_string(token->idata, %s, &consumed);\n" "\t\t/* Invalid if there are trailing characters */\n" "\t\tif (consumed != lwc_string_length(token->idata)) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" "\t\t}\n", ckv->key); for (ident_count = 1 ; ident_count < kvlist->count; ident_count++) { struct keyval *ulkv = kvlist->item[ident_count]; if (strcmp(ulkv->key, "RANGE") == 0) { fprintf(outputf, "\t\tif (%s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" "\t\t}\n\n", ulkv->val); } } fprintf(outputf, "\t\terror = css__stylesheet_style_appendOPV(result, %s, 0, %s);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n\n" "\t\terror = css__stylesheet_style_append(result, num);\n" "\t} else ", parseid->val, ckv->val); } void output_color(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { fprintf(outputf, "{\n" "\t\tuint16_t value = 0;\n" "\t\tuint32_t color = 0;\n" "\t\t*ctx = orig_ctx;\n\n" "\t\terror = css__parse_colour_specifier(c, vector, ctx, &value, &color);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n\n" "\t\terror = css__stylesheet_style_appendOPV(result, %s, 0, value);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n" "\n" "\t\tif (value == COLOR_SET)\n" "\t\t\terror = css__stylesheet_style_append(result, color);\n" "\t}\n\n", parseid->val); } void output_length_unit(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; int ident_count; fprintf(outputf, "{\n" "\t\tcss_fixed length = 0;\n" "\t\tuint32_t unit = 0;\n" "\t\t*ctx = orig_ctx;\n\n" "\t\terror = css__parse_unit_specifier(c, vector, ctx, %s, &length, &unit);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n\n", ckv->key); for (ident_count = 1 ; ident_count < kvlist->count; ident_count++) { struct keyval *ulkv = kvlist->item[ident_count]; if (strcmp(ulkv->key, "ALLOW") == 0) { fprintf(outputf, "\t\tif ((%s) == false) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" "\t\t}\n\n", ulkv->val); } else if (strcmp(ulkv->key, "DISALLOW") == 0) { fprintf(outputf, "\t\tif (%s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" "\t\t}\n\n", ulkv->val); } else if (strcmp(ulkv->key, "RANGE") == 0) { fprintf(outputf, "\t\tif (length %s) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn CSS_INVALID;\n" "\t\t}\n\n", ulkv->val); } } fprintf(outputf, "\t\terror = css__stylesheet_style_appendOPV(result, %s, 0, %s);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n" "\n" "\t\terror = css__stylesheet_style_vappend(result, 2, length, unit);\n" "\t}\n\n", parseid->val, ckv->val); } void output_ident_list(FILE *outputf, struct keyval *parseid, struct keyval_list *kvlist) { struct keyval *ckv = kvlist->item[0]; /* list type : opv value */ struct keyval *ikv; if (strcmp(ckv->key, "STRING_OPTNUM") != 0) { fprintf(stderr, "unknown IDENT list type %s\n", ckv->key); exit(4); } if (kvlist->count < 2) { fprintf(stderr, "Not enough parameters to IDENT list type %s\n", ckv->key); exit(4); } /* list of IDENT and optional numbers */ ikv = kvlist->item[1]; /* numeric default : end condition */ fprintf(outputf, "{\n" "\t\terror = css__stylesheet_style_appendOPV(result, %s, 0, %s);\n" "\t\tif (error != CSS_OK) {\n" "\t\t\t*ctx = orig_ctx;\n" "\t\t\treturn error;\n" "\t\t}\n\n" "\t\twhile ((token != NULL) && (token->type == CSS_TOKEN_IDENT)) {\n" "\t\t\tuint32_t snumber;\n" "\t\t\tcss_fixed num;\n" "\t\t\tint pctx;\n\n" "\t\t\terror = css__stylesheet_string_add(c->sheet, lwc_string_ref(token->idata), &snumber);\n" "\t\t\tif (error != CSS_OK) {\n" "\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\treturn error;\n" "\t\t\t}\n\n" "\t\t\terror = css__stylesheet_style_append(result, snumber);\n" "\t\t\tif (error != CSS_OK) {\n" "\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\treturn error;\n" "\t\t\t}\n\n" "\t\t\tconsumeWhitespace(vector, ctx);\n\n" "\t\t\tpctx = *ctx;\n" "\t\t\ttoken = parserutils_vector_iterate(vector, ctx);\n" "\t\t\tif ((token != NULL) && (token->type == CSS_TOKEN_NUMBER)) {\n" "\t\t\t\tsize_t consumed = 0;\n\n" "\t\t\t\tnum = css__number_from_lwc_string(token->idata, true, &consumed);\n" "\t\t\t\tif (consumed != lwc_string_length(token->idata)) {\n" "\t\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\t\treturn CSS_INVALID;\n" "\t\t\t\t}\n" "\t\t\t\tconsumeWhitespace(vector, ctx);\n\n" "\t\t\t\tpctx = *ctx;\n" "\t\t\t\ttoken = parserutils_vector_iterate(vector, ctx);\n" "\t\t\t} else {\n" "\t\t\t\tnum = INTTOFIX(%s);\n" "\t\t\t}\n\n" "\t\t\terror = css__stylesheet_style_append(result, num);\n" "\t\t\tif (error != CSS_OK) {\n" "\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\treturn error;\n" "\t\t\t}\n\n" "\t\t\tif (token == NULL)\n" "\t\t\t\tbreak;\n\n" "\t\t\tif (token->type == CSS_TOKEN_IDENT) {\n" "\t\t\t\terror = css__stylesheet_style_append(result, %s);\n" "\t\t\t\tif (error != CSS_OK) {\n" "\t\t\t\t\t*ctx = orig_ctx;\n" "\t\t\t\t\treturn error;\n" "\t\t\t\t}\n" "\t\t\t} else {\n" "\t\t\t\t*ctx = pctx; /* rewind one token back */\n" "\t\t\t}\n" "\t\t}\n\n" "\t\terror = css__stylesheet_style_append(result, %s);\n" "\t}\n\n", parseid->val, ckv->val, ikv->key, ckv->val, ikv->val); } void output_invalidcss(FILE *outputf) { fprintf(outputf, "{\n\t\terror = CSS_INVALID;\n\t}\n\n"); } void output_footer(FILE *outputf) { fprintf(outputf, " if (error != CSS_OK)\n" " *ctx = orig_ctx;\n" " \n" " return error;\n" "}\n\n"); } void output_wrap(FILE *outputf, struct keyval *parseid, struct keyval_list *WRAP) { struct keyval *ckv = WRAP->item[0]; fprintf(outputf, " return %s(c, vector, ctx, result, %s);\n}\n", ckv->val, parseid->val); } char str_INHERIT[] = "INHERIT"; struct keyval ident_inherit = { .key = str_INHERIT, }; int main(int argc, char **argv) { char *descriptor; char *curpos; /* current position in input string */ struct keyval *parser_id; /* the parser we are creating output for */ FILE *outputf; struct keyval *rkv; /* current read key:val */ struct keyval_list *curlist; bool do_token_check = true; /* if the check for valid tokens is done */ bool only_ident = true; /* if the only token type is ident */ bool is_generic = false; struct keyval_list base; struct keyval_list IDENT; struct keyval_list IDENT_LIST; struct keyval_list LENGTH_UNIT; struct keyval_list URI; struct keyval_list WRAP; struct keyval_list NUMBER; struct keyval_list COLOR; if (argc < 2) { fprintf(stderr,"Usage: %s [-o ] \n", argv[0]); return 1; } if ((argv[1][0] == '-') && (argv[1][1] == 'o')) { if (argc != 4) { fprintf(stderr,"Usage: %s [-o ] \n", argv[0]); return 1; } outputf = fopen(argv[2], "w"); if (outputf == NULL) { perror("unable to open file"); return 2; /* exit on output file output error */ } descriptor = strdup(argv[3]); } else { outputf = stdout; descriptor = strdup(argv[1]); } curpos = descriptor; base.count = 0; IDENT.count = 0; URI.count = 0; WRAP.count = 0; NUMBER.count = 0; COLOR.count = 0; LENGTH_UNIT.count = 0; IDENT_LIST.count = 0; curlist = &base; while (*curpos != 0) { rkv = get_keyval(&curpos); if (rkv == NULL) { fprintf(stderr,"Token error at offset %ld\n", (long)(curpos - descriptor)); fclose(outputf); return 2; } if (strcmp(rkv->key, "WRAP") == 0) { WRAP.item[WRAP.count++] = rkv; only_ident = false; } else if (strcmp(rkv->key, "NUMBER") == 0) { if (rkv->val[0] == '(') { curlist = &NUMBER; } else if (rkv->val[0] == ')') { curlist = &base; } else { NUMBER.item[NUMBER.count++] = rkv; } only_ident = false; } else if (strcmp(rkv->key, "IDENT") == 0) { if (rkv->val[0] == '(') { curlist = &IDENT; } else if (rkv->val[0] == ')') { curlist = &base; } else if (strcmp(rkv->val, str_INHERIT) == 0) { IDENT.item[IDENT.count++] = &ident_inherit; } } else if (strcmp(rkv->key, "IDENT_LIST") == 0) { if (rkv->val[0] == '(') { curlist = &IDENT_LIST; } else if (rkv->val[0] == ')') { curlist = &base; } } else if (strcmp(rkv->key, "LENGTH_UNIT") == 0) { if (rkv->val[0] == '(') { curlist = &LENGTH_UNIT; } else if (rkv->val[0] == ')') { curlist = &base; } only_ident = false; do_token_check = false; } else if (strcmp(rkv->key, "COLOR") == 0) { COLOR.item[COLOR.count++] = rkv; do_token_check = false; only_ident = false; } else if (strcmp(rkv->key, "URI") == 0) { URI.item[URI.count++] = rkv; only_ident = false; } else if (strcmp(rkv->key, "GENERIC") == 0) { is_generic = true; } else { /* just append to current list */ curlist->item[curlist->count++] = rkv; } } if (base.count != 1) { fprintf(stderr,"Incorrect base element count (got %d expected 1)\n", base.count); fclose(outputf); return 3; } /* header */ output_header(outputf, descriptor, base.item[0], is_generic); if (WRAP.count > 0) { output_wrap(outputf, base.item[0], &WRAP); } else { /* check token type is correct */ output_token_type_check(outputf, do_token_check, &IDENT, &URI, &NUMBER); if (IDENT.count > 0) output_ident(outputf, only_ident, base.item[0], &IDENT); if (URI.count > 0) output_uri(outputf, base.item[0], &URI); if (NUMBER.count > 0) output_number(outputf, base.item[0], &NUMBER); /* terminal blocks, these end the ladder ie no trailing else */ if (COLOR.count > 0) { output_color(outputf, base.item[0], &COLOR); } else if (LENGTH_UNIT.count > 0) { output_length_unit(outputf, base.item[0], &LENGTH_UNIT); } else if (IDENT_LIST.count > 0) { output_ident_list(outputf, base.item[0], &IDENT_LIST); } else { output_invalidcss(outputf); } output_footer(outputf); } fclose(outputf); return 0; } netsurf-all-3.2/libcss/src/parse/properties/clip.c0000644000175000017500000001031512377676736021303 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse clip * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_clip(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error; const css_token *token; int num_lengths = 0; css_fixed length[4] = { 0 }; uint32_t unit[4] = { 0 }; bool match; /* FUNCTION(rect) [ [ IDENT(auto) | length ] CHAR(,)? ]{3} * [ IDENT(auto) | length ] CHAR{)} | * IDENT(auto, inherit) */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal( token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match)) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_CLIP, FLAG_INHERIT, 0); } else if ((token->type == CSS_TOKEN_IDENT) && (lwc_string_caseless_isequal( token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_CLIP, 0, CLIP_AUTO); } else if ((token->type == CSS_TOKEN_FUNCTION) && (lwc_string_caseless_isequal( token->idata, c->strings[RECT], &match) == lwc_error_ok && match)) { int i; uint16_t value = CLIP_SHAPE_RECT; for (i = 0; i < 4; i++) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (token->type == CSS_TOKEN_IDENT) { /* Slightly magical way of generating the auto * values. These are bits 3-6 of the value. */ if ((lwc_string_caseless_isequal( token->idata, c->strings[AUTO], &match) == lwc_error_ok && match)) value |= 1 << (i + 3); else { *ctx = orig_ctx; return CSS_INVALID; } parserutils_vector_iterate(vector, ctx); } else { error = css__parse_unit_specifier(c, vector, ctx, UNIT_PX, &length[num_lengths], &unit[num_lengths]); if (error != CSS_OK) { *ctx = orig_ctx; return error; } if (unit[num_lengths] & UNIT_ANGLE || unit[num_lengths] & UNIT_TIME || unit[num_lengths] & UNIT_FREQ || unit[num_lengths] & UNIT_PCT) { *ctx = orig_ctx; return CSS_INVALID; } num_lengths++; } consumeWhitespace(vector, ctx); /* Consume optional comma after first 3 parameters */ if (i < 3) { token = parserutils_vector_peek(vector, *ctx); if (token == NULL) { *ctx = orig_ctx; return CSS_INVALID; } if (tokenIsChar(token, ',')) parserutils_vector_iterate(vector, ctx); } } consumeWhitespace(vector, ctx); /* Finally, consume closing parenthesis */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) { *ctx = orig_ctx; return CSS_INVALID; } /* output bytecode */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_CLIP, 0, value); if (error != CSS_OK) { *ctx = orig_ctx; return error; } for (i = 0; i < num_lengths; i++) { error = css__stylesheet_style_vappend(result, 2, length[i], unit[i]); if (error != CSS_OK) break; } } else { error = CSS_INVALID; } if (error != CSS_OK) { *ctx = orig_ctx; } return error; } netsurf-all-3.2/libcss/src/parse/properties/font.c0000644000175000017500000003155012377676736021326 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" static css_error parse_system_font(css_language *c, css_style *result, css_system_font *system_font) { css_error error; bool match; /* style */ switch (system_font->style) { case CSS_FONT_STYLE_NORMAL: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_STYLE, 0, FONT_STYLE_NORMAL); break; case CSS_FONT_STYLE_ITALIC: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_STYLE, 0, FONT_STYLE_ITALIC); break; case CSS_FONT_STYLE_OBLIQUE: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_STYLE, 0, FONT_STYLE_OBLIQUE); break; default: error = CSS_BADPARM; break; } if (error != CSS_OK) return error; /* variant */ switch (system_font->variant) { case CSS_FONT_VARIANT_NORMAL: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_VARIANT, 0, FONT_VARIANT_NORMAL); break; case CSS_FONT_VARIANT_SMALL_CAPS: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_VARIANT, 0, FONT_VARIANT_SMALL_CAPS); break; default: error = CSS_BADPARM; break; } if (error != CSS_OK) return error; /* weight */ switch(system_font->weight) { case CSS_FONT_WEIGHT_NORMAL: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_NORMAL); break; case CSS_FONT_WEIGHT_BOLD: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_BOLD); break; case CSS_FONT_WEIGHT_BOLDER: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_BOLDER); break; case CSS_FONT_WEIGHT_LIGHTER: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_LIGHTER); break; case CSS_FONT_WEIGHT_100: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_100); break; case CSS_FONT_WEIGHT_200: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_200); break; case CSS_FONT_WEIGHT_300: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_300); break; case CSS_FONT_WEIGHT_400: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_400); break; case CSS_FONT_WEIGHT_500: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_500); break; case CSS_FONT_WEIGHT_600: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_600); break; case CSS_FONT_WEIGHT_700: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_700); break; case CSS_FONT_WEIGHT_800: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_800); break; case CSS_FONT_WEIGHT_900: error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_900); break; default: error = CSS_BADPARM; break; } if (error != CSS_OK) return error; /* size */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_SIZE, 0, FONT_SIZE_DIMENSION); if (error != CSS_OK) return error; error = css__stylesheet_style_vappend(result, 2, system_font->size.size, system_font->size.unit); if (error != CSS_OK) return error; /* line height */ error = css__stylesheet_style_appendOPV(result, CSS_PROP_LINE_HEIGHT, 0, LINE_HEIGHT_DIMENSION); if (error != CSS_OK) return error; error = css__stylesheet_style_vappend(result, 2, system_font->line_height.size, system_font->line_height.unit); if (error != CSS_OK) return error; /* font family */ if ((lwc_string_caseless_isequal(system_font->family, c->strings[SERIF], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_SERIF); else if ((lwc_string_caseless_isequal(system_font->family, c->strings[SANS_SERIF], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_SANS_SERIF); else if ((lwc_string_caseless_isequal(system_font->family, c->strings[CURSIVE], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_CURSIVE); else if ((lwc_string_caseless_isequal(system_font->family, c->strings[FANTASY], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_FANTASY); else if ((lwc_string_caseless_isequal(system_font->family, c->strings[MONOSPACE], &match) == lwc_error_ok && match)) error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_MONOSPACE); else { uint32_t snumber; error = css__stylesheet_string_add(c->sheet, lwc_string_ref(system_font->family), &snumber); if (error != CSS_OK) return error; error = css__stylesheet_style_appendOPV(result, CSS_PROP_FONT_FAMILY, 0, FONT_FAMILY_STRING); if (error != CSS_OK) return error; error = css__stylesheet_style_append(result, snumber); if (error != CSS_OK) return error; } error = css__stylesheet_style_append(result, FONT_FAMILY_END); return error; } /** * Parse font * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_font(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { const css_token *token; css_error error; int orig_ctx = *ctx; int prev_ctx; css_system_font system_font; bool style = true; bool variant = true; bool weight = true; bool line_height = true; css_style *style_style; css_style *variant_style; css_style *weight_style; css_style *size_style; css_style *line_height_style; css_style *family_style; int svw; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_VARIANT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_WEIGHT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_SIZE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_LINE_HEIGHT); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_FONT_FAMILY); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* Perhaps an unknown font name; ask the client */ if ((token->type == CSS_TOKEN_IDENT) && (c->sheet->font != NULL) && (c->sheet->font(c->sheet->font_pw, token->idata, &system_font) == CSS_OK)) { error = parse_system_font(c, result, &system_font); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &style_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &variant_style); if (error != CSS_OK) { css__stylesheet_style_destroy(style_style); return error; } error = css__stylesheet_style_create(c->sheet, &weight_style); if (error != CSS_OK) { css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(variant_style); return error; } error = css__stylesheet_style_create(c->sheet, &size_style); if (error != CSS_OK) { css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(variant_style); css__stylesheet_style_destroy(weight_style); return error; } error = css__stylesheet_style_create(c->sheet, &line_height_style); if (error != CSS_OK) { css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(variant_style); css__stylesheet_style_destroy(weight_style); css__stylesheet_style_destroy(size_style); return error; } error = css__stylesheet_style_create(c->sheet, &family_style); if (error != CSS_OK) { css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(variant_style); css__stylesheet_style_destroy(weight_style); css__stylesheet_style_destroy(size_style); css__stylesheet_style_destroy(line_height_style); return error; } /* Attempt to parse the optional style, variant, and weight */ for (svw = 0; svw < 3; svw++) { prev_ctx = *ctx; error = CSS_OK; /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if ((token != NULL) && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_font_cleanup; } if ((style) && (error = css__parse_font_style(c, vector, ctx, style_style)) == CSS_OK) { style = false; } else if ((variant) && (error = css__parse_font_variant(c, vector, ctx, variant_style)) == CSS_OK) { variant = false; } else if ((weight) && (error = css__parse_font_weight(c, vector, ctx, weight_style)) == CSS_OK) { weight = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); } else { break; } if (*ctx == prev_ctx) break; } consumeWhitespace(vector, ctx); /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if ((token != NULL) && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_font_cleanup; } /* Now expect a font-size */ error = css__parse_font_size(c, vector, ctx, size_style); if (error != CSS_OK) goto css__parse_font_cleanup; consumeWhitespace(vector, ctx); /* Potential line-height */ token = parserutils_vector_peek(vector, *ctx); if ((token != NULL) && tokenIsChar(token, '/')) { parserutils_vector_iterate(vector, ctx); consumeWhitespace(vector, ctx); /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if ((token != NULL) && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_font_cleanup; } error = css__parse_line_height(c, vector, ctx, line_height_style); if (error != CSS_OK) goto css__parse_font_cleanup; line_height = false; } consumeWhitespace(vector, ctx); /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if ((token != NULL) && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_font_cleanup; } /* Now expect a font-family */ error = css__parse_font_family(c, vector, ctx, family_style); if (error != CSS_OK) goto css__parse_font_cleanup; /* defaults */ if (style) { error = css__stylesheet_style_appendOPV(style_style, CSS_PROP_FONT_STYLE, 0, FONT_STYLE_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } if (variant) { error = css__stylesheet_style_appendOPV(variant_style, CSS_PROP_FONT_VARIANT, 0, FONT_VARIANT_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } if (weight) { error = css__stylesheet_style_appendOPV(weight_style, CSS_PROP_FONT_WEIGHT, 0, FONT_WEIGHT_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } if (line_height) { error = css__stylesheet_style_appendOPV(line_height_style, CSS_PROP_LINE_HEIGHT, 0, LINE_HEIGHT_NORMAL); if (error != CSS_OK) goto css__parse_font_cleanup; } /* merge final output */ error = css__stylesheet_merge_style(result, style_style); if (error != CSS_OK) goto css__parse_font_cleanup; error = css__stylesheet_merge_style(result, variant_style); if (error != CSS_OK) goto css__parse_font_cleanup; error = css__stylesheet_merge_style(result, weight_style); if (error != CSS_OK) goto css__parse_font_cleanup; error = css__stylesheet_merge_style(result, size_style); if (error != CSS_OK) goto css__parse_font_cleanup; error = css__stylesheet_merge_style(result, line_height_style); if (error != CSS_OK) goto css__parse_font_cleanup; error = css__stylesheet_merge_style(result, family_style); css__parse_font_cleanup: css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(variant_style); css__stylesheet_style_destroy(weight_style); css__stylesheet_style_destroy(size_style); css__stylesheet_style_destroy(line_height_style); css__stylesheet_style_destroy(family_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/text_decoration.c0000644000175000017500000000643012377676736023552 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse text-decoration * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_text_decoration(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; css_error error = CSS_INVALID; const css_token *token; bool match; /* IDENT([ underline || overline || line-through || blink ]) * | IDENT (none, inherit) */ token = parserutils_vector_iterate(vector, ctx); if ((token == NULL) || (token->type != CSS_TOKEN_IDENT) ) { *ctx = orig_ctx; return CSS_INVALID; } if (lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) == lwc_error_ok && match) { error = css_stylesheet_style_inherit(result, CSS_PROP_TEXT_DECORATION); } else if (lwc_string_caseless_isequal(token->idata, c->strings[NONE], &match) == lwc_error_ok && match) { error = css__stylesheet_style_appendOPV(result, CSS_PROP_TEXT_DECORATION, 0, TEXT_DECORATION_NONE); } else { uint16_t value = 0; while (token != NULL) { if ((lwc_string_caseless_isequal( token->idata, c->strings[UNDERLINE], &match) == lwc_error_ok && match)) { if ((value & TEXT_DECORATION_UNDERLINE) == 0) value |= TEXT_DECORATION_UNDERLINE; else { *ctx = orig_ctx; return CSS_INVALID; } } else if ((lwc_string_caseless_isequal( token->idata, c->strings[OVERLINE], &match) == lwc_error_ok && match)) { if ((value & TEXT_DECORATION_OVERLINE) == 0) value |= TEXT_DECORATION_OVERLINE; else { *ctx = orig_ctx; return CSS_INVALID; } } else if ((lwc_string_caseless_isequal( token->idata, c->strings[LINE_THROUGH], &match) == lwc_error_ok && match)) { if ((value & TEXT_DECORATION_LINE_THROUGH) == 0) value |= TEXT_DECORATION_LINE_THROUGH; else { *ctx = orig_ctx; return CSS_INVALID; } } else if ((lwc_string_caseless_isequal( token->idata, c->strings[BLINK], &match) == lwc_error_ok && match)) { if ((value & TEXT_DECORATION_BLINK) == 0) value |= TEXT_DECORATION_BLINK; else { *ctx = orig_ctx; return CSS_INVALID; } } else { *ctx = orig_ctx; return CSS_INVALID; } consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); if (token != NULL && token->type != CSS_TOKEN_IDENT) break; token = parserutils_vector_iterate(vector, ctx); } error = css__stylesheet_style_appendOPV(result, CSS_PROP_TEXT_DECORATION, 0, value); } if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/properties/properties.h0000644000175000017500000003777612377676736022601 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_css__parse_properties_properties_h_ #define css_css__parse_properties_properties_h_ #include "stylesheet.h" #include "lex/lex.h" #include "parse/language.h" #include "parse/propstrings.h" /** * Type of property handler function */ typedef css_error (*css_prop_handler)(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP]; css_error css__parse_azimuth(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_attachment(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_image(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_position(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_background_repeat(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_bottom_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_collapse(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_left_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_right_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_spacing(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_top_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_border_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_break_after(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_break_before(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_break_inside(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_caption_side(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_clear(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_clip(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_columns(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_count(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_fill(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_gap(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_rule_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_span(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_column_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_content(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_counter_increment(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_counter_reset(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue_after(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cue_before(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_cursor(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_direction(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_display(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_elevation(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_empty_cells(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_float(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_family(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_size(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_variant(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_font_weight(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_height(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_letter_spacing(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_line_height(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_image(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_position(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_list_style_type(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_margin_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_max_height(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_max_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_min_height(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_min_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_opacity(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_orphans(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_color(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_style(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_outline_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_overflow(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_overflow_x(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_overflow_y(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_bottom(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_left(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_after(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_before(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_page_break_inside(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause_after(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pause_before(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pitch_range(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_pitch(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_play_during(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_position(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_quotes(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_richness(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_right(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_header(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_numeral(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak_punctuation(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speak(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_speech_rate(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_stress(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_table_layout(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_align(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_decoration(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_indent(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_text_transform(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_top(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_unicode_bidi(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_vertical_align(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_visibility(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_voice_family(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_volume(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_white_space(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_widows(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_word_spacing(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_writing_mode(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_z_index(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); #endif netsurf-all-3.2/libcss/src/parse/properties/outline.c0000644000175000017500000001000612377676736022030 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" /** * Parse outline shorthand * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive resulting style * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_INVALID if the input is not valid * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_outline(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result) { int orig_ctx = *ctx; int prev_ctx; const css_token *token; css_error error; bool color = true; bool style = true; bool width = true; css_style *color_style; css_style *style_style; css_style *width_style; /* Firstly, handle inherit */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (is_css_inherit(c, token)) { error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_COLOR); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_STYLE); if (error != CSS_OK) return error; error = css_stylesheet_style_inherit(result, CSS_PROP_OUTLINE_WIDTH); if (error == CSS_OK) parserutils_vector_iterate(vector, ctx); return error; } /* allocate styles */ error = css__stylesheet_style_create(c->sheet, &color_style); if (error != CSS_OK) return error; error = css__stylesheet_style_create(c->sheet, &style_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); return error; } error = css__stylesheet_style_create(c->sheet, &width_style); if (error != CSS_OK) { css__stylesheet_style_destroy(color_style); css__stylesheet_style_destroy(style_style); return error; } /* Attempt to parse the various longhand properties */ do { prev_ctx = *ctx; error = CSS_OK; /* Ensure that we're not about to parse another inherit */ token = parserutils_vector_peek(vector, *ctx); if (token != NULL && is_css_inherit(c, token)) { error = CSS_INVALID; goto css__parse_outline_cleanup; } if ((color) && (error = css__parse_outline_color(c, vector, ctx, color_style)) == CSS_OK) { color = false; } else if ((style) && (error = css__parse_outline_style(c, vector, ctx, style_style)) == CSS_OK) { style = false; } else if ((width) && (error = css__parse_outline_width(c, vector, ctx, width_style)) == CSS_OK) { width = false; } if (error == CSS_OK) { consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } else { /* Forcibly cause loop to exit */ token = NULL; } } while (*ctx != prev_ctx && token != NULL); /* defaults */ if (color) { error = css__stylesheet_style_appendOPV(color_style, CSS_PROP_OUTLINE_COLOR, 0, OUTLINE_COLOR_INVERT); } if (style) { error = css__stylesheet_style_appendOPV(style_style, CSS_PROP_OUTLINE_STYLE, 0, OUTLINE_STYLE_NONE); } if (width) { error = css__stylesheet_style_appendOPV(width_style, CSS_PROP_OUTLINE_WIDTH, 0, OUTLINE_WIDTH_MEDIUM); } error = css__stylesheet_merge_style(result, color_style); if (error != CSS_OK) goto css__parse_outline_cleanup; error = css__stylesheet_merge_style(result, style_style); if (error != CSS_OK) goto css__parse_outline_cleanup; error = css__stylesheet_merge_style(result, width_style); css__parse_outline_cleanup: css__stylesheet_style_destroy(width_style); css__stylesheet_style_destroy(style_style); css__stylesheet_style_destroy(color_style); if (error != CSS_OK) *ctx = orig_ctx; return error; } netsurf-all-3.2/libcss/src/parse/parse.c0000644000175000017500000017150412377676736017302 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include #include #include #include #include "charset/detect.h" #include "lex/lex.h" #include "parse/parse.h" #include "utils/parserutilserror.h" #include "utils/utils.h" #undef DEBUG_STACK #undef DEBUG_EVENTS #ifndef NDEBUG #include extern void parserutils_stack_dump(parserutils_stack *stack, const char *prefix, void (*printer)(void *item)); extern void parserutils_vector_dump(parserutils_vector *vector, const char *prefix, void (*printer)(void *item)); #ifdef DEBUG_STACK static void printer(void *item); #endif #ifdef DEBUG_EVENTS static void tprinter(void *token); #endif #endif /** * Major state numbers */ enum { sStart = 0, sStylesheet = 1, sStatement = 2, sRuleset = 3, sRulesetEnd = 4, sAtRule = 5, sAtRuleEnd = 6, sBlock = 7, sBlockContent = 8, sSelector = 9, sDeclaration = 10, sDeclList = 11, sDeclListEnd = 12, sProperty = 13, sValue0 = 14, sValue1 = 15, sValue = 16, sAny0 = 17, sAny1 = 18, sAny = 19, sMalformedDecl = 20, sMalformedSelector = 21, sMalformedAtRule = 22, sInlineStyle = 23, sISBody0 = 24, sISBody = 25 }; /** * Representation of a parser state */ typedef struct parser_state { unsigned int state : 16, substate : 16; } parser_state; /** * CSS parser object */ struct css_parser { parserutils_inputstream *stream; /**< The inputstream */ css_lexer *lexer; /**< The lexer to use */ bool quirks; /**< Whether to enable parsing quirks */ #define STACK_CHUNK 32 parserutils_stack *states; /**< Stack of states */ parserutils_vector *tokens; /**< Vector of pending tokens */ const css_token *pushback; /**< Push back buffer */ bool parseError; /**< A parse error has occurred */ parserutils_stack *open_items; /**< Stack of open brackets */ uint8_t match_char; /**< Close bracket type for parseAny */ bool last_was_ws; /**< Last token was whitespace */ css_parser_event_handler event; /**< Client's event handler */ void *event_pw; /**< Client data for event handler */ }; static css_error css__parser_create_internal(const char *charset, css_charset_source cs_source, parser_state initial, css_parser **parser); static css_error transition(css_parser *parser, parser_state to, parser_state subsequent); static css_error transitionNoRet(css_parser *parser, parser_state to); static css_error done(css_parser *parser); static css_error expect(css_parser *parser, css_token_type type); static css_error getToken(css_parser *parser, const css_token **token); static css_error pushBack(css_parser *parser, const css_token *token); static css_error eatWS(css_parser *parser); static css_error parseStart(css_parser *parser); static css_error parseStylesheet(css_parser *parser); static css_error parseStatement(css_parser *parser); static css_error parseRuleset(css_parser *parser); static css_error parseRulesetEnd(css_parser *parser); static css_error parseAtRule(css_parser *parser); static css_error parseAtRuleEnd(css_parser *parser); static css_error parseBlock(css_parser *parser); static css_error parseBlockContent(css_parser *parser); static css_error parseSelector(css_parser *parser); static css_error parseDeclaration(css_parser *parser); static css_error parseDeclList(css_parser *parser); static css_error parseDeclListEnd(css_parser *parser); static css_error parseProperty(css_parser *parser); static css_error parseValue0(css_parser *parser); static css_error parseValue1(css_parser *parser); static css_error parseValue(css_parser *parser); static css_error parseAny0(css_parser *parser); static css_error parseAny1(css_parser *parser); static css_error parseAny(css_parser *parser); static css_error parseMalformedDeclaration(css_parser *parser); static css_error parseMalformedSelector(css_parser *parser); static css_error parseMalformedAtRule(css_parser *parser); static css_error parseInlineStyle(css_parser *parser); static css_error parseISBody0(css_parser *parser); static css_error parseISBody(css_parser *parser); static void unref_interned_strings_in_tokens(css_parser *parser); /** * Dispatch table for parsing, indexed by major state number */ static css_error (*parseFuncs[])(css_parser *parser) = { parseStart, parseStylesheet, parseStatement, parseRuleset, parseRulesetEnd, parseAtRule, parseAtRuleEnd, parseBlock, parseBlockContent, parseSelector, parseDeclaration, parseDeclList, parseDeclListEnd, parseProperty, parseValue0, parseValue1, parseValue, parseAny0, parseAny1, parseAny, parseMalformedDeclaration, parseMalformedSelector, parseMalformedAtRule, parseInlineStyle, parseISBody0, parseISBody }; /** * Create a CSS parser * * \param charset Charset of data, if known, or NULL * \param cs_source Source of charset information, or CSS_CHARSET_DEFAULT * \param parser Pointer to location to receive parser instance * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__parser_create(const char *charset, css_charset_source cs_source, css_parser **parser) { parser_state initial = { sStart, 0 }; return css__parser_create_internal(charset, cs_source, initial, parser); } /** * Create a CSS parser for an inline style * * \param charset Charset of data, if known, or NULL * \param cs_source Source of charset information, or CSS_CHARSET_DEFAULT * \param parser Pointer to location to receive parser instance * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__parser_create_for_inline_style(const char *charset, css_charset_source cs_source, css_parser **parser) { parser_state initial = { sInlineStyle, 0 }; return css__parser_create_internal(charset, cs_source, initial, parser); } /** * Destroy a CSS parser * * \param parser The parser instance to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__parser_destroy(css_parser *parser) { if (parser == NULL) return CSS_BADPARM; parserutils_stack_destroy(parser->open_items); parserutils_vector_destroy(parser->tokens); parserutils_stack_destroy(parser->states); css__lexer_destroy(parser->lexer); parserutils_inputstream_destroy(parser->stream); free(parser); return CSS_OK; } /** * Configure a CSS parser * * \param parser The parser instance to configure * \param type The option to configure * \param params Option-specific data * \return CSS_OK on success, appropriate error otherwise */ css_error css__parser_setopt(css_parser *parser, css_parser_opttype type, css_parser_optparams *params) { if (parser == NULL || params == NULL) return CSS_BADPARM; switch (type) { case CSS_PARSER_QUIRKS: parser->quirks = params->quirks; break; case CSS_PARSER_EVENT_HANDLER: parser->event = params->event_handler.handler; parser->event_pw = params->event_handler.pw; break; } return CSS_OK; } /** * Parse a chunk of data using a CSS parser * * \param parser The parser to use * \param data Pointer to the chunk to parse * \param len Length of chunk * \return CSS_OK on success, appropriate error otherwise */ css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, size_t len) { parserutils_error perror; parser_state *state; css_error error = CSS_OK; if (parser == NULL || data == NULL) return CSS_BADPARM; perror = parserutils_inputstream_append(parser->stream, data, len); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); do { state = parserutils_stack_get_current(parser->states); if (state == NULL) break; error = parseFuncs[state->state](parser); } while (error == CSS_OK); return error; } /** * Inform a CSS parser that all data has been received. * * \param parser The parser to inform * \return CSS_OK on success, appropriate error otherwise */ css_error css__parser_completed(css_parser *parser) { parserutils_error perror; parser_state *state; css_error error = CSS_OK; if (parser == NULL) return CSS_BADPARM; /* Send EOF to input stream */ perror = parserutils_inputstream_append(parser->stream, NULL, 0); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); /* Flush through any remaining data */ do { state = parserutils_stack_get_current(parser->states); if (state == NULL) break; error = parseFuncs[state->state](parser); } while (error == CSS_OK); return error; } /** * Retrieve document charset information from a CSS parser * * \param parser The parser instance * \param source Pointer to location to receive charset source * \return Pointer to charset name (constant; do not free) */ const char *css__parser_read_charset(css_parser *parser, css_charset_source *source) { const char *charset; uint32_t src; if (parser == NULL || source == NULL) return NULL; charset = parserutils_inputstream_read_charset(parser->stream, &src); *source = (css_charset_source) src; return charset; } /** * Quirks permitted when parsing * * \param parser Parser to query * \return True if quirks permitted, false otherwise */ bool css__parser_quirks_permitted(css_parser *parser) { return parser->quirks; } /****************************************************************************** * Parser creation helper * ******************************************************************************/ /** * Create a CSS parser (internal) * * \param charset Charset of data, if known, or NULL * \param cs_source Source of charset information, or CSS_CHARSET_DEFAULT * \param initial The required initial state of the parser * \param parser Pointer to location to receive parser instance * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__parser_create_internal(const char *charset, css_charset_source cs_source, parser_state initial, css_parser **parser) { css_parser *p; parserutils_error perror; css_error error; if (parser == NULL) return CSS_BADPARM; p = malloc(sizeof(css_parser)); if (p == NULL) return CSS_NOMEM; perror = parserutils_inputstream_create(charset, cs_source, css__charset_extract, &p->stream); if (perror != PARSERUTILS_OK) { free(p); return css_error_from_parserutils_error(perror); } error = css__lexer_create(p->stream, &p->lexer); if (error != CSS_OK) { parserutils_inputstream_destroy(p->stream); free(p); return error; } perror = parserutils_stack_create(sizeof(parser_state), STACK_CHUNK, &p->states); if (perror != PARSERUTILS_OK) { css__lexer_destroy(p->lexer); parserutils_inputstream_destroy(p->stream); free(p); return css_error_from_parserutils_error(perror); } perror = parserutils_vector_create(sizeof(css_token), STACK_CHUNK, &p->tokens); if (perror != PARSERUTILS_OK) { parserutils_stack_destroy(p->states); css__lexer_destroy(p->lexer); parserutils_inputstream_destroy(p->stream); free(p); return css_error_from_parserutils_error(perror); } perror = parserutils_stack_create(sizeof(char), STACK_CHUNK, &p->open_items); if (perror != PARSERUTILS_OK) { parserutils_vector_destroy(p->tokens); parserutils_stack_destroy(p->states); css__lexer_destroy(p->lexer); parserutils_inputstream_destroy(p->stream); free(p); return css_error_from_parserutils_error(perror); } perror = parserutils_stack_push(p->states, (void *) &initial); if (perror != PARSERUTILS_OK) { parserutils_stack_destroy(p->open_items); parserutils_vector_destroy(p->tokens); parserutils_stack_destroy(p->states); css__lexer_destroy(p->lexer); parserutils_inputstream_destroy(p->stream); free(p); return css_error_from_parserutils_error(perror); } p->quirks = false; p->pushback = NULL; p->parseError = false; p->match_char = 0; p->event = NULL; p->last_was_ws = false; p->event_pw = NULL; *parser = p; return CSS_OK; } /****************************************************************************** * Helper functions * ******************************************************************************/ /** * Transition to a new state, ensuring return to the one specified * * \param parser The parser instance * \param to Destination state * \param subsequent The state to return to * \return CSS_OK on success, appropriate error otherwise */ css_error transition(css_parser *parser, parser_state to, parser_state subsequent) { parser_state *state = parserutils_stack_get_current(parser->states); parser_state current = *state; parserutils_error perror; /* Replace current state on the stack with the subsequent one */ *state = subsequent; /* Push next state on the stack */ perror = parserutils_stack_push(parser->states, (void *) &to); if (perror != PARSERUTILS_OK) { *state = current; return css_error_from_parserutils_error(perror); } #if !defined(NDEBUG) && defined(DEBUG_STACK) parserutils_stack_dump(parser->states, __func__, printer); #endif /* Clear the error flag */ parser->parseError = false; return CSS_OK; } /** * Transition to a new state, returning to previous state on stack * * \param parser The parser instance * \param to Destination state * \return CSS_OK on success, appropriate error otherwise */ css_error transitionNoRet(css_parser *parser, parser_state to) { parser_state *state = parserutils_stack_get_current(parser->states); /* Replace current state on the stack with destination */ *state = to; #if !defined(NDEBUG) && defined(DEBUG_STACK) parserutils_stack_dump(parser->states, __func__, printer); #endif /* Clear the error flag */ parser->parseError = false; return CSS_OK; } /** * Return to previous state on the stack * * \param parser The parser instance * \return CSS_OK on success, appropriate error otherwise */ css_error done(css_parser *parser) { parserutils_error perror; /* Pop current state from stack */ perror = parserutils_stack_pop(parser->states, NULL); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); #if !defined(NDEBUG) && defined(DEBUG_STACK) parserutils_stack_dump(parser->states, __func__, printer); #endif return CSS_OK; } /** * Assert that the expected token is next in the input * * \param parser The parser instance * \param type The expected token type * \return CSS_OK on success, appropriate error otherwise */ css_error expect(css_parser *parser, css_token_type type) { const css_token *token; css_error error; error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type != type) { error = pushBack(parser, token); if (error != CSS_OK) return error; return CSS_INVALID; } return CSS_OK; } /** * Retrieve the next token in the input * * \param parser The parser instance * \param token Pointer to location to receive token * \return CSS_OK on success, appropriate error otherwise */ css_error getToken(css_parser *parser, const css_token **token) { parserutils_error perror; lwc_error lerror; css_error error; /* Use pushback, if it exists */ if (parser->pushback != NULL) { *token = parser->pushback; parser->pushback = NULL; } else { /* Otherwise, ask the lexer */ css_token *t; error = css__lexer_get_token(parser->lexer, &t); if (error != CSS_OK) return error; /* If the last token read was whitespace, keep reading * tokens until we encounter one that isn't whitespace */ while (parser->last_was_ws && t->type == CSS_TOKEN_S) { error = css__lexer_get_token(parser->lexer, &t); if (error != CSS_OK) return error; } /* We need only intern for the following token types: * * CSS_TOKEN_IDENT, CSS_TOKEN_ATKEYWORD, CSS_TOKEN_STRING, * CSS_TOKEN_INVALID_STRING, CSS_TOKEN_HASH, CSS_TOKEN_URI, * CSS_TOKEN_UNICODE_RANGE?, CSS_TOKEN_FUNCTION, CSS_TOKEN_CHAR, * CSS_TOKEN_NUMBER, CSS_TOKEN_PERCENTAGE, CSS_TOKEN_DIMENSION * * These token types all appear before CSS_TOKEN_LAST_INTERN. * All other token types appear after this magic value. */ if (t->type < CSS_TOKEN_LAST_INTERN && t->data.data != NULL) { /* Insert token text into the dictionary */ lerror = lwc_intern_string((char *)t->data.data, t->data.len, &t->idata); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); } else { t->idata = NULL; } *token = t; } /* Append token to vector */ perror = parserutils_vector_append(parser->tokens, (css_token *) (*token)); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); parser->last_was_ws = ((*token)->type == CSS_TOKEN_S); return CSS_OK; } /** * Push a token back on the input * * \param parser The parser instance * \param token The token to push back * \return CSS_OK on success. */ css_error pushBack(css_parser *parser, const css_token *token) { parserutils_error perror; /* The pushback buffer depth is 1 token. Assert this. */ assert(parser->pushback == NULL); perror = parserutils_vector_remove_last(parser->tokens); if (perror != PARSERUTILS_OK) return css_error_from_parserutils_error(perror); parser->pushback = token; return CSS_OK; } /** * Eat whitespace tokens * * \param parser The parser instance * \return CSS_OK on success, appropriate error otherwise */ css_error eatWS(css_parser *parser) { const css_token *token; css_error error; error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type != CSS_TOKEN_S) { error = pushBack(parser, token); if (error != CSS_OK) return error; } return CSS_OK; } /****************************************************************************** * Parser stages * ******************************************************************************/ css_error parseStart(css_parser *parser) { enum { Initial = 0, AfterWS = 1, AfterStylesheet = 2 }; parser_state *state = parserutils_stack_get_current(parser->states); css_error error = CSS_OK; /* start -> ws stylesheet EOF */ switch (state->substate) { case Initial: #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin stylesheet\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_START_STYLESHEET, NULL, parser->event_pw); } error = eatWS(parser); if (error != CSS_OK) return error; state->substate = AfterWS; /* Fall through */ case AfterWS: { parser_state to = { sStylesheet, Initial }; parser_state subsequent = { sStart, AfterStylesheet }; return transition(parser, to, subsequent); } case AfterStylesheet: error = expect(parser, CSS_TOKEN_EOF); if (error != CSS_OK) return error; /* Flag completion, just in case */ } #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); printf("End stylesheet\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_END_STYLESHEET, NULL, parser->event_pw); } unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } css_error parseStylesheet(css_parser *parser) { enum { Initial = 0, WS = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* stylesheet -> CDO ws stylesheet * -> CDC ws stylesheet * -> statement ws stylesheet * -> */ while (1) { switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; switch (token->type) { case CSS_TOKEN_EOF: error = pushBack(parser, token); if (error != CSS_OK) return error; unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); case CSS_TOKEN_CDO: case CSS_TOKEN_CDC: break; default: { parser_state to = { sStatement, Initial }; parser_state subsequent = { sStylesheet, WS }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } } state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; state->substate = Initial; } } } css_error parseStatement(css_parser *parser) { enum { Initial = 0 }; const css_token *token; parser_state to = { sRuleset, Initial }; css_error error; /* statement -> ruleset * at-rule */ error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_ATKEYWORD) to.state = sAtRule; error = pushBack(parser, token); if (error != CSS_OK) return error; return transitionNoRet(parser, to); } css_error parseRuleset(css_parser *parser) { enum { Initial = 0, Brace = 1, WS = 2 }; parser_state *state = parserutils_stack_get_current(parser->states); parser_state to = { sRulesetEnd, Initial }; const css_token *token; css_error error; /* ruleset -> selector '{' ws ruleset-end * -> '{' ws ruleset-end */ switch (state->substate) { case Initial: unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); error = getToken(parser, &token); if (error != CSS_OK) return error; /* The grammar's ambiguous here -- selectors may start with a * brace. We're going to assume that that won't happen, * however. */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && lwc_string_data(token->idata)[0] == '{') { #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin ruleset\n"); #endif if (parser->event != NULL) { if (parser->event(CSS_PARSER_START_RULESET, NULL, parser->event_pw) == CSS_INVALID) { parser_state to = { sMalformedSelector, Initial }; return transitionNoRet(parser, to); } } state->substate = WS; goto ws; } else { parser_state to = { sSelector, Initial }; parser_state subsequent = { sRuleset, Brace }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } break; case Brace: #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin ruleset\n"); parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->parseError == false && parser->event != NULL) { if (parser->event(CSS_PARSER_START_RULESET, parser->tokens, parser->event_pw) == CSS_INVALID) parser->parseError = true; } if (parser->parseError == true) { parser_state to = { sMalformedSelector, Initial }; return transitionNoRet(parser, to); } error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '{') { /* This should never happen, as FOLLOW(selector) * contains only '{' */ assert(0 && "Expected {"); } state->substate = WS; /* Fall through */ case WS: ws: error = eatWS(parser); if (error != CSS_OK) return error; break; } return transitionNoRet(parser, to); } css_error parseRulesetEnd(css_parser *parser) { enum { Initial = 0, DeclList = 1, Brace = 2, WS = 3 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* ruleset-end -> declaration decl-list '}' ws * -> decl-list '}' ws */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) return done(parser); /* If this can't possibly be the start of a decl-list, then * attempt to parse a declaration. This will catch any invalid * input at this point and read to the start of the next * declaration. FIRST(decl-list) = (';', '}') */ if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { parser_state to = { sDeclaration, Initial }; parser_state subsequent = { sRulesetEnd, DeclList }; return transition(parser, to, subsequent); } state->substate = DeclList; /* Fall through */ case DeclList: { parser_state to = { sDeclList, Initial }; parser_state subsequent = { sRulesetEnd, Brace }; return transition(parser, to, subsequent); } case Brace: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { /* This should never happen, as FOLLOW(decl-list) * contains only '}' */ assert(0 && "Expected }"); } state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; } #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("End ruleset\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_END_RULESET, NULL, parser->event_pw); } return done(parser); } css_error parseAtRule(css_parser *parser) { enum { Initial = 0, WS = 1, Any = 2, AfterAny = 3 }; parser_state *state = parserutils_stack_get_current(parser->states); parser_state to = { sAtRuleEnd, Initial }; const css_token *token; css_error error; /* at-rule -> ATKEYWORD ws any0 at-rule-end */ switch (state->substate) { case Initial: unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); error = getToken(parser, &token); if (error != CSS_OK) return error; assert(token->type == CSS_TOKEN_ATKEYWORD); state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; state->substate = Any; /* Fall through */ case Any: { parser_state to = { sAny0, Initial }; parser_state subsequent = { sAtRule, AfterAny }; return transition(parser, to, subsequent); } case AfterAny: if (parser->parseError) { parser_state to = { sMalformedAtRule, Initial }; return transitionNoRet(parser, to); } error = getToken(parser, &token); if (error != CSS_OK) return error; /* Grammar ambiguity: any0 can be followed by '{',';',')',']'. * at-rule can only be followed by '{' and ';'. */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { if (lwc_string_data(token->idata)[0] == ')' || lwc_string_data( token->idata)[0] == ']') { parser_state to = { sAny0, Initial }; parser_state subsequent = { sAtRule, AfterAny }; return transition(parser, to, subsequent); } } error = pushBack(parser, token); if (error != CSS_OK) return error; break; } return transitionNoRet(parser, to); } css_error parseAtRuleEnd(css_parser *parser) { enum { Initial = 0, WS = 1, AfterBlock = 2 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* at-rule-end -> block * -> ';' ws */ switch (state->substate) { case Initial: #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin at-rule\n"); parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { if (parser->event(CSS_PARSER_START_ATRULE, parser->tokens, parser->event_pw) == CSS_INVALID) { parser_state to = { sMalformedAtRule, Initial }; return transitionNoRet(parser, to); } } error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1) { /* Should never happen FOLLOW(at-rule) == '{', ';'*/ assert(0 && "Expected { or ;"); } if (lwc_string_data(token->idata)[0] == '{') { parser_state to = { sBlock, Initial }; parser_state subsequent = { sAtRuleEnd, AfterBlock }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } else if (lwc_string_data(token->idata)[0] != ';') { /* Again, should never happen */ assert(0 && "Expected ;"); } state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; case AfterBlock: break; } #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("End at-rule\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_END_ATRULE, NULL, parser->event_pw); } return done(parser); } css_error parseBlock(css_parser *parser) { enum { Initial = 0, WS = 1, Content = 2, Brace = 3, WS2 = 4 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* block -> '{' ws block-content '}' ws */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("Begin block\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_START_BLOCK, NULL, parser->event_pw); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '{') { /* This should never happen, as FIRST(block) == '{' */ assert(0 && "Expected {"); } unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; state->substate = Content; /* Fall through */ case Content: { parser_state to = { sBlockContent, Initial }; parser_state subsequent = { sBlock, Brace }; return transition(parser, to, subsequent); } case Brace: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { /* This should never happen, as * FOLLOW(block-content) == '}' */ assert(0 && "Expected }"); } state->substate = WS2; /* Fall through */ case WS2: error = eatWS(parser); if (error != CSS_OK) return error; break; } #if !defined(NDEBUG) && defined(DEBUG_EVENTS) printf("End block\n"); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_END_BLOCK, NULL, parser->event_pw); } unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } css_error parseBlockContent(css_parser *parser) { enum { Initial = 0, WS = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* block-content -> any block-content * -> block block-content * -> ATKEYWORD ws block-content * -> ';' ws block-content * -> */ while (1) { switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_ATKEYWORD) { state->substate = WS; } else if (token->type == CSS_TOKEN_CHAR) { if (lwc_string_length(token->idata) == 1 && lwc_string_data( token->idata)[0] == '{') { /* Grammar ambiguity. Assume block */ parser_state to = { sBlock, Initial }; parser_state subsequent = { sBlockContent, Initial }; error = pushBack(parser, token); if (error != CSS_OK) return error; #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { parser->event( CSS_PARSER_BLOCK_CONTENT, parser->tokens, parser->event_pw); } unref_interned_strings_in_tokens( parser); parserutils_vector_clear( parser->tokens); return transition(parser, to, subsequent); } else if (lwc_string_length( token->idata) == 1 && lwc_string_data( token->idata)[0] == ';') { /* Grammar ambiguity. Assume semi */ error = pushBack(parser, token); if (error != CSS_OK) return error; #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { parser->event( CSS_PARSER_BLOCK_CONTENT, parser->tokens, parser->event_pw); } error = getToken(parser, &token); if (error != CSS_OK) return error; unref_interned_strings_in_tokens( parser); parserutils_vector_clear( parser->tokens); state->substate = WS; } else if (lwc_string_length( token->idata) == 1 && lwc_string_data( token->idata)[0] == '}') { /* Grammar ambiguity. Assume end */ error = pushBack(parser, token); if (error != CSS_OK) return error; #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { parser->event( CSS_PARSER_BLOCK_CONTENT, parser->tokens, parser->event_pw); } unref_interned_strings_in_tokens( parser); parserutils_vector_clear( parser->tokens); return done(parser); } } else if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_BLOCK_CONTENT, parser->tokens, parser->event_pw); } unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } if (state->substate == Initial) { parser_state to = { sAny, Initial }; parser_state subsequent = { sBlockContent, Initial }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } break; case WS: error = eatWS(parser); if (error != CSS_OK) return error; state->substate = Initial; } } return done(parser); } css_error parseSelector(css_parser *parser) { enum { Initial = 0, AfterAny1 = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); /* selector -> any1 */ switch (state->substate) { case Initial: { parser_state to = { sAny1, Initial }; parser_state subsequent = { sSelector, AfterAny1 }; unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return transition(parser, to, subsequent); } case AfterAny1: break; } return done(parser); } css_error parseDeclaration(css_parser *parser) { enum { Initial = 0, Colon = 1, WS = 2, AfterValue1 = 3 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* declaration -> property ':' ws value1 */ switch (state->substate) { case Initial: { parser_state to = { sProperty, Initial }; parser_state subsequent = { sDeclaration, Colon }; unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return transition(parser, to, subsequent); } case Colon: if (parser->parseError) { parser_state to = { sMalformedDecl, Initial }; parser->parseError = false; return transitionNoRet(parser, to); } error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != ':') { /* parse error -- expected : */ parser_state to = { sMalformedDecl, Initial }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transitionNoRet(parser, to); } state->substate = WS; /* Fall through */ case WS: { parser_state to = { sValue1, Initial }; parser_state subsequent = { sDeclaration, AfterValue1 }; error = eatWS(parser); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } case AfterValue1: if (parser->parseError) { parser_state to = { sMalformedDecl, Initial }; parser->parseError = false; return transitionNoRet(parser, to); } #if !defined(NDEBUG) && defined(DEBUG_EVENTS) parserutils_vector_dump(parser->tokens, __func__, tprinter); #endif if (parser->event != NULL) { parser->event(CSS_PARSER_DECLARATION, parser->tokens, parser->event_pw); } break; } return done(parser); } css_error parseDeclList(css_parser *parser) { enum { Initial = 0, WS = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); parser_state to = { sDeclListEnd, Initial }; const css_token *token; css_error error; /* decl-list -> ';' ws decl-list-end * -> */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { /* Should never happen */ assert(0 && "Expected ; or }"); } if (lwc_string_data(token->idata)[0] == '}') { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } else { /* ; */ state->substate = WS; } /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; } return transitionNoRet(parser, to); } css_error parseDeclListEnd(css_parser *parser) { enum { Initial = 0, AfterDeclaration = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); parser_state to = { sDeclList, Initial }; const css_token *token; css_error error; /* decl-list-end -> declaration decl-list * -> decl-list */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != ';' && lwc_string_data(token->idata)[0] != '}')) { parser_state to = { sDeclaration, Initial }; parser_state subsequent = { sDeclListEnd, AfterDeclaration }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } else { error = pushBack(parser, token); if (error != CSS_OK) return error; } state->substate = AfterDeclaration; /* Fall through */ case AfterDeclaration: break; } return transitionNoRet(parser, to); } css_error parseProperty(css_parser *parser) { enum { Initial = 0, WS = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* property -> IDENT ws */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_IDENT) { /* parse error */ parser->parseError = true; return done(parser); } state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; } return done(parser); } css_error parseValue1(css_parser *parser) { enum { Initial = 0, AfterValue = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); parser_state to = { sValue0, Initial }; const css_token *token; css_error error; /* value1 -> value value0 */ switch (state->substate) { case Initial: { parser_state to = { sValue, Initial }; parser_state subsequent = { sValue1, AfterValue }; error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; /* Grammar ambiguity -- assume ';' or '}' mark end */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && (lwc_string_data(token->idata)[0] == ';' || lwc_string_data(token->idata)[0] == '}')) { /* Parse error */ parser->parseError = true; return done(parser); } return transition(parser, to, subsequent); } case AfterValue: if (parser->parseError) return done(parser); break; } return transitionNoRet(parser, to); } css_error parseValue0(css_parser *parser) { enum { Initial = 0, AfterValue = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* value0 -> value value0 * -> */ while (1) { switch (state->substate) { case Initial: { parser_state to = { sValue, Initial }; parser_state subsequent = { sValue0, AfterValue }; error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) return done(parser); /* Grammar ambiguity -- assume ';' or '}' mark end */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length( token->idata) == 1 && (lwc_string_data( token->idata)[0] == ';' || lwc_string_data( token->idata)[0] == '}')) { return done(parser); } return transition(parser, to, subsequent); } case AfterValue: if (parser->parseError) return done(parser); state->substate = Initial; break; } } return done(parser); } css_error parseValue(css_parser *parser) { enum { Initial = 0, WS = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* value -> any * -> block * -> ATKEYWORD ws */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_ATKEYWORD) { state->substate = WS; } else if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && lwc_string_data(token->idata)[0] == '{') { /* Grammar ambiguity. Assume block. */ parser_state to = { sBlock, Initial }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transitionNoRet(parser, to); } else { parser_state to = { sAny, Initial }; error = pushBack(parser, token); if (error != CSS_OK) return error; return transitionNoRet(parser, to); } /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; } return done(parser); } css_error parseAny0(css_parser *parser) { enum { Initial = 0, AfterAny = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* any0 -> any any0 * -> */ while (1) { switch (state->substate) { case Initial: { parser_state to = { sAny, Initial }; parser_state subsequent = { sAny0, AfterAny }; error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) return done(parser); /* Grammar ambiguity: * assume '{', ';', ')', ']' mark end */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length( token->idata) == 1 && (lwc_string_data( token->idata)[0] == '{' || lwc_string_data( token->idata)[0] == ';' || lwc_string_data( token->idata)[0] == ')' || lwc_string_data( token->idata)[0] == ']')) { return done(parser); } return transition(parser, to, subsequent); } case AfterAny: if (parser->parseError) return done(parser); state->substate = Initial; break; } } return done(parser); } css_error parseAny1(css_parser *parser) { enum { Initial = 0, AfterAny = 1, AfterAny0 = 2 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* any1 -> any any0 */ switch (state->substate) { case Initial: { parser_state to = { sAny, Initial }; parser_state subsequent = { sAny1, AfterAny }; return transition(parser, to, subsequent); } case AfterAny: { parser_state to = { sAny0, Initial }; parser_state subsequent = { sAny1, AfterAny0 }; if (parser->parseError) return done(parser); return transition(parser, to, subsequent); } case AfterAny0: if (parser->parseError) return done(parser); error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; /* Grammar ambiguity: any0 can be followed by * '{', ';', ')', ']'. any1 can only be followed by '{'. */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { if (lwc_string_data(token->idata)[0] == ';' || lwc_string_data( token->idata)[0] == ')' || lwc_string_data( token->idata)[0] == ']') { parser_state to = { sAny, Initial }; parser_state subsequent = { sAny1, AfterAny }; return transition(parser, to, subsequent); } else if (lwc_string_data(token->idata)[0] != '{') { /* parse error */ parser->parseError = true; } } else { /* parse error */ parser->parseError = true; } } return done(parser); } css_error parseAny(css_parser *parser) { enum { Initial = 0, WS = 1, AfterAny0 = 2, WS2 = 3 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* any -> IDENT ws * -> NUMBER ws * -> PERCENTAGE ws * -> DIMENSION ws * -> STRING ws * -> CHAR ws * -> URI ws * -> HASH ws * -> UNICODE-RANGE ws * -> INCLUDES ws * -> DASHMATCH ws * -> PREFIXMATCH ws * -> SUFFIXMATCH ws * -> SUBSTRINGMATCH ws * -> FUNCTION ws any0 ')' ws * -> '(' ws any0 ')' ws * -> '[' ws any0 ']' ws */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_NUMBER && token->type != CSS_TOKEN_PERCENTAGE && token->type != CSS_TOKEN_DIMENSION && token->type != CSS_TOKEN_STRING && token->type != CSS_TOKEN_CHAR && token->type != CSS_TOKEN_URI && token->type != CSS_TOKEN_HASH && token->type != CSS_TOKEN_UNICODE_RANGE && token->type != CSS_TOKEN_INCLUDES && token->type != CSS_TOKEN_DASHMATCH && token->type != CSS_TOKEN_PREFIXMATCH && token->type != CSS_TOKEN_SUFFIXMATCH && token->type != CSS_TOKEN_SUBSTRINGMATCH && token->type != CSS_TOKEN_FUNCTION) { /* parse error */ parser->parseError = true; return done(parser); } if (token->type == CSS_TOKEN_FUNCTION) { parser->match_char = ')'; state->substate = WS; } else if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && (lwc_string_data(token->idata)[0] == '(' || lwc_string_data(token->idata)[0] == '[')) { parser->match_char = lwc_string_data( token->idata)[0] == '(' ? ')' : ']'; state->substate = WS; } state->substate = WS2; /* Fall through */ case WS: case WS2: ws2: { parser_state to = { sAny0, Initial }; parser_state subsequent = { sAny, AfterAny0 }; error = eatWS(parser); if (error != CSS_OK) return error; if (state->substate == WS2) break; return transition(parser, to, subsequent); } case AfterAny0: { parser_state to = { sAny0, Initial }; parser_state subsequent = { sAny, AfterAny0 }; error = getToken(parser, &token); if (error != CSS_OK) return error; /* Match correct close bracket (grammar ambiguity) */ if (token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1 && lwc_string_data(token->idata)[0] == parser->match_char) { state->substate = WS2; goto ws2; } return transition(parser, to, subsequent); } } return done(parser); } css_error parseMalformedDeclaration(css_parser *parser) { enum { Initial = 0, Go = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token = NULL; css_error error; /* Malformed declaration: read everything up to the next ; or } * We must ensure that pairs of {}, (), [], are balanced */ switch (state->substate) { case Initial: { /* Clear stack of open items */ while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; state->substate = Go; /* Fall through */ } case Go: while (1) { char want; char *match; const char *data; size_t len; error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) break; if (token->type != CSS_TOKEN_CHAR) continue; len = lwc_string_length(token->idata); data = lwc_string_data(token->idata); if (len != 1 || (data[0] != '{' && data[0] != '}' && data[0] != '[' && data[0] != ']' && data[0] != '(' && data[0] != ')' && data[0] != ';')) continue; match = parserutils_stack_get_current( parser->open_items); /* If the stack is empty, then we're done if we've got * either a ';' or '}' */ if (match == NULL) { if (data[0] == ';' || data[0] == '}') break; } /* Regardless, if we've got a semicolon, ignore it */ if (data[0] == ';') continue; /* Get corresponding start tokens for end tokens */ switch (data[0]) { case '}': want = '{'; break; case ']': want = '['; break; case ')': want = '('; break; default: want = 0; break; } /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { parserutils_stack_push(parser->open_items, &data[0]); } } } /* Push the last token (';', '}' or EOF) back */ error = pushBack(parser, token); if (error != CSS_OK) return error; /* Discard the tokens we've read */ unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } css_error parseMalformedSelector(css_parser *parser) { enum { Initial = 0, Go = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* Malformed selector: discard the entirety of the next block, * ensuring we correctly match pairs of {}, [], and (). */ switch (state->substate) { case Initial: /* Clear the stack of open items */ while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; state->substate = Go; /* Fall through */ case Go: while (1) { char want; char *match; const char *data; size_t len; error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) break; if (token->type != CSS_TOKEN_CHAR) continue; len = lwc_string_length(token->idata); data = lwc_string_data(token->idata); if (len != 1 || (data[0] != '{' && data[0] != '}' && data[0] != '[' && data[0] != ']' && data[0] != '(' && data[0] != ')')) continue; match = parserutils_stack_get_current( parser->open_items); /* Get corresponding start tokens for end tokens */ switch (data[0]) { case '}': want = '{'; break; case ']': want = '['; break; case ')': want = '('; break; default: want = 0; break; } /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { parserutils_stack_push(parser->open_items, &data[0]); } /* If we encountered a '}', there was data on the stack * before, and the stack's now empty, then we've popped * a '{' off the stack. That means we've found the end * of the block, so we're done here. */ if (want == '{' && match != NULL && parserutils_stack_get_current( parser->open_items) == NULL) break; } } /* Consume any trailing whitespace after the ruleset */ error = eatWS(parser); if (error != CSS_OK) return error; /* Discard the tokens we've read */ unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } css_error parseMalformedAtRule(css_parser *parser) { enum { Initial = 0, Go = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token = NULL; css_error error; /* Malformed at-rule: read everything up to the next ; or the next * block, whichever is first. * We must ensure that pairs of {}, (), [], are balanced */ switch (state->substate) { case Initial: { /* Clear stack of open items */ while (parserutils_stack_pop(parser->open_items, NULL) == PARSERUTILS_OK) ; state->substate = Go; /* Fall through */ } case Go: while (1) { char want; char *match; const char *data; size_t len; error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) break; if (token->type != CSS_TOKEN_CHAR) continue; len = lwc_string_length(token->idata); data = lwc_string_data(token->idata); if (len != 1 || (data[0] != '{' && data[0] != '}' && data[0] != '[' && data[0] != ']' && data[0] != '(' && data[0] != ')' && data[0] != ';')) continue; match = parserutils_stack_get_current( parser->open_items); /* If we have a semicolon, then we're either done or * need to ignore it */ if (data[0] == ';') { if (match == NULL) break; else continue; } /* Get corresponding start tokens for end tokens */ switch (data[0]) { case '}': want = '{'; break; case ']': want = '['; break; case ')': want = '('; break; default: want = 0; break; } /* Either pop off the stack, if we've matched the * current item, or push the start token on */ if (match != NULL && *match == want) { parserutils_stack_pop( parser->open_items, NULL); } else if (want == 0) { parserutils_stack_push(parser->open_items, &data[0]); } /* If we encountered a '}', there was data on the stack * before, and the stack's now empty, then we've popped * a '{' off the stack. That means we've found the end * of the block, so we're done here. */ if (want == '{' && match != NULL && parserutils_stack_get_current( parser->open_items) == NULL) break; } } /* Consume any trailing whitespace after the at-rule */ error = eatWS(parser); if (error != CSS_OK) return error; /* Discard the tokens we've read */ unref_interned_strings_in_tokens(parser); parserutils_vector_clear(parser->tokens); return done(parser); } css_error parseInlineStyle(css_parser *parser) { enum { Initial = 0, WS = 1, AfterISBody0 = 2 }; parser_state *state = parserutils_stack_get_current(parser->states); css_error error; /* inline-style = ws is-body0 */ switch (state->substate) { case Initial: /* Emit fake events such that the language parser knows * no different from a normal parse. */ if (parser->event != NULL) { /* 1) begin stylesheet */ parser->event(CSS_PARSER_START_STYLESHEET, NULL, parser->event_pw); /* 2) begin ruleset */ parser->event(CSS_PARSER_START_RULESET, NULL, parser->event_pw); } /* Fall through */ case WS: { parser_state to = { sISBody0, Initial }; parser_state subsequent = { sInlineStyle, AfterISBody0 }; state->substate = WS; /* Consume leading whitespace */ error = eatWS(parser); if (error != CSS_OK) return error; return transition(parser, to, subsequent); } case AfterISBody0: /* Clean up any remaining tokens */ unref_interned_strings_in_tokens(parser); /* Emit remaining fake events to end the parse */ if (parser->event != NULL) { /* 1) end ruleset */ parser->event(CSS_PARSER_END_RULESET, NULL, parser->event_pw); /* 2) end stylesheet */ parser->event(CSS_PARSER_END_STYLESHEET, NULL, parser->event_pw); } break; } return done(parser); } css_error parseISBody0(css_parser *parser) { enum { Initial = 0, AfterISBody = 1 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* is-body0 -> is-body is-body0 * -> */ while (1) { switch (state->substate) { case Initial: { parser_state to = { sISBody, Initial }; parser_state subsequent = { sISBody0, AfterISBody }; error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; /* EOF is the only way out */ if (token->type == CSS_TOKEN_EOF) return done(parser); return transition(parser, to, subsequent); } case AfterISBody: /* Unless there's a parse error */ if (parser->parseError) return done(parser); state->substate = Initial; break; } } return done(parser); } css_error parseISBody(css_parser *parser) { enum { Initial = 0, DeclList = 1, Brace = 2, WS = 3 }; parser_state *state = parserutils_stack_get_current(parser->states); const css_token *token; css_error error; /* is-body -> declaration decl-list '}' ws * -> decl-list '}' ws * * Note that this looks suspiciously similar to ruleset-end. * The difference here, however, is that we never end the ruleset. */ switch (state->substate) { case Initial: error = getToken(parser, &token); if (error != CSS_OK) return error; error = pushBack(parser, token); if (error != CSS_OK) return error; /* If this can't possibly be the start of a decl-list, then * attempt to parse a declaration. This will catch any invalid * input at this point and read to the start of the next * declaration. FIRST(decl-list) = (';', '}') */ if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || (lwc_string_data(token->idata)[0] != '}' && lwc_string_data(token->idata)[0] != ';')) { parser_state to = { sDeclaration, Initial }; parser_state subsequent = { sISBody, DeclList }; return transition(parser, to, subsequent); } state->substate = DeclList; /* Fall through */ case DeclList: { parser_state to = { sDeclList, Initial }; parser_state subsequent = { sISBody, Brace }; return transition(parser, to, subsequent); } case Brace: error = getToken(parser, &token); if (error != CSS_OK) return error; if (token->type == CSS_TOKEN_EOF) { error = pushBack(parser, token); if (error != CSS_OK) return error; return done(parser); } if (token->type != CSS_TOKEN_CHAR || lwc_string_length(token->idata) != 1 || lwc_string_data(token->idata)[0] != '}') { /* This should never happen, as FOLLOW(decl-list) * contains only '}' */ assert(0 && "Expected }"); } state->substate = WS; /* Fall through */ case WS: error = eatWS(parser); if (error != CSS_OK) return error; break; } return done(parser); } /** * Iterate the token vector and unref any interned strings in the tokens. * * \param parser The parser whose tokens we are cleaning up. */ void unref_interned_strings_in_tokens(css_parser *parser) { int32_t ctx = 0; const css_token *tok; while ((tok = parserutils_vector_iterate( parser->tokens, &ctx)) != NULL) { if (tok->idata != NULL) { lwc_string_unref(tok->idata); } } } #ifndef NDEBUG #ifdef DEBUG_STACK static void printer(void *item) { parser_state *s = item; printf("[%d %d]", s->state, s->substate); } #endif #ifdef DEBUG_EVENTS static void tprinter(void *token) { css_token *t = token; if (t->data.data) printf("%d: %.*s", t->type, (int) t->data.len, t->data.data); else printf("%d", t->type); } #endif #endif netsurf-all-3.2/libcss/src/parse/font_face.h0000644000175000017500000000115112377676736020107 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 Things Made Out Of Other Things Ltd. * Written by James Montgomerie */ #ifndef css_parse_font_face_h_ #define css_parse_font_face_h_ #include #include "stylesheet.h" #include "lex/lex.h" #include "parse/language.h" css_error css__parse_font_descriptor(css_language *c, const css_token *descriptor, const parserutils_vector *vector, int *ctx, struct css_rule_font_face *rule); #endif netsurf-all-3.2/libcss/src/parse/parse.h0000644000175000017500000000362112377676736017301 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_css__parse_parse_h_ #define css_css__parse_parse_h_ #include #include #include #include #include typedef struct css_parser css_parser; /** * Parser event types */ typedef enum css_parser_event { CSS_PARSER_START_STYLESHEET, CSS_PARSER_END_STYLESHEET, CSS_PARSER_START_RULESET, CSS_PARSER_END_RULESET, CSS_PARSER_START_ATRULE, CSS_PARSER_END_ATRULE, CSS_PARSER_START_BLOCK, CSS_PARSER_END_BLOCK, CSS_PARSER_BLOCK_CONTENT, CSS_PARSER_DECLARATION } css_parser_event; typedef css_error (*css_parser_event_handler)(css_parser_event type, const parserutils_vector *tokens, void *pw); /** * Parser option types */ typedef enum css_parser_opttype { CSS_PARSER_QUIRKS, CSS_PARSER_EVENT_HANDLER } css_parser_opttype; /** * Parser option parameters */ typedef union css_parser_optparams { bool quirks; struct { css_parser_event_handler handler; void *pw; } event_handler; } css_parser_optparams; css_error css__parser_create(const char *charset, css_charset_source cs_source, css_parser **parser); css_error css__parser_create_for_inline_style(const char *charset, css_charset_source cs_source, css_parser **parser); css_error css__parser_destroy(css_parser *parser); css_error css__parser_setopt(css_parser *parser, css_parser_opttype type, css_parser_optparams *params); css_error css__parser_parse_chunk(css_parser *parser, const uint8_t *data, size_t len); css_error css__parser_completed(css_parser *parser); const char *css__parser_read_charset(css_parser *parser, css_charset_source *source); bool css__parser_quirks_permitted(css_parser *parser); #endif netsurf-all-3.2/libcss/src/parse/language.h0000644000175000017500000000512112377676736017747 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_css__parse_language_h_ #define css_css__parse_language_h_ #include #include #include #include #include "lex/lex.h" #include "parse/parse.h" #include "parse/propstrings.h" /** * CSS namespace mapping */ typedef struct css_namespace { lwc_string *prefix; /**< Namespace prefix */ lwc_string *uri; /**< Namespace URI */ } css_namespace; /** * Context for a CSS language parser */ typedef struct css_language { css_stylesheet *sheet; /**< The stylesheet to parse for */ #define STACK_CHUNK 32 parserutils_stack *context; /**< Context stack */ enum { CHARSET_PERMITTED, IMPORT_PERMITTED, NAMESPACE_PERMITTED, HAD_RULE } state; /**< State flag, for at-rule handling */ /** Interned strings */ lwc_string **strings; lwc_string *default_namespace; /**< Default namespace URI */ css_namespace *namespaces; /**< Array of namespace mappings */ uint32_t num_namespaces; /**< Number of namespace mappings */ } css_language; css_error css__language_create(css_stylesheet *sheet, css_parser *parser, void **language); css_error css__language_destroy(css_language *language); /****************************************************************************** * Helper functions * ******************************************************************************/ /** * Consume all leading whitespace tokens * * \param vector The vector to consume from * \param ctx The vector's context */ static inline void consumeWhitespace(const parserutils_vector *vector, int *ctx) { const css_token *token = NULL; while ((token = parserutils_vector_peek(vector, *ctx)) != NULL && token->type == CSS_TOKEN_S) parserutils_vector_iterate(vector, ctx); } /** * Determine if a token is a character * * \param token The token to consider * \param c The character to match (lowercase ASCII only) * \return True if the token matches, false otherwise */ static inline bool tokenIsChar(const css_token *token, uint8_t c) { bool result = false; if (token != NULL && token->type == CSS_TOKEN_CHAR && lwc_string_length(token->idata) == 1) { char d = lwc_string_data(token->idata)[0]; /* Ensure lowercase comparison */ if ('A' <= d && d <= 'Z') d += 'a' - 'A'; result = (d == c); } return result; } #endif netsurf-all-3.2/libcss/src/parse/propstrings.h0000644000175000017500000001502412377676736020561 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_css__parse_propstrings_h_ #define css_css__parse_propstrings_h_ #include "utils/utils.h" enum { /* Universal selector */ UNIVERSAL, /* Common tokens */ COLON, COMMA, SEMICOLON, OPEN_CURLY_BRACE, CLOSE_CURLY_BRACE, ZERO_VALUE, /* At-rules */ CHARSET, LIBCSS_IMPORT, MEDIA, NAMESPACE, FONT_FACE, PAGE, /* Media types */ AURAL, BRAILLE, EMBOSSED, HANDHELD, PRINT, PROJECTION, SCREEN, SPEECH, TTY, TV, ALL, /* Pseudo classes */ FIRST_CHILD, LINK, VISITED, HOVER, ACTIVE, FOCUS, LANG, /* LEFT, RIGHT, -- already in properties */ FIRST, ROOT, NTH_CHILD, NTH_LAST_CHILD, NTH_OF_TYPE, NTH_LAST_OF_TYPE, LAST_CHILD, FIRST_OF_TYPE, LAST_OF_TYPE, ONLY_CHILD, ONLY_OF_TYPE, EMPTY, TARGET, ENABLED, DISABLED, CHECKED, NOT, /* Pseudo elements */ FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, /* Properties */ FIRST_PROP, AZIMUTH = FIRST_PROP, BACKGROUND, BACKGROUND_ATTACHMENT, BACKGROUND_COLOR, BACKGROUND_IMAGE, BACKGROUND_POSITION, BACKGROUND_REPEAT, BORDER, BORDER_BOTTOM, BORDER_BOTTOM_COLOR, BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH, BORDER_COLLAPSE, BORDER_COLOR, BORDER_LEFT, BORDER_LEFT_COLOR, BORDER_LEFT_STYLE, BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR, BORDER_RIGHT_STYLE, BORDER_RIGHT_WIDTH, BORDER_SPACING, BORDER_STYLE, BORDER_TOP, BORDER_TOP_COLOR, BORDER_TOP_STYLE, BORDER_TOP_WIDTH, BORDER_WIDTH, BOTTOM, BREAK_AFTER, BREAK_BEFORE, BREAK_INSIDE, CAPTION_SIDE, CLEAR, CLIP, COLOR, COLUMNS, COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR, COLUMN_RULE_STYLE, COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH, CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE, CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT, FONT_WEIGHT, HEIGHT, LEFT, LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORPHANS, OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, OVERFLOW_X, OVERFLOW_Y, PADDING, PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS, TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM, TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX, LAST_PROP = Z_INDEX, /* Other keywords */ INHERIT, IMPORTANT, NONE, BOTH, FIXED, SCROLL, TRANSPARENT, NO_REPEAT, REPEAT_X, REPEAT_Y, REPEAT, HIDDEN, DOTTED, DASHED, SOLID, LIBCSS_DOUBLE, GROOVE, RIDGE, INSET, OUTSET, THIN, MEDIUM, THICK, COLLAPSE, SEPARATE, AUTO, LTR, RTL, INLINE, BLOCK, LIST_ITEM, RUN_IN, INLINE_BLOCK, TABLE, INLINE_TABLE, TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL, TABLE_CAPTION, BELOW, LEVEL, ABOVE, HIGHER, LOWER, SHOW, HIDE, XX_SMALL, X_SMALL, SMALL, LARGE, X_LARGE, XX_LARGE, LARGER, SMALLER, NORMAL, ITALIC, OBLIQUE, SMALL_CAPS, BOLD, BOLDER, LIGHTER, INSIDE, OUTSIDE, DISC, CIRCLE, SQUARE, DECIMAL, DECIMAL_LEADING_ZERO, LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK, LOWER_LATIN, UPPER_LATIN, ARMENIAN, GEORGIAN, LOWER_ALPHA, UPPER_ALPHA, INVERT, VISIBLE, ALWAYS, AVOID, X_LOW, LOW, HIGH, X_HIGH, LIBCSS_STATIC, RELATIVE, ABSOLUTE, ONCE, DIGITS, CONTINUOUS, CODE, SPELL_OUT, X_SLOW, SLOW, FAST, X_FAST, FASTER, SLOWER, CENTER, JUSTIFY, CAPITALIZE, UPPERCASE, LOWERCASE, EMBED, BIDI_OVERRIDE, BASELINE, SUB, SUPER, TEXT_TOP, MIDDLE, TEXT_BOTTOM, SILENT, X_SOFT, SOFT, LOUD, X_LOUD, PRE, NOWRAP, PRE_WRAP, PRE_LINE, LEFTWARDS, RIGHTWARDS, LEFT_SIDE, FAR_LEFT, CENTER_LEFT, CENTER_RIGHT, FAR_RIGHT, RIGHT_SIDE, BEHIND, RECT, OPEN_QUOTE, CLOSE_QUOTE, NO_OPEN_QUOTE, NO_CLOSE_QUOTE, ATTR, COUNTER, COUNTERS, CROSSHAIR, DEFAULT, POINTER, MOVE, E_RESIZE, NE_RESIZE, NW_RESIZE, N_RESIZE, SE_RESIZE, SW_RESIZE, S_RESIZE, W_RESIZE, LIBCSS_TEXT, WAIT, HELP, PROGRESS, SERIF, SANS_SERIF, CURSIVE, FANTASY, MONOSPACE, MALE, FEMALE, CHILD, MIX, UNDERLINE, OVERLINE, LINE_THROUGH, BLINK, RGB, RGBA, HSL, HSLA, LIBCSS_LEFT, LIBCSS_CENTER, LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL, FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN, AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL, VERTICAL_LR, /* Named colours */ FIRST_COLOUR, ALICEBLUE = FIRST_COLOUR, ANTIQUEWHITE, AQUA, AQUAMARINE, AZURE, BEIGE, BISQUE, BLACK, BLANCHEDALMOND, BLUE, BLUEVIOLET, BROWN, BURLYWOOD, CADETBLUE, CHARTREUSE, CHOCOLATE, CORAL, CORNFLOWERBLUE, CORNSILK, CRIMSON, CYAN, DARKBLUE, DARKCYAN, DARKGOLDENROD, DARKGRAY, DARKGREEN, DARKGREY, DARKKHAKI, DARKMAGENTA, DARKOLIVEGREEN, DARKORANGE, DARKORCHID, DARKRED, DARKSALMON, DARKSEAGREEN, DARKSLATEBLUE, DARKSLATEGRAY, DARKSLATEGREY, DARKTURQUOISE, DARKVIOLET, DEEPPINK, DEEPSKYBLUE, DIMGRAY, DIMGREY, DODGERBLUE, FELDSPAR, FIREBRICK, FLORALWHITE, FORESTGREEN, FUCHSIA, GAINSBORO, GHOSTWHITE, GOLD, GOLDENROD, GRAY, GREEN, GREENYELLOW, GREY, HONEYDEW, HOTPINK, INDIANRED, INDIGO, IVORY, KHAKI, LAVENDER, LAVENDERBLUSH, LAWNGREEN, LEMONCHIFFON, LIGHTBLUE, LIGHTCORAL, LIGHTCYAN, LIGHTGOLDENRODYELLOW, LIGHTGRAY, LIGHTGREEN, LIGHTGREY, LIGHTPINK, LIGHTSALMON, LIGHTSEAGREEN, LIGHTSKYBLUE, LIGHTSLATEBLUE, LIGHTSLATEGRAY, LIGHTSLATEGREY, LIGHTSTEELBLUE, LIGHTYELLOW, LIME, LIMEGREEN, LINEN, MAGENTA, MAROON, MEDIUMAQUAMARINE, MEDIUMBLUE, MEDIUMORCHID, MEDIUMPURPLE, MEDIUMSEAGREEN, MEDIUMSLATEBLUE, MEDIUMSPRINGGREEN, MEDIUMTURQUOISE, MEDIUMVIOLETRED, MIDNIGHTBLUE, MINTCREAM, MISTYROSE, MOCCASIN, NAVAJOWHITE, NAVY, OLDLACE, OLIVE, OLIVEDRAB, ORANGE, ORANGERED, ORCHID, PALEGOLDENROD, PALEGREEN, PALETURQUOISE, PALEVIOLETRED, PAPAYAWHIP, PEACHPUFF, PERU, PINK, PLUM, POWDERBLUE, PURPLE, RED, ROSYBROWN, ROYALBLUE, SADDLEBROWN, SALMON, SANDYBROWN, SEAGREEN, SEASHELL, SIENNA, SILVER, SKYBLUE, SLATEBLUE, SLATEGRAY, SLATEGREY, SNOW, SPRINGGREEN, STEELBLUE, TAN, TEAL, THISTLE, TOMATO, TURQUOISE, VIOLET, VIOLETRED, WHEAT, WHITE, WHITESMOKE, YELLOW, YELLOWGREEN, LAST_COLOUR = YELLOWGREEN, LAST_KNOWN }; css_error css__propstrings_get(lwc_string ***strings); void css__propstrings_unref(void); #endif netsurf-all-3.2/libcss/src/parse/important.c0000644000175000017500000002451012377676736020177 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "parse/important.h" /** * Parse !important * * \param c Parsing context * \param vector Vector of tokens to process * \param ctx Pointer to vector iteration context * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_INVALID if "S* ! S* important" is not at the start of the vector * * Post condition: \a *ctx is updated with the next token to process * If the input is invalid, then \a *ctx remains unchanged. */ css_error css__parse_important(css_language *c, const parserutils_vector *vector, int *ctx, uint8_t *result) { int orig_ctx = *ctx; bool match = false; const css_token *token; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token != NULL && tokenIsChar(token, '!')) { consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) { *ctx = orig_ctx; return CSS_INVALID; } if (lwc_string_caseless_isequal(token->idata, c->strings[IMPORTANT], &match) == lwc_error_ok && match) { *result |= FLAG_IMPORTANT; } else { *ctx = orig_ctx; return CSS_INVALID; } } else if (token != NULL) { *ctx = orig_ctx; return CSS_INVALID; } return CSS_OK; } /** * Make a style important * * \param style The style to modify */ void css__make_style_important(css_style *style) { css_code_t *bytecode = style->bytecode; uint32_t length = style->used; uint32_t offset = 0; while (offset < length) { opcode_t op; uint8_t flags; uint32_t value; css_code_t opv = bytecode[offset]; /* Extract opv components, setting important flag */ op = getOpcode(opv); flags = getFlags(opv) | FLAG_IMPORTANT; value = getValue(opv); /* Write OPV back to bytecode */ bytecode[offset] = buildOPV(op, flags, value); offset++; /* Advance past any property-specific data */ if (isInherit(opv) == false) { switch (op) { case CSS_PROP_AZIMUTH: if ((value & ~AZIMUTH_BEHIND) == AZIMUTH_ANGLE) offset += 2; /* length + units */ break; case CSS_PROP_BORDER_TOP_COLOR: case CSS_PROP_BORDER_RIGHT_COLOR: case CSS_PROP_BORDER_BOTTOM_COLOR: case CSS_PROP_BORDER_LEFT_COLOR: case CSS_PROP_BACKGROUND_COLOR: case CSS_PROP_COLUMN_RULE_COLOR: assert(BACKGROUND_COLOR_SET == (enum op_background_color)BORDER_COLOR_SET); assert(BACKGROUND_COLOR_SET == (enum op_background_color)COLUMN_RULE_COLOR_SET); if (value == BACKGROUND_COLOR_SET) offset++; /* colour */ break; case CSS_PROP_BACKGROUND_IMAGE: case CSS_PROP_CUE_AFTER: case CSS_PROP_CUE_BEFORE: case CSS_PROP_LIST_STYLE_IMAGE: assert(BACKGROUND_IMAGE_URI == (enum op_background_image)CUE_AFTER_URI); assert(BACKGROUND_IMAGE_URI == (enum op_background_image)CUE_BEFORE_URI); assert(BACKGROUND_IMAGE_URI == (enum op_background_image)LIST_STYLE_IMAGE_URI); if (value == BACKGROUND_IMAGE_URI) offset++; /* string table entry */ break; case CSS_PROP_BACKGROUND_POSITION: if ((value & 0xf0) == BACKGROUND_POSITION_HORZ_SET) offset += 2; /* length + units */ if ((value & 0x0f) == BACKGROUND_POSITION_VERT_SET) offset += 2; /* length + units */ break; case CSS_PROP_BORDER_SPACING: if (value == BORDER_SPACING_SET) offset += 4; /* two length + units */ break; case CSS_PROP_BORDER_TOP_WIDTH: case CSS_PROP_BORDER_RIGHT_WIDTH: case CSS_PROP_BORDER_BOTTOM_WIDTH: case CSS_PROP_BORDER_LEFT_WIDTH: case CSS_PROP_OUTLINE_WIDTH: case CSS_PROP_COLUMN_RULE_WIDTH: assert(BORDER_WIDTH_SET == (enum op_border_width)OUTLINE_WIDTH_SET); assert(BORDER_WIDTH_SET == (enum op_border_width)COLUMN_RULE_WIDTH_SET); if (value == BORDER_WIDTH_SET) offset += 2; /* length + units */ break; case CSS_PROP_MARGIN_TOP: case CSS_PROP_MARGIN_RIGHT: case CSS_PROP_MARGIN_BOTTOM: case CSS_PROP_MARGIN_LEFT: case CSS_PROP_BOTTOM: case CSS_PROP_LEFT: case CSS_PROP_RIGHT: case CSS_PROP_TOP: case CSS_PROP_HEIGHT: case CSS_PROP_WIDTH: case CSS_PROP_COLUMN_WIDTH: case CSS_PROP_COLUMN_GAP: assert(BOTTOM_SET == (enum op_bottom)LEFT_SET); assert(BOTTOM_SET == (enum op_bottom)RIGHT_SET); assert(BOTTOM_SET == (enum op_bottom)TOP_SET); assert(BOTTOM_SET == (enum op_bottom)HEIGHT_SET); assert(BOTTOM_SET == (enum op_bottom)MARGIN_SET); assert(BOTTOM_SET == (enum op_bottom)WIDTH_SET); assert(BOTTOM_SET == (enum op_bottom)COLUMN_WIDTH_SET); assert(BOTTOM_SET == (enum op_bottom)COLUMN_GAP_SET); if (value == BOTTOM_SET) offset += 2; /* length + units */ break; case CSS_PROP_CLIP: if ((value & CLIP_SHAPE_MASK) == CLIP_SHAPE_RECT) { if ((value & CLIP_RECT_TOP_AUTO) == 0) offset += 2; /* length + units */ if ((value & CLIP_RECT_RIGHT_AUTO) == 0) offset += 2; /* length + units */ if ((value & CLIP_RECT_BOTTOM_AUTO) == 0) offset += 2; /* length + units */ if ((value & CLIP_RECT_LEFT_AUTO) == 0) offset += 2; /* length + units */ } break; case CSS_PROP_COLOR: if (value == COLOR_SET) offset++; /* colour */ break; case CSS_PROP_COLUMN_COUNT: if (value == COLUMN_COUNT_SET) offset++; /* colour */ break; case CSS_PROP_CONTENT: while (value != CONTENT_NORMAL && value != CONTENT_NONE) { switch (value & 0xff) { case CONTENT_COUNTER: case CONTENT_URI: case CONTENT_ATTR: case CONTENT_STRING: offset++; /* string table entry */ break; case CONTENT_COUNTERS: offset+=2; /* two string entries */ break; case CONTENT_OPEN_QUOTE: case CONTENT_CLOSE_QUOTE: case CONTENT_NO_OPEN_QUOTE: case CONTENT_NO_CLOSE_QUOTE: break; } value = bytecode[offset]; offset++; } break; case CSS_PROP_COUNTER_INCREMENT: case CSS_PROP_COUNTER_RESET: assert(COUNTER_INCREMENT_NONE == (enum op_counter_increment)COUNTER_RESET_NONE); while (value != COUNTER_INCREMENT_NONE) { offset+=2; /* string + integer */ value = bytecode[offset]; offset++; } break; case CSS_PROP_CURSOR: while (value == CURSOR_URI) { offset++; /* string table entry */ value = bytecode[offset]; offset++; } break; case CSS_PROP_ELEVATION: if (value == ELEVATION_ANGLE) offset += 2; /* length + units */ break; case CSS_PROP_FONT_FAMILY: while (value != FONT_FAMILY_END) { switch (value) { case FONT_FAMILY_STRING: case FONT_FAMILY_IDENT_LIST: offset++; /* string table entry */ break; } value = bytecode[offset]; offset++; } break; case CSS_PROP_FONT_SIZE: if (value == FONT_SIZE_DIMENSION) offset += 2; /* length + units */ break; case CSS_PROP_LETTER_SPACING: case CSS_PROP_WORD_SPACING: assert(LETTER_SPACING_SET == (enum op_letter_spacing)WORD_SPACING_SET); if (value == LETTER_SPACING_SET) offset += 2; /* length + units */ break; case CSS_PROP_LINE_HEIGHT: switch (value) { case LINE_HEIGHT_NUMBER: offset++; /* value */ break; case LINE_HEIGHT_DIMENSION: offset += 2; /* length + units */ break; } break; case CSS_PROP_MAX_HEIGHT: case CSS_PROP_MAX_WIDTH: assert(MAX_HEIGHT_SET == (enum op_max_height)MAX_WIDTH_SET); if (value == MAX_HEIGHT_SET) offset += 2; /* length + units */ break; case CSS_PROP_PADDING_TOP: case CSS_PROP_PADDING_RIGHT: case CSS_PROP_PADDING_BOTTOM: case CSS_PROP_PADDING_LEFT: case CSS_PROP_MIN_HEIGHT: case CSS_PROP_MIN_WIDTH: case CSS_PROP_PAUSE_AFTER: case CSS_PROP_PAUSE_BEFORE: case CSS_PROP_TEXT_INDENT: assert(MIN_HEIGHT_SET == (enum op_min_height)MIN_WIDTH_SET); assert(MIN_HEIGHT_SET == (enum op_min_height)PADDING_SET); assert(MIN_HEIGHT_SET == (enum op_min_height)PAUSE_AFTER_SET); assert(MIN_HEIGHT_SET == (enum op_min_height)PAUSE_BEFORE_SET); assert(MIN_HEIGHT_SET == (enum op_min_height)TEXT_INDENT_SET); if (value == MIN_HEIGHT_SET) offset += 2; /* length + units */ break; case CSS_PROP_OPACITY: if (value == OPACITY_SET) offset++; /* value */ break; case CSS_PROP_ORPHANS: case CSS_PROP_PITCH_RANGE: case CSS_PROP_RICHNESS: case CSS_PROP_STRESS: case CSS_PROP_WIDOWS: assert(ORPHANS_SET == (enum op_orphans)PITCH_RANGE_SET); assert(ORPHANS_SET == (enum op_orphans)RICHNESS_SET); assert(ORPHANS_SET == (enum op_orphans)STRESS_SET); assert(ORPHANS_SET == (enum op_orphans)WIDOWS_SET); if (value == ORPHANS_SET) offset++; /* value */ break; case CSS_PROP_OUTLINE_COLOR: if (value == OUTLINE_COLOR_SET) offset++; /* color */ break; case CSS_PROP_PITCH: if (value == PITCH_FREQUENCY) offset += 2; /* length + units */ break; case CSS_PROP_PLAY_DURING: if (value & PLAY_DURING_URI) offset++; /* string table entry */ break; case CSS_PROP_QUOTES: while (value != QUOTES_NONE) { offset += 2; /* two string table entries */ value = bytecode[offset]; offset++; } break; case CSS_PROP_SPEECH_RATE: if (value == SPEECH_RATE_SET) offset++; /* rate */ break; case CSS_PROP_VERTICAL_ALIGN: if (value == VERTICAL_ALIGN_SET) offset += 2; /* length + units */ break; case CSS_PROP_VOICE_FAMILY: while (value != VOICE_FAMILY_END) { switch (value) { case VOICE_FAMILY_STRING: case VOICE_FAMILY_IDENT_LIST: offset++; /* string table entry */ break; } value = bytecode[offset]; offset++; } break; case CSS_PROP_VOLUME: switch (value) { case VOLUME_NUMBER: offset++; /* value */ break; case VOLUME_DIMENSION: offset += 2; /* value + units */ break; } break; case CSS_PROP_Z_INDEX: if (value == Z_INDEX_SET) offset++; /* z index */ break; default: break; } } } } netsurf-all-3.2/libcss/src/parse/Makefile0000644000175000017500000000016612377676736017457 0ustar vincevince# Sources DIR_SOURCES := parse.c language.c important.c propstrings.c font_face.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/parse/propstrings.c0000644000175000017500000005124112377676736020555 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include "parse/propstrings.h" #include "stylesheet.h" #include typedef struct stringmap_entry { const char *data; size_t len; } stringmap_entry; typedef struct css__propstrings_ctx { uint32_t count; lwc_string *strings[LAST_KNOWN]; } css__propstrings_ctx; static css__propstrings_ctx css__propstrings; /* Must be synchronised with enum in propstrings.h */ const stringmap_entry stringmap[LAST_KNOWN] = { { "*", SLEN("*") }, { ":", SLEN(":") }, { ",", SLEN(",") }, { ";", SLEN(";") }, { "{", SLEN("{") }, { "}", SLEN("}") }, { "0", SLEN("0") }, { "charset", SLEN("charset") }, { "import", SLEN("import") }, { "media", SLEN("media") }, { "namespace", SLEN("namespace") }, { "font-face", SLEN("font-face") }, { "page", SLEN("page") }, { "aural", SLEN("aural") }, { "braille", SLEN("braille") }, { "embossed", SLEN("embossed") }, { "handheld", SLEN("handheld") }, { "print", SLEN("print") }, { "projection", SLEN("projection") }, { "screen", SLEN("screen") }, { "speech", SLEN("speech") }, { "tty", SLEN("tty") }, { "tv", SLEN("tv") }, { "all", SLEN("all") }, { "first-child", SLEN("first-child") }, { "link", SLEN("link") }, { "visited", SLEN("visited") }, { "hover", SLEN("hover") }, { "active", SLEN("active") }, { "focus", SLEN("focus") }, { "lang", SLEN("lang") }, { "first", SLEN("first") }, { "root", SLEN("root") }, { "nth-child", SLEN("nth-child") }, { "nth-last-child", SLEN("nth-last-child") }, { "nth-of-type", SLEN("nth-of-type") }, { "nth-last-of-type", SLEN("nth-last-of-type") }, { "last-child", SLEN("last-child") }, { "first-of-type", SLEN("first-of-type") }, { "last-of-type", SLEN("last-of-type") }, { "only-child", SLEN("only-child") }, { "only-of-type", SLEN("only-of-type") }, { "empty", SLEN("empty") }, { "target", SLEN("target") }, { "enabled", SLEN("enabled") }, { "disabled", SLEN("disabled") }, { "checked", SLEN("checked") }, { "not", SLEN("not") }, { "first-line", SLEN("first-line") }, { "first-letter", SLEN("first-letter") }, { "before", SLEN("before") }, { "after", SLEN("after") }, { "azimuth", SLEN("azimuth") }, { "background", SLEN("background") }, { "background-attachment", SLEN("background-attachment") }, { "background-color", SLEN("background-color") }, { "background-image", SLEN("background-image") }, { "background-position", SLEN("background-position") }, { "background-repeat", SLEN("background-repeat") }, { "border", SLEN("border") }, { "border-bottom", SLEN("border-bottom") }, { "border-bottom-color", SLEN("border-bottom-color") }, { "border-bottom-style", SLEN("border-bottom-style") }, { "border-bottom-width", SLEN("border-bottom-width") }, { "border-collapse", SLEN("border-collapse") }, { "border-color", SLEN("border-color") }, { "border-left", SLEN("border-left") }, { "border-left-color", SLEN("border-left-color") }, { "border-left-style", SLEN("border-left-style") }, { "border-left-width", SLEN("border-left-width") }, { "border-right", SLEN("border-right") }, { "border-right-color", SLEN("border-right-color") }, { "border-right-style", SLEN("border-right-style") }, { "border-right-width", SLEN("border-right-width") }, { "border-spacing", SLEN("border-spacing") }, { "border-style", SLEN("border-style") }, { "border-top", SLEN("border-top") }, { "border-top-color", SLEN("border-top-color") }, { "border-top-style", SLEN("border-top-style") }, { "border-top-width", SLEN("border-top-width") }, { "border-width", SLEN("border-width") }, { "bottom", SLEN("bottom") }, { "break-after", SLEN("break-after") }, { "break-before", SLEN("break-before") }, { "break-inside", SLEN("break-inside") }, { "caption-side", SLEN("caption-side") }, { "clear", SLEN("clear") }, { "clip", SLEN("clip") }, { "color", SLEN("color") }, { "columns", SLEN("columns") }, { "column-count", SLEN("column-count") }, { "column-fill", SLEN("column-fill") }, { "column-gap", SLEN("column-gap") }, { "column-rule", SLEN("column-rule") }, { "column-rule-color", SLEN("column-rule-color") }, { "column-rule-style", SLEN("column-rule-style") }, { "column-rule-width", SLEN("column-rule_width") }, { "column-span", SLEN("column-span") }, { "column-width", SLEN("column-width") }, { "content", SLEN("content") }, { "counter-increment", SLEN("counter-increment") }, { "counter-reset", SLEN("counter-reset") }, { "cue", SLEN("cue") }, { "cue-after", SLEN("cue-after") }, { "cue-before", SLEN("cue-before") }, { "cursor", SLEN("cursor") }, { "direction", SLEN("direction") }, { "display", SLEN("display") }, { "elevation", SLEN("elevation") }, { "empty-cells", SLEN("empty-cells") }, { "float", SLEN("float") }, { "font", SLEN("font") }, { "font-family", SLEN("font-family") }, { "font-size", SLEN("font-size") }, { "font-style", SLEN("font-style") }, { "font-variant", SLEN("font-variant") }, { "font-weight", SLEN("font-weight") }, { "height", SLEN("height") }, { "left", SLEN("left") }, { "letter-spacing", SLEN("letter-spacing") }, { "line-height", SLEN("line-height") }, { "list-style", SLEN("list-style") }, { "list-style-image", SLEN("list-style-image") }, { "list-style-position", SLEN("list-style-position") }, { "list-style-type", SLEN("list-style-type") }, { "margin", SLEN("margin") }, { "margin-bottom", SLEN("margin-bottom") }, { "margin-left", SLEN("margin-left") }, { "margin-right", SLEN("margin-right") }, { "margin-top", SLEN("margin-top") }, { "max-height", SLEN("max-height") }, { "max-width", SLEN("max-width") }, { "min-height", SLEN("min-height") }, { "min-width", SLEN("min-width") }, { "opacity", SLEN("opacity") }, { "orphans", SLEN("orphans") }, { "outline", SLEN("outline") }, { "outline-color", SLEN("outline-color") }, { "outline-style", SLEN("outline-style") }, { "outline-width", SLEN("outline-width") }, { "overflow", SLEN("overflow") }, { "overflow-x", SLEN("overflow-x") }, { "overflow-y", SLEN("overflow-y") }, { "padding", SLEN("padding") }, { "padding-bottom", SLEN("padding-bottom") }, { "padding-left", SLEN("padding-left") }, { "padding-right", SLEN("padding-right") }, { "padding-top", SLEN("padding-top") }, { "page-break-after", SLEN("page-break-after") }, { "page-break-before", SLEN("page-break-before") }, { "page-break-inside", SLEN("page-break-inside") }, { "pause", SLEN("pause") }, { "pause-after", SLEN("pause-after") }, { "pause-before", SLEN("pause-before") }, { "pitch-range", SLEN("pitch-range") }, { "pitch", SLEN("pitch") }, { "play-during", SLEN("play-during") }, { "position", SLEN("position") }, { "quotes", SLEN("quotes") }, { "richness", SLEN("richness") }, { "right", SLEN("right") }, { "speak-header", SLEN("speak-header") }, { "speak-numeral", SLEN("speak-numeral") }, { "speak-punctuation", SLEN("speak-punctuation") }, { "speak", SLEN("speak") }, { "speech-rate", SLEN("speech-rate") }, { "stress", SLEN("stress") }, { "table-layout", SLEN("table-layout") }, { "text-align", SLEN("text-align") }, { "text-decoration", SLEN("text-decoration") }, { "text-indent", SLEN("text-indent") }, { "text-transform", SLEN("text-transform") }, { "top", SLEN("top") }, { "unicode-bidi", SLEN("unicode-bidi") }, { "vertical-align", SLEN("vertical-align") }, { "visibility", SLEN("visibility") }, { "voice-family", SLEN("voice-family") }, { "volume", SLEN("volume") }, { "white-space", SLEN("white-space") }, { "widows", SLEN("widows") }, { "width", SLEN("width") }, { "word-spacing", SLEN("word-spacing") }, { "writing-mode", SLEN("writing-mode") }, { "z-index", SLEN("z-index") }, { "inherit", SLEN("inherit") }, { "important", SLEN("important") }, { "none", SLEN("none") }, { "both", SLEN("both") }, { "fixed", SLEN("fixed") }, { "scroll", SLEN("scroll") }, { "transparent", SLEN("transparent") }, { "no-repeat", SLEN("no-repeat") }, { "repeat-x", SLEN("repeat-x") }, { "repeat-y", SLEN("repeat-y") }, { "repeat", SLEN("repeat") }, { "hidden", SLEN("hidden") }, { "dotted", SLEN("dotted") }, { "dashed", SLEN("dashed") }, { "solid", SLEN("solid") }, { "double", SLEN("double") }, { "groove", SLEN("groove") }, { "ridge", SLEN("ridge") }, { "inset", SLEN("inset") }, { "outset", SLEN("outset") }, { "thin", SLEN("thin") }, { "medium", SLEN("medium") }, { "thick", SLEN("thick") }, { "collapse", SLEN("collapse") }, { "separate", SLEN("separate") }, { "auto", SLEN("auto") }, { "ltr", SLEN("ltr") }, { "rtl", SLEN("rtl") }, { "inline", SLEN("inline") }, { "block", SLEN("block") }, { "list-item", SLEN("list-item") }, { "run-in", SLEN("run-in") }, { "inline-block", SLEN("inline-block") }, { "table", SLEN("table") }, { "inline-table", SLEN("inline-table") }, { "table-row-group", SLEN("table-row-group") }, { "table-header-group", SLEN("table-header-group") }, { "table-footer-group", SLEN("table-footer-group") }, { "table-row", SLEN("table-row") }, { "table-column-group", SLEN("table-column-group") }, { "table-column", SLEN("table-column") }, { "table-cell", SLEN("table-cell") }, { "table-caption", SLEN("table-caption") }, { "below", SLEN("below") }, { "level", SLEN("level") }, { "above", SLEN("above") }, { "higher", SLEN("higher") }, { "lower", SLEN("lower") }, { "show", SLEN("show") }, { "hide", SLEN("hide") }, { "xx-small", SLEN("xx-small") }, { "x-small", SLEN("x-small") }, { "small", SLEN("small") }, { "large", SLEN("large") }, { "x-large", SLEN("x-large") }, { "xx-large", SLEN("xx-large") }, { "larger", SLEN("larger") }, { "smaller", SLEN("smaller") }, { "normal", SLEN("normal") }, { "italic", SLEN("italic") }, { "oblique", SLEN("oblique") }, { "small-caps", SLEN("small-caps") }, { "bold", SLEN("bold") }, { "bolder", SLEN("bolder") }, { "lighter", SLEN("lighter") }, { "inside", SLEN("inside") }, { "outside", SLEN("outside") }, { "disc", SLEN("disc") }, { "circle", SLEN("circle") }, { "square", SLEN("square") }, { "decimal", SLEN("decimal") }, { "decimal-leading-zero", SLEN("decimal-leading-zero") }, { "lower-roman", SLEN("lower-roman") }, { "upper-roman", SLEN("upper-roman") }, { "lower-greek", SLEN("lower-greek") }, { "lower-latin", SLEN("lower-latin") }, { "upper-latin", SLEN("upper-latin") }, { "armenian", SLEN("armenian") }, { "georgian", SLEN("georgian") }, { "lower-alpha", SLEN("lower-alpha") }, { "upper-alpha", SLEN("upper-alpha") }, { "invert", SLEN("invert") }, { "visible", SLEN("visible") }, { "always", SLEN("always") }, { "avoid", SLEN("avoid") }, { "x-low", SLEN("x-low") }, { "low", SLEN("low") }, { "high", SLEN("high") }, { "x-high", SLEN("x-high") }, { "static", SLEN("static") }, { "relative", SLEN("relative") }, { "absolute", SLEN("absolute") }, { "once", SLEN("once") }, { "digits", SLEN("digits") }, { "continuous", SLEN("continuous") }, { "code", SLEN("code") }, { "spell-out", SLEN("spell-out") }, { "x-slow", SLEN("x-slow") }, { "slow", SLEN("slow") }, { "fast", SLEN("fast") }, { "x-fast", SLEN("x-fast") }, { "faster", SLEN("faster") }, { "slower", SLEN("slower") }, { "center", SLEN("center") }, { "justify", SLEN("justify") }, { "capitalize", SLEN("capitalize") }, { "uppercase", SLEN("uppercase") }, { "lowercase", SLEN("lowercase") }, { "embed", SLEN("embed") }, { "bidi-override", SLEN("bidi-override") }, { "baseline", SLEN("baseline") }, { "sub", SLEN("sub") }, { "super", SLEN("super") }, { "text-top", SLEN("text-top") }, { "middle", SLEN("middle") }, { "text-bottom", SLEN("text-bottom") }, { "silent", SLEN("silent") }, { "x-soft", SLEN("x-soft") }, { "soft", SLEN("soft") }, { "loud", SLEN("loud") }, { "x-loud", SLEN("x-loud") }, { "pre", SLEN("pre") }, { "nowrap", SLEN("nowrap") }, { "pre-wrap", SLEN("pre-wrap") }, { "pre-line", SLEN("pre-line") }, { "leftwards", SLEN("leftwards") }, { "rightwards", SLEN("rightwards") }, { "left-side", SLEN("left-side") }, { "far-left", SLEN("far-left") }, { "center-left", SLEN("center-left") }, { "center-right", SLEN("center-right") }, { "far-right", SLEN("far-right") }, { "right-side", SLEN("right-side") }, { "behind", SLEN("behind") }, { "rect", SLEN("rect") }, { "open-quote", SLEN("open-quote") }, { "close-quote", SLEN("close-quote") }, { "no-open-quote", SLEN("no-open-quote") }, { "no-close-quote", SLEN("no-close-quote") }, { "attr", SLEN("attr") }, { "counter", SLEN("counter") }, { "counters", SLEN("counters") }, { "crosshair", SLEN("crosshair") }, { "default", SLEN("default") }, { "pointer", SLEN("pointer") }, { "move", SLEN("move") }, { "e-resize", SLEN("e-resize") }, { "ne-resize", SLEN("ne-resize") }, { "nw-resize", SLEN("nw-resize") }, { "n-resize", SLEN("n-resize") }, { "se-resize", SLEN("se-resize") }, { "sw-resize", SLEN("sw-resize") }, { "s-resize", SLEN("s-resize") }, { "w-resize", SLEN("w-resize") }, { "text", SLEN("text") }, { "wait", SLEN("wait") }, { "help", SLEN("help") }, { "progress", SLEN("progress") }, { "serif", SLEN("serif") }, { "sans-serif", SLEN("sans-serif") }, { "cursive", SLEN("cursive") }, { "fantasy", SLEN("fantasy") }, { "monospace", SLEN("monospace") }, { "male", SLEN("male") }, { "female", SLEN("female") }, { "child", SLEN("child") }, { "mix", SLEN("mix") }, { "underline", SLEN("underline") }, { "overline", SLEN("overline") }, { "line-through", SLEN("line-through") }, { "blink", SLEN("blink") }, { "rgb", SLEN("rgb") }, { "rgba", SLEN("rgba") }, { "hsl", SLEN("hsl") }, { "hsla", SLEN("hsla") }, { "-libcss-left", SLEN("-libcss-left") }, { "-libcss-center", SLEN("-libcss-center") }, { "-libcss-right", SLEN("-libcss-right") }, { "currentColor", SLEN("currentColor") }, { "odd", SLEN("odd") }, { "even", SLEN("even") }, { "src", SLEN("src") }, { "local", SLEN("local") }, { "initial", SLEN("initial") }, { "format", SLEN("format") }, { "woff", SLEN("woff") }, { "truetype", SLEN("truetype") }, { "opentype", SLEN("opentype") }, { "embedded-opentype", SLEN("embedded-opentype") }, { "svg", SLEN("svg") }, { "column", SLEN("column") }, { "avoid-page", SLEN("avoid_page") }, { "avoid-column", SLEN("avoid-column") }, { "balance", SLEN("balance") }, { "horizontal-tb", SLEN("horizontal-tb") }, { "vertical-rl", SLEN("vertical-rl") }, { "vertical-lr", SLEN("vertical-lr") }, { "aliceblue", SLEN("aliceblue") }, { "antiquewhite", SLEN("antiquewhite") }, { "aqua", SLEN("aqua") }, { "aquamarine", SLEN("aquamarine") }, { "azure", SLEN("azure") }, { "beige", SLEN("beige") }, { "bisque", SLEN("bisque") }, { "black", SLEN("black") }, { "blanchedalmond", SLEN("blanchedalmond") }, { "blue", SLEN("blue") }, { "blueviolet", SLEN("blueviolet") }, { "brown", SLEN("brown") }, { "burlywood", SLEN("burlywood") }, { "cadetblue", SLEN("cadetblue") }, { "chartreuse", SLEN("chartreuse") }, { "chocolate", SLEN("chocolate") }, { "coral", SLEN("coral") }, { "cornflowerblue", SLEN("cornflowerblue") }, { "cornsilk", SLEN("cornsilk") }, { "crimson", SLEN("crimson") }, { "cyan", SLEN("cyan") }, { "darkblue", SLEN("darkblue") }, { "darkcyan", SLEN("darkcyan") }, { "darkgoldenrod", SLEN("darkgoldenrod") }, { "darkgray", SLEN("darkgray") }, { "darkgreen", SLEN("darkgreen") }, { "darkgrey", SLEN("darkgrey") }, { "darkkhaki", SLEN("darkkhaki") }, { "darkmagenta", SLEN("darkmagenta") }, { "darkolivegreen", SLEN("darkolivegreen") }, { "darkorange", SLEN("darkorange") }, { "darkorchid", SLEN("darkorchid") }, { "darkred", SLEN("darkred") }, { "darksalmon", SLEN("darksalmon") }, { "darkseagreen", SLEN("darkseagreen") }, { "darkslateblue", SLEN("darkslateblue") }, { "darkslategray", SLEN("darkslategray") }, { "darkslategrey", SLEN("darkslategrey") }, { "darkturquoise", SLEN("darkturquoise") }, { "darkviolet", SLEN("darkviolet") }, { "deeppink", SLEN("deeppink") }, { "deepskyblue", SLEN("deepskyblue") }, { "dimgray", SLEN("dimgray") }, { "dimgrey", SLEN("dimgrey") }, { "dodgerblue", SLEN("dodgerblue") }, { "feldspar", SLEN("feldspar") }, { "firebrick", SLEN("firebrick") }, { "floralwhite", SLEN("floralwhite") }, { "forestgreen", SLEN("forestgreen") }, { "fuchsia", SLEN("fuchsia") }, { "gainsboro", SLEN("gainsboro") }, { "ghostwhite", SLEN("ghostwhite") }, { "gold", SLEN("gold") }, { "goldenrod", SLEN("goldenrod") }, { "gray", SLEN("gray") }, { "green", SLEN("green") }, { "greenyellow", SLEN("greenyellow") }, { "grey", SLEN("grey") }, { "honeydew", SLEN("honeydew") }, { "hotpink", SLEN("hotpink") }, { "indianred", SLEN("indianred") }, { "indigo", SLEN("indigo") }, { "ivory", SLEN("ivory") }, { "khaki", SLEN("khaki") }, { "lavender", SLEN("lavender") }, { "lavenderblush", SLEN("lavenderblush") }, { "lawngreen", SLEN("lawngreen") }, { "lemonchiffon", SLEN("lemonchiffon") }, { "lightblue", SLEN("lightblue") }, { "lightcoral", SLEN("lightcoral") }, { "lightcyan", SLEN("lightcyan") }, { "lightgoldenrodyellow", SLEN("lightgoldenrodyellow") }, { "lightgray", SLEN("lightgray") }, { "lightgreen", SLEN("lightgreen") }, { "lightgrey", SLEN("lightgrey") }, { "lightpink", SLEN("lightpink") }, { "lightsalmon", SLEN("lightsalmon") }, { "lightseagreen", SLEN("lightseagreen") }, { "lightskyblue", SLEN("lightskyblue") }, { "lightslateblue", SLEN("lightslateblue") }, { "lightslategray", SLEN("lightslategray") }, { "lightslategrey", SLEN("lightslategrey") }, { "lightsteelblue", SLEN("lightsteelblue") }, { "lightyellow", SLEN("lightyellow") }, { "lime", SLEN("lime") }, { "limegreen", SLEN("limegreen") }, { "linen", SLEN("linen") }, { "magenta", SLEN("magenta") }, { "maroon", SLEN("maroon") }, { "mediumaquamarine", SLEN("mediumaquamarine") }, { "mediumblue", SLEN("mediumblue") }, { "mediumorchid", SLEN("mediumorchid") }, { "mediumpurple", SLEN("mediumpurple") }, { "mediumseagreen", SLEN("mediumseagreen") }, { "mediumslateblue", SLEN("mediumslateblue") }, { "mediumspringgreen", SLEN("mediumspringgreen") }, { "mediumturquoise", SLEN("mediumturquoise") }, { "mediumvioletred", SLEN("mediumvioletred") }, { "midnightblue", SLEN("midnightblue") }, { "mintcream", SLEN("mintcream") }, { "mistyrose", SLEN("mistyrose") }, { "moccasin", SLEN("moccasin") }, { "navajowhite", SLEN("navajowhite") }, { "navy", SLEN("navy") }, { "oldlace", SLEN("oldlace") }, { "olive", SLEN("olive") }, { "olivedrab", SLEN("olivedrab") }, { "orange", SLEN("orange") }, { "orangered", SLEN("orangered") }, { "orchid", SLEN("orchid") }, { "palegoldenrod", SLEN("palegoldenrod") }, { "palegreen", SLEN("palegreen") }, { "paleturquoise", SLEN("paleturquoise") }, { "palevioletred", SLEN("palevioletred") }, { "papayawhip", SLEN("papayawhip") }, { "peachpuff", SLEN("peachpuff") }, { "peru", SLEN("peru") }, { "pink", SLEN("pink") }, { "plum", SLEN("plum") }, { "powderblue", SLEN("powderblue") }, { "purple", SLEN("purple") }, { "red", SLEN("red") }, { "rosybrown", SLEN("rosybrown") }, { "royalblue", SLEN("royalblue") }, { "saddlebrown", SLEN("saddlebrown") }, { "salmon", SLEN("salmon") }, { "sandybrown", SLEN("sandybrown") }, { "seagreen", SLEN("seagreen") }, { "seashell", SLEN("seashell") }, { "sienna", SLEN("sienna") }, { "silver", SLEN("silver") }, { "skyblue", SLEN("skyblue") }, { "slateblue", SLEN("slateblue") }, { "slategray", SLEN("slategray") }, { "slategrey", SLEN("slategrey") }, { "snow", SLEN("snow") }, { "springgreen", SLEN("springgreen") }, { "steelblue", SLEN("steelblue") }, { "tan", SLEN("tan") }, { "teal", SLEN("teal") }, { "thistle", SLEN("thistle") }, { "tomato", SLEN("tomato") }, { "turquoise", SLEN("turquoise") }, { "violet", SLEN("violet") }, { "violetred", SLEN("violetred") }, { "wheat", SLEN("wheat") }, { "white", SLEN("white") }, { "whitesmoke", SLEN("whitesmoke") }, { "yellow", SLEN("yellow") }, { "yellowgreen", SLEN("yellowgreen") } }; /** * Obtain pointer to interned propstring list * * \param sheet Returns pointer to propstring table * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion * * The propstring list is generated with the first call to this function and * destroyed when it has no more users. Call css__propstrings_unref() when * finished with the propstring list. */ css_error css__propstrings_get(lwc_string ***strings) { if (css__propstrings.count > 0) { css__propstrings.count++; } else { int i; lwc_error lerror; /* Intern all known strings */ for (i = 0; i < LAST_KNOWN; i++) { lerror = lwc_intern_string(stringmap[i].data, stringmap[i].len, &css__propstrings.strings[i]); if (lerror != lwc_error_ok) return CSS_NOMEM; } css__propstrings.count++; } *strings = css__propstrings.strings; return CSS_OK; } /** * Reduce reference count for propstring list by one. * * When count hits zero, the list is destroyed. */ void css__propstrings_unref(void) { css__propstrings.count--; if (css__propstrings.count == 0) { int i; for (i = 0; i < LAST_KNOWN; i++) lwc_string_unref(css__propstrings.strings[i]); } } netsurf-all-3.2/libcss/src/parse/language.c0000644000175000017500000014454212377676736017755 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include "stylesheet.h" #include "lex/lex.h" #include "parse/font_face.h" #include "parse/important.h" #include "parse/language.h" #include "parse/parse.h" #include "parse/propstrings.h" #include "parse/properties/properties.h" #include "parse/properties/utils.h" #include "utils/parserutilserror.h" #include "utils/utils.h" typedef struct context_entry { css_parser_event type; /**< Type of entry */ void *data; /**< Data for context */ } context_entry; /* Event handlers */ static css_error language_handle_event(css_parser_event type, const parserutils_vector *tokens, void *pw); static css_error handleStartStylesheet(css_language *c, const parserutils_vector *vector); static css_error handleEndStylesheet(css_language *c, const parserutils_vector *vector); static css_error handleStartRuleset(css_language *c, const parserutils_vector *vector); static css_error handleEndRuleset(css_language *c, const parserutils_vector *vector); static css_error handleStartAtRule(css_language *c, const parserutils_vector *vector); static css_error handleEndAtRule(css_language *c, const parserutils_vector *vector); static css_error handleStartBlock(css_language *c, const parserutils_vector *vector); static css_error handleEndBlock(css_language *c, const parserutils_vector *vector); static css_error handleBlockContent(css_language *c, const parserutils_vector *vector); static css_error handleDeclaration(css_language *c, const parserutils_vector *vector); /* At-rule parsing */ static css_error parseMediaList(css_language *c, const parserutils_vector *vector, int *ctx, uint64_t *media); static css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri); static css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri); /* Selector list parsing */ static css_error parseClass(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific); static css_error parseAttrib(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific); static css_error parseNth(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail_value *value); static css_error parsePseudo(css_language *c, const parserutils_vector *vector, int *ctx, bool in_not, css_selector_detail *specific); static css_error parseSpecific(css_language *c, const parserutils_vector *vector, int *ctx, bool in_not, css_selector_detail *specific); static css_error parseAppendSpecific(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent); static css_error parseSelectorSpecifics(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent); static css_error parseTypeSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_qname *qname); static css_error parseSimpleSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **result); static css_error parseCombinator(css_language *c, const parserutils_vector *vector, int *ctx, css_combinator *result); static css_error parseSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **result); static css_error parseSelectorList(css_language *c, const parserutils_vector *vector, css_rule *rule); /* Declaration parsing */ static css_error parseProperty(css_language *c, const css_token *property, const parserutils_vector *vector, int *ctx, css_rule *rule); /** * Create a CSS language parser * * \param sheet The stylesheet object to parse for * \param parser The core parser object to use * \param language Pointer to location to receive parser object * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__language_create(css_stylesheet *sheet, css_parser *parser, void **language) { css_language *c; css_parser_optparams params; parserutils_error perror; css_error error; if (sheet == NULL || parser == NULL || language == NULL) return CSS_BADPARM; c = malloc(sizeof(css_language)); if (c == NULL) return CSS_NOMEM; perror = parserutils_stack_create(sizeof(context_entry), STACK_CHUNK, &c->context); if (perror != PARSERUTILS_OK) { free(c); return css_error_from_parserutils_error(perror); } params.event_handler.handler = language_handle_event; params.event_handler.pw = c; error = css__parser_setopt(parser, CSS_PARSER_EVENT_HANDLER, ¶ms); if (error != CSS_OK) { parserutils_stack_destroy(c->context); free(c); return error; } c->sheet = sheet; c->state = CHARSET_PERMITTED; c->default_namespace = NULL; c->namespaces = NULL; c->num_namespaces = 0; c->strings = sheet->propstrings; *language = c; return CSS_OK; } /** * Destroy a CSS language parser * * \param language The parser to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__language_destroy(css_language *language) { uint32_t i; if (language == NULL) return CSS_BADPARM; if (language->default_namespace != NULL) lwc_string_unref(language->default_namespace); if (language->namespaces != NULL) { for (i = 0; i < language->num_namespaces; i++) { lwc_string_unref(language->namespaces[i].prefix); lwc_string_unref(language->namespaces[i].uri); } free(language->namespaces); } parserutils_stack_destroy(language->context); free(language); return CSS_OK; } /** * Handler for core parser events * * \param type The event type * \param tokens Vector of tokens read since last event, or NULL * \param pw Pointer to handler context * \return CSS_OK on success, CSS_INVALID to indicate parse error, * appropriate error otherwise. */ css_error language_handle_event(css_parser_event type, const parserutils_vector *tokens, void *pw) { css_language *language = (css_language *) pw; switch (type) { case CSS_PARSER_START_STYLESHEET: return handleStartStylesheet(language, tokens); case CSS_PARSER_END_STYLESHEET: return handleEndStylesheet(language, tokens); case CSS_PARSER_START_RULESET: return handleStartRuleset(language, tokens); case CSS_PARSER_END_RULESET: return handleEndRuleset(language, tokens); case CSS_PARSER_START_ATRULE: return handleStartAtRule(language, tokens); case CSS_PARSER_END_ATRULE: return handleEndAtRule(language, tokens); case CSS_PARSER_START_BLOCK: return handleStartBlock(language, tokens); case CSS_PARSER_END_BLOCK: return handleEndBlock(language, tokens); case CSS_PARSER_BLOCK_CONTENT: return handleBlockContent(language, tokens); case CSS_PARSER_DECLARATION: return handleDeclaration(language, tokens); } return CSS_OK; } /****************************************************************************** * Parser stages * ******************************************************************************/ css_error handleStartStylesheet(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry entry = { CSS_PARSER_START_STYLESHEET, NULL }; UNUSED(vector); assert(c != NULL); perror = parserutils_stack_push(c->context, (void *) &entry); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleEndStylesheet(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry *entry; UNUSED(vector); assert(c != NULL); entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->type != CSS_PARSER_START_STYLESHEET) return CSS_INVALID; perror = parserutils_stack_pop(c->context, NULL); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleStartRuleset(css_language *c, const parserutils_vector *vector) { parserutils_error perror; css_error error; context_entry entry = { CSS_PARSER_START_RULESET, NULL }; context_entry *cur; css_rule *parent_rule = NULL; css_rule *rule = NULL; assert(c != NULL); /* Retrieve parent rule from stack, if any */ cur = parserutils_stack_get_current(c->context); if (cur != NULL && cur->type != CSS_PARSER_START_STYLESHEET) parent_rule = cur->data; error = css__stylesheet_rule_create(c->sheet, CSS_RULE_SELECTOR, &rule); if (error != CSS_OK) return error; if (vector != NULL) { /* Parse selectors, if there are any */ error = parseSelectorList(c, vector, rule); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } } entry.data = rule; perror = parserutils_stack_push(c->context, (void *) &entry); if (perror != PARSERUTILS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return css_error_from_parserutils_error(perror); } error = css__stylesheet_add_rule(c->sheet, rule, parent_rule); if (error != CSS_OK) { parserutils_stack_pop(c->context, NULL); css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Flag that we've had a valid rule, so @import/@namespace/@charset * have no effect. */ c->state = HAD_RULE; /* Rule is now owned by the sheet, so no need to destroy it */ return CSS_OK; } css_error handleEndRuleset(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry *entry; UNUSED(vector); assert(c != NULL); entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->type != CSS_PARSER_START_RULESET) return CSS_INVALID; perror = parserutils_stack_pop(c->context, NULL); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleStartAtRule(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry entry = { CSS_PARSER_START_ATRULE, NULL }; const css_token *token = NULL; const css_token *atkeyword = NULL; int32_t ctx = 0; bool match = false; css_rule *rule; css_error error; /* vector contains: ATKEYWORD ws any0 */ assert(c != NULL); atkeyword = parserutils_vector_iterate(vector, &ctx); consumeWhitespace(vector, &ctx); /* We now have an ATKEYWORD and the context for the start of any0, if * there is one */ assert(atkeyword != NULL && atkeyword->type == CSS_TOKEN_ATKEYWORD); if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[CHARSET], &match) == lwc_error_ok && match) { if (c->state == CHARSET_PERMITTED) { const css_token *charset; /* any0 = STRING */ if (ctx == 0) return CSS_INVALID; charset = parserutils_vector_iterate(vector, &ctx); if (charset == NULL || charset->type != CSS_TOKEN_STRING) return CSS_INVALID; token = parserutils_vector_iterate(vector, &ctx); if (token != NULL) return CSS_INVALID; error = css__stylesheet_rule_create(c->sheet, CSS_RULE_CHARSET, &rule); if (error != CSS_OK) return error; error = css__stylesheet_rule_set_charset(c->sheet, rule, charset->idata); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } error = css__stylesheet_add_rule(c->sheet, rule, NULL); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = IMPORT_PERMITTED; } else { return CSS_INVALID; } } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[LIBCSS_IMPORT], &match) == lwc_error_ok && match) { if (c->state <= IMPORT_PERMITTED) { lwc_string *url; uint64_t media = 0; /* any0 = (STRING | URI) ws * (IDENT ws (',' ws IDENT ws)* )? */ const css_token *uri = parserutils_vector_iterate(vector, &ctx); if (uri == NULL || (uri->type != CSS_TOKEN_STRING && uri->type != CSS_TOKEN_URI)) return CSS_INVALID; consumeWhitespace(vector, &ctx); /* Parse media list */ error = parseMediaList(c, vector, &ctx, &media); if (error != CSS_OK) return error; /* Create rule */ error = css__stylesheet_rule_create(c->sheet, CSS_RULE_IMPORT, &rule); if (error != CSS_OK) return error; /* Resolve import URI */ error = c->sheet->resolve(c->sheet->resolve_pw, c->sheet->url, uri->idata, &url); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Inform rule of it */ error = css__stylesheet_rule_set_nascent_import(c->sheet, rule, url, media); if (error != CSS_OK) { lwc_string_unref(url); css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Inform client of need for import */ if (c->sheet->import != NULL) { error = c->sheet->import(c->sheet->import_pw, c->sheet, url, media); if (error != CSS_OK) { lwc_string_unref(url); css__stylesheet_rule_destroy(c->sheet, rule); return error; } } /* No longer care about url */ lwc_string_unref(url); /* Add rule to sheet */ error = css__stylesheet_add_rule(c->sheet, rule, NULL); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = IMPORT_PERMITTED; } else { return CSS_INVALID; } } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[NAMESPACE], &match) == lwc_error_ok && match) { if (c->state <= NAMESPACE_PERMITTED) { lwc_string *prefix = NULL; /* any0 = (IDENT ws)? (STRING | URI) ws */ token = parserutils_vector_iterate(vector, &ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_IDENT) { prefix = token->idata; consumeWhitespace(vector, &ctx); token = parserutils_vector_iterate(vector, &ctx); } if (token == NULL || (token->type != CSS_TOKEN_STRING && token->type != CSS_TOKEN_URI)) { return CSS_INVALID; } consumeWhitespace(vector, &ctx); error = addNamespace(c, prefix, token->idata); if (error != CSS_OK) return error; c->state = NAMESPACE_PERMITTED; /* Namespaces are special, and do not generate rules */ return CSS_OK; } else { return CSS_INVALID; } } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[MEDIA], &match) == lwc_error_ok && match) { uint64_t media = 0; /* any0 = IDENT ws (',' ws IDENT ws)* */ error = parseMediaList(c, vector, &ctx, &media); if (error != CSS_OK) return error; error = css__stylesheet_rule_create(c->sheet, CSS_RULE_MEDIA, &rule); if (error != CSS_OK) return error; error = css__stylesheet_rule_set_media(c->sheet, rule, media); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } error = css__stylesheet_add_rule(c->sheet, rule, NULL); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[FONT_FACE], &match) == lwc_error_ok && match) { error = css__stylesheet_rule_create(c->sheet, CSS_RULE_FONT_FACE, &rule); if (error != CSS_OK) return error; consumeWhitespace(vector, &ctx); error = css__stylesheet_add_rule(c->sheet, rule, NULL); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; } else if (lwc_string_caseless_isequal(atkeyword->idata, c->strings[PAGE], &match) == lwc_error_ok && match) { const css_token *token; /* any0 = (':' IDENT)? ws */ error = css__stylesheet_rule_create(c->sheet, CSS_RULE_PAGE, &rule); if (error != CSS_OK) return error; consumeWhitespace(vector, &ctx); token = parserutils_vector_peek(vector, ctx); if (token != NULL) { css_selector *sel = NULL; error = parseSelector(c, vector, &ctx, &sel); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } error = css__stylesheet_rule_set_page_selector(c->sheet, rule, sel); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, sel); css__stylesheet_rule_destroy(c->sheet, rule); return error; } } error = css__stylesheet_add_rule(c->sheet, rule, NULL); if (error != CSS_OK) { css__stylesheet_rule_destroy(c->sheet, rule); return error; } /* Rule is now owned by the sheet, * so no need to destroy it */ c->state = HAD_RULE; } else { return CSS_INVALID; } entry.data = rule; perror = parserutils_stack_push(c->context, (void *) &entry); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleEndAtRule(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry *entry; UNUSED(vector); assert(c != NULL); entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->type != CSS_PARSER_START_ATRULE) return CSS_INVALID; perror = parserutils_stack_pop(c->context, NULL); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleStartBlock(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry entry = { CSS_PARSER_START_BLOCK, NULL }; context_entry *cur; UNUSED(vector); /* If the current item on the stack isn't a block, * then clone its data field. This ensures that the relevant rule * is available when parsing the block contents. */ cur = parserutils_stack_get_current(c->context); if (cur != NULL && cur->type != CSS_PARSER_START_BLOCK) entry.data = cur->data; perror = parserutils_stack_push(c->context, (void *) &entry); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } return CSS_OK; } css_error handleEndBlock(css_language *c, const parserutils_vector *vector) { parserutils_error perror; context_entry *entry; css_rule *rule; entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->type != CSS_PARSER_START_BLOCK) return CSS_INVALID; rule = entry->data; perror = parserutils_stack_pop(c->context, NULL); if (perror != PARSERUTILS_OK) { return css_error_from_parserutils_error(perror); } /* If the block we just popped off the stack was associated with a * non-block stack entry, and that entry is not a top-level statement, * then report the end of that entry, too. */ if (rule != NULL && rule->ptype != CSS_RULE_PARENT_STYLESHEET) { if (rule->type == CSS_RULE_SELECTOR) return handleEndRuleset(c, vector); } return CSS_OK; } css_error handleBlockContent(css_language *c, const parserutils_vector *vector) { context_entry *entry; css_rule *rule; /* Block content comprises either declarations (if the current block is * associated with @page, @font-face or a selector), or rulesets (if the * current block is associated with @media). */ entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->data == NULL) return CSS_INVALID; rule = entry->data; if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && rule->type != CSS_RULE_PAGE && rule->type != CSS_RULE_MEDIA && rule->type != CSS_RULE_FONT_FACE)) return CSS_INVALID; if (rule->type == CSS_RULE_MEDIA) { /* Expect rulesets */ return handleStartRuleset(c, vector); } else { /* Expect declarations */ return handleDeclaration(c, vector); } return CSS_OK; } css_error handleDeclaration(css_language *c, const parserutils_vector *vector) { css_error error; const css_token *token, *ident; int ctx = 0; context_entry *entry; css_rule *rule; /* Locations where declarations are permitted: * * + In @page * + In @font-face * + In ruleset */ entry = parserutils_stack_get_current(c->context); if (entry == NULL || entry->data == NULL) return CSS_INVALID; rule = entry->data; if (rule == NULL || (rule->type != CSS_RULE_SELECTOR && rule->type != CSS_RULE_PAGE && rule->type != CSS_RULE_FONT_FACE)) return CSS_INVALID; /* Strip any leading whitespace (can happen if in nested block) */ consumeWhitespace(vector, &ctx); /* IDENT ws ':' ws value * * In CSS 2.1, value is any1, so '{' or ATKEYWORD => parse error */ ident = parserutils_vector_iterate(vector, &ctx); if (ident == NULL || ident->type != CSS_TOKEN_IDENT) return CSS_INVALID; consumeWhitespace(vector, &ctx); token = parserutils_vector_iterate(vector, &ctx); if (token == NULL || tokenIsChar(token, ':') == false) return CSS_INVALID; consumeWhitespace(vector, &ctx); if (rule->type == CSS_RULE_FONT_FACE) { css_rule_font_face * ff_rule = (css_rule_font_face *) rule; error = css__parse_font_descriptor( c, ident, vector, &ctx, ff_rule); } else { error = parseProperty(c, ident, vector, &ctx, rule); } if (error != CSS_OK) return error; return CSS_OK; } /****************************************************************************** * At-rule parsing functions * ******************************************************************************/ css_error parseMediaList(css_language *c, const parserutils_vector *vector, int *ctx, uint64_t *media) { uint64_t ret = 0; bool match = false; const css_token *token; token = parserutils_vector_iterate(vector, ctx); while (token != NULL) { if (token->type != CSS_TOKEN_IDENT) return CSS_INVALID; if (lwc_string_caseless_isequal(token->idata, c->strings[AURAL], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_AURAL; } else if (lwc_string_caseless_isequal( token->idata, c->strings[BRAILLE], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_BRAILLE; } else if (lwc_string_caseless_isequal( token->idata, c->strings[EMBOSSED], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_EMBOSSED; } else if (lwc_string_caseless_isequal( token->idata, c->strings[HANDHELD], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_HANDHELD; } else if (lwc_string_caseless_isequal( token->idata, c->strings[PRINT], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_PRINT; } else if (lwc_string_caseless_isequal( token->idata, c->strings[PROJECTION], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_PROJECTION; } else if (lwc_string_caseless_isequal( token->idata, c->strings[SCREEN], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_SCREEN; } else if (lwc_string_caseless_isequal( token->idata, c->strings[SPEECH], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_SPEECH; } else if (lwc_string_caseless_isequal( token->idata, c->strings[TTY], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_TTY; } else if (lwc_string_caseless_isequal( token->idata, c->strings[TV], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_TV; } else if (lwc_string_caseless_isequal( token->idata, c->strings[ALL], &match) == lwc_error_ok && match) { ret |= CSS_MEDIA_ALL; } else return CSS_INVALID; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token != NULL && tokenIsChar(token, ',') == false) return CSS_INVALID; consumeWhitespace(vector, ctx); } /* If, after parsing the media list, we still have no media, * then it must be ALL. */ if (ret == 0) ret = CSS_MEDIA_ALL; *media = ret; return CSS_OK; } /** * Add a namespace mapping * * \param c Parsing context to add to * \param prefix Namespace prefix, or NULL for default namespace * \param uri Namespace URI * \return CSS_OK on success, CSS_NOMEM on memory exhaustion. */ css_error addNamespace(css_language *c, lwc_string *prefix, lwc_string *uri) { if (prefix == NULL) { /* Replace default namespace */ if (c->default_namespace != NULL) lwc_string_unref(c->default_namespace); /* Special case: if new namespace uri is "", use NULL */ if (lwc_string_length(uri) == 0) c->default_namespace = NULL; else c->default_namespace = lwc_string_ref(uri); } else { /* Replace, or add mapping */ bool match; uint32_t idx; for (idx = 0; idx < c->num_namespaces; idx++) { if (lwc_string_isequal(c->namespaces[idx].prefix, prefix, &match) == lwc_error_ok && match) break; } if (idx == c->num_namespaces) { /* Not found, create a new mapping */ css_namespace *ns = realloc(c->namespaces, sizeof(css_namespace) * (c->num_namespaces + 1)); if (ns == NULL) return CSS_NOMEM; ns[idx].prefix = lwc_string_ref(prefix); ns[idx].uri = NULL; c->namespaces = ns; c->num_namespaces++; } /* Replace namespace URI */ if (c->namespaces[idx].uri != NULL) lwc_string_unref(c->namespaces[idx].uri); /* Special case: if new namespace uri is "", use NULL */ if (lwc_string_length(uri) == 0) c->namespaces[idx].uri = NULL; else c->namespaces[idx].uri = lwc_string_ref(uri); } return CSS_OK; } /** * Look up a namespace prefix * * \param c Language parser context * \param prefix Namespace prefix to find, or NULL for none * \param uri Pointer to location to receive namespace URI * \return CSS_OK on success, CSS_INVALID if prefix is not found */ css_error lookupNamespace(css_language *c, lwc_string *prefix, lwc_string **uri) { uint32_t idx; bool match; if (prefix == NULL) { *uri = NULL; } else { for (idx = 0; idx < c->num_namespaces; idx++) { if (lwc_string_isequal(c->namespaces[idx].prefix, prefix, &match) == lwc_error_ok && match) break; } if (idx == c->num_namespaces) return CSS_INVALID; *uri = c->namespaces[idx].uri; } return CSS_OK; } /****************************************************************************** * Selector list parsing functions * ******************************************************************************/ css_error parseClass(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific) { css_qname qname; css_selector_detail_value detail_value; const css_token *token; /* class -> '.' IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, '.') == false) return CSS_INVALID; token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) return CSS_INVALID; detail_value.string = NULL; qname.ns = NULL; qname.name = token->idata; /* Ensure lwc insensitive string is available for class names */ if (qname.name->insensitive == NULL && lwc__intern_caseless_string(qname.name) != lwc_error_ok) return CSS_NOMEM; return css__stylesheet_selector_detail_init(c->sheet, CSS_SELECTOR_CLASS, &qname, detail_value, CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); } css_error parseAttrib(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail *specific) { css_qname qname; css_selector_detail_value detail_value; const css_token *token, *value = NULL; css_selector_type type = CSS_SELECTOR_ATTRIBUTE; css_error error; lwc_string *prefix = NULL; /* attrib -> '[' ws namespace_prefix? IDENT ws [ * [ '=' | * INCLUDES | * DASHMATCH | * PREFIXMATCH | * SUFFIXMATCH | * SUBSTRINGMATCH * ] ws * [ IDENT | STRING ] ws ]? ']' * namespace_prefix -> [ IDENT | '*' ]? '|' */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, '[') == false) return CSS_INVALID; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && tokenIsChar(token, '*') == false && tokenIsChar(token, '|') == false)) return CSS_INVALID; if (tokenIsChar(token, '|')) { token = parserutils_vector_iterate(vector, ctx); } else { const css_token *temp; temp = parserutils_vector_peek(vector, *ctx); if (temp != NULL && tokenIsChar(temp, '|')) { prefix = token->idata; parserutils_vector_iterate(vector, ctx); token = parserutils_vector_iterate(vector, ctx); } } if (token == NULL || token->type != CSS_TOKEN_IDENT) return CSS_INVALID; error = lookupNamespace(c, prefix, &qname.ns); if (error != CSS_OK) return error; qname.name = token->idata; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL) return CSS_INVALID; if (tokenIsChar(token, ']') == false) { if (tokenIsChar(token, '=')) type = CSS_SELECTOR_ATTRIBUTE_EQUAL; else if (token->type == CSS_TOKEN_INCLUDES) type = CSS_SELECTOR_ATTRIBUTE_INCLUDES; else if (token->type == CSS_TOKEN_DASHMATCH) type = CSS_SELECTOR_ATTRIBUTE_DASHMATCH; else if (token->type == CSS_TOKEN_PREFIXMATCH) type = CSS_SELECTOR_ATTRIBUTE_PREFIX; else if (token->type == CSS_TOKEN_SUFFIXMATCH) type = CSS_SELECTOR_ATTRIBUTE_SUFFIX; else if (token->type == CSS_TOKEN_SUBSTRINGMATCH) type = CSS_SELECTOR_ATTRIBUTE_SUBSTRING; else return CSS_INVALID; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_STRING)) return CSS_INVALID; value = token; consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ']') == false) return CSS_INVALID; } detail_value.string = value != NULL ? value->idata : NULL; return css__stylesheet_selector_detail_init(c->sheet, type, &qname, detail_value, CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); } css_error parseNth(css_language *c, const parserutils_vector *vector, int *ctx, css_selector_detail_value *value) { const css_token *token; bool match; /* nth -> [ DIMENSION | IDENT ] ws [ [ CHAR ws ]? NUMBER ws ]? * (e.g. DIMENSION: 2n-1, 2n- 1, 2n -1, 2n - 1) * (e.g. IDENT: -n-1, -n- 1, -n -1, -n - 1) * -> NUMBER ws * -> IDENT(odd) ws * -> IDENT(even) ws */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_NUMBER && token->type != CSS_TOKEN_DIMENSION)) return CSS_INVALID; if (token->type == CSS_TOKEN_IDENT && lwc_string_caseless_isequal(token->idata, c->strings[ODD], &match) == lwc_error_ok && match) { /* Odd */ value->nth.a = 2; value->nth.b = 1; } else if (token->type == CSS_TOKEN_IDENT && lwc_string_caseless_isequal(token->idata, c->strings[EVEN], &match) == lwc_error_ok && match) { /* Even */ value->nth.a = 2; value->nth.b = 0; } else if (token->type == CSS_TOKEN_NUMBER) { size_t consumed = 0; css_fixed val = 0; val = css__number_from_lwc_string(token->idata, true, &consumed); if (consumed != lwc_string_length(token->idata)) return CSS_INVALID; value->nth.a = 0; value->nth.b = FIXTOINT(val); } else { /* [ DIMENSION | IDENT ] ws [ [ CHAR ws ]? NUMBER ws ]? * * (e.g. DIMENSION: 2n-1, 2n- 1, 2n -1, 2n - 1) * (e.g. IDENT: n, -n-1, -n- 1, -n -1, -n - 1) */ size_t consumed = 0, len; const char *data; css_fixed a = 0, b = 0; int sign = 1; bool had_sign = false, had_b = false; len = lwc_string_length(token->idata); data = lwc_string_data(token->idata); /* Compute a */ if (token->type == CSS_TOKEN_IDENT) { if (len < 2) { if (data[0] != 'n' && data[0] != 'N') return CSS_INVALID; /* n */ a = INTTOFIX(1); data += 1; len -= 1; } else { if (data[0] != '-' || (data[1] != 'n' && data[1] != 'N')) return CSS_INVALID; /* -n */ a = INTTOFIX(-1); data += 2; len -= 2; } if (len > 0) { if (data[0] != '-') return CSS_INVALID; /* -n- */ sign = -1; had_sign = true; if (len > 1) { /* Reject additional sign */ if (data[1] == '-' || data[1] == '+') return CSS_INVALID; /* -n-b */ b = css__number_from_string( (const uint8_t *) data + 1, len - 1, true, &consumed); if (consumed != len - 1) return CSS_INVALID; had_b = true; } } } else { /* 2n */ a = css__number_from_lwc_string(token->idata, true, &consumed); if (consumed == 0 || (data[consumed] != 'n' && data[consumed] != 'N')) return CSS_INVALID; if (len - (++consumed) > 0) { if (data[consumed] != '-') return CSS_INVALID; /* 2n- */ sign = -1; had_sign = true; if (len - (++consumed) > 0) { size_t bstart; /* Reject additional sign */ if (data[consumed] == '-' || data[consumed] == '+') return CSS_INVALID; /* 2n-b */ bstart = consumed; b = css__number_from_string( (const uint8_t *) data + bstart, len - bstart, true, &consumed); if (consumed != len - bstart) return CSS_INVALID; had_b = true; } } } if (had_b == false) { consumeWhitespace(vector, ctx); /* Look for optional b : [ [ CHAR ws ]? NUMBER ws ]? */ token = parserutils_vector_peek(vector, *ctx); if (had_sign == false && token != NULL && (tokenIsChar(token, '-') || tokenIsChar(token, '+'))) { parserutils_vector_iterate(vector, ctx); had_sign = true; if (tokenIsChar(token, '-')) sign = -1; consumeWhitespace(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } /* Expect NUMBER */ if (token != NULL && token->type == CSS_TOKEN_NUMBER) { parserutils_vector_iterate(vector, ctx); /* If we've already seen a sign, ensure one * does not occur at the start of this token */ if (had_sign && lwc_string_length( token->idata) > 0) { data = lwc_string_data(token->idata); if (data[0] == '-' || data[0] == '+') return CSS_INVALID; } b = css__number_from_lwc_string(token->idata, true, &consumed); if (consumed != lwc_string_length(token->idata)) return CSS_INVALID; } } value->nth.a = FIXTOINT(a); value->nth.b = FIXTOINT(b) * sign; } consumeWhitespace(vector, ctx); return CSS_OK; } css_error parsePseudo(css_language *c, const parserutils_vector *vector, int *ctx, bool in_not, css_selector_detail *specific) { static const struct { int index; css_selector_type type; } pseudo_lut[] = { { FIRST_CHILD, CSS_SELECTOR_PSEUDO_CLASS }, { LINK, CSS_SELECTOR_PSEUDO_CLASS }, { VISITED, CSS_SELECTOR_PSEUDO_CLASS }, { HOVER, CSS_SELECTOR_PSEUDO_CLASS }, { ACTIVE, CSS_SELECTOR_PSEUDO_CLASS }, { FOCUS, CSS_SELECTOR_PSEUDO_CLASS }, { LANG, CSS_SELECTOR_PSEUDO_CLASS }, { LEFT, CSS_SELECTOR_PSEUDO_CLASS }, { RIGHT, CSS_SELECTOR_PSEUDO_CLASS }, { FIRST, CSS_SELECTOR_PSEUDO_CLASS }, { ROOT, CSS_SELECTOR_PSEUDO_CLASS }, { NTH_CHILD, CSS_SELECTOR_PSEUDO_CLASS }, { NTH_LAST_CHILD, CSS_SELECTOR_PSEUDO_CLASS }, { NTH_OF_TYPE, CSS_SELECTOR_PSEUDO_CLASS }, { NTH_LAST_OF_TYPE, CSS_SELECTOR_PSEUDO_CLASS }, { LAST_CHILD, CSS_SELECTOR_PSEUDO_CLASS }, { FIRST_OF_TYPE, CSS_SELECTOR_PSEUDO_CLASS }, { LAST_OF_TYPE, CSS_SELECTOR_PSEUDO_CLASS }, { ONLY_CHILD, CSS_SELECTOR_PSEUDO_CLASS }, { ONLY_OF_TYPE, CSS_SELECTOR_PSEUDO_CLASS }, { EMPTY, CSS_SELECTOR_PSEUDO_CLASS }, { TARGET, CSS_SELECTOR_PSEUDO_CLASS }, { ENABLED, CSS_SELECTOR_PSEUDO_CLASS }, { DISABLED, CSS_SELECTOR_PSEUDO_CLASS }, { CHECKED, CSS_SELECTOR_PSEUDO_CLASS }, { NOT, CSS_SELECTOR_PSEUDO_CLASS }, { FIRST_LINE, CSS_SELECTOR_PSEUDO_ELEMENT }, { FIRST_LETTER, CSS_SELECTOR_PSEUDO_ELEMENT }, { BEFORE, CSS_SELECTOR_PSEUDO_ELEMENT }, { AFTER, CSS_SELECTOR_PSEUDO_ELEMENT } }; css_selector_detail_value detail_value; css_selector_detail_value_type value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; css_qname qname; const css_token *token; bool match = false, require_element = false, negate = false; uint32_t lut_idx; css_selector_type type = CSS_SELECTOR_PSEUDO_CLASS;/* GCC's braindead */ css_error error; /* pseudo -> ':' ':'? [ IDENT | FUNCTION ws any1 ws ')' ] */ detail_value.string = NULL; token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ':') == false) return CSS_INVALID; /* Optional second colon before pseudo element names */ token = parserutils_vector_iterate(vector, ctx); if (token != NULL && tokenIsChar(token, ':')) { /* If present, we require a pseudo element */ require_element = true; /* Consume subsequent token */ token = parserutils_vector_iterate(vector, ctx); } /* Expect IDENT or FUNCTION */ if (token == NULL || (token->type != CSS_TOKEN_IDENT && token->type != CSS_TOKEN_FUNCTION)) return CSS_INVALID; qname.ns = NULL; qname.name = token->idata; /* Search lut for selector type */ for (lut_idx = 0; lut_idx < N_ELEMENTS(pseudo_lut); lut_idx++) { if ((lwc_string_caseless_isequal(qname.name, c->strings[pseudo_lut[lut_idx].index], &match) == lwc_error_ok) && match) { type = pseudo_lut[lut_idx].type; break; } } /* Not found: invalid */ if (lut_idx == N_ELEMENTS(pseudo_lut)) return CSS_INVALID; /* Required a pseudo element, but didn't find one: invalid */ if (require_element && type != CSS_SELECTOR_PSEUDO_ELEMENT) return CSS_INVALID; /* :not() and pseudo elements are not permitted in :not() */ if (in_not && (type == CSS_SELECTOR_PSEUDO_ELEMENT || pseudo_lut[lut_idx].index == NOT)) return CSS_INVALID; if (token->type == CSS_TOKEN_FUNCTION) { int fun_type = pseudo_lut[lut_idx].index; consumeWhitespace(vector, ctx); if (fun_type == LANG) { /* IDENT */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || token->type != CSS_TOKEN_IDENT) return CSS_INVALID; detail_value.string = token->idata; value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; consumeWhitespace(vector, ctx); } else if (fun_type == NTH_CHILD || fun_type == NTH_LAST_CHILD || fun_type == NTH_OF_TYPE || fun_type == NTH_LAST_OF_TYPE) { /* an + b */ error = parseNth(c, vector, ctx, &detail_value); if (error != CSS_OK) return error; value_type = CSS_SELECTOR_DETAIL_VALUE_NTH; } else if (fun_type == NOT) { /* type_selector | specific */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_IDENT || tokenIsChar(token, '*') || tokenIsChar(token, '|')) { /* Have type selector */ error = parseTypeSelector(c, vector, ctx, &qname); if (error != CSS_OK) return error; type = CSS_SELECTOR_ELEMENT; /* Ensure lwc insensitive string is available * for element names */ if (qname.name->insensitive == NULL && lwc__intern_caseless_string( qname.name) != lwc_error_ok) return CSS_NOMEM; detail_value.string = NULL; value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; } else { /* specific */ css_selector_detail det; error = parseSpecific(c, vector, ctx, true, &det); if (error != CSS_OK) return error; qname = det.qname; type = det.type; detail_value = det.value; value_type = det.value_type; } negate = true; consumeWhitespace(vector, ctx); } token = parserutils_vector_iterate(vector, ctx); if (token == NULL || tokenIsChar(token, ')') == false) return CSS_INVALID; } return css__stylesheet_selector_detail_init(c->sheet, type, &qname, detail_value, value_type, negate, specific); } css_error parseSpecific(css_language *c, const parserutils_vector *vector, int *ctx, bool in_not, css_selector_detail *specific) { css_error error; const css_token *token; /* specific -> [ HASH | class | attrib | pseudo ] */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_HASH) { css_qname qname; css_selector_detail_value detail_value; detail_value.string = NULL; qname.ns = NULL; qname.name = token->idata; /* Ensure lwc insensitive string is available for id names */ if (qname.name->insensitive == NULL && lwc__intern_caseless_string( qname.name) != lwc_error_ok) return CSS_NOMEM; error = css__stylesheet_selector_detail_init(c->sheet, CSS_SELECTOR_ID, &qname, detail_value, CSS_SELECTOR_DETAIL_VALUE_STRING, false, specific); if (error != CSS_OK) return error; parserutils_vector_iterate(vector, ctx); } else if (tokenIsChar(token, '.')) { error = parseClass(c, vector, ctx, specific); if (error != CSS_OK) return error; } else if (tokenIsChar(token, '[')) { error = parseAttrib(c, vector, ctx, specific); if (error != CSS_OK) return error; } else if (tokenIsChar(token, ':')) { error = parsePseudo(c, vector, ctx, in_not, specific); if (error != CSS_OK) return error; } else { return CSS_INVALID; } return CSS_OK; } css_error parseAppendSpecific(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent) { css_error error; css_selector_detail specific; error = parseSpecific(c, vector, ctx, false, &specific); if (error != CSS_OK) return error; return css__stylesheet_selector_append_specific(c->sheet, parent, &specific); } css_error parseSelectorSpecifics(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **parent) { css_error error; const css_token *token; /* specifics -> specific* */ while ((token = parserutils_vector_peek(vector, *ctx)) != NULL && token->type != CSS_TOKEN_S && tokenIsChar(token, '+') == false && tokenIsChar(token, '>') == false && tokenIsChar(token, '~') == false && tokenIsChar(token, ',') == false) { error = parseAppendSpecific(c, vector, ctx, parent); if (error != CSS_OK) return error; } return CSS_OK; } css_error parseTypeSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_qname *qname) { const css_token *token; css_error error; lwc_string *prefix = NULL; /* type_selector -> namespace_prefix? element_name * namespace_prefix -> [ IDENT | '*' ]? '|' * element_name -> IDENT | '*' */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (tokenIsChar(token, '|') == false) { prefix = token->idata; parserutils_vector_iterate(vector, ctx); token = parserutils_vector_peek(vector, *ctx); } if (token != NULL && tokenIsChar(token, '|')) { /* Have namespace prefix */ parserutils_vector_iterate(vector, ctx); /* Expect element_name */ token = parserutils_vector_iterate(vector, ctx); if (token == NULL || (token->type != CSS_TOKEN_IDENT && tokenIsChar(token, '*') == false)) { return CSS_INVALID; } error = lookupNamespace(c, prefix, &qname->ns); if (error != CSS_OK) return error; qname->name = token->idata; } else { /* No namespace prefix */ if (c->default_namespace == NULL) { qname->ns = c->strings[UNIVERSAL]; } else { qname->ns = c->default_namespace; } qname->name = prefix; } /* Ensure lwc insensitive string is available for element names */ if (qname->name->insensitive == NULL && lwc__intern_caseless_string( qname->name) != lwc_error_ok) return CSS_NOMEM; return CSS_OK; } css_error parseSimpleSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **result) { int orig_ctx = *ctx; css_error error; const css_token *token; css_selector *selector; css_qname qname; /* simple_selector -> type_selector specifics * -> specific specifics */ token = parserutils_vector_peek(vector, *ctx); if (token == NULL) return CSS_INVALID; if (token->type == CSS_TOKEN_IDENT || tokenIsChar(token, '*') || tokenIsChar(token, '|')) { /* Have type selector */ error = parseTypeSelector(c, vector, ctx, &qname); if (error != CSS_OK) { *ctx = orig_ctx; return error; } error = css__stylesheet_selector_create(c->sheet, &qname, &selector); if (error != CSS_OK) { *ctx = orig_ctx; return error; } } else { /* Universal selector */ if (c->default_namespace == NULL) qname.ns = c->strings[UNIVERSAL]; else qname.ns = c->default_namespace; qname.name = c->strings[UNIVERSAL]; error = css__stylesheet_selector_create(c->sheet, &qname, &selector); if (error != CSS_OK) return error; /* Ensure we have at least one specific selector */ error = parseAppendSpecific(c, vector, ctx, &selector); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); return error; } } error = parseSelectorSpecifics(c, vector, ctx, &selector); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); return error; } *result = selector; return CSS_OK; } css_error parseCombinator(css_language *c, const parserutils_vector *vector, int *ctx, css_combinator *result) { const css_token *token; css_combinator comb = CSS_COMBINATOR_NONE; /* combinator -> ws '+' ws | ws '>' ws | ws '~' ws | ws1 */ UNUSED(c); while ((token = parserutils_vector_peek(vector, *ctx)) != NULL) { if (tokenIsChar(token, '+')) comb = CSS_COMBINATOR_SIBLING; else if (tokenIsChar(token, '>')) comb = CSS_COMBINATOR_PARENT; else if (tokenIsChar(token, '~')) comb = CSS_COMBINATOR_GENERIC_SIBLING; else if (token->type == CSS_TOKEN_S) comb = CSS_COMBINATOR_ANCESTOR; else break; parserutils_vector_iterate(vector, ctx); /* If we've seen a '+', '>', or '~', we're done. */ if (comb != CSS_COMBINATOR_ANCESTOR) break; } /* No valid combinator found */ if (comb == CSS_COMBINATOR_NONE) return CSS_INVALID; /* Consume any trailing whitespace */ consumeWhitespace(vector, ctx); *result = comb; return CSS_OK; } css_error parseSelector(css_language *c, const parserutils_vector *vector, int *ctx, css_selector **result) { css_error error; const css_token *token = NULL; css_selector *selector = NULL; /* selector -> simple_selector [ combinator simple_selector ]* ws * * Note, however, that, as combinator can be wholly whitespace, * there's an ambiguity as to whether "ws" has been reached. We * resolve this by attempting to extract a combinator, then * recovering when we detect that we've reached the end of the * selector. */ error = parseSimpleSelector(c, vector, ctx, &selector); if (error != CSS_OK) return error; *result = selector; while ((token = parserutils_vector_peek(vector, *ctx)) != NULL && tokenIsChar(token, ',') == false) { css_combinator comb = CSS_COMBINATOR_NONE; css_selector *other = NULL; error = parseCombinator(c, vector, ctx, &comb); if (error != CSS_OK) return error; /* In the case of "html , body { ... }", the whitespace after * "html" and "body" will be considered an ancestor combinator. * This clearly is not the case, however. Therefore, as a * special case, if we've got an ancestor combinator and there * are no further tokens, or if the next token is a comma, * we ignore the supposed combinator and continue. */ if (comb == CSS_COMBINATOR_ANCESTOR && ((token = parserutils_vector_peek(vector, *ctx)) == NULL || tokenIsChar(token, ','))) continue; error = parseSimpleSelector(c, vector, ctx, &other); if (error != CSS_OK) return error; *result = other; error = css__stylesheet_selector_combine(c->sheet, comb, selector, other); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); return error; } selector = other; } return CSS_OK; } css_error parseSelectorList(css_language *c, const parserutils_vector *vector, css_rule *rule) { css_error error; const css_token *token = NULL; css_selector *selector = NULL; int ctx = 0; /* Strip any leading whitespace (can happen if in nested block) */ consumeWhitespace(vector, &ctx); /* selector_list -> selector [ ',' ws selector ]* */ error = parseSelector(c, vector, &ctx, &selector); if (error != CSS_OK) { if (selector != NULL) css__stylesheet_selector_destroy(c->sheet, selector); return error; } assert(selector != NULL); error = css__stylesheet_rule_add_selector(c->sheet, rule, selector); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); return error; } while (parserutils_vector_peek(vector, ctx) != NULL) { token = parserutils_vector_iterate(vector, &ctx); if (tokenIsChar(token, ',') == false) return CSS_INVALID; consumeWhitespace(vector, &ctx); selector = NULL; error = parseSelector(c, vector, &ctx, &selector); if (error != CSS_OK) { if (selector != NULL) { css__stylesheet_selector_destroy(c->sheet, selector); } return error; } assert(selector != NULL); error = css__stylesheet_rule_add_selector(c->sheet, rule, selector); if (error != CSS_OK) { css__stylesheet_selector_destroy(c->sheet, selector); return error; } } return CSS_OK; } /****************************************************************************** * Property parsing functions * ******************************************************************************/ css_error parseProperty(css_language *c, const css_token *property, const parserutils_vector *vector, int *ctx, css_rule *rule) { css_error error; css_prop_handler handler = NULL; int i = 0; uint8_t flags = 0; css_style *style = NULL; const css_token *token; /* Find property index */ /** \todo improve on this linear search */ for (i = FIRST_PROP; i <= LAST_PROP; i++) { bool match = false; if (lwc_string_caseless_isequal(property->idata, c->strings[i], &match) == lwc_error_ok && match) break; } if (i == LAST_PROP + 1) return CSS_INVALID; /* Get handler */ handler = property_handlers[i - FIRST_PROP]; assert(handler != NULL); /* allocate style */ error = css__stylesheet_style_create(c->sheet, &style); if (error != CSS_OK) return error; assert (style != NULL); /* Call the handler */ error = handler(c, vector, ctx, style); if (error != CSS_OK) { css__stylesheet_style_destroy(style); return error; } /* Determine if this declaration is important or not */ error = css__parse_important(c, vector, ctx, &flags); if (error != CSS_OK) { css__stylesheet_style_destroy(style); return error; } /* Ensure that we've exhausted all the input */ consumeWhitespace(vector, ctx); token = parserutils_vector_iterate(vector, ctx); if (token != NULL) { /* Trailing junk, so discard declaration */ css__stylesheet_style_destroy(style); return CSS_INVALID; } /* If it's important, then mark the style appropriately */ if (flags != 0) css__make_style_important(style); /* Append style to rule */ error = css__stylesheet_rule_append_style(c->sheet, rule, style); if (error != CSS_OK) { css__stylesheet_style_destroy(style); return error; } /* Style owned or destroyed by stylesheet, so forget about it */ return CSS_OK; } netsurf-all-3.2/libcss/src/stylesheet.c0000644000175000017500000012165312377676736017247 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include "stylesheet.h" #include "bytecode/bytecode.h" #include "parse/language.h" #include "utils/parserutilserror.h" #include "utils/utils.h" #include "select/dispatch.h" #include "select/font_face.h" static css_error _add_selectors(css_stylesheet *sheet, css_rule *rule); static css_error _remove_selectors(css_stylesheet *sheet, css_rule *rule); static size_t _rule_size(const css_rule *rule); /** * Add a string to a stylesheet's string vector. * * \param sheet The stylesheet to add string to. * \param string The string to add. * \param string_number Pointer to location to receive string number. * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion * * \post Ownership of \a string reference is passed to the stylesheet (even on failure) * \note The returned string number is guaranteed to be non-zero */ css_error css__stylesheet_string_add(css_stylesheet *sheet, lwc_string *string, uint32_t *string_number) { uint32_t new_string_number; /* The string number count */ /* search for the string in the existing vector */ for (new_string_number = 0; new_string_number < sheet->string_vector_c; new_string_number++) { lwc_error res; bool isequal; res = lwc_string_isequal(string, sheet->string_vector[new_string_number], &isequal); if (res != lwc_error_ok) { lwc_string_unref(string); return css_error_from_lwc_error(res); } if (isequal) { lwc_string_unref(string); *string_number = (new_string_number + 1); return CSS_OK; } } /* string does not exist in current vector, add a new one */ if (sheet->string_vector_c >= sheet->string_vector_l) { /* additional storage must be allocated to deal with * this request. */ lwc_string **new_vector; uint32_t new_vector_len; new_vector_len = sheet->string_vector_l + 256; new_vector = realloc(sheet->string_vector, new_vector_len * sizeof(lwc_string *)); if (new_vector == NULL) { lwc_string_unref(string); return CSS_NOMEM; } sheet->string_vector = new_vector; sheet->string_vector_l = new_vector_len; } sheet->string_vector_c++; sheet->string_vector[new_string_number] = string; *string_number = (new_string_number + 1); return CSS_OK; } /** * Get a string from a stylesheet's string vector. * * \param sheet The stylesheet to retrive string from. * \param string_number The string number to retrive. * \param string Pointer to location to receive string. * \return CSS_OK on success, * CSS_BADPARM on bad parameters, */ css_error css__stylesheet_string_get(css_stylesheet *sheet, uint32_t string_number, lwc_string **string) { /* External string numbers = index into vector + 1 */ string_number--; if (string_number > sheet->string_vector_c) { return CSS_BADPARM; } *string = sheet->string_vector[string_number]; return CSS_OK; } /** * Create a stylesheet * * \param params Stylesheet parameters * \param stylesheet Pointer to location to receive stylesheet * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css_stylesheet_create(const css_stylesheet_params *params, css_stylesheet **stylesheet) { css_parser_optparams optparams; css_error error; css_stylesheet *sheet; if (params == NULL || params->params_version != CSS_STYLESHEET_PARAMS_VERSION_1 || params->url == NULL || params->resolve == NULL || stylesheet == NULL) return CSS_BADPARM; sheet = calloc(1, sizeof(css_stylesheet)); if (sheet == NULL) return CSS_NOMEM; error = css__propstrings_get(&sheet->propstrings); if (error != CSS_OK) { free(sheet); return error; } sheet->inline_style = params->inline_style; if (params->inline_style) { error = css__parser_create_for_inline_style(params->charset, (params->charset != NULL) ? CSS_CHARSET_DICTATED : CSS_CHARSET_DEFAULT, &sheet->parser); } else { error = css__parser_create(params->charset, (params->charset != NULL) ? CSS_CHARSET_DICTATED : CSS_CHARSET_DEFAULT, &sheet->parser); } if (error != CSS_OK) { css__propstrings_unref(); free(sheet); return error; } sheet->quirks_allowed = params->allow_quirks; if (params->allow_quirks) { optparams.quirks = true; error = css__parser_setopt(sheet->parser, CSS_PARSER_QUIRKS, &optparams); if (error != CSS_OK) { css__parser_destroy(sheet->parser); css__propstrings_unref(); free(sheet); return error; } } sheet->level = params->level; error = css__language_create(sheet, sheet->parser, &sheet->parser_frontend); if (error != CSS_OK) { css__parser_destroy(sheet->parser); css__propstrings_unref(); free(sheet); return error; } error = css__selector_hash_create(&sheet->selectors); if (error != CSS_OK) { css__language_destroy(sheet->parser_frontend); css__parser_destroy(sheet->parser); css__propstrings_unref(); free(sheet); return error; } sheet->url = strdup(params->url); if (sheet->url == NULL) { css__selector_hash_destroy(sheet->selectors); css__language_destroy(sheet->parser_frontend); css__parser_destroy(sheet->parser); css__propstrings_unref(); free(sheet); return CSS_NOMEM; } if (params->title != NULL) { sheet->title = strdup(params->title); if (sheet->title == NULL) { free(sheet->url); css__selector_hash_destroy(sheet->selectors); css__language_destroy(sheet->parser_frontend); css__parser_destroy(sheet->parser); css__propstrings_unref(); free(sheet); return CSS_NOMEM; } } sheet->resolve = params->resolve; sheet->resolve_pw = params->resolve_pw; sheet->import = params->import; sheet->import_pw = params->import_pw; sheet->color = params->color; sheet->color_pw = params->color_pw; sheet->font = params->font; sheet->font_pw = params->font_pw; sheet->size = sizeof(css_stylesheet) + strlen(sheet->url); if (sheet->title != NULL) sheet->size += strlen(sheet->title); *stylesheet = sheet; return CSS_OK; } /** * Destroy a stylesheet * * \param sheet The stylesheet to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_destroy(css_stylesheet *sheet) { uint32_t index; css_rule *r, *s; if (sheet == NULL) return CSS_BADPARM; if (sheet->title != NULL) free(sheet->title); free(sheet->url); for (r = sheet->rule_list; r != NULL; r = s) { s = r->next; /* Detach from list */ r->parent = NULL; r->prev = NULL; r->next = NULL; css__stylesheet_rule_destroy(sheet, r); } css__selector_hash_destroy(sheet->selectors); /* These three may have been destroyed when parsing completed */ if (sheet->parser_frontend != NULL) css__language_destroy(sheet->parser_frontend); if (sheet->parser != NULL) css__parser_destroy(sheet->parser); if (sheet->cached_style != NULL) css__stylesheet_style_destroy(sheet->cached_style); /* destroy string vector */ for (index = 0; index < sheet->string_vector_c; index++) { lwc_string_unref(sheet->string_vector[index]); } if (sheet->string_vector != NULL) free(sheet->string_vector); css__propstrings_unref(); free(sheet); return CSS_OK; } /** * Append source data to a stylesheet * * \param sheet The stylesheet to append data to * \param data Pointer to data to append * \param len Length, in bytes, of data to append * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_append_data(css_stylesheet *sheet, const uint8_t *data, size_t len) { if (sheet == NULL || data == NULL) return CSS_BADPARM; if (sheet->parser == NULL) return CSS_INVALID; return css__parser_parse_chunk(sheet->parser, data, len); } /** * Flag that the last of a stylesheet's data has been seen * * \param sheet The stylesheet in question * \return CSS_OK on success, * CSS_IMPORTS_PENDING if there are imports pending, * appropriate error otherwise */ css_error css_stylesheet_data_done(css_stylesheet *sheet) { const css_rule *r; css_error error; if (sheet == NULL) return CSS_BADPARM; if (sheet->parser == NULL) return CSS_INVALID; error = css__parser_completed(sheet->parser); if (error != CSS_OK) return error; /* Destroy the parser, as it's no longer needed */ css__language_destroy(sheet->parser_frontend); css__parser_destroy(sheet->parser); sheet->parser_frontend = NULL; sheet->parser = NULL; /* If we have a cached style, drop it as we're done parsing. */ if (sheet->cached_style != NULL) { css__stylesheet_style_destroy(sheet->cached_style); sheet->cached_style = NULL; } /* Determine if there are any pending imports */ for (r = sheet->rule_list; r != NULL; r = r->next) { const css_rule_import *i = (const css_rule_import *) r; if (r->type != CSS_RULE_UNKNOWN && r->type != CSS_RULE_CHARSET && r->type != CSS_RULE_IMPORT) break; if (r->type == CSS_RULE_IMPORT && i->sheet == NULL) return CSS_IMPORTS_PENDING; } return CSS_OK; } /** * Retrieve the next pending import for the parent stylesheet * * \param parent Parent stylesheet * \param url Pointer to object to be populated with details of URL of * imported stylesheet (potentially relative) * \param media Pointer to location to receive applicable media types for * imported sheet, * \return CSS_OK on success, * CSS_INVALID if there are no pending imports remaining * * The client must resolve the absolute URL of the imported stylesheet, * using the parent's URL as the base. It must then fetch the imported * stylesheet, and parse it to completion, including fetching any stylesheets * it may import. The resultant sheet must then be registered with the * parent using css_stylesheet_register_import(). * * The client must then call this function again, to determine if there * are any further imports for the parent stylesheet, and, if so, * process them as described above. * * If the client is unable to fetch an imported stylesheet, it must * register an empty stylesheet with the parent in its place. */ css_error css_stylesheet_next_pending_import(css_stylesheet *parent, lwc_string **url, uint64_t *media) { const css_rule *r; if (parent == NULL || url == NULL || media == NULL) return CSS_BADPARM; for (r = parent->rule_list; r != NULL; r = r->next) { const css_rule_import *i = (const css_rule_import *) r; if (r->type != CSS_RULE_UNKNOWN && r->type != CSS_RULE_CHARSET && r->type != CSS_RULE_IMPORT) break; if (r->type == CSS_RULE_IMPORT && i->sheet == NULL) { *url = lwc_string_ref(i->url); *media = i->media; return CSS_OK; } } return CSS_INVALID; } /** * Register an imported stylesheet with its parent * * \param parent Parent stylesheet * \param import Imported sheet * \return CSS_OK on success, * CSS_INVALID if there are no outstanding imports, * appropriate error otherwise. * * Ownership of the imported stylesheet is retained by the client. */ css_error css_stylesheet_register_import(css_stylesheet *parent, css_stylesheet *import) { css_rule *r; if (parent == NULL || import == NULL) return CSS_BADPARM; for (r = parent->rule_list; r != NULL; r = r->next) { css_rule_import *i = (css_rule_import *) r; if (r->type != CSS_RULE_UNKNOWN && r->type != CSS_RULE_CHARSET && r->type != CSS_RULE_IMPORT) break; if (r->type == CSS_RULE_IMPORT && i->sheet == NULL) { i->sheet = import; return CSS_OK; } } return CSS_INVALID; } /** * Retrieve the language level of a stylesheet * * \param sheet The stylesheet to retrieve the language level of * \param level Pointer to location to receive language level * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_get_language_level(css_stylesheet *sheet, css_language_level *level) { if (sheet == NULL || level == NULL) return CSS_BADPARM; *level = sheet->level; return CSS_OK; } /** * Retrieve the URL associated with a stylesheet * * \param sheet The stylesheet to retrieve the URL from * \param url Pointer to location to receive pointer to URL * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url) { if (sheet == NULL || url == NULL) return CSS_BADPARM; *url = sheet->url; return CSS_OK; } /** * Retrieve the title associated with a stylesheet * * \param sheet The stylesheet to retrieve the title from * \param title Pointer to location to receive pointer to title * \return CSS_Ok on success, appropriate error otherwise */ css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title) { if (sheet == NULL || title == NULL) return CSS_BADPARM; *title = sheet->title; return CSS_OK; } /** * Determine whether quirky parsing was permitted on a stylesheet * * \param sheet The stylesheet to consider * \param quirks Pointer to location to receive quirkyness * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_quirks_allowed(css_stylesheet *sheet, bool *allowed) { if (sheet == NULL || allowed == NULL) return CSS_BADPARM; *allowed = sheet->quirks_allowed; return CSS_OK; } /** * Determine whether quirky parsing was used on a stylesheet * * \param sheet The stylesheet to consider * \param quirks Pointer to location to receive quirkyness * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_used_quirks(css_stylesheet *sheet, bool *quirks) { if (sheet == NULL || quirks == NULL) return CSS_BADPARM; *quirks = sheet->quirks_used; return CSS_OK; } /** * Get disabled status of a stylesheet * * \param sheet The stylesheet to consider * \param disabled Pointer to location to receive disabled state * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled) { if (sheet == NULL || disabled == NULL) return CSS_BADPARM; *disabled = sheet->disabled; return CSS_OK; } /** * Set a stylesheet's disabled state * * \param sheet The stylesheet to modify * \param disabled The new disabled state * \return CSS_OK on success, appropriate error otherwise */ css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled) { if (sheet == NULL) return CSS_BADPARM; sheet->disabled = disabled; /** \todo needs to trigger some event announcing styles have changed */ return CSS_OK; } /** * Determine the memory-resident size of a stylesheet * * \param sheet Sheet to consider * \param size Pointer to location to receive byte count * \return CSS_OK on success. * * \note The returned size will not include the size of interned strings * or imported stylesheets. */ css_error css_stylesheet_size(css_stylesheet *sheet, size_t *size) { size_t bytes = 0; css_error error; if (sheet == NULL || size == NULL) return CSS_BADPARM; bytes = sheet->size; /* Selector hash */ if (sheet->selectors != NULL) { size_t hash_size; error = css__selector_hash_size(sheet->selectors, &hash_size); if (error != CSS_OK) return error; bytes += hash_size; } *size = bytes; return CSS_OK; } /****************************************************************************** * Library-private API below here * ******************************************************************************/ /* Note, CSS_STYLE_DEFAULT_SIZE must be a power of 2 */ /* With a test set of NetSurf's homepage, BBC news, wikipedia, CNN, Ars, Google and El-Reg, * 16 seems to be a good medium between wastage and reallocs. */ #define CSS_STYLE_DEFAULT_SIZE 16 /** * Create a style * * \param sheet The stylesheet context * \param len The required length of the style * \param style Pointer to location to receive style * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__stylesheet_style_create(css_stylesheet *sheet, css_style **style) { css_style *s; if (sheet == NULL) return CSS_BADPARM; if (sheet->cached_style != NULL) { *style = sheet->cached_style; sheet->cached_style = NULL; return CSS_OK; } s = malloc(sizeof(css_style)); if (s == NULL) return CSS_NOMEM; s->bytecode = malloc(sizeof(css_code_t) * CSS_STYLE_DEFAULT_SIZE); if (s->bytecode == NULL) { free(s); /* do not leak */ return CSS_NOMEM; } s->allocated = CSS_STYLE_DEFAULT_SIZE; s->used = 0; s->sheet = sheet; *style = s; return CSS_OK; } css_error css__stylesheet_merge_style(css_style *target, css_style *style) { css_code_t *newcode; uint32_t newcode_len; if (target == NULL || style == NULL) return CSS_BADPARM; newcode_len = target->used + style->used ; if (newcode_len > target->allocated) { newcode_len += CSS_STYLE_DEFAULT_SIZE - 1; newcode_len &= ~(CSS_STYLE_DEFAULT_SIZE - 1); newcode = realloc(target->bytecode, newcode_len * sizeof(css_code_t)); if (newcode == NULL) return CSS_NOMEM; target->bytecode = newcode; target->allocated = newcode_len; } memcpy(target->bytecode + target->used, style->bytecode, style->used * sizeof(css_code_t)); target->used += style->used; return CSS_OK; } /** append one or more css code entries to a style */ css_error css__stylesheet_style_vappend(css_style *style, uint32_t style_count, ...) { va_list ap; css_error error = CSS_OK; css_code_t css_code; va_start(ap, style_count); while (style_count > 0) { css_code = va_arg(ap, css_code_t); error = css__stylesheet_style_append(style, css_code); if (error != CSS_OK) break; style_count--; } va_end(ap); return error; } /** append a css code entry to a style */ css_error css__stylesheet_style_append(css_style *style, css_code_t css_code) { if (style == NULL) return CSS_BADPARM; if (style->allocated == style->used) { /* space not available to append, extend allocation */ css_code_t *newcode; uint32_t newcode_len = style->allocated * 2; newcode = realloc(style->bytecode, sizeof(css_code_t) * newcode_len); if (newcode == NULL) return CSS_NOMEM; style->bytecode = newcode; style->allocated = newcode_len; } style->bytecode[style->used] = css_code; style->used++; return CSS_OK; } /** * Destroy a style * * \param sheet The stylesheet context * \param style The style to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_style_destroy(css_style *style) { css_stylesheet *sheet; if (style == NULL) return CSS_BADPARM; sheet = style->sheet; if (sheet->cached_style == NULL) { sheet->cached_style = style; style->used = 0; } else if (sheet->cached_style->allocated < style->allocated) { free(sheet->cached_style->bytecode); free(sheet->cached_style); sheet->cached_style = style; style->used = 0; } else { free(style->bytecode); free(style); } return CSS_OK; } /** * Create an element selector * * \param sheet The stylesheet context * \param qname Qualified name of selector * \param selector Pointer to location to receive selector object * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__stylesheet_selector_create(css_stylesheet *sheet, css_qname *qname, css_selector **selector) { css_selector *sel; if (sheet == NULL || qname == NULL || qname->name == NULL || selector == NULL) return CSS_BADPARM; sel = malloc(sizeof(css_selector)); if (sel == NULL) return CSS_NOMEM; memset(sel, 0, sizeof(css_selector)); sel->data.type = CSS_SELECTOR_ELEMENT; if (qname->ns != NULL) sel->data.qname.ns = lwc_string_ref(qname->ns); else sel->data.qname.ns = NULL; sel->data.qname.name = lwc_string_ref(qname->name); sel->data.value.string = NULL; sel->data.value_type = CSS_SELECTOR_DETAIL_VALUE_STRING; if (sheet->inline_style) { sel->specificity = CSS_SPECIFICITY_A; } else { /* Initial specificity -- 1 for an element, 0 for universal */ if (lwc_string_length(qname->name) != 1 || lwc_string_data(qname->name)[0] != '*') sel->specificity = CSS_SPECIFICITY_D; else sel->specificity = 0; } sel->data.comb = CSS_COMBINATOR_NONE; *selector = sel; return CSS_OK; } /** * Destroy a selector object * * \param sheet The stylesheet context * \param selector The selector to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_selector_destroy(css_stylesheet *sheet, css_selector *selector) { css_selector *c, *d; css_selector_detail *detail; if (sheet == NULL || selector == NULL) return CSS_BADPARM; /* Must not be attached to a rule */ assert(selector->rule == NULL); /* Destroy combinator chain */ for (c = selector->combinator; c != NULL; c = d) { d = c->combinator; for (detail = &c->data; detail;) { if (detail->qname.ns != NULL) lwc_string_unref(detail->qname.ns); lwc_string_unref(detail->qname.name); if (detail->value_type == CSS_SELECTOR_DETAIL_VALUE_STRING && detail->value.string != NULL) { lwc_string_unref(detail->value.string); } if (detail->next) detail++; else detail = NULL; } free(c); } for (detail = &selector->data; detail;) { if (detail->qname.ns != NULL) lwc_string_unref(detail->qname.ns); lwc_string_unref(detail->qname.name); if (detail->value_type == CSS_SELECTOR_DETAIL_VALUE_STRING && detail->value.string != NULL) { lwc_string_unref(detail->value.string); } if (detail->next) detail++; else detail = NULL; } /* Destroy this selector */ free(selector); return CSS_OK; } /** * Initialise a selector detail * * \param sheet The stylesheet context * \param type The type of selector to create * \param qname Qualified name of selector * \param value Value of selector * \param value_type Type of \a value * \param negate Whether the detail match should be negated * \param detail Pointer to detail object to initialise * \return CSS_OK on success, * CSS_BADPARM on bad parameters * * \note No strings are referenced at this point: they will be * referenced when appending the detail to a selector. */ css_error css__stylesheet_selector_detail_init(css_stylesheet *sheet, css_selector_type type, css_qname *qname, css_selector_detail_value value, css_selector_detail_value_type value_type, bool negate, css_selector_detail *detail) { if (sheet == NULL || qname == NULL || qname->name == NULL || detail == NULL) return CSS_BADPARM; memset(detail, 0, sizeof(css_selector_detail)); detail->type = type; detail->qname = *qname; detail->value = value; detail->value_type = value_type; detail->negate = negate; return CSS_OK; } /** * Append a selector to the specifics chain of another selector * * \param sheet The stylesheet context * \param parent Pointer to pointer to the parent selector (updated on exit) * \param specific The selector to append (copied) * \return CSS_OK on success, appropriate error otherwise. */ css_error css__stylesheet_selector_append_specific(css_stylesheet *sheet, css_selector **parent, const css_selector_detail *detail) { css_selector *temp; css_selector_detail *d; size_t num_details = 0; if (sheet == NULL || parent == NULL || *parent == NULL || detail == NULL) return CSS_BADPARM; /** \todo this may want optimising -- counting blocks is O(n) * In practice, however, n isn't likely to be large, so may be fine */ /* Count current number of detail blocks */ for (d = &(*parent)->data; d->next != 0; d++) num_details++; /* Grow selector by one detail block */ temp = realloc((*parent), sizeof(css_selector) + (num_details + 1) * sizeof(css_selector_detail)); if (temp == NULL) return CSS_NOMEM; /* Copy detail into empty block */ *(d = &(&temp->data)[num_details + 1]) = *detail; /* Flag that there's another block */ (&temp->data)[num_details].next = 1; /* Ref the strings */ if (detail->qname.ns != NULL) d->qname.ns = lwc_string_ref(detail->qname.ns); d->qname.name = lwc_string_ref(detail->qname.name); if (detail->value_type == CSS_SELECTOR_DETAIL_VALUE_STRING && detail->value.string != NULL) d->value.string = lwc_string_ref(detail->value.string); (*parent) = temp; /* Update parent's specificity */ switch (detail->type) { case CSS_SELECTOR_CLASS: case CSS_SELECTOR_PSEUDO_CLASS: case CSS_SELECTOR_ATTRIBUTE: case CSS_SELECTOR_ATTRIBUTE_EQUAL: case CSS_SELECTOR_ATTRIBUTE_DASHMATCH: case CSS_SELECTOR_ATTRIBUTE_INCLUDES: case CSS_SELECTOR_ATTRIBUTE_PREFIX: case CSS_SELECTOR_ATTRIBUTE_SUFFIX: case CSS_SELECTOR_ATTRIBUTE_SUBSTRING: (*parent)->specificity += CSS_SPECIFICITY_C; break; case CSS_SELECTOR_ID: (*parent)->specificity += CSS_SPECIFICITY_B; break; case CSS_SELECTOR_PSEUDO_ELEMENT: case CSS_SELECTOR_ELEMENT: (*parent)->specificity += CSS_SPECIFICITY_D; break; } return CSS_OK; } /** * Combine a pair of selectors * * \param sheet The stylesheet context * \param type The combinator type * \param a The first operand * \param b The second operand * \return CSS_OK on success, appropriate error otherwise. * * For example, given A + B, the combinator field of B would point at A, * with a combinator type of CSS_COMBINATOR_SIBLING. Thus, given B, we can * find its combinator. It is not possible to find B given A. */ css_error css__stylesheet_selector_combine(css_stylesheet *sheet, css_combinator type, css_selector *a, css_selector *b) { const css_selector_detail *det; if (sheet == NULL || a == NULL || b == NULL) return CSS_BADPARM; /* Ensure that there is no existing combinator on B */ assert(b->combinator == NULL); /* A must not contain a pseudo element */ for (det = &a->data; det != NULL; ) { if (det->type == CSS_SELECTOR_PSEUDO_ELEMENT) return CSS_INVALID; det = (det->next != 0) ? det + 1 : NULL; } b->combinator = a; b->data.comb = type; /* And propagate A's specificity to B */ b->specificity += a->specificity; return CSS_OK; } /** * Create a CSS rule * * \param sheet The stylesheet context * \param type The rule type * \param rule Pointer to location to receive rule object * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__stylesheet_rule_create(css_stylesheet *sheet, css_rule_type type, css_rule **rule) { css_rule *r; size_t required = 0; if (sheet == NULL || rule == NULL) return CSS_BADPARM; switch (type) { case CSS_RULE_UNKNOWN: required = sizeof(css_rule); break; case CSS_RULE_SELECTOR: required = sizeof(css_rule_selector); break; case CSS_RULE_CHARSET: required = sizeof(css_rule_charset); break; case CSS_RULE_IMPORT: required = sizeof(css_rule_import); break; case CSS_RULE_MEDIA: required = sizeof(css_rule_media); break; case CSS_RULE_FONT_FACE: required = sizeof(css_rule_font_face); break; case CSS_RULE_PAGE: required = sizeof(css_rule_page); break; } r = malloc(required); if (r == NULL) return CSS_NOMEM; memset(r, 0, required); r->type = type; *rule = r; return CSS_OK; } /** * Destroy a CSS rule * * \param sheet The stylesheet context * \param rule The rule to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_destroy(css_stylesheet *sheet, css_rule *rule) { if (sheet == NULL || rule == NULL) return CSS_BADPARM; /* Must be detached from parent/siblings */ assert(rule->parent == NULL && rule->next == NULL && rule->prev == NULL); /* Destroy type-specific contents */ switch (rule->type) { case CSS_RULE_UNKNOWN: break; case CSS_RULE_SELECTOR: { css_rule_selector *s = (css_rule_selector *) rule; uint32_t i; for (i = 0; i < rule->items; i++) { css_selector *sel = s->selectors[i]; /* Detach from rule */ sel->rule = NULL; css__stylesheet_selector_destroy(sheet, sel); } if (s->selectors != NULL) free(s->selectors); if (s->style != NULL) css__stylesheet_style_destroy(s->style); } break; case CSS_RULE_CHARSET: { css_rule_charset *charset = (css_rule_charset *) rule; lwc_string_unref(charset->encoding); } break; case CSS_RULE_IMPORT: { css_rule_import *import = (css_rule_import *) rule; lwc_string_unref(import->url); /* Do not destroy imported sheet: it is owned by the client */ } break; case CSS_RULE_MEDIA: { css_rule_media *media = (css_rule_media *) rule; css_rule *c, *d; for (c = media->first_child; c != NULL; c = d) { d = c->next; /* Detach from list */ c->parent = NULL; c->prev = NULL; c->next = NULL; css__stylesheet_rule_destroy(sheet, c); } } break; case CSS_RULE_FONT_FACE: { css_rule_font_face *font_face_r = (css_rule_font_face *) rule; if (font_face_r->font_face != NULL) css__font_face_destroy(font_face_r->font_face); } break; case CSS_RULE_PAGE: { css_rule_page *page = (css_rule_page *) rule; if (page->selector != NULL) { page->selector->rule = NULL; css__stylesheet_selector_destroy(sheet, page->selector); } if (page->style != NULL) css__stylesheet_style_destroy(page->style); } break; } /* Destroy rule */ free(rule); return CSS_OK; } /** * Add a selector to a CSS rule * * \param sheet The stylesheet context * \param rule The rule to add to (must be of type CSS_RULE_SELECTOR) * \param selector The selector to add * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_add_selector(css_stylesheet *sheet, css_rule *rule, css_selector *selector) { css_rule_selector *r = (css_rule_selector *) rule; css_selector **sels; if (sheet == NULL || rule == NULL || selector == NULL) return CSS_BADPARM; /* Ensure rule is a CSS_RULE_SELECTOR */ assert(rule->type == CSS_RULE_SELECTOR); sels = realloc(r->selectors, (r->base.items + 1) * sizeof(css_selector *)); if (sels == NULL) return CSS_NOMEM; /* Insert into rule's selector list */ sels[r->base.items] = selector; r->base.items++; r->selectors = sels; /* Set selector's rule field */ selector->rule = rule; return CSS_OK; } /** * Append a style to a CSS rule * * \param sheet The stylesheet context * \param rule The rule to add to (must be CSS_RULE_SELECTOR or CSS_RULE_PAGE) * \param style The style to add * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_append_style(css_stylesheet *sheet, css_rule *rule, css_style *style) { css_style *current_style; css_error error; if (sheet == NULL || rule == NULL || style == NULL) return CSS_BADPARM; assert(rule->type == CSS_RULE_SELECTOR || rule->type == CSS_RULE_PAGE); if (rule->type == CSS_RULE_SELECTOR) current_style = ((css_rule_selector *) rule)->style; else current_style = ((css_rule_page *) rule)->style; if (current_style != NULL) { error = css__stylesheet_merge_style(current_style, style); if (error != CSS_OK) return error; /* Done with style */ css__stylesheet_style_destroy(style); } else { /* No current style, so use this one */ current_style = style; /* Add to the sheet's size */ sheet->size += (style->used * sizeof(css_code_t)); } if (rule->type == CSS_RULE_SELECTOR) ((css_rule_selector *) rule)->style = current_style; else ((css_rule_page *) rule)->style = current_style; return CSS_OK; } /** * Set the charset of a CSS rule * * \param sheet The stylesheet context * \param rule The rule to add to (must be of type CSS_RULE_CHARSET) * \param charset The charset * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_set_charset(css_stylesheet *sheet, css_rule *rule, lwc_string *charset) { css_rule_charset *r = (css_rule_charset *) rule; if (sheet == NULL || rule == NULL || charset == NULL) return CSS_BADPARM; /* Ensure rule is a CSS_RULE_CHARSET */ assert(rule->type == CSS_RULE_CHARSET); /* Set rule's encoding field */ r->encoding = lwc_string_ref(charset); return CSS_OK; } /** * Set the necessary data to import a stylesheet associated with a rule * * \param sheet The stylesheet context * \param rule The rule to add to (must be of type CSS_RULE_IMPORT) * \param url The URL of the imported stylesheet * \param media The applicable media types for the imported stylesheet * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_set_nascent_import(css_stylesheet *sheet, css_rule *rule, lwc_string *url, uint64_t media) { css_rule_import *r = (css_rule_import *) rule; if (sheet == NULL || rule == NULL || url == NULL) return CSS_BADPARM; /* Ensure rule is a CSS_RULE_IMPORT */ assert(rule->type == CSS_RULE_IMPORT); /* Set the rule's sheet field */ r->url = lwc_string_ref(url); r->media = media; return CSS_OK; } /** * Set the media of an @media rule * * \param sheet The stylesheet context * \param rule The rule to add to (must be of type CSS_RULE_MEDIA) * \param media The applicable media types for the rule * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_set_media(css_stylesheet *sheet, css_rule *rule, uint64_t media) { css_rule_media *r = (css_rule_media *) rule; if (sheet == NULL || rule == NULL) return CSS_BADPARM; /* Ensure rule is a CSS_RULE_MEDIA */ assert(rule->type == CSS_RULE_MEDIA); /* Set the rule's media */ r->media = media; return CSS_OK; } /** * Set an @page rule selector * * \param sheet The stylesheet context * \param rule The rule to add to (must be of type CSS_RULE_PAGE) * \param selector The page selector * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_rule_set_page_selector(css_stylesheet *sheet, css_rule *rule, css_selector *selector) { css_rule_page *r = (css_rule_page *) rule; if (sheet == NULL || rule == NULL || selector == NULL) return CSS_BADPARM; /* Ensure rule is a CSS_RULE_PAGE */ assert(rule->type == CSS_RULE_PAGE); /** \todo validate selector */ /* Set the rule's selector */ r->selector = selector; /* Set selector's rule field */ selector->rule = rule; return CSS_OK; } /** * Add a rule to a stylesheet * * \param sheet The stylesheet to add to * \param rule The rule to add * \param parent The parent rule, or NULL for a top-level rule * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_add_rule(css_stylesheet *sheet, css_rule *rule, css_rule *parent) { css_error error; if (sheet == NULL || rule == NULL) return CSS_BADPARM; /* Need to fill in rule's index field before adding selectors * because selector chains consider the rule index for sort order */ rule->index = sheet->rule_count; /* Add any selectors to the hash */ error = _add_selectors(sheet, rule); if (error != CSS_OK) return error; /* Add to the sheet's size */ sheet->size += _rule_size(rule); if (parent != NULL) { css_rule_media *media = (css_rule_media *) parent; /* Parent must be an @media rule, or NULL */ assert(parent->type == CSS_RULE_MEDIA); /* Add rule to parent */ rule->ptype = CSS_RULE_PARENT_RULE; rule->parent = parent; sheet->rule_count++; if (media->last_child == NULL) { rule->prev = rule->next = NULL; media->first_child = media->last_child = rule; } else { media->last_child->next = rule; rule->prev = media->last_child; rule->next = NULL; media->last_child = rule; } } else { /* Add rule to sheet */ rule->ptype = CSS_RULE_PARENT_STYLESHEET; rule->parent = sheet; sheet->rule_count++; if (sheet->last_rule == NULL) { rule->prev = rule->next = NULL; sheet->rule_list = sheet->last_rule = rule; } else { sheet->last_rule->next = rule; rule->prev = sheet->last_rule; rule->next = NULL; sheet->last_rule = rule; } } /** \todo needs to trigger some event announcing styles have changed */ return CSS_OK; } /** * Remove a rule from a stylesheet * * \param sheet The sheet to remove from * \param rule The rule to remove * \return CSS_OK on success, appropriate error otherwise */ css_error css__stylesheet_remove_rule(css_stylesheet *sheet, css_rule *rule) { css_error error; if (sheet == NULL || rule == NULL) return CSS_BADPARM; error = _remove_selectors(sheet, rule); if (error != CSS_OK) return error; /* Reduce sheet's size */ sheet->size -= _rule_size(rule); if (rule->next == NULL) sheet->last_rule = rule->prev; else rule->next->prev = rule->prev; if (rule->prev == NULL) sheet->rule_list = rule->next; else rule->prev->next = rule->next; /* Invalidate linkage fields */ rule->parent = NULL; rule->prev = NULL; rule->next = NULL; /**\ todo renumber subsequent rules? may not be necessary, as there's * only an expectation that rules which occur later in the stylesheet * have a higher index than those that appear earlier. There's no * guarantee that the number space is continuous. */ /** \todo needs to trigger some event announcing styles have changed */ return CSS_OK; } /****************************************************************************** * Private API below here * ******************************************************************************/ /** * Add selectors in a rule to the hash * * \param sheet Stylesheet containing hash * \param rule Rule to consider * \return CSS_OK on success, appropriate error otherwise */ css_error _add_selectors(css_stylesheet *sheet, css_rule *rule) { css_error error; if (sheet == NULL || rule == NULL) return CSS_BADPARM; /* Rule must not be in sheet */ assert(rule->parent == NULL); switch (rule->type) { case CSS_RULE_SELECTOR: { css_rule_selector *s = (css_rule_selector *) rule; int32_t i; for (i = 0; i < rule->items; i++) { css_selector *sel = s->selectors[i]; error = css__selector_hash_insert( sheet->selectors, sel); if (error != CSS_OK) { /* Failed, revert our changes */ for (i--; i >= 0; i--) { sel = s->selectors[i]; /* Ignore errors */ css__selector_hash_remove( sheet->selectors, sel); } return error; } } } break; case CSS_RULE_MEDIA: { css_rule_media *m = (css_rule_media *) rule; css_rule *r; for (r = m->first_child; r != NULL; r = r->next) { error = _add_selectors(sheet, r); if (error != CSS_OK) { /* Failed, revert our changes */ for (r = r->prev; r != NULL; r = r->prev) { _remove_selectors(sheet, r); } return error; } } } break; } return CSS_OK; } /** * Remove selectors in a rule from the hash * * \param sheet Stylesheet containing hash * \param rule Rule to consider * \return CSS_OK on success, appropriate error otherwise */ css_error _remove_selectors(css_stylesheet *sheet, css_rule *rule) { css_error error; if (sheet == NULL || rule == NULL) return CSS_BADPARM; switch (rule->type) { case CSS_RULE_SELECTOR: { css_rule_selector *s = (css_rule_selector *) rule; int32_t i; for (i = 0; i < rule->items; i++) { css_selector *sel = s->selectors[i]; error = css__selector_hash_remove(sheet->selectors, sel); if (error != CSS_OK) return error; } } break; case CSS_RULE_MEDIA: { css_rule_media *m = (css_rule_media *) rule; css_rule *r; for (r = m->first_child; r != NULL; r = r->next) { error = _remove_selectors(sheet, r); if (error != CSS_OK) return error; } } break; } return CSS_OK; } /** * Calculate the size of a rule * * \param r Rule to consider * \return Size in bytes * * \note The returned size does not include interned strings. */ size_t _rule_size(const css_rule *r) { size_t bytes = 0; if (r->type == CSS_RULE_SELECTOR) { const css_rule_selector *rs = (const css_rule_selector *) r; uint32_t i; bytes += sizeof(css_rule_selector); /* Process selector chains */ bytes += r->items * sizeof(css_selector *); for (i = 0; i < r->items; i++) { const css_selector *s = rs->selectors[i]; do { const css_selector_detail *d = &s->data; bytes += sizeof(css_selector); while (d->next) { bytes += sizeof(css_selector_detail); d++; } s = s->combinator; } while (s != NULL); } if (rs->style != NULL) bytes += (rs->style->used * sizeof(css_code_t)); } else if (r->type == CSS_RULE_CHARSET) { bytes += sizeof(css_rule_charset); } else if (r->type == CSS_RULE_IMPORT) { bytes += sizeof(css_rule_import); } else if (r->type == CSS_RULE_MEDIA) { const css_rule_media *rm = (const css_rule_media *) r; const css_rule *c; bytes += sizeof(css_rule_media); /* Process children */ for (c = rm->first_child; c != NULL; c = c->next) bytes += _rule_size(c); } else if (r->type == CSS_RULE_FONT_FACE) { const css_rule_font_face *rf = (const css_rule_font_face *) r; bytes += sizeof(css_rule_font_face); if (rf->font_face != NULL) bytes += sizeof(css_font_face); } else if (r->type == CSS_RULE_PAGE) { const css_rule_page *rp = (const css_rule_page *) r; const css_selector *s = rp->selector; /* Process selector chain */ while (s != NULL) { const css_selector_detail *d = &s->data; bytes += sizeof(css_selector); while (d->next) { bytes += sizeof(css_selector_detail); d++; } s = s->combinator; } if (rp->style != NULL) bytes += (rp->style->used * sizeof(css_code_t)); } return bytes; } netsurf-all-3.2/libcss/src/utils/0000755000175000017500000000000012377713347016030 5ustar vincevincenetsurf-all-3.2/libcss/src/utils/errors.c0000644000175000017500000000216712377676736017530 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include /** * Convert a LibCSS error code to a string * * \param error The error code to convert * \return Pointer to string representation of error, or NULL if unknown. */ const char *css_error_to_string(css_error error) { const char *result = NULL; switch (error) { case CSS_OK: result = "No error"; break; case CSS_NOMEM: result = "Insufficient memory"; break; case CSS_BADPARM: result = "Bad parameter"; break; case CSS_INVALID: result = "Invalid input"; break; case CSS_FILENOTFOUND: result = "File not found"; break; case CSS_NEEDDATA: result = "Insufficient data"; break; case CSS_BADCHARSET: result = "BOM and @charset mismatch"; break; case CSS_EOF: result = "EOF encountered"; break; case CSS_IMPORTS_PENDING: result = "Imports pending"; break; case CSS_PROPERTY_NOT_SET: result = "Property not set"; break; } return result; } netsurf-all-3.2/libcss/src/utils/utils.c0000644000175000017500000000522312377676736017350 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007-9 John-Mark Bell */ #include "utils/utils.h" css_fixed css__number_from_lwc_string(lwc_string *string, bool int_only, size_t *consumed) { if (string == NULL || lwc_string_length(string) == 0 || consumed == NULL) return 0; return css__number_from_string( (uint8_t *)lwc_string_data(string), lwc_string_length(string), int_only, consumed); } css_fixed css__number_from_string(const uint8_t *data, size_t len, bool int_only, size_t *consumed) { const uint8_t *ptr = data; int sign = 1; int32_t intpart = 0; int32_t fracpart = 0; int32_t pwr = 1; if (data == NULL || len == 0 || consumed == NULL) return 0; /* number = [+-]? ([0-9]+ | [0-9]* '.' [0-9]+) */ /* Extract sign, if any */ if (ptr[0] == '-') { sign = -1; len--; ptr++; } else if (ptr[0] == '+') { len--; ptr++; } /* Ensure we have either a digit or a '.' followed by a digit */ if (len == 0) { *consumed = 0; return 0; } else { if (ptr[0] == '.') { if (len == 1 || ptr[1] < '0' || '9' < ptr[1]) { *consumed = 0; return 0; } } else if (ptr[0] < '0' || '9' < ptr[0]) { *consumed = 0; return 0; } } /* Now extract intpart, assuming base 10 */ while (len > 0) { /* Stop on first non-digit */ if (ptr[0] < '0' || '9' < ptr[0]) break; /* Prevent overflow of 'intpart'; proper clamping below */ if (intpart < (1 << 22)) { intpart *= 10; intpart += ptr[0] - '0'; } ptr++; len--; } /* And fracpart, again, assuming base 10 */ if (int_only == false && len > 1 && ptr[0] == '.' && ('0' <= ptr[1] && ptr[1] <= '9')) { ptr++; len--; while (len > 0) { if (ptr[0] < '0' || '9' < ptr[0]) break; if (pwr < 1000000) { pwr *= 10; fracpart *= 10; fracpart += ptr[0] - '0'; } ptr++; len--; } fracpart = ((1 << 10) * fracpart + pwr/2) / pwr; if (fracpart >= (1 << 10)) { intpart++; fracpart &= (1 << 10) - 1; } } *consumed = ptr - data; if (sign > 0) { /* If the result is larger than we can represent, * then clamp to the maximum value we can store. */ if (intpart >= (1 << 21)) { intpart = (1 << 21) - 1; fracpart = (1 << 10) - 1; } } else { /* If the negated result is smaller than we can represent * then clamp to the minimum value we can store. */ if (intpart >= (1 << 21)) { intpart = -(1 << 21); fracpart = 0; } else { intpart = -intpart; if (fracpart) { fracpart = (1 << 10) - fracpart; intpart--; } } } return (intpart << 10) | fracpart; } netsurf-all-3.2/libcss/src/utils/parserutilserror.h0000644000175000017500000000125512377676736021645 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef css_utils_parserutilserror_h_ #define css_utils_parserutilserror_h_ #include #include /** * Convert a ParserUtils error into a LibCSS error * * \param error The ParserUtils error to convert * \return The corresponding LibCSS error */ static inline css_error css_error_from_parserutils_error( parserutils_error error) { /* Currently, there's a 1:1 mapping, so we've nothing to do */ return (css_error) error; } #endif netsurf-all-3.2/libcss/src/utils/utils.h0000644000175000017500000000306212377676736017354 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007-8 John-Mark Bell */ #ifndef css_utils_h_ #define css_utils_h_ #include #include #include #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef SLEN /* Calculate length of a string constant */ #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ #endif #ifndef UNUSED #define UNUSED(x) ((x)=(x)) #endif #ifndef N_ELEMENTS #define N_ELEMENTS(x) (sizeof((x)) / sizeof((x)[0])) #endif css_fixed css__number_from_lwc_string(lwc_string *string, bool int_only, size_t *consumed); css_fixed css__number_from_string(const uint8_t *data, size_t len, bool int_only, size_t *consumed); static inline bool isDigit(uint8_t c) { return '0' <= c && c <= '9'; } static inline bool isHex(uint8_t c) { return isDigit(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); } static inline uint32_t charToHex(uint8_t c) { c -= '0'; if (c > 9) c -= 'A' - '9' - 1; if (c > 15) c -= 'a' - 'A'; return c; } static inline css_error css_error_from_lwc_error(lwc_error err) { switch (err) { case lwc_error_ok: return CSS_OK; case lwc_error_oom: return CSS_NOMEM; case lwc_error_range: return CSS_BADPARM; default: break; } return CSS_INVALID; } #endif netsurf-all-3.2/libcss/src/utils/Makefile0000644000175000017500000000011612377676736017500 0ustar vincevince# Sources DIR_SOURCES := errors.c utils.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/select/0000755000175000017500000000000012377713347016147 5ustar vincevincenetsurf-all-3.2/libcss/src/select/propget.h0000644000175000017500000012566712377676736020033 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_propget_h_ #define css_select_propget_h_ #include #include "computed.h" /* Important: keep this file in sync with computed.h */ /** \todo Is there a better way to ensure this happens? */ #define LETTER_SPACING_INDEX 0 #define LETTER_SPACING_SHIFT 2 #define LETTER_SPACING_MASK 0xfc static inline uint8_t get_letter_spacing( const css_computed_style *style, css_fixed *length, css_unit *unit) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[LETTER_SPACING_INDEX]; bits &= LETTER_SPACING_MASK; bits >>= LETTER_SPACING_SHIFT; /* 6bits: uuuutt : unit | type */ if ((bits & 3) == CSS_LETTER_SPACING_SET) { *length = style->uncommon->letter_spacing; *unit = bits >> 2; } return (bits & 3); } return CSS_LETTER_SPACING_NORMAL; } #undef LETTER_SPACING_MASK #undef LETTER_SPACING_SHIFT #undef LETTER_SPACING_INDEX #define OUTLINE_COLOR_INDEX 0 #define OUTLINE_COLOR_SHIFT 0 #define OUTLINE_COLOR_MASK 0x3 static inline uint8_t get_outline_color( const css_computed_style *style, css_color *color) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[OUTLINE_COLOR_INDEX]; bits &= OUTLINE_COLOR_MASK; bits >>= OUTLINE_COLOR_SHIFT; /* 2bits: tt : type */ if ((bits & 3) == CSS_OUTLINE_COLOR_COLOR) { *color = style->uncommon->outline_color; } return (bits & 3); } return CSS_OUTLINE_COLOR_INVERT; } #undef OUTLINE_COLOR_MASK #undef OUTLINE_COLOR_SHIFT #undef OUTLINE_COLOR_INDEX #define OUTLINE_WIDTH_INDEX 1 #define OUTLINE_WIDTH_SHIFT 1 #define OUTLINE_WIDTH_MASK 0xfe static inline uint8_t get_outline_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[OUTLINE_WIDTH_INDEX]; bits &= OUTLINE_WIDTH_MASK; bits >>= OUTLINE_WIDTH_SHIFT; /* 7bits: uuuuttt : unit | type */ if ((bits & 7) == CSS_OUTLINE_WIDTH_WIDTH) { *length = style->uncommon->outline_width; *unit = bits >> 3; } return (bits & 7); } *length = INTTOFIX(2); *unit = CSS_UNIT_PX; return CSS_OUTLINE_WIDTH_WIDTH; } #undef OUTLINE_WIDTH_MASK #undef OUTLINE_WIDTH_SHIFT #undef OUTLINE_WIDTH_INDEX #define BORDER_SPACING_INDEX 1 #define BORDER_SPACING_SHIFT 0 #define BORDER_SPACING_MASK 0x1 #define BORDER_SPACING_INDEX1 2 #define BORDER_SPACING_SHIFT1 0 #define BORDER_SPACING_MASK1 0xff static inline uint8_t get_border_spacing( const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[BORDER_SPACING_INDEX]; bits &= BORDER_SPACING_MASK; bits >>= BORDER_SPACING_SHIFT; /* 1 bit: type */ if (bits == CSS_BORDER_SPACING_SET) { uint8_t bits1 = style->uncommon->bits[BORDER_SPACING_INDEX1]; bits1 &= BORDER_SPACING_MASK1; bits1 >>= BORDER_SPACING_SHIFT1; /* 8bits: hhhhvvvv : hunit | vunit */ *hlength = style->uncommon->border_spacing[0]; *hunit = bits1 >> 4; *vlength = style->uncommon->border_spacing[1]; *vunit = bits1 & 0xf; } return bits; } else { *hlength = *vlength = 0; *hunit = *vunit = CSS_UNIT_PX; } return CSS_BORDER_SPACING_SET; } #undef BORDER_SPACING_MASK1 #undef BORDER_SPACING_SHIFT1 #undef BORDER_SPACING_INDEX1 #undef BORDER_SPACING_MASK #undef BORDER_SPACING_SHIFT #undef BORDER_SPACING_INDEX #define WORD_SPACING_INDEX 3 #define WORD_SPACING_SHIFT 2 #define WORD_SPACING_MASK 0xfc static inline uint8_t get_word_spacing( const css_computed_style *style, css_fixed *length, css_unit *unit) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[WORD_SPACING_INDEX]; bits &= WORD_SPACING_MASK; bits >>= WORD_SPACING_SHIFT; /* 6bits: uuuutt : unit | type */ if ((bits & 3) == CSS_WORD_SPACING_SET) { *length = style->uncommon->word_spacing; *unit = bits >> 2; } return (bits & 3); } return CSS_WORD_SPACING_NORMAL; } #undef WORD_SPACING_MASK #undef WORD_SPACING_SHIFT #undef WORD_SPACING_INDEX #define WRITING_MODE_INDEX 4 #define WRITING_MODE_MASK 0x6 #define WRITING_MODE_SHIFT 1 static inline uint8_t get_writing_mode( const css_computed_style *style) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[WRITING_MODE_INDEX]; bits &= WRITING_MODE_MASK; bits >>= WRITING_MODE_SHIFT; /* 2bits: type */ return bits; } return CSS_WRITING_MODE_HORIZONTAL_TB; } #undef WRITING_MODE_INDEX #undef WRITING_MODE_MASK #undef WRITING_MODE_SHIFT #define COUNTER_INCREMENT_INDEX 3 #define COUNTER_INCREMENT_SHIFT 1 #define COUNTER_INCREMENT_MASK 0x2 static inline uint8_t get_counter_increment( const css_computed_style *style, const css_computed_counter **counters) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[COUNTER_INCREMENT_INDEX]; bits &= COUNTER_INCREMENT_MASK; bits >>= COUNTER_INCREMENT_SHIFT; /* 1bit: type */ *counters = style->uncommon->counter_increment; return bits; } return CSS_COUNTER_INCREMENT_NONE; } #undef COUNTER_INCREMENT_MASK #undef COUNTER_INCREMENT_SHIFT #undef COUNTER_INCREMENT_INDEX #define COUNTER_RESET_INDEX 3 #define COUNTER_RESET_SHIFT 0 #define COUNTER_RESET_MASK 0x1 static inline uint8_t get_counter_reset( const css_computed_style *style, const css_computed_counter **counters) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[COUNTER_RESET_INDEX]; bits &= COUNTER_RESET_MASK; bits >>= COUNTER_RESET_SHIFT; /* 1bit: type */ *counters = style->uncommon->counter_reset; return bits; } return CSS_COUNTER_RESET_NONE; } #undef COUNTER_RESET_MASK #undef COUNTER_RESET_SHIFT #undef COUNTER_RESET_INDEX #define CURSOR_INDEX 4 #define CURSOR_SHIFT 3 #define CURSOR_MASK 0xf8 static inline uint8_t get_cursor( const css_computed_style *style, lwc_string ***urls) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[CURSOR_INDEX]; bits &= CURSOR_MASK; bits >>= CURSOR_SHIFT; /* 5bits: type */ *urls = style->uncommon->cursor; return bits; } return CSS_CURSOR_AUTO; } #undef CURSOR_MASK #undef CURSOR_SHIFT #undef CURSOR_INDEX #define CLIP_INDEX 7 #define CLIP_SHIFT 2 #define CLIP_MASK 0xfc #define CLIP_INDEX1 5 #define CLIP_SHIFT1 0 #define CLIP_MASK1 0xff #define CLIP_INDEX2 6 #define CLIP_SHIFT2 0 #define CLIP_MASK2 0xff static inline uint8_t get_clip( const css_computed_style *style, css_computed_clip_rect *rect) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[CLIP_INDEX]; bits &= CLIP_MASK; bits >>= CLIP_SHIFT; /* 6bits: trblyy : top | right | bottom | left | type */ if ((bits & 0x3) == CSS_CLIP_RECT) { uint8_t bits1; rect->left_auto = (bits & 0x4); rect->bottom_auto = (bits & 0x8); rect->right_auto = (bits & 0x10); rect->top_auto = (bits & 0x20); if (rect->top_auto == false || rect->right_auto == false) { /* 8bits: ttttrrrr : top | right */ bits1 = style->uncommon->bits[CLIP_INDEX1]; bits1 &= CLIP_MASK1; bits1 >>= CLIP_SHIFT1; } else { bits1 = 0; } rect->top = style->uncommon->clip[0]; rect->tunit = bits1 >> 4; rect->right = style->uncommon->clip[1]; rect->runit = bits1 & 0xf; if (rect->bottom_auto == false || rect->left_auto == false) { /* 8bits: bbbbllll : bottom | left */ bits1 = style->uncommon->bits[CLIP_INDEX2]; bits1 &= CLIP_MASK2; bits1 >>= CLIP_SHIFT2; } else { bits1 = 0; } rect->bottom = style->uncommon->clip[2]; rect->bunit = bits1 >> 4; rect->left = style->uncommon->clip[3]; rect->lunit = bits1 & 0xf; } return (bits & 0x3); } return CSS_CLIP_AUTO; } #undef CLIP_MASK2 #undef CLIP_SHIFT2 #undef CLIP_INDEX2 #undef CLIP_MASK1 #undef CLIP_SHIFT1 #undef CLIP_INDEX1 #undef CLIP_MASK #undef CLIP_SHIFT #undef CLIP_INDEX #define CONTENT_INDEX 7 #define CONTENT_SHIFT 0 #define CONTENT_MASK 0x3 static inline uint8_t get_content( const css_computed_style *style, const css_computed_content_item **content) { if (style->uncommon != NULL) { uint8_t bits = style->uncommon->bits[CONTENT_INDEX]; bits &= CONTENT_MASK; bits >>= CONTENT_SHIFT; /* 2bits: type */ *content = style->uncommon->content; return bits; } return CSS_CONTENT_NORMAL; } #undef CONTENT_MASK #undef CONTENT_SHIFT #undef CONTENT_INDEX #define VERTICAL_ALIGN_INDEX 0 #define VERTICAL_ALIGN_SHIFT 0 #define VERTICAL_ALIGN_MASK 0xff static inline uint8_t get_vertical_align( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[VERTICAL_ALIGN_INDEX]; bits &= VERTICAL_ALIGN_MASK; bits >>= VERTICAL_ALIGN_SHIFT; /* 8bits: uuuutttt : units | type */ if ((bits & 0xf) == CSS_VERTICAL_ALIGN_SET) { *length = style->vertical_align; *unit = bits >> 4; } return (bits & 0xf); } #undef VERTICAL_ALIGN_MASK #undef VERTICAL_ALIGN_SHIFT #undef VERTICAL_ALIGN_INDEX #define FONT_SIZE_INDEX 1 #define FONT_SIZE_SHIFT 0 #define FONT_SIZE_MASK 0xff static inline uint8_t get_font_size( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[FONT_SIZE_INDEX]; bits &= FONT_SIZE_MASK; bits >>= FONT_SIZE_SHIFT; /* 8bits: uuuutttt : units | type */ if ((bits & 0xf) == CSS_FONT_SIZE_DIMENSION) { *length = style->font_size; *unit = bits >> 4; } return (bits & 0xf); } #undef FONT_SIZE_MASK #undef FONT_SIZE_SHIFT #undef FONT_SIZE_INDEX #define BORDER_TOP_WIDTH_INDEX 2 #define BORDER_TOP_WIDTH_SHIFT 1 #define BORDER_TOP_WIDTH_MASK 0xfe static inline uint8_t get_border_top_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[BORDER_TOP_WIDTH_INDEX]; bits &= BORDER_TOP_WIDTH_MASK; bits >>= BORDER_TOP_WIDTH_SHIFT; /* 7bits: uuuuttt : units | type */ if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) { *length = style->border_width[0]; *unit = bits >> 3; } return (bits & 0x7); } #undef BORDER_TOP_WIDTH_MASK #undef BORDER_TOP_WIDTH_SHIFT #undef BORDER_TOP_WIDTH_INDEX #define BORDER_RIGHT_WIDTH_INDEX 3 #define BORDER_RIGHT_WIDTH_SHIFT 1 #define BORDER_RIGHT_WIDTH_MASK 0xfe static inline uint8_t get_border_right_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[BORDER_RIGHT_WIDTH_INDEX]; bits &= BORDER_RIGHT_WIDTH_MASK; bits >>= BORDER_RIGHT_WIDTH_SHIFT; /* 7bits: uuuuttt : units | type */ if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) { *length = style->border_width[1]; *unit = bits >> 3; } return (bits & 0x7); } #undef BORDER_RIGHT_WIDTH_MASK #undef BORDER_RIGHT_WIDTH_SHIFT #undef BORDER_RIGHT_WIDTH_INDEX #define BORDER_BOTTOM_WIDTH_INDEX 4 #define BORDER_BOTTOM_WIDTH_SHIFT 1 #define BORDER_BOTTOM_WIDTH_MASK 0xfe static inline uint8_t get_border_bottom_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[BORDER_BOTTOM_WIDTH_INDEX]; bits &= BORDER_BOTTOM_WIDTH_MASK; bits >>= BORDER_BOTTOM_WIDTH_SHIFT; /* 7bits: uuuuttt : units | type */ if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) { *length = style->border_width[2]; *unit = bits >> 3; } return (bits & 0x7); } #undef BORDER_BOTTOM_WIDTH_MASK #undef BORDER_BOTTOM_WIDTH_SHIFT #undef BORDER_BOTTOM_WIDTH_INDEX #define BORDER_LEFT_WIDTH_INDEX 5 #define BORDER_LEFT_WIDTH_SHIFT 1 #define BORDER_LEFT_WIDTH_MASK 0xfe static inline uint8_t get_border_left_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[BORDER_LEFT_WIDTH_INDEX]; bits &= BORDER_LEFT_WIDTH_MASK; bits >>= BORDER_LEFT_WIDTH_SHIFT; /* 7bits: uuuuttt : units | type */ if ((bits & 0x7) == CSS_BORDER_WIDTH_WIDTH) { *length = style->border_width[3]; *unit = bits >> 3; } return (bits & 0x7); } #undef BORDER_LEFT_WIDTH_MASK #undef BORDER_LEFT_WIDTH_SHIFT #undef BORDER_LEFT_WIDTH_INDEX #define BACKGROUND_IMAGE_INDEX 2 #define BACKGROUND_IMAGE_SHIFT 0 #define BACKGROUND_IMAGE_MASK 0x1 static inline uint8_t get_background_image( const css_computed_style *style, lwc_string **url) { uint8_t bits = style->bits[BACKGROUND_IMAGE_INDEX]; bits &= BACKGROUND_IMAGE_MASK; bits >>= BACKGROUND_IMAGE_SHIFT; /* 1bit: type */ *url = style->background_image; return bits; } #undef BACKGROUND_IMAGE_MASK #undef BACKGROUND_IMAGE_SHIFT #undef BACKGROUND_IMAGE_INDEX #define COLOR_INDEX 3 #define COLOR_SHIFT 0 #define COLOR_MASK 0x1 static inline uint8_t get_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[COLOR_INDEX]; bits &= COLOR_MASK; bits >>= COLOR_SHIFT; /* 1bit: type */ *color = style->color; return bits; } #undef COLOR_MASK #undef COLOR_SHIFT #undef COLOR_INDEX #define LIST_STYLE_IMAGE_INDEX 4 #define LIST_STYLE_IMAGE_SHIFT 0 #define LIST_STYLE_IMAGE_MASK 0x1 static inline uint8_t get_list_style_image( const css_computed_style *style, lwc_string **url) { uint8_t bits = style->bits[LIST_STYLE_IMAGE_INDEX]; bits &= LIST_STYLE_IMAGE_MASK; bits >>= LIST_STYLE_IMAGE_SHIFT; /* 1bit: type */ *url = style->list_style_image; return bits; } #undef LIST_STYLE_IMAGE_MASK #undef LIST_STYLE_IMAGE_SHIFT #undef LIST_STYLE_IMAGE_INDEX #define QUOTES_INDEX 5 #define QUOTES_SHIFT 0 #define QUOTES_MASK 0x1 static inline uint8_t get_quotes( const css_computed_style *style, lwc_string ***quotes) { uint8_t bits = style->bits[QUOTES_INDEX]; bits &= QUOTES_MASK; bits >>= QUOTES_SHIFT; /* 1bit: type */ *quotes = style->quotes; return bits; } #undef QUOTES_MASK #undef QUOTES_SHIFT #undef QUOTES_INDEX #define TOP_INDEX 6 #define TOP_SHIFT 2 #define TOP_MASK 0xfc static inline uint8_t get_top( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[TOP_INDEX]; bits &= TOP_MASK; bits >>= TOP_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_TOP_SET) { *length = style->top; *unit = bits >> 2; } return (bits & 0x3); } static inline uint8_t get_top_bits( const css_computed_style *style) { uint8_t bits = style->bits[TOP_INDEX]; bits &= TOP_MASK; bits >>= TOP_SHIFT; /* 6bits: uuuutt : units | type */ return bits; } #undef TOP_MASK #undef TOP_SHIFT #undef TOP_INDEX #define RIGHT_INDEX 7 #define RIGHT_SHIFT 2 #define RIGHT_MASK 0xfc static inline uint8_t get_right( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[RIGHT_INDEX]; bits &= RIGHT_MASK; bits >>= RIGHT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_RIGHT_SET) { *length = style->right; *unit = bits >> 2; } return (bits & 0x3); } static inline uint8_t get_right_bits( const css_computed_style *style) { uint8_t bits = style->bits[RIGHT_INDEX]; bits &= RIGHT_MASK; bits >>= RIGHT_SHIFT; /* 6bits: uuuutt : units | type */ return bits; } #undef RIGHT_MASK #undef RIGHT_SHIFT #undef RIGHT_INDEX #define BOTTOM_INDEX 8 #define BOTTOM_SHIFT 2 #define BOTTOM_MASK 0xfc static inline uint8_t get_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[BOTTOM_INDEX]; bits &= BOTTOM_MASK; bits >>= BOTTOM_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_BOTTOM_SET) { *length = style->bottom; *unit = bits >> 2; } return (bits & 0x3); } static inline uint8_t get_bottom_bits( const css_computed_style *style) { uint8_t bits = style->bits[BOTTOM_INDEX]; bits &= BOTTOM_MASK; bits >>= BOTTOM_SHIFT; /* 6bits: uuuutt : units | type */ return bits; } #undef BOTTOM_MASK #undef BOTTOM_SHIFT #undef BOTTOM_INDEX #define LEFT_INDEX 9 #define LEFT_SHIFT 2 #define LEFT_MASK 0xfc static inline uint8_t get_left( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[LEFT_INDEX]; bits &= LEFT_MASK; bits >>= LEFT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_LEFT_SET) { *length = style->left; *unit = bits >> 2; } return (bits & 0x3); } static inline uint8_t get_left_bits( const css_computed_style *style) { uint8_t bits = style->bits[LEFT_INDEX]; bits &= LEFT_MASK; bits >>= LEFT_SHIFT; /* 6bits: uuuutt : units | type */ return bits; } #undef LEFT_MASK #undef LEFT_SHIFT #undef LEFT_INDEX #define BORDER_TOP_COLOR_INDEX 6 #define BORDER_TOP_COLOR_SHIFT 0 #define BORDER_TOP_COLOR_MASK 0x3 static inline uint8_t get_border_top_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[BORDER_TOP_COLOR_INDEX]; bits &= BORDER_TOP_COLOR_MASK; bits >>= BORDER_TOP_COLOR_SHIFT; /* 2bits: type */ *color = style->border_color[0]; return bits; } #undef BORDER_TOP_COLOR_MASK #undef BORDER_TOP_COLOR_SHIFT #undef BORDER_TOP_COLOR_INDEX #define BORDER_RIGHT_COLOR_INDEX 7 #define BORDER_RIGHT_COLOR_SHIFT 0 #define BORDER_RIGHT_COLOR_MASK 0x3 static inline uint8_t get_border_right_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[BORDER_RIGHT_COLOR_INDEX]; bits &= BORDER_RIGHT_COLOR_MASK; bits >>= BORDER_RIGHT_COLOR_SHIFT; /* 2bits: type */ *color = style->border_color[1]; return bits; } #undef BORDER_RIGHT_COLOR_MASK #undef BORDER_RIGHT_COLOR_SHIFT #undef BORDER_RIGHT_COLOR_INDEX #define BORDER_BOTTOM_COLOR_INDEX 8 #define BORDER_BOTTOM_COLOR_SHIFT 0 #define BORDER_BOTTOM_COLOR_MASK 0x3 static inline uint8_t get_border_bottom_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[BORDER_BOTTOM_COLOR_INDEX]; bits &= BORDER_BOTTOM_COLOR_MASK; bits >>= BORDER_BOTTOM_COLOR_SHIFT; /* 2bits: type */ *color = style->border_color[2]; return bits; } #undef BORDER_BOTTOM_COLOR_MASK #undef BORDER_BOTTOM_COLOR_SHIFT #undef BORDER_BOTTOM_COLOR_INDEX #define BORDER_LEFT_COLOR_INDEX 9 #define BORDER_LEFT_COLOR_SHIFT 0 #define BORDER_LEFT_COLOR_MASK 0x3 static inline uint8_t get_border_left_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[BORDER_LEFT_COLOR_INDEX]; bits &= BORDER_LEFT_COLOR_MASK; bits >>= BORDER_LEFT_COLOR_SHIFT; /* 2bits: type */ *color = style->border_color[3]; return bits; } #undef BORDER_LEFT_COLOR_MASK #undef BORDER_LEFT_COLOR_SHIFT #undef BORDER_LEFT_COLOR_INDEX #define HEIGHT_INDEX 10 #define HEIGHT_SHIFT 2 #define HEIGHT_MASK 0xfc static inline uint8_t get_height( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[HEIGHT_INDEX]; bits &= HEIGHT_MASK; bits >>= HEIGHT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_HEIGHT_SET) { *length = style->height; *unit = bits >> 2; } return (bits & 0x3); } #undef HEIGHT_MASK #undef HEIGHT_SHIFT #undef HEIGHT_INDEX #define LINE_HEIGHT_INDEX 11 #define LINE_HEIGHT_SHIFT 2 #define LINE_HEIGHT_MASK 0xfc static inline uint8_t get_line_height( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[LINE_HEIGHT_INDEX]; bits &= LINE_HEIGHT_MASK; bits >>= LINE_HEIGHT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_LINE_HEIGHT_NUMBER || (bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) { *length = style->line_height; } if ((bits & 0x3) == CSS_LINE_HEIGHT_DIMENSION) { *unit = bits >> 2; } return (bits & 0x3); } #undef LINE_HEIGHT_MASK #undef LINE_HEIGHT_SHIFT #undef LINE_HEIGHT_INDEX #define BACKGROUND_COLOR_INDEX 10 #define BACKGROUND_COLOR_SHIFT 0 #define BACKGROUND_COLOR_MASK 0x3 static inline uint8_t get_background_color( const css_computed_style *style, css_color *color) { uint8_t bits = style->bits[BACKGROUND_COLOR_INDEX]; bits &= BACKGROUND_COLOR_MASK; bits >>= BACKGROUND_COLOR_SHIFT; /* 2bits: type */ *color = style->background_color; return bits; } #undef BACKGROUND_COLOR_MASK #undef BACKGROUND_COLOR_SHIFT #undef BACKGROUND_COLOR_INDEX #define Z_INDEX_INDEX 11 #define Z_INDEX_SHIFT 0 #define Z_INDEX_MASK 0x3 static inline uint8_t get_z_index( const css_computed_style *style, int32_t *z_index) { uint8_t bits = style->bits[Z_INDEX_INDEX]; bits &= Z_INDEX_MASK; bits >>= Z_INDEX_SHIFT; /* 2bits: type */ *z_index = style->z_index; return bits; } #undef Z_INDEX_MASK #undef Z_INDEX_SHIFT #undef Z_INDEX_INDEX #define MARGIN_TOP_INDEX 12 #define MARGIN_TOP_SHIFT 2 #define MARGIN_TOP_MASK 0xfc static inline uint8_t get_margin_top( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MARGIN_TOP_INDEX]; bits &= MARGIN_TOP_MASK; bits >>= MARGIN_TOP_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MARGIN_SET) { *length = style->margin[0]; *unit = bits >> 2; } return (bits & 0x3); } #undef MARGIN_TOP_MASK #undef MARGIN_TOP_SHIFT #undef MARGIN_TOP_INDEX #define MARGIN_RIGHT_INDEX 13 #define MARGIN_RIGHT_SHIFT 2 #define MARGIN_RIGHT_MASK 0xfc static inline uint8_t get_margin_right( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MARGIN_RIGHT_INDEX]; bits &= MARGIN_RIGHT_MASK; bits >>= MARGIN_RIGHT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MARGIN_SET) { *length = style->margin[1]; *unit = bits >> 2; } return (bits & 0x3); } #undef MARGIN_RIGHT_MASK #undef MARGIN_RIGHT_SHIFT #undef MARGIN_RIGHT_INDEX #define MARGIN_BOTTOM_INDEX 14 #define MARGIN_BOTTOM_SHIFT 2 #define MARGIN_BOTTOM_MASK 0xfc static inline uint8_t get_margin_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MARGIN_BOTTOM_INDEX]; bits &= MARGIN_BOTTOM_MASK; bits >>= MARGIN_BOTTOM_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MARGIN_SET) { *length = style->margin[2]; *unit = bits >> 2; } return (bits & 0x3); } #undef MARGIN_BOTTOM_MASK #undef MARGIN_BOTTOM_SHIFT #undef MARGIN_BOTTOM_INDEX #define MARGIN_LEFT_INDEX 15 #define MARGIN_LEFT_SHIFT 2 #define MARGIN_LEFT_MASK 0xfc static inline uint8_t get_margin_left( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MARGIN_LEFT_INDEX]; bits &= MARGIN_LEFT_MASK; bits >>= MARGIN_LEFT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MARGIN_SET) { *length = style->margin[3]; *unit = bits >> 2; } return (bits & 0x3); } #undef MARGIN_LEFT_MASK #undef MARGIN_LEFT_SHIFT #undef MARGIN_LEFT_INDEX #define BACKGROUND_ATTACHMENT_INDEX 12 #define BACKGROUND_ATTACHMENT_SHIFT 0 #define BACKGROUND_ATTACHMENT_MASK 0x3 static inline uint8_t get_background_attachment( const css_computed_style *style) { uint8_t bits = style->bits[BACKGROUND_ATTACHMENT_INDEX]; bits &= BACKGROUND_ATTACHMENT_MASK; bits >>= BACKGROUND_ATTACHMENT_SHIFT; /* 2bits: type */ return bits; } #undef BACKGROUND_ATTACHMENT_MASK #undef BACKGROUND_ATTACHMENT_SHIFT #undef BACKGROUND_ATTACHMENT_INDEX #define BORDER_COLLAPSE_INDEX 13 #define BORDER_COLLAPSE_SHIFT 0 #define BORDER_COLLAPSE_MASK 0x3 static inline uint8_t get_border_collapse( const css_computed_style *style) { uint8_t bits = style->bits[BORDER_COLLAPSE_INDEX]; bits &= BORDER_COLLAPSE_MASK; bits >>= BORDER_COLLAPSE_SHIFT; /* 2bits: type */ return bits; } #undef BORDER_COLLAPSE_MASK #undef BORDER_COLLAPSE_SHIFT #undef BORDER_COLLAPSE_INDEX #define CAPTION_SIDE_INDEX 14 #define CAPTION_SIDE_SHIFT 0 #define CAPTION_SIDE_MASK 0x3 static inline uint8_t get_caption_side( const css_computed_style *style) { uint8_t bits = style->bits[CAPTION_SIDE_INDEX]; bits &= CAPTION_SIDE_MASK; bits >>= CAPTION_SIDE_SHIFT; /* 2bits: type */ return bits; } #undef CAPTION_SIDE_MASK #undef CAPTION_SIDE_SHIFT #undef CAPTION_SIDE_INDEX #define DIRECTION_INDEX 15 #define DIRECTION_SHIFT 0 #define DIRECTION_MASK 0x3 static inline uint8_t get_direction( const css_computed_style *style) { uint8_t bits = style->bits[DIRECTION_INDEX]; bits &= DIRECTION_MASK; bits >>= DIRECTION_SHIFT; /* 2bits: type */ return bits; } #undef DIRECTION_MASK #undef DIRECTION_SHIFT #undef DIRECTION_INDEX #define MAX_HEIGHT_INDEX 16 #define MAX_HEIGHT_SHIFT 2 #define MAX_HEIGHT_MASK 0xfc static inline uint8_t get_max_height( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MAX_HEIGHT_INDEX]; bits &= MAX_HEIGHT_MASK; bits >>= MAX_HEIGHT_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MAX_HEIGHT_SET) { *length = style->max_height; *unit = bits >> 2; } return (bits & 0x3); } #undef MAX_HEIGHT_MASK #undef MAX_HEIGHT_SHIFT #undef MAX_HEIGHT_INDEX #define MAX_WIDTH_INDEX 17 #define MAX_WIDTH_SHIFT 2 #define MAX_WIDTH_MASK 0xfc static inline uint8_t get_max_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MAX_WIDTH_INDEX]; bits &= MAX_WIDTH_MASK; bits >>= MAX_WIDTH_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_MAX_WIDTH_SET) { *length = style->max_width; *unit = bits >> 2; } return (bits & 0x3); } #undef MAX_WIDTH_MASK #undef MAX_WIDTH_SHIFT #undef MAX_WIDTH_INDEX #define WIDTH_INDEX 18 #define WIDTH_SHIFT 2 #define WIDTH_MASK 0xfc static inline uint8_t get_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[WIDTH_INDEX]; bits &= WIDTH_MASK; bits >>= WIDTH_SHIFT; /* 6bits: uuuutt : units | type */ if ((bits & 0x3) == CSS_WIDTH_SET) { *length = style->width; *unit = bits >> 2; } return (bits & 0x3); } #undef WIDTH_MASK #undef WIDTH_SHIFT #undef WIDTH_INDEX #define EMPTY_CELLS_INDEX 16 #define EMPTY_CELLS_SHIFT 0 #define EMPTY_CELLS_MASK 0x3 static inline uint8_t get_empty_cells( const css_computed_style *style) { uint8_t bits = style->bits[EMPTY_CELLS_INDEX]; bits &= EMPTY_CELLS_MASK; bits >>= EMPTY_CELLS_SHIFT; /* 2bits: type */ return bits; } #undef EMPTY_CELLS_MASK #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_INDEX #define FLOAT_INDEX 17 #define FLOAT_SHIFT 0 #define FLOAT_MASK 0x3 static inline uint8_t get_float( const css_computed_style *style) { uint8_t bits = style->bits[FLOAT_INDEX]; bits &= FLOAT_MASK; bits >>= FLOAT_SHIFT; /* 2bits: type */ return bits; } #undef FLOAT_MASK #undef FLOAT_SHIFT #undef FLOAT_INDEX #define FONT_STYLE_INDEX 18 #define FONT_STYLE_SHIFT 0 #define FONT_STYLE_MASK 0x3 static inline uint8_t get_font_style( const css_computed_style *style) { uint8_t bits = style->bits[FONT_STYLE_INDEX]; bits &= FONT_STYLE_MASK; bits >>= FONT_STYLE_SHIFT; /* 2bits: type */ return bits; } #undef FONT_STYLE_MASK #undef FONT_STYLE_SHIFT #undef FONT_STYLE_INDEX #define MIN_HEIGHT_INDEX 19 #define MIN_HEIGHT_SHIFT 3 #define MIN_HEIGHT_MASK 0xf8 static inline uint8_t get_min_height( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MIN_HEIGHT_INDEX]; bits &= MIN_HEIGHT_MASK; bits >>= MIN_HEIGHT_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_MIN_HEIGHT_SET) { *length = style->min_height; *unit = bits >> 1; } return (bits & 0x1); } #undef MIN_HEIGHT_MASK #undef MIN_HEIGHT_SHIFT #undef MIN_HEIGHT_INDEX #define MIN_WIDTH_INDEX 20 #define MIN_WIDTH_SHIFT 3 #define MIN_WIDTH_MASK 0xf8 static inline uint8_t get_min_width( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[MIN_WIDTH_INDEX]; bits &= MIN_WIDTH_MASK; bits >>= MIN_WIDTH_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_MIN_WIDTH_SET) { *length = style->min_width; *unit = bits >> 1; } return (bits & 0x1); } #undef MIN_WIDTH_MASK #undef MIN_WIDTH_SHIFT #undef MIN_WIDTH_INDEX #define BACKGROUND_REPEAT_INDEX 19 #define BACKGROUND_REPEAT_SHIFT 0 #define BACKGROUND_REPEAT_MASK 0x7 static inline uint8_t get_background_repeat( const css_computed_style *style) { uint8_t bits = style->bits[BACKGROUND_REPEAT_INDEX]; bits &= BACKGROUND_REPEAT_MASK; bits >>= BACKGROUND_REPEAT_SHIFT; /* 3bits: type */ return bits; } #undef BACKGROUND_REPEAT_MASK #undef BACKGROUND_REPEAT_SHIFT #undef BACKGROUND_REPEAT_INDEX #define CLEAR_INDEX 20 #define CLEAR_SHIFT 0 #define CLEAR_MASK 0x7 static inline uint8_t get_clear( const css_computed_style *style) { uint8_t bits = style->bits[CLEAR_INDEX]; bits &= CLEAR_MASK; bits >>= CLEAR_SHIFT; /* 3bits: type */ return bits; } #undef CLEAR_MASK #undef CLEAR_SHIFT #undef CLEAR_INDEX #define PADDING_TOP_INDEX 21 #define PADDING_TOP_SHIFT 3 #define PADDING_TOP_MASK 0xf8 static inline uint8_t get_padding_top( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[PADDING_TOP_INDEX]; bits &= PADDING_TOP_MASK; bits >>= PADDING_TOP_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_PADDING_SET) { *length = style->padding[0]; *unit = bits >> 1; } return (bits & 0x1); } #undef PADDING_TOP_MASK #undef PADDING_TOP_SHIFT #undef PADDING_TOP_INDEX #define PADDING_RIGHT_INDEX 22 #define PADDING_RIGHT_SHIFT 3 #define PADDING_RIGHT_MASK 0xf8 static inline uint8_t get_padding_right( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[PADDING_RIGHT_INDEX]; bits &= PADDING_RIGHT_MASK; bits >>= PADDING_RIGHT_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_PADDING_SET) { *length = style->padding[1]; *unit = bits >> 1; } return (bits & 0x1); } #undef PADDING_RIGHT_MASK #undef PADDING_RIGHT_SHIFT #undef PADDING_RIGHT_INDEX #define PADDING_BOTTOM_INDEX 23 #define PADDING_BOTTOM_SHIFT 3 #define PADDING_BOTTOM_MASK 0xf8 static inline uint8_t get_padding_bottom( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[PADDING_BOTTOM_INDEX]; bits &= PADDING_BOTTOM_MASK; bits >>= PADDING_BOTTOM_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_PADDING_SET) { *length = style->padding[2]; *unit = bits >> 1; } return (bits & 0x1); } #undef PADDING_BOTTOM_MASK #undef PADDING_BOTTOM_SHIFT #undef PADDING_BOTTOM_INDEX #define PADDING_LEFT_INDEX 24 #define PADDING_LEFT_SHIFT 3 #define PADDING_LEFT_MASK 0xf8 static inline uint8_t get_padding_left( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[PADDING_LEFT_INDEX]; bits &= PADDING_LEFT_MASK; bits >>= PADDING_LEFT_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_PADDING_SET) { *length = style->padding[3]; *unit = bits >> 1; } return (bits & 0x1); } #undef PADDING_LEFT_MASK #undef PADDING_LEFT_SHIFT #undef PADDING_LEFT_INDEX #define OVERFLOW_X_INDEX 21 #define OVERFLOW_X_SHIFT 0 #define OVERFLOW_X_MASK 0x7 static inline uint8_t get_overflow_x( const css_computed_style *style) { uint8_t bits = style->bits[OVERFLOW_X_INDEX]; bits &= OVERFLOW_X_MASK; bits >>= OVERFLOW_X_SHIFT; /* 3bits: type */ return bits; } #undef OVERFLOW_X_MASK #undef OVERFLOW_X_SHIFT #undef OVERFLOW_X_INDEX #define OVERFLOW_Y_INDEX 34 #define OVERFLOW_Y_SHIFT 5 #define OVERFLOW_Y_MASK 0xe0 static inline uint8_t get_overflow_y( const css_computed_style *style) { uint8_t bits = style->bits[OVERFLOW_Y_INDEX]; bits &= OVERFLOW_Y_MASK; bits >>= OVERFLOW_Y_SHIFT; /* 3bits: type */ return bits; } #undef OVERFLOW_Y_MASK #undef OVERFLOW_Y_SHIFT #undef OVERFLOW_Y_INDEX #define POSITION_INDEX 22 #define POSITION_SHIFT 0 #define POSITION_MASK 0x7 static inline uint8_t get_position( const css_computed_style *style) { uint8_t bits = style->bits[POSITION_INDEX]; bits &= POSITION_MASK; bits >>= POSITION_SHIFT; /* 3bits: type */ return bits; } #undef POSITION_MASK #undef POSITION_SHIFT #undef POSITION_INDEX #define OPACITY_INDEX 23 #define OPACITY_SHIFT 2 #define OPACITY_MASK 0x04 static inline uint8_t get_opacity( const css_computed_style *style, css_fixed *opacity) { uint8_t bits = style->bits[OPACITY_INDEX]; bits &= OPACITY_MASK; bits >>= OPACITY_SHIFT; /* 1bit: t : type */ if ((bits & 0x1) == CSS_OPACITY_SET) { *opacity = style->opacity; } return (bits & 0x1); } #undef OPACITY_MASK #undef OPACITY_SHIFT #undef OPACITY_INDEX #define TEXT_TRANSFORM_INDEX 24 #define TEXT_TRANSFORM_SHIFT 0 #define TEXT_TRANSFORM_MASK 0x7 static inline uint8_t get_text_transform( const css_computed_style *style) { uint8_t bits = style->bits[TEXT_TRANSFORM_INDEX]; bits &= TEXT_TRANSFORM_MASK; bits >>= TEXT_TRANSFORM_SHIFT; /* 3bits: type */ return bits; } #undef TEXT_TRANSFORM_MASK #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_INDEX #define TEXT_INDENT_INDEX 25 #define TEXT_INDENT_SHIFT 3 #define TEXT_INDENT_MASK 0xf8 static inline uint8_t get_text_indent( const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t bits = style->bits[TEXT_INDENT_INDEX]; bits &= TEXT_INDENT_MASK; bits >>= TEXT_INDENT_SHIFT; /* 5bits: uuuut : units | type */ if ((bits & 0x1) == CSS_TEXT_INDENT_SET) { *length = style->text_indent; *unit = bits >> 1; } return (bits & 0x1); } #undef TEXT_INDENT_MASK #undef TEXT_INDENT_SHIFT #undef TEXT_INDENT_INDEX #define WHITE_SPACE_INDEX 25 #define WHITE_SPACE_SHIFT 0 #define WHITE_SPACE_MASK 0x7 static inline uint8_t get_white_space( const css_computed_style *style) { uint8_t bits = style->bits[WHITE_SPACE_INDEX]; bits &= WHITE_SPACE_MASK; bits >>= WHITE_SPACE_SHIFT; /* 3bits: type */ return bits; } #undef WHITE_SPACE_MASK #undef WHITE_SPACE_SHIFT #undef WHITE_SPACE_INDEX #define BACKGROUND_POSITION_INDEX 27 #define BACKGROUND_POSITION_SHIFT 7 #define BACKGROUND_POSITION_MASK 0x80 #define BACKGROUND_POSITION_INDEX1 26 #define BACKGROUND_POSITION_SHIFT1 0 #define BACKGROUND_POSITION_MASK1 0xff static inline uint8_t get_background_position( const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit) { uint8_t bits = style->bits[BACKGROUND_POSITION_INDEX]; bits &= BACKGROUND_POSITION_MASK; bits >>= BACKGROUND_POSITION_SHIFT; /* 1bit: type */ if (bits == CSS_BACKGROUND_POSITION_SET) { uint8_t bits1 = style->bits[BACKGROUND_POSITION_INDEX1]; bits1 &= BACKGROUND_POSITION_MASK1; bits1 >>= BACKGROUND_POSITION_SHIFT1; /* 8bits: hhhhvvvv : hunit | vunit */ *hlength = style->background_position[0]; *hunit = bits1 >> 4; *vlength = style->background_position[1]; *vunit = bits1 & 0xf; } return bits; } #undef BACKGROUND_POSITION_MASK1 #undef BACKGROUND_POSITION_SHIFT1 #undef BACKGROUND_POSITION_INDEX1 #undef BACKGROUND_POSITION_MASK #undef BACKGROUND_POSITION_SHIFT #undef BACKGROUND_POSITION_INDEX #define DISPLAY_INDEX 27 #define DISPLAY_SHIFT 2 #define DISPLAY_MASK 0x7c static inline uint8_t get_display( const css_computed_style *style) { uint8_t bits = style->bits[DISPLAY_INDEX]; bits &= DISPLAY_MASK; bits >>= DISPLAY_SHIFT; /* 5bits: type */ return bits; } #undef DISPLAY_MASK #undef DISPLAY_SHIFT #undef DISPLAY_INDEX #define FONT_VARIANT_INDEX 27 #define FONT_VARIANT_SHIFT 0 #define FONT_VARIANT_MASK 0x3 static inline uint8_t get_font_variant( const css_computed_style *style) { uint8_t bits = style->bits[FONT_VARIANT_INDEX]; bits &= FONT_VARIANT_MASK; bits >>= FONT_VARIANT_SHIFT; /* 2bits: type */ return bits; } #undef FONT_VARIANT_MASK #undef FONT_VARIANT_SHIFT #undef FONT_VARIANT_INDEX #define TEXT_DECORATION_INDEX 28 #define TEXT_DECORATION_SHIFT 3 #define TEXT_DECORATION_MASK 0xf8 static inline uint8_t get_text_decoration( const css_computed_style *style) { uint8_t bits = style->bits[TEXT_DECORATION_INDEX]; bits &= TEXT_DECORATION_MASK; bits >>= TEXT_DECORATION_SHIFT; /* 5bits: type */ return bits; } #undef TEXT_DECORATION_MASK #undef TEXT_DECORATION_SHIFT #undef TEXT_DECORATION_INDEX #define FONT_FAMILY_INDEX 28 #define FONT_FAMILY_SHIFT 0 #define FONT_FAMILY_MASK 0x7 static inline uint8_t get_font_family( const css_computed_style *style, lwc_string ***names) { uint8_t bits = style->bits[FONT_FAMILY_INDEX]; bits &= FONT_FAMILY_MASK; bits >>= FONT_FAMILY_SHIFT; /* 3bits: type */ *names = style->font_family; return bits; } #undef FONT_FAMILY_MASK #undef FONT_FAMILY_SHIFT #undef FONT_FAMILY_INDEX #define BORDER_TOP_STYLE_INDEX 29 #define BORDER_TOP_STYLE_SHIFT 4 #define BORDER_TOP_STYLE_MASK 0xf0 static inline uint8_t get_border_top_style( const css_computed_style *style) { uint8_t bits = style->bits[BORDER_TOP_STYLE_INDEX]; bits &= BORDER_TOP_STYLE_MASK; bits >>= BORDER_TOP_STYLE_SHIFT; /* 4bits: type */ return bits; } #undef BORDER_TOP_STYLE_MASK #undef BORDER_TOP_STYLE_SHIFT #undef BORDER_TOP_STYLE_INDEX #define BORDER_RIGHT_STYLE_INDEX 29 #define BORDER_RIGHT_STYLE_SHIFT 0 #define BORDER_RIGHT_STYLE_MASK 0xf static inline uint8_t get_border_right_style( const css_computed_style *style) { uint8_t bits = style->bits[BORDER_RIGHT_STYLE_INDEX]; bits &= BORDER_RIGHT_STYLE_MASK; bits >>= BORDER_RIGHT_STYLE_SHIFT; /* 4bits: type */ return bits; } #undef BORDER_RIGHT_STYLE_MASK #undef BORDER_RIGHT_STYLE_SHIFT #undef BORDER_RIGHT_STYLE_INDEX #define BORDER_BOTTOM_STYLE_INDEX 30 #define BORDER_BOTTOM_STYLE_SHIFT 4 #define BORDER_BOTTOM_STYLE_MASK 0xf0 static inline uint8_t get_border_bottom_style( const css_computed_style *style) { uint8_t bits = style->bits[BORDER_BOTTOM_STYLE_INDEX]; bits &= BORDER_BOTTOM_STYLE_MASK; bits >>= BORDER_BOTTOM_STYLE_SHIFT; /* 4bits: type */ return bits; } #undef BORDER_BOTTOM_STYLE_MASK #undef BORDER_BOTTOM_STYLE_SHIFT #undef BORDER_BOTTOM_STYLE_INDEX #define BORDER_LEFT_STYLE_INDEX 30 #define BORDER_LEFT_STYLE_SHIFT 0 #define BORDER_LEFT_STYLE_MASK 0xf static inline uint8_t get_border_left_style( const css_computed_style *style) { uint8_t bits = style->bits[BORDER_LEFT_STYLE_INDEX]; bits &= BORDER_LEFT_STYLE_MASK; bits >>= BORDER_LEFT_STYLE_SHIFT; /* 4bits: type */ return bits; } #undef BORDER_LEFT_STYLE_MASK #undef BORDER_LEFT_STYLE_SHIFT #undef BORDER_LEFT_STYLE_INDEX #define FONT_WEIGHT_INDEX 31 #define FONT_WEIGHT_SHIFT 4 #define FONT_WEIGHT_MASK 0xf0 static inline uint8_t get_font_weight( const css_computed_style *style) { uint8_t bits = style->bits[FONT_WEIGHT_INDEX]; bits &= FONT_WEIGHT_MASK; bits >>= FONT_WEIGHT_SHIFT; /* 4bits: type */ return bits; } #undef FONT_WEIGHT_MASK #undef FONT_WEIGHT_SHIFT #undef FONT_WEIGHT_INDEX #define LIST_STYLE_TYPE_INDEX 31 #define LIST_STYLE_TYPE_SHIFT 0 #define LIST_STYLE_TYPE_MASK 0xf static inline uint8_t get_list_style_type( const css_computed_style *style) { uint8_t bits = style->bits[LIST_STYLE_TYPE_INDEX]; bits &= LIST_STYLE_TYPE_MASK; bits >>= LIST_STYLE_TYPE_SHIFT; /* 4bits: type */ return bits; } #undef LIST_STYLE_TYPE_MASK #undef LIST_STYLE_TYPE_SHIFT #undef LIST_STYLE_TYPE_INDEX #define OUTLINE_STYLE_INDEX 32 #define OUTLINE_STYLE_SHIFT 4 #define OUTLINE_STYLE_MASK 0xf0 static inline uint8_t get_outline_style( const css_computed_style *style) { uint8_t bits = style->bits[OUTLINE_STYLE_INDEX]; bits &= OUTLINE_STYLE_MASK; bits >>= OUTLINE_STYLE_SHIFT; /* 4bits: type */ return bits; } #undef OUTLINE_STYLE_MASK #undef OUTLINE_STYLE_SHIFT #undef OUTLINE_STYLE_INDEX #define TABLE_LAYOUT_INDEX 32 #define TABLE_LAYOUT_SHIFT 2 #define TABLE_LAYOUT_MASK 0xc static inline uint8_t get_table_layout( const css_computed_style *style) { uint8_t bits = style->bits[TABLE_LAYOUT_INDEX]; bits &= TABLE_LAYOUT_MASK; bits >>= TABLE_LAYOUT_SHIFT; /* 2bits: type */ return bits; } #undef TABLE_LAYOUT_MASK #undef TABLE_LAYOUT_SHIFT #undef TABLE_LAYOUT_INDEX #define UNICODE_BIDI_INDEX 32 #define UNICODE_BIDI_SHIFT 0 #define UNICODE_BIDI_MASK 0x3 static inline uint8_t get_unicode_bidi( const css_computed_style *style) { uint8_t bits = style->bits[UNICODE_BIDI_INDEX]; bits &= UNICODE_BIDI_MASK; bits >>= UNICODE_BIDI_SHIFT; /* 2bits: type */ return bits; } #undef UNICODE_BIDI_MASK #undef UNICODE_BIDI_SHIFT #undef UNICODE_BIDI_INDEX #define VISIBILITY_INDEX 33 #define VISIBILITY_SHIFT 6 #define VISIBILITY_MASK 0xc0 static inline uint8_t get_visibility( const css_computed_style *style) { uint8_t bits = style->bits[VISIBILITY_INDEX]; bits &= VISIBILITY_MASK; bits >>= VISIBILITY_SHIFT; /* 2bits: type */ return bits; } #undef VISIBILITY_MASK #undef VISIBILITY_SHIFT #undef VISIBILITY_INDEX #define LIST_STYLE_POSITION_INDEX 33 #define LIST_STYLE_POSITION_SHIFT 4 #define LIST_STYLE_POSITION_MASK 0x30 static inline uint8_t get_list_style_position( const css_computed_style *style) { uint8_t bits = style->bits[LIST_STYLE_POSITION_INDEX]; bits &= LIST_STYLE_POSITION_MASK; bits >>= LIST_STYLE_POSITION_SHIFT; /* 2bits: type */ return bits; } #undef LIST_STYLE_POSITION_MASK #undef LIST_STYLE_POSITION_SHIFT #undef LIST_STYLE_POSITION_INDEX #define TEXT_ALIGN_INDEX 33 #define TEXT_ALIGN_SHIFT 0 #define TEXT_ALIGN_MASK 0xf static inline uint8_t get_text_align( const css_computed_style *style) { uint8_t bits = style->bits[TEXT_ALIGN_INDEX]; bits &= TEXT_ALIGN_MASK; bits >>= TEXT_ALIGN_SHIFT; /* 4bits: type */ return bits; } #undef TEXT_ALIGN_MASK #undef TEXT_ALIGN_SHIFT #undef TEXT_ALIGN_INDEX #define PAGE_BREAK_AFTER_INDEX 0 #define PAGE_BREAK_AFTER_SHIFT 0 #define PAGE_BREAK_AFTER_MASK 0x7 static inline uint8_t get_page_break_after( const css_computed_style *style) { if (style->page != NULL) { uint8_t bits = style->page->bits[PAGE_BREAK_AFTER_INDEX]; bits &= PAGE_BREAK_AFTER_MASK; bits >>= PAGE_BREAK_AFTER_SHIFT; /* 3bits: type */ return bits; } return CSS_PAGE_BREAK_AFTER_AUTO; } #undef PAGE_BREAK_AFTER_MASK #undef PAGE_BREAK_AFTER_SHIFT #undef PAGE_BREAK_AFTER_INDEX #define PAGE_BREAK_BEFORE_INDEX 0 #define PAGE_BREAK_BEFORE_SHIFT 3 #define PAGE_BREAK_BEFORE_MASK 0x38 static inline uint8_t get_page_break_before( const css_computed_style *style) { if (style->page != NULL) { uint8_t bits = style->page->bits[PAGE_BREAK_BEFORE_INDEX]; bits &= PAGE_BREAK_BEFORE_MASK; bits >>= PAGE_BREAK_BEFORE_SHIFT; /* 3bits: type */ return bits; } return CSS_PAGE_BREAK_BEFORE_AUTO; } #undef PAGE_BREAK_BEFORE_MASK #undef PAGE_BREAK_BEFORE_SHIFT #undef PAGE_BREAK_BEFORE_INDEX #define PAGE_BREAK_INSIDE_INDEX 0 #define PAGE_BREAK_INSIDE_SHIFT 6 #define PAGE_BREAK_INSIDE_MASK 0xc0 static inline uint8_t get_page_break_inside( const css_computed_style *style) { if (style->page != NULL) { uint8_t bits = style->page->bits[PAGE_BREAK_INSIDE_INDEX]; bits &= PAGE_BREAK_INSIDE_MASK; bits >>= PAGE_BREAK_INSIDE_SHIFT; /* 2bits: type */ return bits; } return CSS_PAGE_BREAK_INSIDE_AUTO; } #undef PAGE_BREAK_INSIDE_MASK #undef PAGE_BREAK_INSIDE_SHIFT #undef PAGE_BREAK_INSIDE_INDEX #define ORPHANS_INDEX 1 #define ORPHANS_SHIFT 0 #define ORPHANS_MASK 0x1 static inline uint8_t get_orphans( const css_computed_style *style, int32_t *orphans) { if (style->page != NULL) { uint8_t bits = style->page->bits[ORPHANS_INDEX]; bits &= ORPHANS_MASK; bits >>= ORPHANS_SHIFT; *orphans = style->page->orphans; /* 1bit: type */ return bits; } *orphans = 2; return CSS_ORPHANS_SET; } #undef ORPHANS_MASK #undef ORPHANS_SHIFT #undef ORPHANS_INDEX #define WIDOWS_INDEX 1 #define WIDOWS_SHIFT 1 #define WIDOWS_MASK 0x2 static inline uint8_t get_widows( const css_computed_style *style, int32_t *widows) { if (style->page != NULL) { uint8_t bits = style->page->bits[WIDOWS_INDEX]; bits &= WIDOWS_MASK; bits >>= WIDOWS_SHIFT; *widows = style->page->widows; /* 1bit: type */ return bits; } *widows = 2; return CSS_WIDOWS_SET; } #undef WIDOWS_MASK #undef WIDOWS_SHIFT #undef WIDOWS_INDEX #endif netsurf-all-3.2/libcss/src/select/hash.c0000644000175000017500000006465612377676736017271 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include "stylesheet.h" #include "select/hash.h" #include "utils/utils.h" #undef PRINT_CHAIN_BLOOM_DETAILS typedef struct hash_entry { const css_selector *sel; css_bloom sel_chain_bloom[CSS_BLOOM_SIZE]; struct hash_entry *next; } hash_entry; typedef struct hash_t { #define DEFAULT_SLOTS (1<<6) size_t n_slots; hash_entry *slots; } hash_t; struct css_selector_hash { hash_t elements; hash_t classes; hash_t ids; hash_entry universal; size_t hash_size; }; static hash_entry empty_slot; static inline lwc_string *_class_name(const css_selector *selector); static inline lwc_string *_id_name(const css_selector *selector); static css_error _insert_into_chain(css_selector_hash *ctx, hash_entry *head, const css_selector *selector); static css_error _remove_from_chain(css_selector_hash *ctx, hash_entry *head, const css_selector *selector); static css_error _iterate_elements( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next); static css_error _iterate_classes( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next); static css_error _iterate_ids( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next); static css_error _iterate_universal( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next); /* Get case insensitive hash value for a name. * All element/class/id names are known to have their insensitive ptr set. */ #define _hash_name(name) \ lwc_string_hash_value(name->insensitive) /* No bytecode if rule body is empty or wholly invalid -- * Only interested in rules with bytecode */ #define RULE_HAS_BYTECODE(r) \ (((css_rule_selector *)(r->sel->rule))->style != NULL) /** * Test first selector on selector chain for having matching element name. * * If source of rule is element or universal hash, we know the * element name is a match. If it comes from the class or id hash, * we have to test for a match. * * \param selector selector chain head to test * \param qname element name to look for * \return true iff chain head doesn't fail to match element name */ static inline bool _chain_good_for_element_name(const css_selector *selector, const css_qname *qname, const lwc_string *uni) { if (selector->data.qname.name != uni) { bool match; if (lwc_string_caseless_isequal( selector->data.qname.name, qname->name, &match) == lwc_error_ok && match == false) { return false; } } return true; } /** * Test whether the rule applies for current media. * * \param rule Rule to test * \meaid media Current media type(s) * \return true iff chain's rule applies for media */ static inline bool _rule_good_for_media(const css_rule *rule, uint64_t media) { bool applies = true; const css_rule *ancestor = rule; while (ancestor != NULL) { const css_rule_media *m = (const css_rule_media *) ancestor; if (ancestor->type == CSS_RULE_MEDIA && (m->media & media) == 0) { applies = false; break; } if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) ancestor = ancestor->parent; else ancestor = NULL; } return applies; } /** * Create a hash * * \param hash Pointer to location to receive result * \return CSS_OK on success, appropriate error otherwise */ css_error css__selector_hash_create(css_selector_hash **hash) { css_selector_hash *h; if (hash == NULL) return CSS_BADPARM; h = malloc(sizeof(css_selector_hash)); if (h == NULL) return CSS_NOMEM; /* Element hash */ h->elements.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry)); if (h->elements.slots == NULL) { free(h); return CSS_NOMEM; } memset(h->elements.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry)); h->elements.n_slots = DEFAULT_SLOTS; /* Class hash */ h->classes.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry)); if (h->classes.slots == NULL) { free(h->elements.slots); free(h); return CSS_NOMEM; } memset(h->classes.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry)); h->classes.n_slots = DEFAULT_SLOTS; /* ID hash */ h->ids.slots = malloc(DEFAULT_SLOTS * sizeof(hash_entry)); if (h->ids.slots == NULL) { free(h->classes.slots); free(h->elements.slots); free(h); return CSS_NOMEM; } memset(h->ids.slots, 0, DEFAULT_SLOTS * sizeof(hash_entry)); h->ids.n_slots = DEFAULT_SLOTS; /* Universal chain */ memset(&h->universal, 0, sizeof(hash_entry)); h->hash_size = sizeof(css_selector_hash) + DEFAULT_SLOTS * sizeof(hash_entry) + DEFAULT_SLOTS * sizeof(hash_entry) + DEFAULT_SLOTS * sizeof(hash_entry); *hash = h; return CSS_OK; } /** * Destroy a hash * * \param hash The hash to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__selector_hash_destroy(css_selector_hash *hash) { hash_entry *d, *e; uint32_t i; if (hash == NULL) return CSS_BADPARM; /* Element hash */ for (i = 0; i < hash->elements.n_slots; i++) { for (d = hash->elements.slots[i].next; d != NULL; d = e) { e = d->next; free(d); } } free(hash->elements.slots); /* Class hash */ for (i = 0; i < hash->classes.n_slots; i++) { for (d = hash->classes.slots[i].next; d != NULL; d = e) { e = d->next; free(d); } } free(hash->classes.slots); /* ID hash */ for (i = 0; i < hash->ids.n_slots; i++) { for (d = hash->ids.slots[i].next; d != NULL; d = e) { e = d->next; free(d); } } free(hash->ids.slots); /* Universal chain */ for (d = hash->universal.next; d != NULL; d = e) { e = d->next; free(d); } free(hash); return CSS_OK; } /** * Insert an item into a hash * * \param hash The hash to insert into * \param selector Pointer to selector * \return CSS_OK on success, appropriate error otherwise */ css_error css__selector_hash_insert(css_selector_hash *hash, const css_selector *selector) { uint32_t index, mask; lwc_string *name; css_error error; if (hash == NULL || selector == NULL) return CSS_BADPARM; /* Work out which hash to insert into */ if ((name = _id_name(selector)) != NULL) { /* Named ID */ mask = hash->ids.n_slots - 1; index = _hash_name(name) & mask; error = _insert_into_chain(hash, &hash->ids.slots[index], selector); } else if ((name = _class_name(selector)) != NULL) { /* Named class */ mask = hash->classes.n_slots - 1; index = _hash_name(name) & mask; error = _insert_into_chain(hash, &hash->classes.slots[index], selector); } else if (lwc_string_length(selector->data.qname.name) != 1 || lwc_string_data(selector->data.qname.name)[0] != '*') { /* Named element */ mask = hash->elements.n_slots - 1; index = _hash_name(selector->data.qname.name) & mask; error = _insert_into_chain(hash, &hash->elements.slots[index], selector); } else { /* Universal chain */ error = _insert_into_chain(hash, &hash->universal, selector); } return error; } /** * Remove an item from a hash * * \param hash The hash to remove from * \param selector Pointer to selector * \return CSS_OK on success, appropriate error otherwise */ css_error css__selector_hash_remove(css_selector_hash *hash, const css_selector *selector) { uint32_t index, mask; lwc_string *name; css_error error; if (hash == NULL || selector == NULL) return CSS_BADPARM; /* Work out which hash to remove from */ if ((name = _id_name(selector)) != NULL) { /* Named ID */ mask = hash->ids.n_slots - 1; index = _hash_name(name) & mask; error = _remove_from_chain(hash, &hash->ids.slots[index], selector); } else if ((name = _class_name(selector)) != NULL) { /* Named class */ mask = hash->classes.n_slots - 1; index = _hash_name(name) & mask; error = _remove_from_chain(hash, &hash->classes.slots[index], selector); } else if (lwc_string_length(selector->data.qname.name) != 1 || lwc_string_data(selector->data.qname.name)[0] != '*') { /* Named element */ mask = hash->elements.n_slots - 1; index = _hash_name(selector->data.qname.name) & mask; error = _remove_from_chain(hash, &hash->elements.slots[index], selector); } else { /* Universal chain */ error = _remove_from_chain(hash, &hash->universal, selector); } return error; } /** * Find the first selector that matches name * * \param hash Hash to search * \param qname Qualified name to match * \param iterator Pointer to location to receive iterator function * \param matched Pointer to location to receive selector * \return CSS_OK on success, appropriate error otherwise * * If nothing matches, CSS_OK will be returned and **matched == NULL */ css_error css__selector_hash_find(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const css_selector ***matched) { uint32_t index, mask; hash_entry *head; if (hash == NULL || req == NULL || iterator == NULL || matched == NULL) return CSS_BADPARM; /* Find index */ mask = hash->elements.n_slots - 1; if (req->qname.name->insensitive == NULL && lwc__intern_caseless_string( req->qname.name) != lwc_error_ok) { return CSS_NOMEM; } index = _hash_name(req->qname.name) & mask; head = &hash->elements.slots[index]; if (head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { lwc_error lerror; bool match = false; lerror = lwc_string_isequal( req->qname.name->insensitive, head->sel->data.qname.name->insensitive, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _rule_good_for_media(head->sel->rule, req->media)) { /* Found a match */ break; } } head = head->next; } if (head == NULL) head = &empty_slot; } (*iterator) = _iterate_elements; (*matched) = (const css_selector **) head; return CSS_OK; } /** * Find the first selector that has a class that matches name * * \param hash Hash to search * \param name Name to match * \param iterator Pointer to location to receive iterator function * \param matched Pointer to location to receive selector * \return CSS_OK on success, appropriate error otherwise * * If nothing matches, CSS_OK will be returned and **matched == NULL */ css_error css__selector_hash_find_by_class(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const css_selector ***matched) { uint32_t index, mask; hash_entry *head; if (hash == NULL || req == NULL || req->class == NULL || iterator == NULL || matched == NULL) return CSS_BADPARM; /* Find index */ mask = hash->classes.n_slots - 1; if (req->class->insensitive == NULL && lwc__intern_caseless_string( req->class) != lwc_error_ok) { return CSS_NOMEM; } index = _hash_name(req->class) & mask; head = &hash->classes.slots[index]; if (head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { lwc_error lerror; lwc_string *n; bool match = false; n = _class_name(head->sel); if (n != NULL) { lerror = lwc_string_isequal( req->class->insensitive, n->insensitive, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _chain_good_for_element_name( head->sel, &(req->qname), req->uni) && _rule_good_for_media( head->sel->rule, req->media)) { /* Found a match */ break; } } } head = head->next; } if (head == NULL) head = &empty_slot; } (*iterator) = _iterate_classes; (*matched) = (const css_selector **) head; return CSS_OK; } /** * Find the first selector that has an ID that matches name * * \param hash Hash to search * \param name Name to match * \param iterator Pointer to location to receive iterator function * \param matched Pointer to location to receive selector * \return CSS_OK on success, appropriate error otherwise * * If nothing matches, CSS_OK will be returned and **matched == NULL */ css_error css__selector_hash_find_by_id(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const css_selector ***matched) { uint32_t index, mask; hash_entry *head; if (hash == NULL || req == NULL || req->id == NULL || iterator == NULL || matched == NULL) return CSS_BADPARM; /* Find index */ mask = hash->ids.n_slots - 1; if (req->id->insensitive == NULL && lwc__intern_caseless_string( req->id) != lwc_error_ok) { return CSS_NOMEM; } index = _hash_name(req->id) & mask; head = &hash->ids.slots[index]; if (head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { lwc_error lerror; lwc_string *n; bool match = false; n = _id_name(head->sel); if (n != NULL) { lerror = lwc_string_isequal( req->id->insensitive, n->insensitive, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _chain_good_for_element_name( head->sel, &req->qname, req->uni) && _rule_good_for_media( head->sel->rule, req->media)) { /* Found a match */ break; } } } head = head->next; } if (head == NULL) head = &empty_slot; } (*iterator) = _iterate_ids; (*matched) = (const css_selector **) head; return CSS_OK; } /** * Find the first universal selector * * \param hash Hash to search * \param iterator Pointer to location to receive iterator function * \param matched Pointer to location to receive selector * \return CSS_OK on success, appropriate error otherwise * * If nothing matches, CSS_OK will be returned and **matched == NULL */ css_error css__selector_hash_find_universal(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const css_selector ***matched) { hash_entry *head; if (hash == NULL || req == NULL || iterator == NULL || matched == NULL) return CSS_BADPARM; head = &hash->universal; if (head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { if (RULE_HAS_BYTECODE(head) && css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _rule_good_for_media(head->sel->rule, req->media)) { /* Found a match */ break; } head = head->next; } if (head == NULL) head = &empty_slot; } (*iterator) = _iterate_universal; (*matched) = (const css_selector **) head; return CSS_OK; } /** * Determine the memory-resident size of a hash * * \param hash Hash to consider * \param size Pointer to location to receive byte count * \return CSS_OK on success. * * \note The returned size will represent the size of the hash datastructures, * and will not include the size of the data stored in the hash. */ css_error css__selector_hash_size(css_selector_hash *hash, size_t *size) { if (hash == NULL || size == NULL) return CSS_BADPARM; *size = hash->hash_size; return CSS_OK; } /****************************************************************************** * Private functions * ******************************************************************************/ /** * Retrieve the first class name in a selector, or NULL if none * * \param selector Selector to consider * \return Pointer to class name, or NULL if none */ lwc_string *_class_name(const css_selector *selector) { const css_selector_detail *detail = &selector->data; lwc_string *name = NULL; do { /* Ignore :not(.class) */ if (detail->type == CSS_SELECTOR_CLASS && detail->negate == 0) { name = detail->qname.name; break; } if (detail->next) detail++; else detail = NULL; } while (detail != NULL); return name; } /** * Retrieve the first ID name in a selector, or NULL if none * * \param selector Selector to consider * \return Pointer to ID name, or NULL if none */ lwc_string *_id_name(const css_selector *selector) { const css_selector_detail *detail = &selector->data; lwc_string *name = NULL; do { /* Ignore :not(#id) */ if (detail->type == CSS_SELECTOR_ID && detail->negate == 0) { name = detail->qname.name; break; } if (detail->next) detail++; else detail = NULL; } while (detail != NULL); return name; } /** * Add a selector detail to the bloom filter, if the detail is relevant. * * \param d Selector detail to consider and add if relevant * \param bloom Bloom filter to add to. */ static inline void _chain_bloom_add_detail( const css_selector_detail *d, css_bloom bloom[CSS_BLOOM_SIZE]) { lwc_string *add; /* String to add to bloom */ switch (d->type) { case CSS_SELECTOR_ELEMENT: /* Don't add universal element selector to bloom */ if (lwc_string_length(d->qname.name) == 1 && lwc_string_data(d->qname.name)[0] == '*') { return; } /* Fall through */ case CSS_SELECTOR_CLASS: case CSS_SELECTOR_ID: /* Element, Id and Class names always have the insensitive * string set at css_selector_detail creation time. */ add = d->qname.name->insensitive; if (add != NULL) { css_bloom_add_hash(bloom, lwc_string_hash_value(add)); } break; default: break; } return; } /** * Generate a selector chain's bloom filter * * \param s Selector at head of selector chain * \param bloom Bloom filter to generate. */ static void _chain_bloom_generate(const css_selector *s, css_bloom bloom[CSS_BLOOM_SIZE]) { css_bloom_init(bloom); /* Work back through selector chain... */ do { /* ...looking for Ancestor/Parent combinators */ if (s->data.comb == CSS_COMBINATOR_ANCESTOR || s->data.comb == CSS_COMBINATOR_PARENT) { const css_selector_detail *d = &s->combinator->data; do { if (d->negate == 0) { _chain_bloom_add_detail(d, bloom); } } while ((d++)->next != 0); } s = s->combinator; } while (s != NULL); } #ifdef PRINT_CHAIN_BLOOM_DETAILS /* Count bits set in uint32_t */ static int bits_set(uint32_t n) { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); n = (n + (n >> 4)) & 0x0f0f0f0f; n = n + (n >> 8); n = n + (n >> 16); return n & 0x0000003f; } /* Selector chain bloom instrumentation ouput display. */ static void print_chain_bloom_details(css_bloom bloom[CSS_BLOOM_SIZE]) { printf("Chain bloom:\t"); int total = 0, i; int set[4]; for (i = 0; i < CSS_BLOOM_SIZE; i++) { set[i] = bits_set(bloom[i]); total += set[i]; } printf("bits set:"); for (i = 0; i < CSS_BLOOM_SIZE; i++) { printf(" %2i", set[i]); } printf(" (total:%4i of %i) saturation: %3i%%\n", total, (32 * CSS_BLOOM_SIZE), (100 * total) / (32 * CSS_BLOOM_SIZE)); } #endif /** * Insert a selector into a hash chain * * \param ctx Selector hash * \param head Head of chain to insert into * \param selector Selector to insert * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion. */ css_error _insert_into_chain(css_selector_hash *ctx, hash_entry *head, const css_selector *selector) { if (head->sel == NULL) { head->sel = selector; head->next = NULL; _chain_bloom_generate(selector, head->sel_chain_bloom); #ifdef PRINT_CHAIN_BLOOM_DETAILS print_chain_bloom_details(head->sel_chain_bloom); #endif } else { hash_entry *search = head; hash_entry *prev = NULL; hash_entry *entry = malloc(sizeof(hash_entry)); if (entry == NULL) return CSS_NOMEM; /* Find place to insert entry */ do { /* Sort by ascending specificity */ if (search->sel->specificity > selector->specificity) break; /* Sort by ascending rule index */ if (search->sel->specificity == selector->specificity && search->sel->rule->index > selector->rule->index) break; prev = search; search = search->next; } while (search != NULL); entry->sel = selector; _chain_bloom_generate(selector, entry->sel_chain_bloom); #ifdef PRINT_CHAIN_BLOOM_DETAILS print_chain_bloom_details(entry->sel_chain_bloom); #endif if (prev == NULL) { hash_entry temp; entry->next = entry; temp = *entry; *entry = *head; *head = temp; } else { entry->next = prev->next; prev->next = entry; } ctx->hash_size += sizeof(hash_entry); } return CSS_OK; } /** * Remove a selector from a hash chain * * \param ctx Selector hash * \param head Head of chain to remove from * \param selector Selector to remove * \return CSS_OK on success, * CSS_INVALID if selector not found in chain. */ css_error _remove_from_chain(css_selector_hash *ctx, hash_entry *head, const css_selector *selector) { hash_entry *search = head, *prev = NULL; if (head->sel == NULL) return CSS_INVALID; do { if (search->sel == selector) break; prev = search; search = search->next; } while (search != NULL); if (search == NULL) return CSS_INVALID; if (prev == NULL) { if (search->next != NULL) { head->sel = search->next->sel; head->next = search->next->next; } else { head->sel = NULL; head->next = NULL; } } else { prev->next = search->next; free(search); ctx->hash_size -= sizeof(hash_entry); } return CSS_OK; } /** * Find the next selector that matches * * \param current Current item * \param next Pointer to location to receive next item * \return CSS_OK on success, appropriate error otherwise * * If nothing further matches, CSS_OK will be returned and **next == NULL */ css_error _iterate_elements( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next) { const hash_entry *head = (const hash_entry *) current; bool match = false; lwc_error lerror = lwc_error_ok; lwc_string *name; name = req->qname.name; head = head->next; if (head != NULL && head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { lerror = lwc_string_caseless_isequal(name, head->sel->data.qname.name, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _rule_good_for_media(head->sel->rule, req->media)) { /* Found a match */ break; } } head = head->next; } } if (head == NULL) head = &empty_slot; (*next) = (const css_selector **) head; return CSS_OK; } /** * Find the next selector that matches * * \param current Current item * \param next Pointer to location to receive next item * \return CSS_OK on success, appropriate error otherwise * * If nothing further matches, CSS_OK will be returned and **next == NULL */ css_error _iterate_classes( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next) { const hash_entry *head = (const hash_entry *) current; bool match = false; lwc_error lerror = lwc_error_ok; lwc_string *name, *ref; ref = req->class; head = head->next; if (head != NULL && head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { name = _class_name(head->sel); if (name != NULL) { lerror = lwc_string_caseless_isequal( ref, name, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _chain_good_for_element_name( head->sel, &(req->qname), req->uni) && _rule_good_for_media( head->sel->rule, req->media)) { /* Found a match */ break; } } } head = head->next; } } if (head == NULL) head = &empty_slot; (*next) = (const css_selector **) head; return CSS_OK; } /** * Find the next selector that matches * * \param current Current item * \param next Pointer to location to receive next item * \return CSS_OK on success, appropriate error otherwise * * If nothing further matches, CSS_OK will be returned and **next == NULL */ css_error _iterate_ids( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next) { const hash_entry *head = (const hash_entry *) current; bool match = false; lwc_error lerror = lwc_error_ok; lwc_string *name, *ref; ref = req->id; head = head->next; if (head != NULL && head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { name = _id_name(head->sel); if (name != NULL) { lerror = lwc_string_caseless_isequal( ref, name, &match); if (lerror != lwc_error_ok) return css_error_from_lwc_error(lerror); if (match && RULE_HAS_BYTECODE(head)) { if (css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _chain_good_for_element_name( head->sel, &req->qname, req->uni) && _rule_good_for_media( head->sel->rule, req->media)) { /* Found a match */ break; } } } head = head->next; } } if (head == NULL) head = &empty_slot; (*next) = (const css_selector **) head; return CSS_OK; } /** * Find the next selector that matches * * \param current Current item * \param next Pointer to location to receive next item * \return CSS_OK on success, appropriate error otherwise * * If nothing further matches, CSS_OK will be returned and **next == NULL */ css_error _iterate_universal( const struct css_hash_selection_requirments *req, const css_selector **current, const css_selector ***next) { const hash_entry *head = (const hash_entry *) current; head = head->next; if (head != NULL && head->sel != NULL) { /* Search through chain for first match */ while (head != NULL) { if (RULE_HAS_BYTECODE(head) && css_bloom_in_bloom( head->sel_chain_bloom, req->node_bloom) && _rule_good_for_media(head->sel->rule, req->media)) { /* Found a match */ break; } head = head->next; } } if (head == NULL) head = &empty_slot; (*next) = (const css_selector **) head; return CSS_OK; } netsurf-all-3.2/libcss/src/select/select.h0000644000175000017500000000436112377676736017615 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_select_h_ #define css_select_select_h_ #include #include #include #include "stylesheet.h" /** * Item in the reject cache (only class and id types are valid) */ typedef struct reject_item { lwc_string *value; css_selector_type type; } reject_item; typedef struct prop_state { uint32_t specificity; /* Specificity of property in result */ unsigned int set : 1, /* Whether property is set in result */ origin : 2, /* Origin of property in result */ important : 1, /* Importance of property in result */ inherit : 1; /* Property is set to inherit */ } prop_state; /** * Selection state */ typedef struct css_select_state { void *node; /* Node we're selecting for */ uint64_t media; /* Currently active media types */ css_select_results *results; /* Result set to populate */ css_pseudo_element current_pseudo; /* Current pseudo element */ css_computed_style *computed; /* Computed style to populate */ css_select_handler *handler; /* Handler functions */ void *pw; /* Client data for handlers */ const css_stylesheet *sheet; /* Current sheet being processed */ css_origin current_origin; /* Origin of current sheet */ uint32_t current_specificity; /* Specificity of current rule */ css_qname element; /* Element we're selecting for */ lwc_string *id; /* Node id, if any */ lwc_string **classes; /* Node classes, if any */ uint32_t n_classes; /* Number of classes */ reject_item reject_cache[128]; /* Reject cache (filled from end) */ reject_item *next_reject; /* Next free slot in reject cache */ const css_bloom *bloom; /* Bloom filter */ prop_state props[CSS_N_PROPERTIES][CSS_PSEUDO_ELEMENT_COUNT]; } css_select_state; static inline void advance_bytecode(css_style *style, uint32_t n_bytes) { style->used -= (n_bytes / sizeof(css_code_t)); style->bytecode = style->bytecode + (n_bytes / sizeof(css_code_t)); } bool css__outranks_existing(uint16_t op, bool important, css_select_state *state, bool inherit); #endif netsurf-all-3.2/libcss/src/select/computed.c0000644000175000017500000012351112377676736020150 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include "select/computed.h" #include "select/dispatch.h" #include "select/propget.h" #include "select/propset.h" #include "utils/utils.h" static css_error compute_absolute_color(css_computed_style *style, uint8_t (*get)(const css_computed_style *style, css_color *color), css_error (*set)(css_computed_style *style, uint8_t type, css_color color)); static css_error compute_border_colors(css_computed_style *style); static css_error compute_absolute_border_width(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_border_side_width(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)); static css_error compute_absolute_sides(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_clip(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_line_height(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_margins(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_padding(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_vertical_align(css_computed_style *style, const css_hint_length *ex_size); static css_error compute_absolute_length(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)); static css_error compute_absolute_length_auto(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)); static css_error compute_absolute_length_none(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)); static css_error compute_absolute_length_normal(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)); static css_error compute_absolute_length_pair(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len1, css_unit *unit1, css_fixed *len2, css_unit *unit2), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len1, css_unit unit1, css_fixed len2, css_unit unit2)); /** * Create a computed style * * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_BADPARM on bad parameters. */ css_error css_computed_style_create(css_computed_style **result) { css_computed_style *s; if (result == NULL) return CSS_BADPARM; s = malloc(sizeof(css_computed_style)); if (s == NULL) return CSS_NOMEM; memset(s, 0, sizeof(css_computed_style)); *result = s; return CSS_OK; } /** * Destroy a computed style * * \param style Style to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css_computed_style_destroy(css_computed_style *style) { if (style == NULL) return CSS_BADPARM; if (style->uncommon != NULL) { if (style->uncommon->counter_increment != NULL) { css_computed_counter *c; for (c = style->uncommon->counter_increment; c->name != NULL; c++) { lwc_string_unref(c->name); } free(style->uncommon->counter_increment); } if (style->uncommon->counter_reset != NULL) { css_computed_counter *c; for (c = style->uncommon->counter_reset; c->name != NULL; c++) { lwc_string_unref(c->name); } free(style->uncommon->counter_reset); } if (style->uncommon->cursor != NULL) { lwc_string **s; for (s = style->uncommon->cursor; *s != NULL; s++) { lwc_string_unref(*s); } free(style->uncommon->cursor); } if (style->uncommon->content != NULL) { css_computed_content_item *c; for (c = style->uncommon->content; c->type != CSS_COMPUTED_CONTENT_NONE; c++) { switch (c->type) { case CSS_COMPUTED_CONTENT_STRING: lwc_string_unref(c->data.string); break; case CSS_COMPUTED_CONTENT_URI: lwc_string_unref(c->data.uri); break; case CSS_COMPUTED_CONTENT_ATTR: lwc_string_unref(c->data.attr); break; case CSS_COMPUTED_CONTENT_COUNTER: lwc_string_unref(c->data.counter.name); break; case CSS_COMPUTED_CONTENT_COUNTERS: lwc_string_unref(c->data.counters.name); lwc_string_unref(c->data.counters.sep); break; default: break; } } free(style->uncommon->content); } free(style->uncommon); } if (style->page != NULL) { free(style->page); } if (style->aural != NULL) { free(style->aural); } if (style->font_family != NULL) { lwc_string **s; for (s = style->font_family; *s != NULL; s++) { lwc_string_unref(*s); } free(style->font_family); } if (style->quotes != NULL) { lwc_string **s; for (s = style->quotes; *s != NULL; s++) { lwc_string_unref(*s); } free(style->quotes); } if (style->list_style_image != NULL) lwc_string_unref(style->list_style_image); if (style->background_image != NULL) lwc_string_unref(style->background_image); free(style); return CSS_OK; } /** * Populate a blank computed style with Initial values * * \param style Computed style to populate * \param handler Dispatch table of handler functions * \param pw Client-specific private data for handler functions * \return CSS_OK on success. */ css_error css_computed_style_initialise(css_computed_style *style, css_select_handler *handler, void *pw) { css_select_state state; uint32_t i; css_error error; if (style == NULL) return CSS_BADPARM; state.node = NULL; state.media = CSS_MEDIA_ALL; state.results = NULL; state.computed = style; state.handler = handler; state.pw = pw; for (i = 0; i < CSS_N_PROPERTIES; i++) { /* No need to initialise anything other than the normal * properties -- the others are handled by the accessors */ if (prop_dispatch[i].inherited == false && prop_dispatch[i].group == GROUP_NORMAL) { error = prop_dispatch[i].initial(&state); if (error != CSS_OK) return error; } } return CSS_OK; } /** * Compose two computed styles * * \param parent Parent style * \param child Child style * \param compute_font_size Function to compute an absolute font size * \param pw Client data for compute_font_size * \param result Pointer to style to compose into * \return CSS_OK on success, appropriate error otherwise. * * \pre \a parent is a fully composed style (thus has no inherited properties) * * \note \a child and \a result may point at the same object */ css_error css_computed_style_compose(const css_computed_style *parent, const css_computed_style *child, css_error (*compute_font_size)(void *pw, const css_hint *parent, css_hint *size), void *pw, css_computed_style *result) { css_error error = CSS_OK; size_t i; /* Iterate through the properties */ for (i = 0; i < CSS_N_PROPERTIES; i++) { /* Skip any in extension blocks if the block does not exist */ if (prop_dispatch[i].group == GROUP_UNCOMMON && parent->uncommon == NULL && child->uncommon == NULL) continue; if (prop_dispatch[i].group == GROUP_PAGE && parent->page == NULL && child->page == NULL) continue; if (prop_dispatch[i].group == GROUP_AURAL && parent->aural == NULL && child->aural == NULL) continue; /* Compose the property */ error = prop_dispatch[i].compose(parent, child, result); if (error != CSS_OK) break; } /* Finally, compute absolute values for everything */ return css__compute_absolute_values(parent, result, compute_font_size, pw); } /****************************************************************************** * Property accessors * ******************************************************************************/ uint8_t css_computed_letter_spacing(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_letter_spacing(style, length, unit); } uint8_t css_computed_outline_color(const css_computed_style *style, css_color *color) { return get_outline_color(style, color); } uint8_t css_computed_outline_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_outline_width(style, length, unit); } uint8_t css_computed_border_spacing(const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit) { return get_border_spacing(style, hlength, hunit, vlength, vunit); } uint8_t css_computed_word_spacing(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_word_spacing(style, length, unit); } uint8_t css_computed_writing_mode(const css_computed_style *style) { return get_writing_mode(style); } uint8_t css_computed_counter_increment(const css_computed_style *style, const css_computed_counter **counters) { return get_counter_increment(style, counters); } uint8_t css_computed_counter_reset(const css_computed_style *style, const css_computed_counter **counters) { return get_counter_reset(style, counters); } uint8_t css_computed_cursor(const css_computed_style *style, lwc_string ***urls) { return get_cursor(style, urls); } uint8_t css_computed_clip(const css_computed_style *style, css_computed_clip_rect *rect) { return get_clip(style, rect); } uint8_t css_computed_content(const css_computed_style *style, const css_computed_content_item **content) { return get_content(style, content); } uint8_t css_computed_vertical_align(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_vertical_align(style, length, unit); } uint8_t css_computed_font_size(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_font_size(style, length, unit); } uint8_t css_computed_border_top_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_border_top_width(style, length, unit); } uint8_t css_computed_border_right_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_border_right_width(style, length, unit); } uint8_t css_computed_border_bottom_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_border_bottom_width(style, length, unit); } uint8_t css_computed_border_left_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_border_left_width(style, length, unit); } uint8_t css_computed_background_image(const css_computed_style *style, lwc_string **url) { return get_background_image(style, url); } uint8_t css_computed_color(const css_computed_style *style, css_color *color) { return get_color(style, color); } uint8_t css_computed_list_style_image(const css_computed_style *style, lwc_string **url) { return get_list_style_image(style, url); } uint8_t css_computed_quotes(const css_computed_style *style, lwc_string ***quotes) { return get_quotes(style, quotes); } uint8_t css_computed_top(const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t position = css_computed_position(style); uint8_t top = get_top(style, length, unit); /* Fix up, based on computed position */ if (position == CSS_POSITION_STATIC) { /* Static -> auto */ top = CSS_TOP_AUTO; } else if (position == CSS_POSITION_RELATIVE) { /* Relative -> follow $9.4.3 */ uint8_t bottom = get_bottom_bits(style); if (top == CSS_TOP_AUTO && (bottom & 0x3) == CSS_BOTTOM_AUTO) { /* Both auto => 0px */ *length = 0; *unit = CSS_UNIT_PX; } else if (top == CSS_TOP_AUTO) { /* Top is auto => -bottom */ *length = -style->bottom; *unit = (css_unit) (bottom >> 2); } top = CSS_TOP_SET; } return top; } uint8_t css_computed_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t position = css_computed_position(style); uint8_t right = get_right(style, length, unit); /* Fix up, based on computed position */ if (position == CSS_POSITION_STATIC) { /* Static -> auto */ right = CSS_RIGHT_AUTO; } else if (position == CSS_POSITION_RELATIVE) { /* Relative -> follow $9.4.3 */ uint8_t left = get_left_bits(style); if (right == CSS_RIGHT_AUTO && (left & 0x3) == CSS_LEFT_AUTO) { /* Both auto => 0px */ *length = 0; *unit = CSS_UNIT_PX; } else if (right == CSS_RIGHT_AUTO) { /* Right is auto => -left */ *length = -style->left; *unit = (css_unit) (left >> 2); } else { /** \todo Consider containing block's direction * if overconstrained */ } right = CSS_RIGHT_SET; } return right; } uint8_t css_computed_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t position = css_computed_position(style); uint8_t bottom = get_bottom(style, length, unit); /* Fix up, based on computed position */ if (position == CSS_POSITION_STATIC) { /* Static -> auto */ bottom = CSS_BOTTOM_AUTO; } else if (position == CSS_POSITION_RELATIVE) { /* Relative -> follow $9.4.3 */ uint8_t top = get_top_bits(style); if (bottom == CSS_BOTTOM_AUTO && (top & 0x3) == CSS_TOP_AUTO) { /* Both auto => 0px */ *length = 0; *unit = CSS_UNIT_PX; } else if (bottom == CSS_BOTTOM_AUTO || (top & 0x3) != CSS_TOP_AUTO) { /* Bottom is auto or top is not auto => -top */ *length = -style->top; *unit = (css_unit) (top >> 2); } bottom = CSS_BOTTOM_SET; } return bottom; } uint8_t css_computed_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { uint8_t position = css_computed_position(style); uint8_t left = get_left(style, length, unit); /* Fix up, based on computed position */ if (position == CSS_POSITION_STATIC) { /* Static -> auto */ left = CSS_LEFT_AUTO; } else if (position == CSS_POSITION_RELATIVE) { /* Relative -> follow $9.4.3 */ uint8_t right = get_right_bits(style); if (left == CSS_LEFT_AUTO && (right & 0x3) == CSS_RIGHT_AUTO) { /* Both auto => 0px */ *length = 0; *unit = CSS_UNIT_PX; } else if (left == CSS_LEFT_AUTO) { /* Left is auto => -right */ *length = -style->right; *unit = (css_unit) (right >> 2); } else { /** \todo Consider containing block's direction * if overconstrained */ } left = CSS_LEFT_SET; } return left; } uint8_t css_computed_border_top_color(const css_computed_style *style, css_color *color) { return get_border_top_color(style, color); } uint8_t css_computed_border_right_color(const css_computed_style *style, css_color *color) { return get_border_right_color(style, color); } uint8_t css_computed_border_bottom_color(const css_computed_style *style, css_color *color) { return get_border_bottom_color(style, color); } uint8_t css_computed_border_left_color(const css_computed_style *style, css_color *color) { return get_border_left_color(style, color); } uint8_t css_computed_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_height(style, length, unit); } uint8_t css_computed_line_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_line_height(style, length, unit); } uint8_t css_computed_background_color(const css_computed_style *style, css_color *color) { return get_background_color(style, color); } uint8_t css_computed_z_index(const css_computed_style *style, int32_t *z_index) { return get_z_index(style, z_index); } uint8_t css_computed_margin_top(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_margin_top(style, length, unit); } uint8_t css_computed_margin_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_margin_right(style, length, unit); } uint8_t css_computed_margin_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_margin_bottom(style, length, unit); } uint8_t css_computed_margin_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_margin_left(style, length, unit); } uint8_t css_computed_background_attachment(const css_computed_style *style) { return get_background_attachment(style); } uint8_t css_computed_border_collapse(const css_computed_style *style) { return get_border_collapse(style); } uint8_t css_computed_caption_side(const css_computed_style *style) { return get_caption_side(style); } uint8_t css_computed_direction(const css_computed_style *style) { return get_direction(style); } uint8_t css_computed_max_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_max_height(style, length, unit); } uint8_t css_computed_max_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_max_width(style, length, unit); } uint8_t css_computed_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_width(style, length, unit); } uint8_t css_computed_empty_cells(const css_computed_style *style) { return get_empty_cells(style); } uint8_t css_computed_float(const css_computed_style *style) { uint8_t position = css_computed_position(style); uint8_t value = get_float(style); /* Fix up as per $9.7:2 */ if (position == CSS_POSITION_ABSOLUTE || position == CSS_POSITION_FIXED) return CSS_FLOAT_NONE; return value; } uint8_t css_computed_font_style(const css_computed_style *style) { return get_font_style(style); } uint8_t css_computed_min_height(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_min_height(style, length, unit); } uint8_t css_computed_min_width(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_min_width(style, length, unit); } uint8_t css_computed_background_repeat(const css_computed_style *style) { return get_background_repeat(style); } uint8_t css_computed_clear(const css_computed_style *style) { return get_clear(style); } uint8_t css_computed_padding_top(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_padding_top(style, length, unit); } uint8_t css_computed_padding_right(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_padding_right(style, length, unit); } uint8_t css_computed_padding_bottom(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_padding_bottom(style, length, unit); } uint8_t css_computed_padding_left(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_padding_left(style, length, unit); } uint8_t css_computed_overflow_x(const css_computed_style *style) { return get_overflow_x(style); } uint8_t css_computed_overflow_y(const css_computed_style *style) { return get_overflow_y(style); } uint8_t css_computed_position(const css_computed_style *style) { return get_position(style); } uint8_t css_computed_opacity(const css_computed_style *style, css_fixed *opacity) { return get_opacity(style, opacity); } uint8_t css_computed_text_transform(const css_computed_style *style) { return get_text_transform(style); } uint8_t css_computed_text_indent(const css_computed_style *style, css_fixed *length, css_unit *unit) { return get_text_indent(style, length, unit); } uint8_t css_computed_white_space(const css_computed_style *style) { return get_white_space(style); } uint8_t css_computed_background_position(const css_computed_style *style, css_fixed *hlength, css_unit *hunit, css_fixed *vlength, css_unit *vunit) { return get_background_position(style, hlength, hunit, vlength, vunit); } uint8_t css_computed_display(const css_computed_style *style, bool root) { uint8_t position = css_computed_position(style); uint8_t display = get_display(style); /* Return computed display as per $9.7 */ if (display == CSS_DISPLAY_NONE) return display; /* 1. */ if ((position == CSS_POSITION_ABSOLUTE || position == CSS_POSITION_FIXED) /* 2. */ || css_computed_float(style) != CSS_FLOAT_NONE /* 3. */ || root /* 4. */) { if (display == CSS_DISPLAY_INLINE_TABLE) { return CSS_DISPLAY_TABLE; } else if (display == CSS_DISPLAY_INLINE || display == CSS_DISPLAY_RUN_IN || display == CSS_DISPLAY_TABLE_ROW_GROUP || display == CSS_DISPLAY_TABLE_COLUMN || display == CSS_DISPLAY_TABLE_COLUMN_GROUP || display == CSS_DISPLAY_TABLE_HEADER_GROUP || display == CSS_DISPLAY_TABLE_FOOTER_GROUP || display == CSS_DISPLAY_TABLE_ROW || display == CSS_DISPLAY_TABLE_CELL || display == CSS_DISPLAY_TABLE_CAPTION || display == CSS_DISPLAY_INLINE_BLOCK) { return CSS_DISPLAY_BLOCK; } } /* 5. */ return display; } uint8_t css_computed_display_static(const css_computed_style *style) { return get_display(style); } uint8_t css_computed_font_variant(const css_computed_style *style) { return get_font_variant(style); } uint8_t css_computed_text_decoration(const css_computed_style *style) { return get_text_decoration(style); } uint8_t css_computed_font_family(const css_computed_style *style, lwc_string ***names) { return get_font_family(style, names); } uint8_t css_computed_border_top_style(const css_computed_style *style) { return get_border_top_style(style); } uint8_t css_computed_border_right_style(const css_computed_style *style) { return get_border_right_style(style); } uint8_t css_computed_border_bottom_style(const css_computed_style *style) { return get_border_bottom_style(style); } uint8_t css_computed_border_left_style(const css_computed_style *style) { return get_border_left_style(style); } uint8_t css_computed_font_weight(const css_computed_style *style) { return get_font_weight(style); } uint8_t css_computed_list_style_type(const css_computed_style *style) { return get_list_style_type(style); } uint8_t css_computed_outline_style(const css_computed_style *style) { return get_outline_style(style); } uint8_t css_computed_table_layout(const css_computed_style *style) { return get_table_layout(style); } uint8_t css_computed_unicode_bidi(const css_computed_style *style) { return get_unicode_bidi(style); } uint8_t css_computed_visibility(const css_computed_style *style) { return get_visibility(style); } uint8_t css_computed_list_style_position(const css_computed_style *style) { return get_list_style_position(style); } uint8_t css_computed_text_align(const css_computed_style *style) { return get_text_align(style); } uint8_t css_computed_page_break_after(const css_computed_style *style) { return get_page_break_after(style); } uint8_t css_computed_page_break_before(const css_computed_style *style) { return get_page_break_before(style); } uint8_t css_computed_page_break_inside(const css_computed_style *style) { return get_page_break_inside(style); } uint8_t css_computed_orphans(const css_computed_style *style, int32_t *orphans) { return get_orphans(style, orphans); } uint8_t css_computed_widows(const css_computed_style *style, int32_t *widows) { return get_widows(style, widows); } /****************************************************************************** * Library internals * ******************************************************************************/ /** * Compute the absolute values of a style * * \param parent Parent style, or NULL for tree root * \param style Computed style to process * \param compute_font_size Callback to calculate an absolute font-size * \param pw Private word for callback * \return CSS_OK on success. */ css_error css__compute_absolute_values(const css_computed_style *parent, css_computed_style *style, css_error (*compute_font_size)(void *pw, const css_hint *parent, css_hint *size), void *pw) { css_hint psize, size, ex_size; css_error error; /* Ensure font-size is absolute */ if (parent != NULL) { psize.status = get_font_size(parent, &psize.data.length.value, &psize.data.length.unit); } size.status = get_font_size(style, &size.data.length.value, &size.data.length.unit); error = compute_font_size(pw, parent != NULL ? &psize : NULL, &size); if (error != CSS_OK) return error; error = set_font_size(style, size.status, size.data.length.value, size.data.length.unit); if (error != CSS_OK) return error; /* Compute the size of an ex unit */ ex_size.status = CSS_FONT_SIZE_DIMENSION; ex_size.data.length.value = INTTOFIX(1); ex_size.data.length.unit = CSS_UNIT_EX; error = compute_font_size(pw, &size, &ex_size); if (error != CSS_OK) return error; /* Convert ex size into ems */ if (size.data.length.value != 0) ex_size.data.length.value = FDIV(ex_size.data.length.value, size.data.length.value); else ex_size.data.length.value = 0; ex_size.data.length.unit = CSS_UNIT_EM; /* Fix up background-position */ error = compute_absolute_length_pair(style, &ex_size.data.length, get_background_position, set_background_position); if (error != CSS_OK) return error; /* Fix up background-color */ error = compute_absolute_color(style, get_background_color, set_background_color); if (error != CSS_OK) return error; /* Fix up border-{top,right,bottom,left}-color */ error = compute_border_colors(style); if (error != CSS_OK) return error; /* Fix up border-{top,right,bottom,left}-width */ error = compute_absolute_border_width(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up sides */ error = compute_absolute_sides(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up height */ error = compute_absolute_length_auto(style, &ex_size.data.length, get_height, set_height); if (error != CSS_OK) return error; /* Fix up line-height (must be before vertical-align) */ error = compute_absolute_line_height(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up margins */ error = compute_absolute_margins(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up max-height */ error = compute_absolute_length_none(style, &ex_size.data.length, get_max_height, set_max_height); if (error != CSS_OK) return error; /* Fix up max-width */ error = compute_absolute_length_none(style, &ex_size.data.length, get_max_width, set_max_width); if (error != CSS_OK) return error; /* Fix up min-height */ error = compute_absolute_length(style, &ex_size.data.length, get_min_height, set_min_height); if (error != CSS_OK) return error; /* Fix up min-width */ error = compute_absolute_length(style, &ex_size.data.length, get_min_width, set_min_width); if (error != CSS_OK) return error; /* Fix up padding */ error = compute_absolute_padding(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up text-indent */ error = compute_absolute_length(style, &ex_size.data.length, get_text_indent, set_text_indent); if (error != CSS_OK) return error; /* Fix up vertical-align */ error = compute_absolute_vertical_align(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up width */ error = compute_absolute_length_auto(style, &ex_size.data.length, get_width, set_width); if (error != CSS_OK) return error; /* Uncommon properties */ if (style->uncommon != NULL) { /* Fix up border-spacing */ error = compute_absolute_length_pair(style, &ex_size.data.length, get_border_spacing, set_border_spacing); if (error != CSS_OK) return error; /* Fix up clip */ error = compute_absolute_clip(style, &ex_size.data.length); if (error != CSS_OK) return error; /* Fix up letter-spacing */ error = compute_absolute_length_normal(style, &ex_size.data.length, get_letter_spacing, set_letter_spacing); if (error != CSS_OK) return error; /* Fix up outline-color */ error = compute_absolute_color(style, get_outline_color, set_outline_color); if (error != CSS_OK) return error; /* Fix up outline-width */ error = compute_absolute_border_side_width(style, &ex_size.data.length, get_outline_width, set_outline_width); if (error != CSS_OK) return error; /* Fix up word spacing */ error = compute_absolute_length_normal(style, &ex_size.data.length, get_word_spacing, set_word_spacing); if (error != CSS_OK) return error; } return CSS_OK; } /****************************************************************************** * Absolute value calculators ******************************************************************************/ /** * Compute colour values, replacing any set to currentColor with * the computed value of color. * * \param style The style to process * \param get Accessor for colour value * \param set Mutator for colour value * \return CSS_OK on success */ css_error compute_absolute_color(css_computed_style *style, uint8_t (*get)(const css_computed_style *style, css_color *color), css_error (*set)(css_computed_style *style, uint8_t type, css_color color)) { css_color color; css_error error = CSS_OK; if (get(style, &color) == CSS_BACKGROUND_COLOR_CURRENT_COLOR) { css_color computed_color; css_computed_color(style, &computed_color); error = set(style, CSS_BACKGROUND_COLOR_COLOR, computed_color); } return error; } /** * Compute border colours, replacing any set to currentColor with * the computed value of color. * * \param style The style to process * \return CSS_OK on success */ css_error compute_border_colors(css_computed_style *style) { css_color color, bcol; css_error error; css_computed_color(style, &color); if (get_border_top_color(style, &bcol) == CSS_BORDER_COLOR_CURRENT_COLOR) { error = set_border_top_color(style, CSS_BORDER_COLOR_COLOR, color); if (error != CSS_OK) return error; } if (get_border_right_color(style, &bcol) == CSS_BORDER_COLOR_CURRENT_COLOR) { error = set_border_right_color(style, CSS_BORDER_COLOR_COLOR, color); if (error != CSS_OK) return error; } if (get_border_bottom_color(style, &bcol) == CSS_BORDER_COLOR_CURRENT_COLOR) { error = set_border_bottom_color(style, CSS_BORDER_COLOR_COLOR, color); if (error != CSS_OK) return error; } if (get_border_left_color(style, &bcol) == CSS_BORDER_COLOR_CURRENT_COLOR) { error = set_border_left_color(style, CSS_BORDER_COLOR_COLOR, color); if (error != CSS_OK) return error; } return CSS_OK; } /** * Compute absolute border widths * * \param style Style to process * \param ex_size Ex size in ems * \return CSS_OK on success */ css_error compute_absolute_border_width(css_computed_style *style, const css_hint_length *ex_size) { css_error error; error = compute_absolute_border_side_width(style, ex_size, get_border_top_width, set_border_top_width); if (error != CSS_OK) return error; error = compute_absolute_border_side_width(style, ex_size, get_border_right_width, set_border_right_width); if (error != CSS_OK) return error; error = compute_absolute_border_side_width(style, ex_size, get_border_bottom_width, set_border_bottom_width); if (error != CSS_OK) return error; error = compute_absolute_border_side_width(style, ex_size, get_border_left_width, set_border_left_width); if (error != CSS_OK) return error; return CSS_OK; } /** * Compute an absolute border side width * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_border_side_width(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)) { css_fixed length; css_unit unit; uint8_t type; type = get(style, &length, &unit); if (type == CSS_BORDER_WIDTH_THIN) { length = INTTOFIX(1); unit = CSS_UNIT_PX; } else if (type == CSS_BORDER_WIDTH_MEDIUM) { length = INTTOFIX(2); unit = CSS_UNIT_PX; } else if (type == CSS_BORDER_WIDTH_THICK) { length = INTTOFIX(4); unit = CSS_UNIT_PX; } if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } return set(style, CSS_BORDER_WIDTH_WIDTH, length, unit); } /** * Compute absolute clip * * \param style Style to process * \param ex_size Ex size in ems * \return CSS_OK on success */ css_error compute_absolute_clip(css_computed_style *style, const css_hint_length *ex_size) { css_computed_clip_rect rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, false, false, false, false }; css_error error; if (get_clip(style, &rect) == CSS_CLIP_RECT) { if (rect.top_auto == false) { if (rect.tunit == CSS_UNIT_EX) { rect.top = FMUL(rect.top, ex_size->value); rect.tunit = ex_size->unit; } } if (rect.right_auto == false) { if (rect.runit == CSS_UNIT_EX) { rect.right = FMUL(rect.right, ex_size->value); rect.runit = ex_size->unit; } } if (rect.bottom_auto == false) { if (rect.bunit == CSS_UNIT_EX) { rect.bottom = FMUL(rect.bottom, ex_size->value); rect.bunit = ex_size->unit; } } if (rect.left_auto == false) { if (rect.lunit == CSS_UNIT_EX) { rect.left = FMUL(rect.left, ex_size->value); rect.lunit = ex_size->unit; } } error = set_clip(style, CSS_CLIP_RECT, &rect); if (error != CSS_OK) return error; } return CSS_OK; } /** * Compute absolute line-height * * \param style Style to process * \param ex_size Ex size, in ems * \return CSS_OK on success */ css_error compute_absolute_line_height(css_computed_style *style, const css_hint_length *ex_size) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type; css_error error; type = get_line_height(style, &length, &unit); if (type == CSS_LINE_HEIGHT_DIMENSION) { if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } error = set_line_height(style, type, length, unit); if (error != CSS_OK) return error; } return CSS_OK; } /** * Compute the absolute values of {top,right,bottom,left} * * \param style Style to process * \param ex_size Ex size, in ems * \return CSS_OK on success */ css_error compute_absolute_sides(css_computed_style *style, const css_hint_length *ex_size) { css_error error; /* Calculate absolute lengths for sides */ error = compute_absolute_length_auto(style, ex_size, get_top, set_top); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_right, set_right); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_bottom, set_bottom); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_left, set_left); if (error != CSS_OK) return error; return CSS_OK; } /** * Compute absolute margins * * \param style Style to process * \param ex_size Ex size, in ems * \return CSS_OK on success */ css_error compute_absolute_margins(css_computed_style *style, const css_hint_length *ex_size) { css_error error; error = compute_absolute_length_auto(style, ex_size, get_margin_top, set_margin_top); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_margin_right, set_margin_right); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_margin_bottom, set_margin_bottom); if (error != CSS_OK) return error; error = compute_absolute_length_auto(style, ex_size, get_margin_left, set_margin_left); if (error != CSS_OK) return error; return CSS_OK; } /** * Compute absolute padding * * \param style Style to process * \param ex_size Ex size, in ems * \return CSS_OK on success */ css_error compute_absolute_padding(css_computed_style *style, const css_hint_length *ex_size) { css_error error; error = compute_absolute_length(style, ex_size, get_padding_top, set_padding_top); if (error != CSS_OK) return error; error = compute_absolute_length(style, ex_size, get_padding_right, set_padding_right); if (error != CSS_OK) return error; error = compute_absolute_length(style, ex_size, get_padding_bottom, set_padding_bottom); if (error != CSS_OK) return error; error = compute_absolute_length(style, ex_size, get_padding_left, set_padding_left); if (error != CSS_OK) return error; return CSS_OK; } /** * Compute absolute vertical-align * * \param style Style to process * \param ex_size Ex size, in ems * \return CSS_OK on success */ css_error compute_absolute_vertical_align(css_computed_style *style, const css_hint_length *ex_size) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type; css_error error; type = get_vertical_align(style, &length, &unit); if (type == CSS_VERTICAL_ALIGN_SET) { if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } error = set_vertical_align(style, type, length, unit); if (error != CSS_OK) return error; } return CSS_OK; } /** * Compute the absolute value of length * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_length(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)) { css_fixed length; css_unit unit; uint8_t type; type = get(style, &length, &unit); if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } return set(style, type, length, unit); } /** * Compute the absolute value of length or auto * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_length_auto(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)) { css_fixed length; css_unit unit; uint8_t type; type = get(style, &length, &unit); if (type != CSS_BOTTOM_AUTO) { if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } return set(style, CSS_BOTTOM_SET, length, unit); } return set(style, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX); } /** * Compute the absolute value of length or none * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_length_none(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)) { css_fixed length; css_unit unit; uint8_t type; type = get(style, &length, &unit); if (type != CSS_MAX_HEIGHT_NONE) { if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } return set(style, CSS_MAX_HEIGHT_SET, length, unit); } return set(style, CSS_MAX_HEIGHT_NONE, 0, CSS_UNIT_PX); } /** * Compute the absolute value of length or normal * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_length_normal(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len, css_unit *unit), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len, css_unit unit)) { css_fixed length; css_unit unit; uint8_t type; type = get(style, &length, &unit); if (type != CSS_LETTER_SPACING_NORMAL) { if (unit == CSS_UNIT_EX) { length = FMUL(length, ex_size->value); unit = ex_size->unit; } return set(style, CSS_LETTER_SPACING_SET, length, unit); } return set(style, CSS_LETTER_SPACING_NORMAL, 0, CSS_UNIT_PX); } /** * Compute the absolute value of length pair * * \param style Style to process * \param ex_size Ex size, in ems * \param get Function to read length * \param set Function to write length * \return CSS_OK on success */ css_error compute_absolute_length_pair(css_computed_style *style, const css_hint_length *ex_size, uint8_t (*get)(const css_computed_style *style, css_fixed *len1, css_unit *unit1, css_fixed *len2, css_unit *unit2), css_error (*set)(css_computed_style *style, uint8_t type, css_fixed len1, css_unit unit1, css_fixed len2, css_unit unit2)) { css_fixed length1, length2; css_unit unit1, unit2; uint8_t type; type = get(style, &length1, &unit1, &length2, &unit2); if (unit1 == CSS_UNIT_EX) { length1 = FMUL(length1, ex_size->value); unit1 = ex_size->unit; } if (unit2 == CSS_UNIT_EX) { length2 = FMUL(length2, ex_size->value); unit2 = ex_size->unit; } return set(style, type, length1, unit1, length2, unit2); } netsurf-all-3.2/libcss/src/select/font_face.c0000644000175000017500000001316412377676736020256 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 Things Made Out Of Other Things Ltd. * Written by James Montgomerie */ #include #include "select/font_face.h" static void font_faces_srcs_destroy(css_font_face *font_face) { uint32_t i; css_font_face_src *srcs = font_face->srcs; for (i = 0; i < font_face->n_srcs; ++i) { if (srcs[i].location != NULL) { lwc_string_unref(srcs[i].location); } } free(srcs); font_face->srcs = NULL; } static const css_font_face default_font_face = { NULL, NULL, 0, { (CSS_FONT_WEIGHT_NORMAL << 2) | CSS_FONT_STYLE_NORMAL } }; /** * Create a font-face * * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_NOMEM on memory exhaustion, * CSS_BADPARM on bad parameters. */ css_error css__font_face_create(css_font_face **result) { css_font_face *f; if (result == NULL) return CSS_BADPARM; f = malloc(sizeof(css_font_face)); if (f == NULL) return CSS_NOMEM; memcpy(f, &default_font_face, sizeof(css_font_face)); *result = f; return CSS_OK; } /** * Destroy a font-face * * \param font_face Font-face to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__font_face_destroy(css_font_face *font_face) { if (font_face == NULL) return CSS_BADPARM; if (font_face->font_family != NULL) lwc_string_unref(font_face->font_family); if (font_face->srcs != NULL) font_faces_srcs_destroy(font_face); free(font_face); return CSS_OK; } /** * Set a font-face's font-family name * * \param font_face The font-face * \param font_family Font-family name * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_BADPARM on bad parameters. */ css_error css__font_face_set_font_family(css_font_face *font_face, lwc_string *font_family) { if (font_face == NULL || font_family == NULL) return CSS_BADPARM; if (font_face->font_family != NULL) lwc_string_unref(font_face->font_family); font_face->font_family = lwc_string_ref(font_family); return CSS_OK; } /** * Get a font-face's font-family name * * \param font_face The font-face * \param result Pointer to location to receive result * \return CSS_OK on success, * CSS_BADPARM on bad parameters. */ css_error css_font_face_get_font_family(const css_font_face *font_face, lwc_string **font_family) { if (font_face == NULL || font_family == NULL) return CSS_BADPARM; *font_family = font_face->font_family; return CSS_OK; } /** * Get the style of font for a font-face. * * \param src The font-face * \return The style, as a css_font_style_e */ uint8_t css_font_face_font_style(const css_font_face *font_face) { return font_face->bits[0] & 0x3; } /** * Get the weight of font for a font-face. * * \param src The font-face * \return The style, as a css_font_weight_e */ uint8_t css_font_face_font_weight(const css_font_face *font_face) { return (font_face->bits[0] >> 2) & 0xf; } /** * Get the number of potential src locations for a font-face * * \param font_face The font-face * \param count Pointer to location to receive result * \return CSS_OK on success, * CSS_BADPARM on bad parameters. */ css_error css_font_face_count_srcs(const css_font_face *font_face, uint32_t *count) { if (font_face == NULL || count == NULL) return CSS_BADPARM; *count = font_face->n_srcs; return CSS_OK; } /** * Get a specific src location from a font-face * * \param font_face The font-face * \param index The index for the wanted src. * \param count Pointer to location to receive result * \return CSS_OK on success, * CSS_BADPARM on bad parameters. */ css_error css_font_face_get_src(const css_font_face *font_face, uint32_t index, const css_font_face_src **src) { if (font_face == NULL || src == NULL || index >= font_face->n_srcs) return CSS_BADPARM; *src = &(font_face->srcs[index]); return CSS_OK; } /** * Get the location for a font-face src. * * \param font_face The font-face * \param count Pointer to location to receive result * \return CSS_OK on success, * CSS_BADPARM on bad parameters. * * \note The type of location (local or URL) can be gathered from * css_font_face_src_location_type, and the format of font (if specified) * from css_font_face_src_format. */ css_error css_font_face_src_get_location(const css_font_face_src *src, lwc_string **location) { if (src == NULL || location == NULL) return CSS_BADPARM; *location = src->location; return CSS_OK; } /** * Get the location type for a font-face src. * * \param src The font-face src * \return The location type */ css_font_face_location_type css_font_face_src_location_type( const css_font_face_src *src) { return src->bits[0] & 0x3; } /** * Get the format of font for a font-face src. * * \param src The font-face src * \return The format, if specified */ css_font_face_format css_font_face_src_format(const css_font_face_src *src) { return (src->bits[0] >> 2) & 0x1f; } /** * Set a font-faces array of srcs. * * \param font_face The font-face * \param srcs The array of css_font_face_srcs * \param n_srcs The count of css_font_face_srcs in the array * \return The format, if specified */ css_error css__font_face_set_srcs(css_font_face *font_face, css_font_face_src *srcs, uint32_t n_srcs) { if (font_face->srcs != NULL) font_faces_srcs_destroy(font_face); font_face->srcs = srcs; font_face->n_srcs = n_srcs; return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/0000755000175000017500000000000012377713347020343 5ustar vincevincenetsurf-all-3.2/libcss/src/select/properties/background_position.c0000644000175000017500000000612112377676736024564 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_background_position(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_BACKGROUND_POSITION_INHERIT; css_fixed hlength = 0; css_fixed vlength = 0; uint32_t hunit = UNIT_PX; uint32_t vunit = UNIT_PX; if (isInherit(opv) == false) { value = CSS_BACKGROUND_POSITION_SET; switch (getValue(opv) & 0xf0) { case BACKGROUND_POSITION_HORZ_SET: hlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(hlength)); hunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(hunit)); break; case BACKGROUND_POSITION_HORZ_CENTER: hlength = INTTOFIX(50); hunit = UNIT_PCT; break; case BACKGROUND_POSITION_HORZ_RIGHT: hlength = INTTOFIX(100); hunit = UNIT_PCT; break; case BACKGROUND_POSITION_HORZ_LEFT: hlength = INTTOFIX(0); hunit = UNIT_PCT; break; } switch (getValue(opv) & 0x0f) { case BACKGROUND_POSITION_VERT_SET: vlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(vlength)); vunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(vunit)); break; case BACKGROUND_POSITION_VERT_CENTER: vlength = INTTOFIX(50); vunit = UNIT_PCT; break; case BACKGROUND_POSITION_VERT_BOTTOM: vlength = INTTOFIX(100); vunit = UNIT_PCT; break; case BACKGROUND_POSITION_VERT_TOP: vlength = INTTOFIX(0); vunit = UNIT_PCT; break; } } hunit = css__to_css_unit(hunit); vunit = css__to_css_unit(vunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_background_position(state->computed, value, hlength, hunit, vlength, vunit); } return CSS_OK; } css_error css__set_background_position_from_hint(const css_hint *hint, css_computed_style *style) { return set_background_position(style, hint->status, hint->data.position.h.value, hint->data.position.h.unit, hint->data.position.v.value, hint->data.position.v.unit); } css_error css__initial_background_position(css_select_state *state) { return set_background_position(state->computed, CSS_BACKGROUND_POSITION_SET, 0, CSS_UNIT_PCT, 0, CSS_UNIT_PCT); } css_error css__compose_background_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed hlength = 0, vlength = 0; css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX; uint8_t type = get_background_position(child, &hlength, &hunit, &vlength, &vunit); if (type == CSS_BACKGROUND_POSITION_INHERIT) { type = get_background_position(parent, &hlength, &hunit, &vlength, &vunit); } return set_background_position(result, type, hlength, hunit, vlength, vunit); } netsurf-all-3.2/libcss/src/select/properties/bottom.c0000644000175000017500000000235712377676736022034 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_bottom(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_bottom); } css_error css__set_bottom_from_hint(const css_hint *hint, css_computed_style *style) { return set_bottom(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_bottom(css_select_state *state) { return set_bottom(state->computed, CSS_BOTTOM_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_bottom(child, &length, &unit); if (type == CSS_BOTTOM_INHERIT) { type = get_bottom(parent, &length, &unit); } return set_bottom(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/elevation.c0000644000175000017500000000313612377676736022512 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_elevation(uint32_t opv, css_style *style, css_select_state *state) { css_fixed val = 0; uint32_t unit = UNIT_DEG; if (isInherit(opv) == false) { switch (getValue(opv)) { case ELEVATION_ANGLE: val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case ELEVATION_BELOW: case ELEVATION_LEVEL: case ELEVATION_ABOVE: case ELEVATION_HIGHER: case ELEVATION_LOWER: /** \todo convert to public values */ break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_elevation_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_elevation(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_elevation(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/margin_top.c0000644000175000017500000000242412377676736022662 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_margin_top(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_margin_top); } css_error css__set_margin_top_from_hint(const css_hint *hint, css_computed_style *style) { return set_margin_top(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_margin_top(css_select_state *state) { return set_margin_top(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX); } css_error css__compose_margin_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_margin_top(child, &length, &unit); if (type == CSS_MARGIN_INHERIT) { type = get_margin_top(parent, &length, &unit); } return set_margin_top(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/display.c0000644000175000017500000000470312377676736022172 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_display(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_DISPLAY_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case DISPLAY_INLINE: value = CSS_DISPLAY_INLINE; break; case DISPLAY_BLOCK: value = CSS_DISPLAY_BLOCK; break; case DISPLAY_LIST_ITEM: value = CSS_DISPLAY_LIST_ITEM; break; case DISPLAY_RUN_IN: value = CSS_DISPLAY_RUN_IN; break; case DISPLAY_INLINE_BLOCK: value = CSS_DISPLAY_INLINE_BLOCK; break; case DISPLAY_TABLE: value = CSS_DISPLAY_TABLE; break; case DISPLAY_INLINE_TABLE: value = CSS_DISPLAY_INLINE_TABLE; break; case DISPLAY_TABLE_ROW_GROUP: value = CSS_DISPLAY_TABLE_ROW_GROUP; break; case DISPLAY_TABLE_HEADER_GROUP: value = CSS_DISPLAY_TABLE_HEADER_GROUP; break; case DISPLAY_TABLE_FOOTER_GROUP: value = CSS_DISPLAY_TABLE_FOOTER_GROUP; break; case DISPLAY_TABLE_ROW: value = CSS_DISPLAY_TABLE_ROW; break; case DISPLAY_TABLE_COLUMN_GROUP: value = CSS_DISPLAY_TABLE_COLUMN_GROUP; break; case DISPLAY_TABLE_COLUMN: value = CSS_DISPLAY_TABLE_COLUMN; break; case DISPLAY_TABLE_CELL: value = CSS_DISPLAY_TABLE_CELL; break; case DISPLAY_TABLE_CAPTION: value = CSS_DISPLAY_TABLE_CAPTION; break; case DISPLAY_NONE: value = CSS_DISPLAY_NONE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_display(state->computed, value); } return CSS_OK; } css_error css__set_display_from_hint(const css_hint *hint, css_computed_style *style) { return set_display(style, hint->status); } css_error css__initial_display(css_select_state *state) { return set_display(state->computed, CSS_DISPLAY_INLINE); } css_error css__compose_display(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_display(child); if (type == CSS_DISPLAY_INHERIT) { type = get_display(parent); } return set_display(result, type); } netsurf-all-3.2/libcss/src/select/properties/outline_width.c0000644000175000017500000000306512377676736023403 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_outline_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_width(opv, style, state, set_outline_width); } css_error css__set_outline_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_outline_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_outline_width(css_select_state *state) { return set_outline_width(state->computed, CSS_OUTLINE_WIDTH_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_outline_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_outline_width(child, &length, &unit); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_OUTLINE_WIDTH_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_OUTLINE_WIDTH_INHERIT) { type = get_outline_width(parent, &length, &unit); } return set_outline_width(result, type, length, unit); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/font_family.c0000644000175000017500000001210212377676736023024 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_font_family(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FONT_FAMILY_INHERIT; lwc_string **fonts = NULL; uint32_t n_fonts = 0; if (isInherit(opv) == false) { uint32_t v = getValue(opv); while (v != FONT_FAMILY_END) { lwc_string *font = NULL; lwc_string **temp; switch (v) { case FONT_FAMILY_STRING: case FONT_FAMILY_IDENT_LIST: css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &font); advance_bytecode(style, sizeof(css_code_t)); break; case FONT_FAMILY_SERIF: if (value == CSS_FONT_FAMILY_INHERIT) value = CSS_FONT_FAMILY_SERIF; break; case FONT_FAMILY_SANS_SERIF: if (value == CSS_FONT_FAMILY_INHERIT) value = CSS_FONT_FAMILY_SANS_SERIF; break; case FONT_FAMILY_CURSIVE: if (value == CSS_FONT_FAMILY_INHERIT) value = CSS_FONT_FAMILY_CURSIVE; break; case FONT_FAMILY_FANTASY: if (value == CSS_FONT_FAMILY_INHERIT) value = CSS_FONT_FAMILY_FANTASY; break; case FONT_FAMILY_MONOSPACE: if (value == CSS_FONT_FAMILY_INHERIT) value = CSS_FONT_FAMILY_MONOSPACE; break; } /* Only use family-names which occur before the first * generic-family. Any values which occur after the * first generic-family are ignored. */ /** \todo Do this at bytecode generation time? */ if (value == CSS_FONT_FAMILY_INHERIT && font != NULL) { temp = realloc(fonts, (n_fonts + 1) * sizeof(lwc_string *)); if (temp == NULL) { if (fonts != NULL) { free(fonts); } return CSS_NOMEM; } fonts = temp; fonts[n_fonts] = font; n_fonts++; } v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(v)); } } /* Terminate array with blank entry, if needed */ if (n_fonts > 0) { lwc_string **temp; temp = realloc(fonts, (n_fonts + 1) * sizeof(lwc_string *)); if (temp == NULL) { free(fonts); return CSS_NOMEM; } fonts = temp; fonts[n_fonts] = NULL; if (value == CSS_FONT_FAMILY_INHERIT) { /* The stylesheet doesn't specify a generic family, * but it has specified named fonts. * Fall back to the user agent's default family. * We don't want to inherit, because that will * incorrectly overwrite the named fonts list too. */ css_hint hint; css_error error; error = state->handler->ua_default_for_property( state->pw, CSS_PROP_FONT_FAMILY, &hint); if (error == CSS_OK) { lwc_string **item; value = hint.status; for (item = hint.data.strings; item != NULL && (*item) != NULL; item++) { lwc_string_unref(*item); } if (hint.data.strings != NULL) { free(hint.data.strings); } } if (value == CSS_FONT_FAMILY_INHERIT) { /* No sane UA default: assume sans-serif */ value = CSS_FONT_FAMILY_SANS_SERIF; } } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { css_error error; error = set_font_family(state->computed, value, fonts); if (error != CSS_OK && n_fonts > 0) free(fonts); return error; } else { if (n_fonts > 0) free(fonts); } return CSS_OK; } css_error css__set_font_family_from_hint(const css_hint *hint, css_computed_style *style) { lwc_string **item; css_error error; error = set_font_family(style, hint->status, hint->data.strings); for (item = hint->data.strings; item != NULL && (*item) != NULL; item++) { lwc_string_unref(*item); } if (error != CSS_OK && hint->data.strings != NULL) free(hint->data.strings); return error; } css_error css__initial_font_family(css_select_state *state) { css_hint hint; css_error error; error = state->handler->ua_default_for_property(state->pw, CSS_PROP_FONT_FAMILY, &hint); if (error != CSS_OK) return error; return css__set_font_family_from_hint(&hint, state->computed); } css_error css__compose_font_family(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; lwc_string **names = NULL; uint8_t type = get_font_family(child, &names); if (type == CSS_FONT_FAMILY_INHERIT || result != child) { size_t n_names = 0; lwc_string **copy = NULL; if (type == CSS_FONT_FAMILY_INHERIT) type = get_font_family(parent, &names); if (names != NULL) { lwc_string **i; for (i = names; (*i) != NULL; i++) n_names++; copy = malloc((n_names + 1) * sizeof(lwc_string *)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, names, (n_names + 1) * sizeof(lwc_string *)); } error = set_font_family(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/break_inside.c0000644000175000017500000000253312377676736023143 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_break_inside(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BREAK_INSIDE_AUTO: case BREAK_INSIDE_AVOID: case BREAK_INSIDE_AVOID_PAGE: case BREAK_INSIDE_AVOID_COLUMN: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_break_inside_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_break_inside(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_break_inside(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/orphans.c0000644000175000017500000000222012377676736022167 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_orphans(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_number(opv, style, state, set_orphans); } css_error css__set_orphans_from_hint(const css_hint *hint, css_computed_style *style) { return set_orphans(style, hint->status, hint->data.integer); } css_error css__initial_orphans(css_select_state *state) { return set_orphans(state->computed, CSS_ORPHANS_SET, 2); } css_error css__compose_orphans(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { int32_t count = 0; uint8_t type = get_orphans(child, &count); if (type == CSS_ORPHANS_INHERIT) { type = get_orphans(parent, &count); } return set_orphans(result, type, count); } netsurf-all-3.2/libcss/src/select/properties/max_height.c0000644000175000017500000000244112377676736022637 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_max_height(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_none(opv, style, state, set_max_height); } css_error css__set_max_height_from_hint(const css_hint *hint, css_computed_style *style) { return set_max_height(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_max_height(css_select_state *state) { return set_max_height(state->computed, CSS_MAX_HEIGHT_NONE, 0, CSS_UNIT_PX); } css_error css__compose_max_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_max_height(child, &length, &unit); if (type == CSS_MAX_HEIGHT_INHERIT) { type = get_max_height(parent, &length, &unit); } return set_max_height(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/page_break_after.c0000644000175000017500000000232712377676736023766 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_page_break_after(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_page_break_after_before_inside(opv, style, state, set_page_break_after); } css_error css__set_page_break_after_from_hint(const css_hint *hint, css_computed_style *style) { return set_page_break_after(style, hint->status); } css_error css__initial_page_break_after(css_select_state *state) { return set_page_break_after(state->computed, CSS_PAGE_BREAK_AFTER_AUTO); } css_error css__compose_page_break_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_page_break_after(child); if (type == CSS_PAGE_BREAK_AFTER_INHERIT) { type = get_page_break_after(parent); } return set_page_break_after(result, type); } netsurf-all-3.2/libcss/src/select/properties/play_during.c0000644000175000017500000000272512377676736023044 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_play_during(uint32_t opv, css_style *style, css_select_state *state) { lwc_string *uri = NULL; if (isInherit(opv) == false) { switch (getValue(opv)) { case PLAY_DURING_URI: css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri); advance_bytecode(style, sizeof(css_code_t)); break; case PLAY_DURING_AUTO: case PLAY_DURING_NONE: /** \todo convert to public values */ break; } /** \todo mix & repeat */ } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo play-during */ } return CSS_OK; } css_error css__set_play_during_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_play_during(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_play_during(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/break_after.c0000644000175000017500000000272512377676736022774 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_break_after(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BREAK_AFTER_AUTO: case BREAK_AFTER_ALWAYS: case BREAK_AFTER_AVOID: case BREAK_AFTER_LEFT: case BREAK_AFTER_RIGHT: case BREAK_AFTER_PAGE: case BREAK_AFTER_COLUMN: case BREAK_AFTER_AVOID_PAGE: case BREAK_AFTER_AVOID_COLUMN: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_break_after_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_break_after(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_break_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/width.c0000644000175000017500000000234112377676736021640 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_width); } css_error css__set_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_width(css_select_state *state) { return set_width(state->computed, CSS_WIDTH_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_width(child, &length, &unit); if (type == CSS_WIDTH_INHERIT) { type = get_width(parent, &length, &unit); } return set_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/voice_family.c0000644000175000017500000000526712377676736023201 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_voice_family(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = 0; lwc_string **voices = NULL; uint32_t n_voices = 0; if (isInherit(opv) == false) { uint32_t v = getValue(opv); while (v != VOICE_FAMILY_END) { lwc_string *voice = NULL; lwc_string **temp; switch (v) { case VOICE_FAMILY_STRING: case VOICE_FAMILY_IDENT_LIST: css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &voice); advance_bytecode(style, sizeof(css_code_t)); break; case VOICE_FAMILY_MALE: if (value == 0) value = 1; break; case VOICE_FAMILY_FEMALE: if (value == 0) value = 1; break; case VOICE_FAMILY_CHILD: if (value == 0) value = 1; break; } /* Only use family-names which occur before the first * generic-family. Any values which occur after the * first generic-family are ignored. */ /** \todo Do this at bytecode generation time? */ if (value == 0 && voice != NULL) { temp = realloc(voices, (n_voices + 1) * sizeof(lwc_string *)); if (temp == NULL) { if (voices != NULL) { free(voices); } return CSS_NOMEM; } voices = temp; voices[n_voices] = voice; n_voices++; } v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(v)); } } /* Terminate array with blank entry, if needed */ if (n_voices > 0) { lwc_string **temp; temp = realloc(voices, (n_voices + 1) * sizeof(lwc_string *)); if (temp == NULL) { free(voices); return CSS_NOMEM; } voices = temp; voices[n_voices] = NULL; } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo voice-family */ if (n_voices > 0) free(voices); } else { if (n_voices > 0) free(voices); } return CSS_OK; } css_error css__set_voice_family_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_voice_family(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_voice_family(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/right.c0000644000175000017500000000234112377676736021636 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_right(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_right); } css_error css__set_right_from_hint(const css_hint *hint, css_computed_style *style) { return set_right(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_right(css_select_state *state) { return set_right(state->computed, CSS_RIGHT_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_right(child, &length, &unit); if (type == CSS_RIGHT_INHERIT) { type = get_right(parent, &length, &unit); } return set_right(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/font_size.c0000644000175000017500000000463212377676736022526 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_font_size(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FONT_SIZE_INHERIT; css_fixed size = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case FONT_SIZE_DIMENSION: value = CSS_FONT_SIZE_DIMENSION; size = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(size)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case FONT_SIZE_XX_SMALL: value = CSS_FONT_SIZE_XX_SMALL; break; case FONT_SIZE_X_SMALL: value = CSS_FONT_SIZE_X_SMALL; break; case FONT_SIZE_SMALL: value = CSS_FONT_SIZE_SMALL; break; case FONT_SIZE_MEDIUM: value = CSS_FONT_SIZE_MEDIUM; break; case FONT_SIZE_LARGE: value = CSS_FONT_SIZE_LARGE; break; case FONT_SIZE_X_LARGE: value = CSS_FONT_SIZE_X_LARGE; break; case FONT_SIZE_XX_LARGE: value = CSS_FONT_SIZE_XX_LARGE; break; case FONT_SIZE_LARGER: value = CSS_FONT_SIZE_LARGER; break; case FONT_SIZE_SMALLER: value = CSS_FONT_SIZE_SMALLER; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_font_size(state->computed, value, size, unit); } return CSS_OK; } css_error css__set_font_size_from_hint(const css_hint *hint, css_computed_style *style) { return set_font_size(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_font_size(css_select_state *state) { return set_font_size(state->computed, CSS_FONT_SIZE_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_font_size(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed size = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_font_size(child, &size, &unit); if (type == CSS_FONT_SIZE_INHERIT) { type = get_font_size(parent, &size, &unit); } return set_font_size(result, type, size, unit); } netsurf-all-3.2/libcss/src/select/properties/pitch.c0000644000175000017500000000304712377676736021634 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_pitch(uint32_t opv, css_style *style, css_select_state *state) { css_fixed freq = 0; uint32_t unit = UNIT_HZ; if (isInherit(opv) == false) { switch (getValue(opv)) { case PITCH_FREQUENCY: freq = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(freq)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case PITCH_X_LOW: case PITCH_LOW: case PITCH_MEDIUM: case PITCH_HIGH: case PITCH_X_HIGH: /** \todo convert to public values */ break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo pitch */ } return CSS_OK; } css_error css__set_pitch_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_pitch(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_pitch(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/quotes.c0000644000175000017500000000663212377676736022050 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_quotes(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_QUOTES_INHERIT; lwc_string **quotes = NULL; uint32_t n_quotes = 0; if (isInherit(opv) == false) { uint32_t v = getValue(opv); value = CSS_QUOTES_STRING; while (v != QUOTES_NONE) { lwc_string *open, *close; lwc_string **temp; css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &open); advance_bytecode(style, sizeof(css_code_t)); css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &close); advance_bytecode(style, sizeof(css_code_t)); temp = realloc(quotes, (n_quotes + 2) * sizeof(lwc_string *)); if (temp == NULL) { if (quotes != NULL) { free(quotes); } return CSS_NOMEM; } quotes = temp; quotes[n_quotes++] = open; quotes[n_quotes++] = close; v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(v)); } } /* Terminate array, if required */ if (n_quotes > 0) { lwc_string **temp; temp = realloc(quotes, (n_quotes + 1) * sizeof(lwc_string *)); if (temp == NULL) { free(quotes); return CSS_NOMEM; } quotes = temp; quotes[n_quotes] = NULL; } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { css_error error; error = set_quotes(state->computed, value, quotes); if (error != CSS_OK && quotes != NULL) free(quotes); return error; } else { if (quotes != NULL) free(quotes); } return CSS_OK; } css_error css__set_quotes_from_hint(const css_hint *hint, css_computed_style *style) { lwc_string **item; css_error error; error = set_quotes(style, hint->status, hint->data.strings); for (item = hint->data.strings; item != NULL && (*item) != NULL; item++) { lwc_string_unref(*item); } if (error != CSS_OK && hint->data.strings != NULL) free(hint->data.strings); return error; } css_error css__initial_quotes(css_select_state *state) { css_hint hint; css_error error; error = state->handler->ua_default_for_property(state->pw, CSS_PROP_QUOTES, &hint); if (error != CSS_OK) return error; return css__set_quotes_from_hint(&hint, state->computed); } css_error css__compose_quotes(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; lwc_string **quotes = NULL; uint8_t type = get_quotes(child, "es); if (type == CSS_QUOTES_INHERIT || result != child) { size_t n_quotes = 0; lwc_string **copy = NULL; if (type == CSS_QUOTES_INHERIT) { type = get_quotes(parent, "es); } if (quotes != NULL) { lwc_string **i; for (i = quotes; (*i) != NULL; i++) n_quotes++; copy = malloc((n_quotes + 1) * sizeof(lwc_string *)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, quotes, (n_quotes + 1) * sizeof(lwc_string *)); } error = set_quotes(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/page_break_before.c0000644000175000017500000000236012377676736024124 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_page_break_before(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_page_break_after_before_inside(opv, style, state, set_page_break_before); } css_error css__set_page_break_before_from_hint(const css_hint *hint, css_computed_style *style) { return set_page_break_before(style, hint->status); } css_error css__initial_page_break_before(css_select_state *state) { return set_page_break_before(state->computed, CSS_PAGE_BREAK_BEFORE_AUTO); } css_error css__compose_page_break_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_page_break_before(child); if (type == CSS_PAGE_BREAK_BEFORE_INHERIT) { type = get_page_break_before(parent); } return set_page_break_before(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_top_style.c0000644000175000017500000000227012377676736024101 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_top_style(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_style(opv, style, state, set_border_top_style); } css_error css__set_border_top_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_top_style(style, hint->status); } css_error css__initial_border_top_style(css_select_state *state) { return set_border_top_style(state->computed, CSS_BORDER_STYLE_NONE); } css_error css__compose_border_top_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_border_top_style(child); if (type == CSS_BORDER_STYLE_INHERIT) { type = get_border_top_style(parent); } return set_border_top_style(result, type); } netsurf-all-3.2/libcss/src/select/properties/margin_bottom.c0000644000175000017500000000246212377676736023366 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_margin_bottom(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_margin_bottom); } css_error css__set_margin_bottom_from_hint(const css_hint *hint, css_computed_style *style) { return set_margin_bottom(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_margin_bottom(css_select_state *state) { return set_margin_bottom(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX); } css_error css__compose_margin_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_margin_bottom(child, &length, &unit); if (type == CSS_MARGIN_INHERIT) { type = get_margin_bottom(parent, &length, &unit); } return set_margin_bottom(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/border_right_color.c0000644000175000017500000000243612377676736024376 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_right_color(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_bg_border_color(opv, style, state, set_border_right_color); } css_error css__set_border_right_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_right_color(style, hint->status, hint->data.color); } css_error css__initial_border_right_color(css_select_state *state) { return set_border_right_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0); } css_error css__compose_border_right_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_border_right_color(child, &color); if (type == CSS_BORDER_COLOR_INHERIT) { type = get_border_right_color(parent, &color); } return set_border_right_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/height.c0000644000175000017500000000235512377676736021776 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_height(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_height); } css_error css__set_height_from_hint(const css_hint *hint, css_computed_style *style) { return set_height(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_height(css_select_state *state) { return set_height(state->computed, CSS_HEIGHT_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_height(child, &length, &unit); if (type == CSS_HEIGHT_INHERIT) { type = get_height(parent, &length, &unit); } return set_height(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/writing_mode.c0000644000175000017500000000331412377676736023211 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_writing_mode(uint32_t opv, css_style *style, css_select_state *state) { bool inherit = isInherit(opv); uint16_t writing_mode = CSS_WRITING_MODE_INHERIT; UNUSED(style); if (inherit == false) { switch (getValue(opv)) { case WRITING_MODE_HORIZONTAL_TB: writing_mode = CSS_WRITING_MODE_HORIZONTAL_TB; break; case WRITING_MODE_VERTICAL_RL: writing_mode = CSS_WRITING_MODE_VERTICAL_RL; break; case WRITING_MODE_VERTICAL_LR: writing_mode = CSS_WRITING_MODE_VERTICAL_LR; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, inherit)) { return set_writing_mode(state->computed, writing_mode); } return CSS_OK; } css_error css__set_writing_mode_from_hint(const css_hint *hint, css_computed_style *style) { return set_writing_mode(style, hint->status); } css_error css__initial_writing_mode(css_select_state *state) { return set_writing_mode(state->computed, CSS_WRITING_MODE_HORIZONTAL_TB); } css_error css__compose_writing_mode(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t writing_mode = get_writing_mode(child); if (writing_mode == CSS_WRITING_MODE_INHERIT) { writing_mode = get_writing_mode(parent); } return set_writing_mode(result, writing_mode); } netsurf-all-3.2/libcss/src/select/properties/speak_punctuation.c0000644000175000017500000000246212377676736024261 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_speak_punctuation( uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case SPEAK_PUNCTUATION_CODE: case SPEAK_PUNCTUATION_NONE: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo speak-punctuation */ } return CSS_OK; } css_error css__set_speak_punctuation_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_speak_punctuation(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_speak_punctuation(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/text_align.c0000644000175000017500000000442412377676736022663 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_text_align(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_TEXT_ALIGN_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case TEXT_ALIGN_LEFT: value = CSS_TEXT_ALIGN_LEFT; break; case TEXT_ALIGN_RIGHT: value = CSS_TEXT_ALIGN_RIGHT; break; case TEXT_ALIGN_CENTER: value = CSS_TEXT_ALIGN_CENTER; break; case TEXT_ALIGN_JUSTIFY: value = CSS_TEXT_ALIGN_JUSTIFY; break; case TEXT_ALIGN_LIBCSS_LEFT: value = CSS_TEXT_ALIGN_LIBCSS_LEFT; break; case TEXT_ALIGN_LIBCSS_CENTER: value = CSS_TEXT_ALIGN_LIBCSS_CENTER; break; case TEXT_ALIGN_LIBCSS_RIGHT: value = CSS_TEXT_ALIGN_LIBCSS_RIGHT; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_text_align(state->computed, value); } return CSS_OK; } css_error css__set_text_align_from_hint(const css_hint *hint, css_computed_style *style) { return set_text_align(style, hint->status); } css_error css__initial_text_align(css_select_state *state) { return set_text_align(state->computed, CSS_TEXT_ALIGN_DEFAULT); } css_error css__compose_text_align(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_text_align(child); if (type == CSS_TEXT_ALIGN_INHERIT) { type = get_text_align(parent); } else if (type == CSS_TEXT_ALIGN_INHERIT_IF_NON_MAGIC) { /* This is purely for the benefit of HTML tables */ type = get_text_align(parent); /* If the parent's text-align is a magical one, * then reset to the default value. Otherwise, * inherit as normal. */ if (type == CSS_TEXT_ALIGN_LIBCSS_LEFT || type == CSS_TEXT_ALIGN_LIBCSS_CENTER || type == CSS_TEXT_ALIGN_LIBCSS_RIGHT) type = CSS_TEXT_ALIGN_DEFAULT; } return set_text_align(result, type); } netsurf-all-3.2/libcss/src/select/properties/column_rule_width.c0000644000175000017500000000312012377676736024240 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_rule_width(uint32_t opv, css_style *style, css_select_state *state) { css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_RULE_WIDTH_SET: length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case COLUMN_RULE_WIDTH_THIN: case COLUMN_RULE_WIDTH_MEDIUM: case COLUMN_RULE_WIDTH_THICK: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_rule_width_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_rule_width(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_rule_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/content.c0000644000175000017500000001371512377676736022202 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_content(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_CONTENT_INHERIT; css_computed_content_item *content = NULL; uint32_t n_contents = 0; if (isInherit(opv) == false) { uint32_t v = getValue(opv); if (v == CONTENT_NORMAL) { value = CSS_CONTENT_NORMAL; } else if (v == CONTENT_NONE) { value = CSS_CONTENT_NONE; } else { value = CSS_CONTENT_SET; while (v != CONTENT_NORMAL) { lwc_string *he; css_computed_content_item *temp; css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &he); temp = realloc(content, (n_contents + 1) * sizeof(css_computed_content_item)); if (temp == NULL) { if (content != NULL) { free(content); } return CSS_NOMEM; } content = temp; switch (v & 0xff) { case CONTENT_COUNTER: advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_COUNTER; content[n_contents].data.counter.name = he; content[n_contents].data.counter.style = v >> CONTENT_COUNTER_STYLE_SHIFT; break; case CONTENT_COUNTERS: { lwc_string *sep; advance_bytecode(style, sizeof(css_code_t)); css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &sep); advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_COUNTERS; content[n_contents].data.counters.name = he; content[n_contents].data.counters.sep = sep; content[n_contents].data.counters.style = v >> CONTENT_COUNTERS_STYLE_SHIFT; } break; case CONTENT_URI: advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_URI; content[n_contents].data.uri = he; break; case CONTENT_ATTR: advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_ATTR; content[n_contents].data.attr = he; break; case CONTENT_STRING: advance_bytecode(style, sizeof(css_code_t)); content[n_contents].type = CSS_COMPUTED_CONTENT_STRING; content[n_contents].data.string = he; break; case CONTENT_OPEN_QUOTE: content[n_contents].type = CSS_COMPUTED_CONTENT_OPEN_QUOTE; break; case CONTENT_CLOSE_QUOTE: content[n_contents].type = CSS_COMPUTED_CONTENT_CLOSE_QUOTE; break; case CONTENT_NO_OPEN_QUOTE: content[n_contents].type = CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE; break; case CONTENT_NO_CLOSE_QUOTE: content[n_contents].type = CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE; break; } n_contents++; v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(v)); } } } /* If we have some content, terminate the array with a blank entry */ if (n_contents > 0) { css_computed_content_item *temp; temp = realloc(content, (n_contents + 1) * sizeof(css_computed_content_item)); if (temp == NULL) { free(content); return CSS_NOMEM; } content = temp; content[n_contents].type = CSS_COMPUTED_CONTENT_NONE; } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { css_error error; error = set_content(state->computed, value, content); if (error != CSS_OK && content != NULL) free(content); return error; } else if (content != NULL) { free(content); } return CSS_OK; } css_error css__set_content_from_hint(const css_hint *hint, css_computed_style *style) { css_computed_content_item *item; css_error error; error = set_content(style, hint->status, hint->data.content); for (item = hint->data.content; item != NULL && item->type != CSS_COMPUTED_CONTENT_NONE; item++) { switch (item->type) { case CSS_COMPUTED_CONTENT_STRING: lwc_string_unref(item->data.string); break; case CSS_COMPUTED_CONTENT_URI: lwc_string_unref(item->data.uri); break; case CSS_COMPUTED_CONTENT_COUNTER: lwc_string_unref(item->data.counter.name); break; case CSS_COMPUTED_CONTENT_COUNTERS: lwc_string_unref(item->data.counters.name); lwc_string_unref(item->data.counters.sep); break; case CSS_COMPUTED_CONTENT_ATTR: lwc_string_unref(item->data.attr); break; default: break; } } if (error != CSS_OK && hint->data.content != NULL) free(hint->data.content); return error; } css_error css__initial_content(css_select_state *state) { return set_content(state->computed, CSS_CONTENT_NORMAL, NULL); } css_error css__compose_content(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; const css_computed_content_item *items = NULL; uint8_t type = get_content(child, &items); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CONTENT_INHERIT || (child->uncommon != NULL && result != child)) { size_t n_items = 0; css_computed_content_item *copy = NULL; if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CONTENT_INHERIT) { type = get_content(parent, &items); } if (type == CSS_CONTENT_SET) { const css_computed_content_item *i; for (i = items; i->type != CSS_COMPUTED_CONTENT_NONE; i++) n_items++; copy = malloc((n_items + 1) * sizeof(css_computed_content_item)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, items, (n_items + 1) * sizeof(css_computed_content_item)); } error = set_content(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/column_width.c0000644000175000017500000000276112377676736023223 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_width(uint32_t opv, css_style *style, css_select_state *state) { css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_WIDTH_SET: length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case COLUMN_WIDTH_AUTO: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_width_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_width(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/cue_after.c0000644000175000017500000000201412377676736022453 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_cue_after(uint32_t opv, css_style *style, css_select_state *state) { /** \todo cue-after */ return css__cascade_uri_none(opv, style, state, NULL); } css_error css__set_cue_after_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_cue_after(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_cue_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/color.c0000644000175000017500000000356112377676736021644 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_color(uint32_t opv, css_style *style, css_select_state *state) { bool inherit = isInherit(opv); uint16_t value = CSS_COLOR_INHERIT; css_color color = 0; if (inherit == false) { switch (getValue(opv)) { case COLOR_TRANSPARENT: value = CSS_COLOR_COLOR; break; case COLOR_CURRENT_COLOR: /* color: currentColor always computes to inherit */ value = CSS_COLOR_INHERIT; inherit = true; break; case COLOR_SET: value = CSS_COLOR_COLOR; color = *((css_color *) style->bytecode); advance_bytecode(style, sizeof(color)); break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, inherit)) { return set_color(state->computed, value, color); } return CSS_OK; } css_error css__set_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_color(style, hint->status, hint->data.color); } css_error css__initial_color(css_select_state *state) { css_hint hint; css_error error; error = state->handler->ua_default_for_property(state->pw, CSS_PROP_COLOR, &hint); if (error != CSS_OK) return error; return css__set_color_from_hint(&hint, state->computed); } css_error css__compose_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_color(child, &color); if (type == CSS_COLOR_INHERIT) { type = get_color(parent, &color); } return set_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/overflow_y.c0000644000175000017500000000312312377676736022713 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_overflow_y(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_OVERFLOW_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case OVERFLOW_VISIBLE: value = CSS_OVERFLOW_VISIBLE; break; case OVERFLOW_HIDDEN: value = CSS_OVERFLOW_HIDDEN; break; case OVERFLOW_SCROLL: value = CSS_OVERFLOW_SCROLL; break; case OVERFLOW_AUTO: value = CSS_OVERFLOW_AUTO; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_overflow_y(state->computed, value); } return CSS_OK; } css_error css__set_overflow_y_from_hint(const css_hint *hint, css_computed_style *style) { return set_overflow_y(style, hint->status); } css_error css__initial_overflow_y(css_select_state *state) { return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE); } css_error css__compose_overflow_y(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_overflow_y(child); if (type == CSS_OVERFLOW_INHERIT) { type = get_overflow_y(parent); } return set_overflow_y(result, type); } netsurf-all-3.2/libcss/src/select/properties/richness.c0000644000175000017500000000200512377676736022334 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_richness(uint32_t opv, css_style *style, css_select_state *state) { /** \todo richness */ return css__cascade_number(opv, style, state, NULL); } css_error css__set_richness_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_richness(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_richness(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/left.c0000644000175000017500000000232512377676736021455 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_left(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_left); } css_error css__set_left_from_hint(const css_hint *hint, css_computed_style *style) { return set_left(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_left(css_select_state *state) { return set_left(state->computed, CSS_LEFT_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_left(child, &length, &unit); if (type == CSS_LEFT_INHERIT) { type = get_left(parent, &length, &unit); } return set_left(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/cursor.c0000644000175000017500000001035612377676736022043 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_cursor(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_CURSOR_INHERIT; lwc_string **uris = NULL; uint32_t n_uris = 0; if (isInherit(opv) == false) { uint32_t v = getValue(opv); while (v == CURSOR_URI) { lwc_string *uri; lwc_string **temp; css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri); advance_bytecode(style, sizeof(css_code_t)); temp = realloc(uris, (n_uris + 1) * sizeof(lwc_string *)); if (temp == NULL) { if (uris != NULL) { free(uris); } return CSS_NOMEM; } uris = temp; uris[n_uris] = uri; n_uris++; v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(v)); } switch (v) { case CURSOR_AUTO: value = CSS_CURSOR_AUTO; break; case CURSOR_CROSSHAIR: value = CSS_CURSOR_CROSSHAIR; break; case CURSOR_DEFAULT: value = CSS_CURSOR_DEFAULT; break; case CURSOR_POINTER: value = CSS_CURSOR_POINTER; break; case CURSOR_MOVE: value = CSS_CURSOR_MOVE; break; case CURSOR_E_RESIZE: value = CSS_CURSOR_E_RESIZE; break; case CURSOR_NE_RESIZE: value = CSS_CURSOR_NE_RESIZE; break; case CURSOR_NW_RESIZE: value = CSS_CURSOR_NW_RESIZE; break; case CURSOR_N_RESIZE: value = CSS_CURSOR_N_RESIZE; break; case CURSOR_SE_RESIZE: value = CSS_CURSOR_SE_RESIZE; break; case CURSOR_SW_RESIZE: value = CSS_CURSOR_SW_RESIZE; break; case CURSOR_S_RESIZE: value = CSS_CURSOR_S_RESIZE; break; case CURSOR_W_RESIZE: value = CSS_CURSOR_W_RESIZE; break; case CURSOR_TEXT: value = CSS_CURSOR_TEXT; break; case CURSOR_WAIT: value = CSS_CURSOR_WAIT; break; case CURSOR_HELP: value = CSS_CURSOR_HELP; break; case CURSOR_PROGRESS: value = CSS_CURSOR_PROGRESS; break; } } /* Terminate array with blank entry, if needed */ if (n_uris > 0) { lwc_string **temp; temp = realloc(uris, (n_uris + 1) * sizeof(lwc_string *)); if (temp == NULL) { free(uris); return CSS_NOMEM; } uris = temp; uris[n_uris] = NULL; } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { css_error error; error = set_cursor(state->computed, value, uris); if (error != CSS_OK && n_uris > 0) free(uris); return error; } else { if (n_uris > 0) free(uris); } return CSS_OK; } css_error css__set_cursor_from_hint(const css_hint *hint, css_computed_style *style) { lwc_string **item; css_error error; error = set_cursor(style, hint->status, hint->data.strings); for (item = hint->data.strings; item != NULL && (*item) != NULL; item++) { lwc_string_unref(*item); } if (error != CSS_OK && hint->data.strings != NULL) free(hint->data.strings); return error; } css_error css__initial_cursor(css_select_state *state) { return set_cursor(state->computed, CSS_CURSOR_AUTO, NULL); } css_error css__compose_cursor(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; lwc_string **urls = NULL; uint8_t type = get_cursor(child, &urls); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CURSOR_INHERIT || (child->uncommon != NULL && result != child)) { size_t n_urls = 0; lwc_string **copy = NULL; if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CURSOR_INHERIT) { type = get_cursor(parent, &urls); } if (urls != NULL) { lwc_string **i; for (i = urls; (*i) != NULL; i++) n_urls++; copy = malloc((n_urls + 1) * sizeof(lwc_string *)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, urls, (n_urls + 1) * sizeof(lwc_string *)); } error = set_cursor(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/background_color.c0000644000175000017500000000240612377676736024040 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_background_color(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_bg_border_color(opv, style, state, set_background_color); } css_error css__set_background_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_background_color(style, hint->status, hint->data.color); } css_error css__initial_background_color(css_select_state *state) { return set_background_color(state->computed, CSS_BACKGROUND_COLOR_COLOR, 0); } css_error css__compose_background_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_background_color(child, &color); if (type == CSS_BACKGROUND_COLOR_INHERIT) { type = get_background_color(parent, &color); } return set_background_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/speak_numeral.c0000644000175000017500000000243512377676736023353 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_speak_numeral(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case SPEAK_NUMERAL_DIGITS: case SPEAK_NUMERAL_CONTINUOUS: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo speak-numeral */ } return CSS_OK; } css_error css__set_speak_numeral_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_speak_numeral(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_speak_numeral(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/font_variant.c0000644000175000017500000000301012377676736023205 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_font_variant(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FONT_VARIANT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case FONT_VARIANT_NORMAL: value = CSS_FONT_VARIANT_NORMAL; break; case FONT_VARIANT_SMALL_CAPS: value = CSS_FONT_VARIANT_SMALL_CAPS; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_font_variant(state->computed, value); } return CSS_OK; } css_error css__set_font_variant_from_hint(const css_hint *hint, css_computed_style *style) { return set_font_variant(style, hint->status); } css_error css__initial_font_variant(css_select_state *state) { return set_font_variant(state->computed, CSS_FONT_VARIANT_NORMAL); } css_error css__compose_font_variant(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_font_variant(child); if (type == CSS_FONT_VARIANT_INHERIT) { type = get_font_variant(parent); } return set_font_variant(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_right_width.c0000644000175000017500000000257012377676736024376 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_right_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_width(opv, style, state, set_border_right_width); } css_error css__set_border_right_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_right_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_border_right_width(css_select_state *state) { return set_border_right_width(state->computed, CSS_BORDER_WIDTH_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_border_right_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_border_right_width(child, &length, &unit); if (type == CSS_BORDER_WIDTH_INHERIT) { type = get_border_right_width(parent, &length, &unit); } return set_border_right_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/padding_left.c0000644000175000017500000000244512377676736023146 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_padding_left(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_padding_left); } css_error css__set_padding_left_from_hint(const css_hint *hint, css_computed_style *style) { return set_padding_left(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_padding_left(css_select_state *state) { return set_padding_left(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX); } css_error css__compose_padding_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_padding_left(child, &length, &unit); if (type == CSS_PADDING_INHERIT) { type = get_padding_left(parent, &length, &unit); } return set_padding_left(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/pause_after.c0000644000175000017500000000202412377676736023015 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_pause_after(uint32_t opv, css_style *style, css_select_state *state) { /** \todo pause-after */ return css__cascade_length(opv, style, state, NULL); } css_error css__set_pause_after_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_pause_after(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_pause_after(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/outline_color.c0000644000175000017500000000411312377676736023375 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_outline_color(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_OUTLINE_COLOR_INHERIT; css_color color = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case OUTLINE_COLOR_TRANSPARENT: value = CSS_OUTLINE_COLOR_COLOR; break; case OUTLINE_COLOR_CURRENT_COLOR: value = CSS_OUTLINE_COLOR_CURRENT_COLOR; break; case OUTLINE_COLOR_SET: value = CSS_OUTLINE_COLOR_COLOR; color = *((css_color *) style->bytecode); advance_bytecode(style, sizeof(color)); break; case OUTLINE_COLOR_INVERT: value = CSS_OUTLINE_COLOR_INVERT; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_outline_color(state->computed, value, color); } return CSS_OK; } css_error css__set_outline_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_outline_color(style, hint->status, hint->data.color); } css_error css__initial_outline_color(css_select_state *state) { return set_outline_color(state->computed, CSS_OUTLINE_COLOR_INVERT, 0); } css_error css__compose_outline_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color = 0; uint8_t type = get_outline_color(child, &color); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_OUTLINE_COLOR_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_OUTLINE_COLOR_INHERIT) { type = get_outline_color(parent, &color); } return set_outline_color(result, type, color); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/font_style.c0000644000175000017500000000304612377676736022712 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_font_style(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FONT_STYLE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case FONT_STYLE_NORMAL: value = CSS_FONT_STYLE_NORMAL; break; case FONT_STYLE_ITALIC: value = CSS_FONT_STYLE_ITALIC; break; case FONT_STYLE_OBLIQUE: value = CSS_FONT_STYLE_OBLIQUE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_font_style(state->computed, value); } return CSS_OK; } css_error css__set_font_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_font_style(style, hint->status); } css_error css__initial_font_style(css_select_state *state) { return set_font_style(state->computed, CSS_FONT_STYLE_NORMAL); } css_error css__compose_font_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_font_style(child); if (type == CSS_FONT_STYLE_INHERIT) { type= get_font_style(parent); } return set_font_style(result, type); } netsurf-all-3.2/libcss/src/select/properties/helpers.h0000644000175000017500000000446512377676736022201 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_properties_helpers_h_ #define css_select_properties_helpers_h_ uint32_t generic_destroy_color(void *bytecode); uint32_t generic_destroy_uri(void *bytecode); uint32_t generic_destroy_length(void *bytecode); uint32_t generic_destroy_number(void *bytecode); css_unit css__to_css_unit(uint32_t u); css_error css__cascade_bg_border_color(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_color)); css_error css__cascade_uri_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, lwc_string *)); css_error css__cascade_border_style(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t)); css_error css__cascade_border_width(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)); css_error css__cascade_length_auto(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)); css_error css__cascade_length_normal(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)); css_error css__cascade_length_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)); css_error css__cascade_length(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)); css_error css__cascade_number(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed)); css_error css__cascade_page_break_after_before_inside(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t)); css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_computed_counter *)); #endif netsurf-all-3.2/libcss/src/select/properties/outline_style.c0000644000175000017500000000223312377676736023420 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_outline_style(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_style(opv, style, state, set_outline_style); } css_error css__set_outline_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_outline_style(style, hint->status); } css_error css__initial_outline_style(css_select_state *state) { return set_outline_style(state->computed, CSS_OUTLINE_STYLE_NONE); } css_error css__compose_outline_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_outline_style(child); if (type == CSS_OUTLINE_STYLE_INHERIT) { type = get_outline_style(parent); } return set_outline_style(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_collapse.c0000644000175000017500000000307712377676736023667 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_collapse(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_BORDER_COLLAPSE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BORDER_COLLAPSE_SEPARATE: value = CSS_BORDER_COLLAPSE_SEPARATE; break; case BORDER_COLLAPSE_COLLAPSE: value = CSS_BORDER_COLLAPSE_COLLAPSE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_border_collapse(state->computed, value); } return CSS_OK; } css_error css__set_border_collapse_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_collapse(style, hint->status); } css_error css__initial_border_collapse(css_select_state *state) { return set_border_collapse(state->computed, CSS_BORDER_COLLAPSE_SEPARATE); } css_error css__compose_border_collapse(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_border_collapse(child); if (type == CSS_BORDER_COLLAPSE_INHERIT) { type = get_border_collapse(parent); } return set_border_collapse(result, type); } netsurf-all-3.2/libcss/src/select/properties/helpers.c0000644000175000017500000002763512377676736022200 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/properties/properties.h" #include "select/propget.h" #include "select/propset.h" #include "utils/utils.h" #include "select/properties/helpers.h" /* Useful helpers */ css_unit css__to_css_unit(uint32_t u) { switch (u) { case UNIT_PX: return CSS_UNIT_PX; case UNIT_EX: return CSS_UNIT_EX; case UNIT_EM: return CSS_UNIT_EM; case UNIT_IN: return CSS_UNIT_IN; case UNIT_CM: return CSS_UNIT_CM; case UNIT_MM: return CSS_UNIT_MM; case UNIT_PT: return CSS_UNIT_PT; case UNIT_PC: return CSS_UNIT_PC; case UNIT_PCT: return CSS_UNIT_PCT; case UNIT_DEG: return CSS_UNIT_DEG; case UNIT_GRAD: return CSS_UNIT_GRAD; case UNIT_RAD: return CSS_UNIT_RAD; case UNIT_MS: return CSS_UNIT_MS; case UNIT_S: return CSS_UNIT_S; case UNIT_HZ: return CSS_UNIT_HZ; case UNIT_KHZ: return CSS_UNIT_KHZ; } return 0; } /****************************************************************************** * Utilities below here * ******************************************************************************/ css_error css__cascade_bg_border_color(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_color)) { uint16_t value = CSS_BACKGROUND_COLOR_INHERIT; css_color color = 0; assert(CSS_BACKGROUND_COLOR_INHERIT == (enum css_background_color_e)CSS_BORDER_COLOR_INHERIT); assert(CSS_BACKGROUND_COLOR_COLOR == (enum css_background_color_e)CSS_BORDER_COLOR_COLOR); assert(CSS_BACKGROUND_COLOR_CURRENT_COLOR == (enum css_background_color_e)CSS_BORDER_COLOR_CURRENT_COLOR); if (isInherit(opv) == false) { switch (getValue(opv)) { case BACKGROUND_COLOR_TRANSPARENT: value = CSS_BACKGROUND_COLOR_COLOR; break; case BACKGROUND_COLOR_CURRENT_COLOR: value = CSS_BACKGROUND_COLOR_CURRENT_COLOR; break; case BACKGROUND_COLOR_SET: value = CSS_BACKGROUND_COLOR_COLOR; color = *((css_color *) style->bytecode); advance_bytecode(style, sizeof(color)); break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, color); } return CSS_OK; } css_error css__cascade_uri_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, lwc_string *)) { uint16_t value = CSS_BACKGROUND_IMAGE_INHERIT; lwc_string *uri = NULL; if (isInherit(opv) == false) { switch (getValue(opv)) { case BACKGROUND_IMAGE_NONE: value = CSS_BACKGROUND_IMAGE_NONE; break; case BACKGROUND_IMAGE_URI: value = CSS_BACKGROUND_IMAGE_IMAGE; css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &uri); advance_bytecode(style, sizeof(css_code_t)); break; } } /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, uri); } return CSS_OK; } css_error css__cascade_border_style(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t)) { uint16_t value = CSS_BORDER_STYLE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BORDER_STYLE_NONE: value = CSS_BORDER_STYLE_NONE; break; case BORDER_STYLE_HIDDEN: value = CSS_BORDER_STYLE_HIDDEN; break; case BORDER_STYLE_DOTTED: value = CSS_BORDER_STYLE_DOTTED; break; case BORDER_STYLE_DASHED: value = CSS_BORDER_STYLE_DASHED; break; case BORDER_STYLE_SOLID: value = CSS_BORDER_STYLE_SOLID; break; case BORDER_STYLE_DOUBLE: value = CSS_BORDER_STYLE_DOUBLE; break; case BORDER_STYLE_GROOVE: value = CSS_BORDER_STYLE_GROOVE; break; case BORDER_STYLE_RIDGE: value = CSS_BORDER_STYLE_RIDGE; break; case BORDER_STYLE_INSET: value = CSS_BORDER_STYLE_INSET; break; case BORDER_STYLE_OUTSET: value = CSS_BORDER_STYLE_OUTSET; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value); } return CSS_OK; } css_error css__cascade_border_width(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)) { uint16_t value = CSS_BORDER_WIDTH_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case BORDER_WIDTH_SET: value = CSS_BORDER_WIDTH_WIDTH; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case BORDER_WIDTH_THIN: value = CSS_BORDER_WIDTH_THIN; break; case BORDER_WIDTH_MEDIUM: value = CSS_BORDER_WIDTH_MEDIUM; break; case BORDER_WIDTH_THICK: value = CSS_BORDER_WIDTH_THICK; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length, unit); } return CSS_OK; } css_error css__cascade_length_auto(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)) { uint16_t value = CSS_BOTTOM_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case BOTTOM_SET: value = CSS_BOTTOM_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case BOTTOM_AUTO: value = CSS_BOTTOM_AUTO; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length, unit); } return CSS_OK; } css_error css__cascade_length_normal(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)) { uint16_t value = CSS_LETTER_SPACING_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case LETTER_SPACING_SET: value = CSS_LETTER_SPACING_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case LETTER_SPACING_NORMAL: value = CSS_LETTER_SPACING_NORMAL; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length, unit); } return CSS_OK; } css_error css__cascade_length_none(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)) { uint16_t value = CSS_MAX_HEIGHT_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case MAX_HEIGHT_SET: value = CSS_MAX_HEIGHT_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case MAX_HEIGHT_NONE: value = CSS_MAX_HEIGHT_NONE; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length, unit); } return CSS_OK; } css_error css__cascade_length(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed, css_unit)) { uint16_t value = CSS_MIN_HEIGHT_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { value = CSS_MIN_HEIGHT_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); } unit = css__to_css_unit(unit); /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length, unit); } return CSS_OK; } css_error css__cascade_number(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_fixed)) { uint16_t value = 0; css_fixed length = 0; /** \todo values */ if (isInherit(opv) == false) { value = 0; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); } /** \todo lose fun != NULL once all properties have set routines */ if (fun != NULL && css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value, length); } return CSS_OK; } css_error css__cascade_page_break_after_before_inside(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t)) { uint16_t value = CSS_PAGE_BREAK_AFTER_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case PAGE_BREAK_AFTER_AUTO: value = CSS_PAGE_BREAK_AFTER_AUTO; break; case PAGE_BREAK_AFTER_ALWAYS: value = CSS_PAGE_BREAK_AFTER_ALWAYS; break; case PAGE_BREAK_AFTER_AVOID: value = CSS_PAGE_BREAK_AFTER_AVOID; break; case PAGE_BREAK_AFTER_LEFT: value = CSS_PAGE_BREAK_AFTER_LEFT; break; case PAGE_BREAK_AFTER_RIGHT: value = CSS_PAGE_BREAK_AFTER_RIGHT; break; } } /** \todo lose fun != NULL */ if (fun != NULL && css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return fun(state->computed, value); } return CSS_OK; } css_error css__cascade_counter_increment_reset(uint32_t opv, css_style *style, css_select_state *state, css_error (*fun)(css_computed_style *, uint8_t, css_computed_counter *)) { uint16_t value = CSS_COUNTER_INCREMENT_INHERIT; css_computed_counter *counters = NULL; uint32_t n_counters = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case COUNTER_INCREMENT_NAMED: { uint32_t v = getValue(opv); while (v != COUNTER_INCREMENT_NONE) { css_computed_counter *temp; lwc_string *name; css_fixed val = 0; css__stylesheet_string_get(style->sheet, *((css_code_t *) style->bytecode), &name); advance_bytecode(style, sizeof(css_code_t)); val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(css_code_t)); temp = realloc(counters, (n_counters + 1) * sizeof(css_computed_counter)); if (temp == NULL) { if (counters != NULL) { free(counters); } return CSS_NOMEM; } counters = temp; counters[n_counters].name = name; counters[n_counters].value = val; n_counters++; v = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(css_code_t)); } } break; case COUNTER_INCREMENT_NONE: value = CSS_COUNTER_INCREMENT_NONE; break; } } /* If we have some counters, terminate the array with a blank entry */ if (n_counters > 0) { css_computed_counter *temp; temp = realloc(counters, (n_counters + 1) * sizeof(css_computed_counter)); if (temp == NULL) { free(counters); return CSS_NOMEM; } counters = temp; counters[n_counters].name = NULL; counters[n_counters].value = 0; } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { css_error error; error = fun(state->computed, value, counters); if (error != CSS_OK && n_counters > 0) free(counters); return error; } else if (n_counters > 0) { free(counters); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/widows.c0000644000175000017500000000220412377676736022033 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_widows(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_number(opv, style, state, set_widows); } css_error css__set_widows_from_hint(const css_hint *hint, css_computed_style *style) { return set_widows(style, hint->status, hint->data.integer); } css_error css__initial_widows(css_select_state *state) { return set_widows(state->computed, CSS_WIDOWS_SET, 2); } css_error css__compose_widows(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { int32_t count = 0; uint8_t type = get_widows(child, &count); if (type == CSS_WIDOWS_INHERIT) { type = get_widows(parent, &count); } return set_widows(result, type, count); } netsurf-all-3.2/libcss/src/select/properties/background_image.c0000644000175000017500000000255012377676736024004 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_background_image(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_uri_none(opv, style, state, set_background_image); } css_error css__set_background_image_from_hint(const css_hint *hint, css_computed_style *style) { css_error error; error = set_background_image(style, hint->status, hint->data.string); if (hint->data.string != NULL) lwc_string_unref(hint->data.string); return error; } css_error css__initial_background_image(css_select_state *state) { return set_background_image(state->computed, CSS_BACKGROUND_IMAGE_NONE, NULL); } css_error css__compose_background_image(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { lwc_string *url; uint8_t type = get_background_image(child, &url); if (type == CSS_BACKGROUND_IMAGE_INHERIT) { type = get_background_image(parent, &url); } return set_background_image(result, type, url); } netsurf-all-3.2/libcss/src/select/properties/list_style_type.c0000644000175000017500000000524512377676736023763 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_list_style_type(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_LIST_STYLE_TYPE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case LIST_STYLE_TYPE_DISC: value = CSS_LIST_STYLE_TYPE_DISC; break; case LIST_STYLE_TYPE_CIRCLE: value = CSS_LIST_STYLE_TYPE_CIRCLE; break; case LIST_STYLE_TYPE_SQUARE: value = CSS_LIST_STYLE_TYPE_SQUARE; break; case LIST_STYLE_TYPE_DECIMAL: value = CSS_LIST_STYLE_TYPE_DECIMAL; break; case LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO: value = CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO; break; case LIST_STYLE_TYPE_LOWER_ROMAN: value = CSS_LIST_STYLE_TYPE_LOWER_ROMAN; break; case LIST_STYLE_TYPE_UPPER_ROMAN: value = CSS_LIST_STYLE_TYPE_UPPER_ROMAN; break; case LIST_STYLE_TYPE_LOWER_GREEK: value = CSS_LIST_STYLE_TYPE_LOWER_GREEK; break; case LIST_STYLE_TYPE_LOWER_LATIN: value = CSS_LIST_STYLE_TYPE_LOWER_LATIN; break; case LIST_STYLE_TYPE_UPPER_LATIN: value = CSS_LIST_STYLE_TYPE_UPPER_LATIN; break; case LIST_STYLE_TYPE_ARMENIAN: value = CSS_LIST_STYLE_TYPE_ARMENIAN; break; case LIST_STYLE_TYPE_GEORGIAN: value = CSS_LIST_STYLE_TYPE_GEORGIAN; break; case LIST_STYLE_TYPE_LOWER_ALPHA: value = CSS_LIST_STYLE_TYPE_LOWER_ALPHA; break; case LIST_STYLE_TYPE_UPPER_ALPHA: value = CSS_LIST_STYLE_TYPE_UPPER_ALPHA; break; case LIST_STYLE_TYPE_NONE: value = CSS_LIST_STYLE_TYPE_NONE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_list_style_type(state->computed, value); } return CSS_OK; } css_error css__set_list_style_type_from_hint(const css_hint *hint, css_computed_style *style) { return set_list_style_type(style, hint->status); } css_error css__initial_list_style_type(css_select_state *state) { return set_list_style_type(state->computed, CSS_LIST_STYLE_TYPE_DISC); } css_error css__compose_list_style_type(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_list_style_type(child); if (type == CSS_LIST_STYLE_TYPE_INHERIT) { type = get_list_style_type(parent); } return set_list_style_type(result, type); } netsurf-all-3.2/libcss/src/select/properties/speech_rate.c0000644000175000017500000000301312377676736023000 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_speech_rate(uint32_t opv, css_style *style, css_select_state *state) { css_fixed rate = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case SPEECH_RATE_SET: rate = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(rate)); break; case SPEECH_RATE_X_SLOW: case SPEECH_RATE_SLOW: case SPEECH_RATE_MEDIUM: case SPEECH_RATE_FAST: case SPEECH_RATE_X_FAST: case SPEECH_RATE_FASTER: case SPEECH_RATE_SLOWER: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo speech-rate */ } return CSS_OK; } css_error css__set_speech_rate_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_speech_rate(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_speech_rate(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/border_left_color.c0000644000175000017500000000242412377676736024210 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_left_color(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_bg_border_color(opv, style, state, set_border_left_color); } css_error css__set_border_left_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_left_color(style, hint->status, hint->data.color); } css_error css__initial_border_left_color(css_select_state *state) { return set_border_left_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0); } css_error css__compose_border_left_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_border_left_color(child, &color); if (type == CSS_BORDER_COLOR_INHERIT) { type = get_border_left_color(parent, &color); } return set_border_left_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/top.c0000644000175000017500000000231112377676736021320 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_top(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_top); } css_error css__set_top_from_hint(const css_hint *hint, css_computed_style *style) { return set_top(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_top(css_select_state *state) { return set_top(state->computed, CSS_TOP_AUTO, 0, CSS_UNIT_PX); } css_error css__compose_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_top(child, &length, &unit); if (type == CSS_TOP_INHERIT) { type = get_top(parent, &length, &unit); } return set_top(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/border_bottom_width.c0000644000175000017500000000260212377676736024561 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_bottom_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_width(opv, style, state, set_border_bottom_width); } css_error css__set_border_bottom_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_bottom_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_border_bottom_width(css_select_state *state) { return set_border_bottom_width(state->computed, CSS_BORDER_WIDTH_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_border_bottom_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_border_bottom_width(child, &length, &unit); if (type == CSS_BORDER_WIDTH_INHERIT) { type = get_border_bottom_width(parent, &length, &unit); } return set_border_bottom_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/word_spacing.c0000644000175000017500000000305212377676736023200 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_word_spacing(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_normal(opv, style, state, set_word_spacing); } css_error css__set_word_spacing_from_hint(const css_hint *hint, css_computed_style *style) { return set_word_spacing(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_word_spacing(css_select_state *state) { return set_word_spacing(state->computed, CSS_WORD_SPACING_NORMAL, 0, CSS_UNIT_PX); } css_error css__compose_word_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_word_spacing(child, &length, &unit); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_WORD_SPACING_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_WORD_SPACING_INHERIT) { type = get_word_spacing(parent, &length, &unit); } return set_word_spacing(result, type, length, unit); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/padding_top.c0000644000175000017500000000243312377676736023013 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_padding_top(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_padding_top); } css_error css__set_padding_top_from_hint(const css_hint *hint, css_computed_style *style) { return set_padding_top(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_padding_top(css_select_state *state) { return set_padding_top(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX); } css_error css__compose_padding_top(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_padding_top(child, &length, &unit); if (type == CSS_PADDING_INHERIT) { type = get_padding_top(parent, &length, &unit); } return set_padding_top(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/column_rule_color.c0000644000175000017500000000271512377676736024250 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_rule_color(uint32_t opv, css_style *style, css_select_state *state) { css_color color = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_RULE_COLOR_SET: color = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(color)); break; case COLUMN_RULE_COLOR_TRANSPARENT: case COLUMN_RULE_COLOR_CURRENT_COLOR: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_rule_color_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_rule_color(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_rule_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/overflow_x.c0000644000175000017500000000312312377676736022712 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_overflow_x(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_OVERFLOW_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case OVERFLOW_VISIBLE: value = CSS_OVERFLOW_VISIBLE; break; case OVERFLOW_HIDDEN: value = CSS_OVERFLOW_HIDDEN; break; case OVERFLOW_SCROLL: value = CSS_OVERFLOW_SCROLL; break; case OVERFLOW_AUTO: value = CSS_OVERFLOW_AUTO; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_overflow_x(state->computed, value); } return CSS_OK; } css_error css__set_overflow_x_from_hint(const css_hint *hint, css_computed_style *style) { return set_overflow_x(style, hint->status); } css_error css__initial_overflow_x(css_select_state *state) { return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE); } css_error css__compose_overflow_x(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_overflow_x(child); if (type == CSS_OVERFLOW_INHERIT) { type = get_overflow_x(parent); } return set_overflow_x(result, type); } netsurf-all-3.2/libcss/src/select/properties/vertical_align.c0000644000175000017500000000475512377676736023517 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_vertical_align(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_VERTICAL_ALIGN_INHERIT; css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case VERTICAL_ALIGN_SET: value = CSS_VERTICAL_ALIGN_SET; length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case VERTICAL_ALIGN_BASELINE: value = CSS_VERTICAL_ALIGN_BASELINE; break; case VERTICAL_ALIGN_SUB: value = CSS_VERTICAL_ALIGN_SUB; break; case VERTICAL_ALIGN_SUPER: value = CSS_VERTICAL_ALIGN_SUPER; break; case VERTICAL_ALIGN_TOP: value = CSS_VERTICAL_ALIGN_TOP; break; case VERTICAL_ALIGN_TEXT_TOP: value = CSS_VERTICAL_ALIGN_TEXT_TOP; break; case VERTICAL_ALIGN_MIDDLE: value = CSS_VERTICAL_ALIGN_MIDDLE; break; case VERTICAL_ALIGN_BOTTOM: value = CSS_VERTICAL_ALIGN_BOTTOM; break; case VERTICAL_ALIGN_TEXT_BOTTOM: value = CSS_VERTICAL_ALIGN_TEXT_BOTTOM; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_vertical_align(state->computed, value, length, unit); } return CSS_OK; } css_error css__set_vertical_align_from_hint(const css_hint *hint, css_computed_style *style) { return set_vertical_align(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_vertical_align(css_select_state *state) { return set_vertical_align(state->computed, CSS_VERTICAL_ALIGN_BASELINE, 0, CSS_UNIT_PX); } css_error css__compose_vertical_align(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_vertical_align(child, &length, &unit); if (type == CSS_VERTICAL_ALIGN_INHERIT) { type = get_vertical_align(parent, &length, &unit); } return set_vertical_align(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/cue_before.c0000644000175000017500000000202112377676736022612 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_cue_before(uint32_t opv, css_style *style, css_select_state *state) { /** \todo cue-before */ return css__cascade_uri_none(opv, style, state, NULL); } css_error css__set_cue_before_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_cue_before(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_cue_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/page_break_inside.c0000644000175000017500000000235212377676736024136 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_page_break_inside(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_page_break_after_before_inside(opv, style, state, set_page_break_inside); } css_error css__set_page_break_inside_from_hint(const css_hint *hint, css_computed_style *style) { return set_page_break_inside(style, hint->status); } css_error css__initial_page_break_inside(css_select_state *state) { return set_page_break_inside(state->computed, CSS_PAGE_BREAK_INSIDE_AUTO); } css_error css__compose_page_break_inside(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_page_break_inside(child); if (type == CSS_PAGE_BREAK_INSIDE_INHERIT) { type = get_page_break_inside(parent); } return set_page_break_inside(result, type); } netsurf-all-3.2/libcss/src/select/properties/line_height.c0000644000175000017500000000405612377676736023005 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_line_height(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_LINE_HEIGHT_INHERIT; css_fixed val = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case LINE_HEIGHT_NUMBER: value = CSS_LINE_HEIGHT_NUMBER; val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); break; case LINE_HEIGHT_DIMENSION: value = CSS_LINE_HEIGHT_DIMENSION; val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case LINE_HEIGHT_NORMAL: value = CSS_LINE_HEIGHT_NORMAL; break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_line_height(state->computed, value, val, unit); } return CSS_OK; } css_error css__set_line_height_from_hint(const css_hint *hint, css_computed_style *style) { return set_line_height(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_line_height(css_select_state *state) { return set_line_height(state->computed, CSS_LINE_HEIGHT_NORMAL, 0, CSS_UNIT_PX); } css_error css__compose_line_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_line_height(child, &length, &unit); if (type == CSS_LINE_HEIGHT_INHERIT) { type = get_line_height(parent, &length, &unit); } return set_line_height(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/empty_cells.c0000644000175000017500000000274512377676736023051 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_empty_cells(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_EMPTY_CELLS_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case EMPTY_CELLS_SHOW: value = CSS_EMPTY_CELLS_SHOW; break; case EMPTY_CELLS_HIDE: value = CSS_EMPTY_CELLS_HIDE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_empty_cells(state->computed, value); } return CSS_OK; } css_error css__set_empty_cells_from_hint(const css_hint *hint, css_computed_style *style) { return set_empty_cells(style, hint->status); } css_error css__initial_empty_cells(css_select_state *state) { return set_empty_cells(state->computed, CSS_EMPTY_CELLS_SHOW); } css_error css__compose_empty_cells(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_empty_cells(child); if (type == CSS_EMPTY_CELLS_INHERIT) { type = get_empty_cells(parent); } return set_empty_cells(result, type); } netsurf-all-3.2/libcss/src/select/properties/padding_bottom.c0000644000175000017500000000247512377676736023523 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_padding_bottom(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_padding_bottom); } css_error css__set_padding_bottom_from_hint(const css_hint *hint, css_computed_style *style) { return set_padding_bottom(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_padding_bottom(css_select_state *state) { return set_padding_bottom(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX); } css_error css__compose_padding_bottom(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_padding_bottom(child, &length, &unit); if (type == CSS_PADDING_INHERIT) { type = get_padding_bottom(parent, &length, &unit); } return set_padding_bottom(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/list_style_image.c0000644000175000017500000000254712377676736024066 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_list_style_image(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_uri_none(opv, style, state, set_list_style_image); } css_error css__set_list_style_image_from_hint(const css_hint *hint, css_computed_style *style) { css_error error; error = set_list_style_image(style, hint->status, hint->data.string); if (hint->data.string != NULL) lwc_string_unref(hint->data.string); return error; } css_error css__initial_list_style_image(css_select_state *state) { return set_list_style_image(state->computed, CSS_LIST_STYLE_IMAGE_NONE, NULL); } css_error css__compose_list_style_image(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { lwc_string *url; uint8_t type = get_list_style_image(child, &url); if (type == CSS_LIST_STYLE_IMAGE_INHERIT) { type = get_list_style_image(parent, &url); } return set_list_style_image(result, type, url); } netsurf-all-3.2/libcss/src/select/properties/pause_before.c0000644000175000017500000000203112377676736023154 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_pause_before(uint32_t opv, css_style *style, css_select_state *state) { /** \todo pause-before */ return css__cascade_length(opv, style, state, NULL); } css_error css__set_pause_before_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_pause_before(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_pause_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/border_left_style.c0000644000175000017500000000230212377676736024225 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_left_style(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_style(opv, style, state, set_border_left_style); } css_error css__set_border_left_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_left_style(style, hint->status); } css_error css__initial_border_left_style(css_select_state *state) { return set_border_left_style(state->computed, CSS_BORDER_STYLE_NONE); } css_error css__compose_border_left_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_border_left_style(child); if (type == CSS_BORDER_STYLE_INHERIT) { type = get_border_left_style(parent); } return set_border_left_style(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_top_color.c0000644000175000017500000000240212377676736024054 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_top_color(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_bg_border_color(opv, style, state, set_border_top_color); } css_error css__set_border_top_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_top_color(style, hint->status, hint->data.color); } css_error css__initial_border_top_color(css_select_state *state) { return set_border_top_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0); } css_error css__compose_border_top_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_border_top_color(child, &color); if (type == CSS_BORDER_COLOR_INHERIT) { type = get_border_top_color(parent, &color); } return set_border_top_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/break_before.c0000644000175000017500000000274212377676736023134 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_break_before(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BREAK_BEFORE_AUTO: case BREAK_BEFORE_ALWAYS: case BREAK_BEFORE_AVOID: case BREAK_BEFORE_LEFT: case BREAK_BEFORE_RIGHT: case BREAK_BEFORE_PAGE: case BREAK_BEFORE_COLUMN: case BREAK_BEFORE_AVOID_PAGE: case BREAK_BEFORE_AVOID_COLUMN: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_break_before_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_break_before(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_break_before(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/column_count.c0000644000175000017500000000260012377676736023224 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_count(uint32_t opv, css_style *style, css_select_state *state) { css_fixed count = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_COUNT_SET: count = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(count)); break; case COLUMN_COUNT_AUTO: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_count_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_count(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_count(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/counter_increment.c0000644000175000017500000000456112377676736024252 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_counter_increment(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_counter_increment_reset(opv, style, state, set_counter_increment); } css_error css__set_counter_increment_from_hint(const css_hint *hint, css_computed_style *style) { css_computed_counter *item; css_error error; error = set_counter_increment(style, hint->status, hint->data.counter); if (hint->status == CSS_COUNTER_INCREMENT_NAMED && hint->data.counter != NULL) { for (item = hint->data.counter; item->name != NULL; item++) { lwc_string_unref(item->name); } } if (error != CSS_OK && hint->data.counter != NULL) free(hint->data.counter); return error; } css_error css__initial_counter_increment(css_select_state *state) { return set_counter_increment(state->computed, CSS_COUNTER_INCREMENT_NONE, NULL); } css_error css__compose_counter_increment(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; const css_computed_counter *items = NULL; uint8_t type = get_counter_increment(child, &items); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_COUNTER_INCREMENT_INHERIT || (child->uncommon != NULL && result != child)) { size_t n_items = 0; css_computed_counter *copy = NULL; if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_COUNTER_INCREMENT_INHERIT) { type = get_counter_increment(parent, &items); } if (type == CSS_COUNTER_INCREMENT_NAMED && items != NULL) { const css_computed_counter *i; for (i = items; i->name != NULL; i++) n_items++; copy = malloc((n_items + 1) * sizeof(css_computed_counter)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, items, (n_items + 1) * sizeof(css_computed_counter)); } error = set_counter_increment(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/column_fill.c0000644000175000017500000000242512377676736023027 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_fill(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_FILL_BALANCE: case COLUMN_FILL_AUTO: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_fill_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_fill(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_fill(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/z_index.c0000644000175000017500000000310612377676736022161 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_z_index(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_Z_INDEX_INHERIT; css_fixed index = 0; if (isInherit(opv) == false) { switch (getValue(opv)) { case Z_INDEX_SET: value = CSS_Z_INDEX_SET; index = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(index)); break; case Z_INDEX_AUTO: value = CSS_Z_INDEX_AUTO; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_z_index(state->computed, value, index); } return CSS_OK; } css_error css__set_z_index_from_hint(const css_hint *hint, css_computed_style *style) { return set_z_index(style, hint->status, hint->data.integer); } css_error css__initial_z_index(css_select_state *state) { return set_z_index(state->computed, CSS_Z_INDEX_AUTO, 0); } css_error css__compose_z_index(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { int32_t index = 0; uint8_t type = get_z_index(child, &index); if (type == CSS_Z_INDEX_INHERIT) { type = get_z_index(parent, &index); } return set_z_index(result, type, index); } netsurf-all-3.2/libcss/src/select/properties/white_space.c0000644000175000017500000000331212377676736023013 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_white_space(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_WHITE_SPACE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case WHITE_SPACE_NORMAL: value = CSS_WHITE_SPACE_NORMAL; break; case WHITE_SPACE_PRE: value = CSS_WHITE_SPACE_PRE; break; case WHITE_SPACE_NOWRAP: value = CSS_WHITE_SPACE_NOWRAP; break; case WHITE_SPACE_PRE_WRAP: value = CSS_WHITE_SPACE_PRE_WRAP; break; case WHITE_SPACE_PRE_LINE: value = CSS_WHITE_SPACE_PRE_LINE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_white_space(state->computed, value); } return CSS_OK; } css_error css__set_white_space_from_hint(const css_hint *hint, css_computed_style *style) { return set_white_space(style, hint->status); } css_error css__initial_white_space(css_select_state *state) { return set_white_space(state->computed, CSS_WHITE_SPACE_NORMAL); } css_error css__compose_white_space(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_white_space(child); if (type == CSS_WHITE_SPACE_INHERIT) { type = get_white_space(parent); } return set_white_space(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_bottom_color.c0000644000175000017500000000244712377676736024567 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_bottom_color(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_bg_border_color(opv, style, state, set_border_bottom_color); } css_error css__set_border_bottom_color_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_bottom_color(style, hint->status, hint->data.color); } css_error css__initial_border_bottom_color(css_select_state *state) { return set_border_bottom_color(state->computed, CSS_BORDER_COLOR_CURRENT_COLOR, 0); } css_error css__compose_border_bottom_color(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_color color; uint8_t type = get_border_bottom_color(child, &color); if (type == CSS_BORDER_COLOR_INHERIT) { type = get_border_bottom_color(parent, &color); } return set_border_bottom_color(result, type, color); } netsurf-all-3.2/libcss/src/select/properties/margin_right.c0000644000175000017500000000245012377676736023174 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_margin_right(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_margin_right); } css_error css__set_margin_right_from_hint(const css_hint *hint, css_computed_style *style) { return set_margin_right(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_margin_right(css_select_state *state) { return set_margin_right(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX); } css_error css__compose_margin_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_margin_right(child, &length, &unit); if (type == CSS_MARGIN_INHERIT) { type = get_margin_right(parent, &length, &unit); } return set_margin_right(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/text_transform.c0000644000175000017500000000331612377676736023603 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_text_transform(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_TEXT_TRANSFORM_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case TEXT_TRANSFORM_CAPITALIZE: value = CSS_TEXT_TRANSFORM_CAPITALIZE; break; case TEXT_TRANSFORM_UPPERCASE: value = CSS_TEXT_TRANSFORM_UPPERCASE; break; case TEXT_TRANSFORM_LOWERCASE: value = CSS_TEXT_TRANSFORM_LOWERCASE; break; case TEXT_TRANSFORM_NONE: value = CSS_TEXT_TRANSFORM_NONE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_text_transform(state->computed, value); } return CSS_OK; } css_error css__set_text_transform_from_hint(const css_hint *hint, css_computed_style *style) { return set_text_transform(style, hint->status); } css_error css__initial_text_transform(css_select_state *state) { return set_text_transform(state->computed, CSS_TEXT_TRANSFORM_NONE); } css_error css__compose_text_transform(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_text_transform(child); if (type == CSS_TEXT_TRANSFORM_INHERIT) { type = get_text_transform(parent); } return set_text_transform(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_spacing.c0000644000175000017500000000477612377676736023520 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_spacing(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_BORDER_SPACING_INHERIT; css_fixed hlength = 0; css_fixed vlength = 0; uint32_t hunit = UNIT_PX; uint32_t vunit = UNIT_PX; if (isInherit(opv) == false) { value = CSS_BORDER_SPACING_SET; hlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(hlength)); hunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(hunit)); vlength = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(vlength)); vunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(vunit)); } hunit = css__to_css_unit(hunit); vunit = css__to_css_unit(vunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_border_spacing(state->computed, value, hlength, hunit, vlength, vunit); } return CSS_OK; } css_error css__set_border_spacing_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_spacing(style, hint->status, hint->data.position.h.value, hint->data.position.h.unit, hint->data.position.v.value, hint->data.position.v.unit); } css_error css__initial_border_spacing(css_select_state *state) { return set_border_spacing(state->computed, CSS_BORDER_SPACING_SET, 0, CSS_UNIT_PX, 0, CSS_UNIT_PX); } css_error css__compose_border_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed hlength = 0, vlength = 0; css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX; uint8_t type = get_border_spacing(child, &hlength, &hunit, &vlength, &vunit); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_BORDER_SPACING_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_BORDER_SPACING_INHERIT) { type = get_border_spacing(parent, &hlength, &hunit, &vlength, &vunit); } return set_border_spacing(result, type, hlength, hunit, vlength, vunit); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/azimuth.c0000644000175000017500000000334012377676736022202 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_azimuth(uint32_t opv, css_style *style, css_select_state *state) { css_fixed val = 0; uint32_t unit = UNIT_DEG; if (isInherit(opv) == false) { switch (getValue(opv) & ~AZIMUTH_BEHIND) { case AZIMUTH_ANGLE: val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case AZIMUTH_LEFTWARDS: case AZIMUTH_RIGHTWARDS: case AZIMUTH_LEFT_SIDE: case AZIMUTH_FAR_LEFT: case AZIMUTH_LEFT: case AZIMUTH_CENTER_LEFT: case AZIMUTH_CENTER: case AZIMUTH_CENTER_RIGHT: case AZIMUTH_RIGHT: case AZIMUTH_FAR_RIGHT: case AZIMUTH_RIGHT_SIDE: /** \todo azimuth values */ break; } /** \todo azimuth behind */ } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed azimuth */ } return CSS_OK; } css_error css__set_azimuth_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_azimuth(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_azimuth(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/unicode_bidi.c0000644000175000017500000000312712377676736023141 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_unicode_bidi(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_UNICODE_BIDI_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case UNICODE_BIDI_NORMAL: value = CSS_UNICODE_BIDI_NORMAL; break; case UNICODE_BIDI_EMBED: value = CSS_UNICODE_BIDI_EMBED; break; case UNICODE_BIDI_BIDI_OVERRIDE: value = CSS_UNICODE_BIDI_BIDI_OVERRIDE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_unicode_bidi(state->computed, value); } return CSS_OK; } css_error css__set_unicode_bidi_from_hint(const css_hint *hint, css_computed_style *style) { return set_unicode_bidi(style, hint->status); } css_error css__initial_unicode_bidi(css_select_state *state) { return set_unicode_bidi(state->computed, CSS_UNICODE_BIDI_NORMAL); } css_error css__compose_unicode_bidi(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_unicode_bidi(child); if (type == CSS_UNICODE_BIDI_INHERIT) { type = get_unicode_bidi(parent); } return set_unicode_bidi(result, type); } netsurf-all-3.2/libcss/src/select/properties/font_weight.c0000644000175000017500000000431712377676736023043 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_font_weight(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FONT_WEIGHT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case FONT_WEIGHT_NORMAL: value = CSS_FONT_WEIGHT_NORMAL; break; case FONT_WEIGHT_BOLD: value = CSS_FONT_WEIGHT_BOLD; break; case FONT_WEIGHT_BOLDER: value = CSS_FONT_WEIGHT_BOLDER; break; case FONT_WEIGHT_LIGHTER: value = CSS_FONT_WEIGHT_LIGHTER; break; case FONT_WEIGHT_100: value = CSS_FONT_WEIGHT_100; break; case FONT_WEIGHT_200: value = CSS_FONT_WEIGHT_200; break; case FONT_WEIGHT_300: value = CSS_FONT_WEIGHT_300; break; case FONT_WEIGHT_400: value = CSS_FONT_WEIGHT_400; break; case FONT_WEIGHT_500: value = CSS_FONT_WEIGHT_500; break; case FONT_WEIGHT_600: value = CSS_FONT_WEIGHT_600; break; case FONT_WEIGHT_700: value = CSS_FONT_WEIGHT_700; break; case FONT_WEIGHT_800: value = CSS_FONT_WEIGHT_800; break; case FONT_WEIGHT_900: value = CSS_FONT_WEIGHT_900; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_font_weight(state->computed, value); } return CSS_OK; } css_error css__set_font_weight_from_hint(const css_hint *hint, css_computed_style *style) { return set_font_weight(style, hint->status); } css_error css__initial_font_weight(css_select_state *state) { return set_font_weight(state->computed, CSS_FONT_WEIGHT_NORMAL); } css_error css__compose_font_weight(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_font_weight(child); if (type == CSS_FONT_WEIGHT_INHERIT) { type = get_font_weight(parent); } return set_font_weight(result, type); } netsurf-all-3.2/libcss/src/select/properties/background_repeat.c0000644000175000017500000000342012377676736024177 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_background_repeat(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_BACKGROUND_REPEAT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BACKGROUND_REPEAT_NO_REPEAT: value = CSS_BACKGROUND_REPEAT_NO_REPEAT; break; case BACKGROUND_REPEAT_REPEAT_X: value = CSS_BACKGROUND_REPEAT_REPEAT_X; break; case BACKGROUND_REPEAT_REPEAT_Y: value = CSS_BACKGROUND_REPEAT_REPEAT_Y; break; case BACKGROUND_REPEAT_REPEAT: value = CSS_BACKGROUND_REPEAT_REPEAT; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_background_repeat(state->computed, value); } return CSS_OK; } css_error css__set_background_repeat_from_hint(const css_hint *hint, css_computed_style *style) { return set_background_repeat(style, hint->status); } css_error css__initial_background_repeat(css_select_state *state) { return set_background_repeat(state->computed, CSS_BACKGROUND_REPEAT_REPEAT); } css_error css__compose_background_repeat(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_background_repeat(child); if (type == CSS_BACKGROUND_REPEAT_INHERIT) { type = get_background_repeat(parent); } return set_background_repeat(result, type); } netsurf-all-3.2/libcss/src/select/properties/column_span.c0000644000175000017500000000242112377676736023036 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_span(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_SPAN_NONE: case COLUMN_SPAN_ALL: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_span_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_span(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_span(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/caption_side.c0000644000175000017500000000277112377676736023171 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_caption_side(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_CAPTION_SIDE_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case CAPTION_SIDE_TOP: value = CSS_CAPTION_SIDE_TOP; break; case CAPTION_SIDE_BOTTOM: value = CSS_CAPTION_SIDE_BOTTOM; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_caption_side(state->computed, value); } return CSS_OK; } css_error css__set_caption_side_from_hint(const css_hint *hint, css_computed_style *style) { return set_caption_side(style, hint->status); } css_error css__initial_caption_side(css_select_state *state) { return set_caption_side(state->computed, CSS_CAPTION_SIDE_TOP); } css_error css__compose_caption_side(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_caption_side(child); if (type == CSS_CAPTION_SIDE_INHERIT) { type = get_caption_side(parent); } return set_caption_side(result, type); } netsurf-all-3.2/libcss/src/select/properties/table_layout.c0000644000175000017500000000277012377676736023213 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_table_layout(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_TABLE_LAYOUT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case TABLE_LAYOUT_AUTO: value = CSS_TABLE_LAYOUT_AUTO; break; case TABLE_LAYOUT_FIXED: value = CSS_TABLE_LAYOUT_FIXED; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_table_layout(state->computed, value); } return CSS_OK; } css_error css__set_table_layout_from_hint(const css_hint *hint, css_computed_style *style) { return set_table_layout(style, hint->status); } css_error css__initial_table_layout(css_select_state *state) { return set_table_layout(state->computed, CSS_TABLE_LAYOUT_AUTO); } css_error css__compose_table_layout(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_table_layout(child); if (type == CSS_TABLE_LAYOUT_INHERIT) { type = get_table_layout(parent); } return set_table_layout(result, type); } netsurf-all-3.2/libcss/src/select/properties/volume.c0000644000175000017500000000327412377676736022036 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_volume(uint32_t opv, css_style *style, css_select_state *state) { css_fixed val = 0; uint32_t unit = UNIT_PCT; if (isInherit(opv) == false) { switch (getValue(opv)) { case VOLUME_NUMBER: val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); break; case VOLUME_DIMENSION: val = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(val)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case VOLUME_SILENT: case VOLUME_X_SOFT: case VOLUME_SOFT: case VOLUME_MEDIUM: case VOLUME_LOUD: case VOLUME_X_LOUD: /** \todo convert to public values */ break; } } unit = css__to_css_unit(unit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo volume */ } return CSS_OK; } css_error css__set_volume_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_volume(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_volume(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/border_left_width.c0000644000175000017500000000255612377676736024217 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_left_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_width(opv, style, state, set_border_left_width); } css_error css__set_border_left_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_left_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_border_left_width(css_select_state *state) { return set_border_left_width(state->computed, CSS_BORDER_WIDTH_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_border_left_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_border_left_width(child, &length, &unit); if (type == CSS_BORDER_WIDTH_INHERIT) { type = get_border_left_width(parent, &length, &unit); } return set_border_left_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/letter_spacing.c0000644000175000017500000000310612377676736023524 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_letter_spacing(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_normal(opv, style, state, set_letter_spacing); } css_error css__set_letter_spacing_from_hint(const css_hint *hint, css_computed_style *style) { return set_letter_spacing(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_letter_spacing(css_select_state *state) { return set_letter_spacing(state->computed, CSS_LETTER_SPACING_NORMAL, 0, CSS_UNIT_PX); } css_error css__compose_letter_spacing(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_letter_spacing(child, &length, &unit); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_LETTER_SPACING_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_LETTER_SPACING_INHERIT) { type = get_letter_spacing(parent, &length, &unit); } return set_letter_spacing(result, type, length, unit); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/border_top_width.c0000644000175000017500000000254612377676736024066 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_top_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_width(opv, style, state, set_border_top_width); } css_error css__set_border_top_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_top_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_border_top_width(css_select_state *state) { return set_border_top_width(state->computed, CSS_BORDER_WIDTH_MEDIUM, 0, CSS_UNIT_PX); } css_error css__compose_border_top_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_border_top_width(child, &length, &unit); if (type == CSS_BORDER_WIDTH_INHERIT) { type = get_border_top_width(parent, &length, &unit); } return set_border_top_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/list_style_position.c0000644000175000017500000000317612377676736024647 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_list_style_position(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_LIST_STYLE_POSITION_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case LIST_STYLE_POSITION_INSIDE: value = CSS_LIST_STYLE_POSITION_INSIDE; break; case LIST_STYLE_POSITION_OUTSIDE: value = CSS_LIST_STYLE_POSITION_OUTSIDE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_list_style_position(state->computed, value); } return CSS_OK; } css_error css__set_list_style_position_from_hint(const css_hint *hint, css_computed_style *style) { return set_list_style_position(style, hint->status); } css_error css__initial_list_style_position(css_select_state *state) { return set_list_style_position(state->computed, CSS_LIST_STYLE_POSITION_OUTSIDE); } css_error css__compose_list_style_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_list_style_position(child); if (type == CSS_LIST_STYLE_POSITION_INHERIT) { type = get_list_style_position(parent); } return set_list_style_position(result, type); } netsurf-all-3.2/libcss/src/select/properties/speak.c0000644000175000017500000000236712377676736021634 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_speak(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case SPEAK_NORMAL: case SPEAK_NONE: case SPEAK_SPELL_OUT: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo speak */ } return CSS_OK; } css_error css__set_speak_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_speak(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_speak(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/opacity.c0000644000175000017500000000274312377676736022177 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_opacity(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_OPACITY_INHERIT; css_fixed opacity = 0; if (isInherit(opv) == false) { value = CSS_Z_INDEX_SET; opacity = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(opacity)); } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_opacity(state->computed, value, opacity); } return CSS_OK; } css_error css__set_opacity_from_hint(const css_hint *hint, css_computed_style *style) { return set_opacity(style, hint->status, hint->data.fixed); } css_error css__initial_opacity(css_select_state *state) { return set_opacity(state->computed, CSS_OPACITY_SET, INTTOFIX(1)); } css_error css__compose_opacity(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed opacity = 0; uint8_t type = get_opacity(child, &opacity); if (type == CSS_OPACITY_INHERIT) { type = get_opacity(parent, &opacity); } return set_opacity(result, type, opacity); } netsurf-all-3.2/libcss/src/select/properties/Makefile0000644000175000017500000000364412377676736022024 0ustar vincevince# Sources DIR_SOURCES := helpers.c \ azimuth.c \ background_attachment.c \ background_color.c \ background_image.c \ background_position.c \ background_repeat.c \ border_bottom_color.c \ border_bottom_style.c \ border_bottom_width.c \ border_collapse.c \ border_left_color.c \ border_left_style.c \ border_left_width.c \ border_right_color.c \ border_right_style.c \ border_right_width.c \ border_spacing.c \ border_top_color.c \ border_top_style.c \ border_top_width.c \ bottom.c \ break_after.c \ break_before.c \ break_inside.c \ caption_side.c \ clear.c \ clip.c \ color.c \ column_count.c \ column_fill.c \ column_gap.c \ column_rule_color.c \ column_rule_style.c \ column_rule_width.c \ column_span.c \ column_width.c \ content.c \ counter_increment.c \ counter_reset.c \ cue_after.c \ cue_before.c \ cursor.c \ direction.c \ display.c \ elevation.c \ empty_cells.c \ float.c \ font_family.c \ font_size.c \ font_style.c \ font_variant.c \ font_weight.c \ height.c \ left.c \ letter_spacing.c \ line_height.c \ list_style_image.c \ list_style_position.c \ list_style_type.c \ margin_bottom.c \ margin_left.c \ margin_right.c \ margin_top.c \ max_height.c \ max_width.c \ min_height.c \ min_width.c \ opacity.c \ orphans.c \ outline_color.c \ outline_style.c \ outline_width.c \ overflow_x.c \ overflow_y.c \ padding_bottom.c \ padding_left.c \ padding_right.c \ padding_top.c \ page_break_after.c \ page_break_before.c \ page_break_inside.c \ pause_after.c \ pause_before.c \ pitch.c \ pitch_range.c \ play_during.c \ position.c \ quotes.c \ richness.c \ right.c \ speech_rate.c \ speak.c \ speak_header.c \ speak_numeral.c \ speak_punctuation.c \ stress.c \ table_layout.c \ text_align.c \ text_decoration.c \ text_indent.c \ text_transform.c \ top.c \ unicode_bidi.c \ vertical_align.c \ visibility.c \ voice_family.c \ volume.c \ white_space.c \ widows.c \ width.c \ word_spacing.c \ writing_mode.c \ z_index.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/select/properties/margin_left.c0000644000175000017500000000243612377676736023015 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_margin_left(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_auto(opv, style, state, set_margin_left); } css_error css__set_margin_left_from_hint(const css_hint *hint, css_computed_style *style) { return set_margin_left(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_margin_left(css_select_state *state) { return set_margin_left(state->computed, CSS_MARGIN_SET, 0, CSS_UNIT_PX); } css_error css__compose_margin_left(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_margin_left(child, &length, &unit); if (type == CSS_MARGIN_INHERIT) { type = get_margin_left(parent, &length, &unit); } return set_margin_left(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/stress.c0000644000175000017500000000177312377676736022054 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_stress(uint32_t opv, css_style *style, css_select_state *state) { /** \todo stress */ return css__cascade_number(opv, style, state, NULL); } css_error css__set_stress_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_stress(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_stress(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/border_right_style.c0000644000175000017500000000231412377676736024413 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_right_style(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_style(opv, style, state, set_border_right_style); } css_error css__set_border_right_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_right_style(style, hint->status); } css_error css__initial_border_right_style(css_select_state *state) { return set_border_right_style(state->computed, CSS_BORDER_STYLE_NONE); } css_error css__compose_border_right_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_border_right_style(child); if (type == CSS_BORDER_STYLE_INHERIT) { type = get_border_right_style(parent); } return set_border_right_style(result, type); } netsurf-all-3.2/libcss/src/select/properties/pitch_range.c0000644000175000017500000000202412377676736023002 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_pitch_range(uint32_t opv, css_style *style, css_select_state *state) { /** \todo pitch-range */ return css__cascade_number(opv, style, state, NULL); } css_error css__set_pitch_range_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_pitch_range(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_pitch_range(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/clip.c0000644000175000017500000000651712377676736021461 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_clip(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_CLIP_INHERIT; css_computed_clip_rect rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, false, false, false, false }; if (isInherit(opv) == false) { switch (getValue(opv) & CLIP_SHAPE_MASK) { case CLIP_SHAPE_RECT: if (getValue(opv) & CLIP_RECT_TOP_AUTO) { rect.top_auto = true; } else { rect.top = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(css_fixed)); rect.tunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(uint32_t)); } if (getValue(opv) & CLIP_RECT_RIGHT_AUTO) { rect.right_auto = true; } else { rect.right = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(css_fixed)); rect.runit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(uint32_t)); } if (getValue(opv) & CLIP_RECT_BOTTOM_AUTO) { rect.bottom_auto = true; } else { rect.bottom = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(css_fixed)); rect.bunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(uint32_t)); } if (getValue(opv) & CLIP_RECT_LEFT_AUTO) { rect.left_auto = true; } else { rect.left = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(css_fixed)); rect.lunit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(uint32_t)); } value = CSS_CLIP_RECT; break; case CLIP_AUTO: value = CSS_CLIP_AUTO; break; } } rect.tunit = css__to_css_unit(rect.tunit); rect.runit = css__to_css_unit(rect.runit); rect.bunit = css__to_css_unit(rect.bunit); rect.lunit = css__to_css_unit(rect.lunit); if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_clip(state->computed, value, &rect); } return CSS_OK; } css_error css__set_clip_from_hint(const css_hint *hint, css_computed_style *style) { return set_clip(style, hint->status, hint->data.clip); } css_error css__initial_clip(css_select_state *state) { css_computed_clip_rect rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, false, false, false, false }; return set_clip(state->computed, CSS_CLIP_AUTO, &rect); } css_error css__compose_clip(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_computed_clip_rect rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, CSS_UNIT_PX, false, false, false, false }; uint8_t type = get_clip(child, &rect); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CLIP_INHERIT || (child->uncommon != NULL && result != child)) { if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_CLIP_INHERIT) { type = get_clip(parent, &rect); } return set_clip(result, type, &rect); } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/padding_right.c0000644000175000017500000000246312377676736023331 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_padding_right(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_padding_right); } css_error css__set_padding_right_from_hint(const css_hint *hint, css_computed_style *style) { return set_padding_right(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_padding_right(css_select_state *state) { return set_padding_right(state->computed, CSS_PADDING_SET, 0, CSS_UNIT_PX); } css_error css__compose_padding_right(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_padding_right(child, &length, &unit); if (type == CSS_PADDING_INHERIT) { type = get_padding_right(parent, &length, &unit); } return set_padding_right(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/min_height.c0000644000175000017500000000243312377676736022636 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_min_height(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_min_height); } css_error css__set_min_height_from_hint(const css_hint *hint, css_computed_style *style) { return set_min_height(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_min_height(css_select_state *state) { return set_min_height(state->computed, CSS_MIN_HEIGHT_SET, 0, CSS_UNIT_PX); } css_error css__compose_min_height(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_min_height(child, &length, &unit); if (type == CSS_MIN_HEIGHT_INHERIT) { type = get_min_height(parent, &length, &unit); } return set_min_height(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/direction.c0000644000175000017500000000267612377676736022514 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_direction(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_DIRECTION_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case DIRECTION_LTR: value = CSS_DIRECTION_LTR; break; case DIRECTION_RTL: value = CSS_DIRECTION_RTL; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_direction(state->computed, value); } return CSS_OK; } css_error css__set_direction_from_hint(const css_hint *hint, css_computed_style *style) { return set_direction(style, hint->status); } css_error css__initial_direction(css_select_state *state) { return set_direction(state->computed, CSS_DIRECTION_LTR); } css_error css__compose_direction(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_direction(child); if (type == CSS_DIRECTION_INHERIT) { type = get_direction(parent); } return set_direction(result, type); } netsurf-all-3.2/libcss/src/select/properties/column_rule_style.c0000644000175000017500000000307512377676736024272 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_rule_style(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_RULE_STYLE_NONE: case COLUMN_RULE_STYLE_HIDDEN: case COLUMN_RULE_STYLE_DOTTED: case COLUMN_RULE_STYLE_DASHED: case COLUMN_RULE_STYLE_SOLID: case COLUMN_RULE_STYLE_DOUBLE: case COLUMN_RULE_STYLE_GROOVE: case COLUMN_RULE_STYLE_RIDGE: case COLUMN_RULE_STYLE_INSET: case COLUMN_RULE_STYLE_OUTSET: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_rule_style_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_rule_style(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_rule_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/column_gap.c0000644000175000017500000000274712377676736022657 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Michael Drake */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_column_gap(uint32_t opv, css_style *style, css_select_state *state) { css_fixed length = 0; uint32_t unit = UNIT_PX; if (isInherit(opv) == false) { switch (getValue(opv)) { case COLUMN_GAP_SET: length = *((css_fixed *) style->bytecode); advance_bytecode(style, sizeof(length)); unit = *((uint32_t *) style->bytecode); advance_bytecode(style, sizeof(unit)); break; case COLUMN_GAP_NORMAL: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo set computed elevation */ } return CSS_OK; } css_error css__set_column_gap_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_column_gap(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_column_gap(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/text_decoration.c0000644000175000017500000000357012377676736023721 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_text_decoration(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_TEXT_DECORATION_INHERIT; UNUSED(style); if (isInherit(opv) == false) { if (getValue(opv) == TEXT_DECORATION_NONE) { value = CSS_TEXT_DECORATION_NONE; } else { assert(value == 0); if (getValue(opv) & TEXT_DECORATION_UNDERLINE) value |= CSS_TEXT_DECORATION_UNDERLINE; if (getValue(opv) & TEXT_DECORATION_OVERLINE) value |= CSS_TEXT_DECORATION_OVERLINE; if (getValue(opv) & TEXT_DECORATION_LINE_THROUGH) value |= CSS_TEXT_DECORATION_LINE_THROUGH; if (getValue(opv) & TEXT_DECORATION_BLINK) value |= CSS_TEXT_DECORATION_BLINK; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_text_decoration(state->computed, value); } return CSS_OK; } css_error css__set_text_decoration_from_hint(const css_hint *hint, css_computed_style *style) { return set_text_decoration(style, hint->status); } css_error css__initial_text_decoration(css_select_state *state) { return set_text_decoration(state->computed, CSS_TEXT_DECORATION_NONE); } css_error css__compose_text_decoration(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_text_decoration(child); if (type == CSS_TEXT_DECORATION_INHERIT) { type = get_text_decoration(parent); } return set_text_decoration(result, type); } netsurf-all-3.2/libcss/src/select/properties/text_indent.c0000644000175000017500000000244712377676736023055 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_text_indent(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_text_indent); } css_error css__set_text_indent_from_hint(const css_hint *hint, css_computed_style *style) { return set_text_indent(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_text_indent(css_select_state *state) { return set_text_indent(state->computed, CSS_TEXT_INDENT_SET, 0, CSS_UNIT_PX); } css_error css__compose_text_indent(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_text_indent(child, &length, &unit); if (type == CSS_TEXT_INDENT_INHERIT) { type = get_text_indent(parent, &length, &unit); } return set_text_indent(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/clear.c0000644000175000017500000000276212377676736021616 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_clear(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_CLEAR_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case CLEAR_NONE: value = CSS_CLEAR_NONE; break; case CLEAR_LEFT: value = CSS_CLEAR_LEFT; break; case CLEAR_RIGHT: value = CSS_CLEAR_RIGHT; break; case CLEAR_BOTH: value = CSS_CLEAR_BOTH; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_clear(state->computed, value); } return CSS_OK; } css_error css__set_clear_from_hint(const css_hint *hint, css_computed_style *style) { return set_clear(style, hint->status); } css_error css__initial_clear(css_select_state *state) { return set_clear(state->computed, CSS_CLEAR_NONE); } css_error css__compose_clear(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_clear(child); if (type == CSS_CLEAR_INHERIT) { type = get_clear(parent); } return set_clear(result, type); } netsurf-all-3.2/libcss/src/select/properties/properties.h0000644000175000017500000001027012377676736022722 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_properties_h_ #define css_select_properties_h_ #include #include #include "stylesheet.h" #include "select/select.h" #define PROPERTY_FUNCS(pname) \ css_error css__cascade_##pname (uint32_t opv, css_style *style, css_select_state *state); \ css_error css__set_##pname##_from_hint(const css_hint *hint, css_computed_style *style); \ css_error css__initial_##pname (css_select_state *state); \ css_error css__compose_##pname (const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); \ uint32_t destroy_##pname (void *bytecode) PROPERTY_FUNCS(azimuth); PROPERTY_FUNCS(background_attachment); PROPERTY_FUNCS(background_color); PROPERTY_FUNCS(background_image); PROPERTY_FUNCS(background_position); PROPERTY_FUNCS(background_repeat); PROPERTY_FUNCS(border_collapse); PROPERTY_FUNCS(border_spacing); PROPERTY_FUNCS(border_top_color); PROPERTY_FUNCS(border_right_color); PROPERTY_FUNCS(border_bottom_color); PROPERTY_FUNCS(border_left_color); PROPERTY_FUNCS(border_top_style); PROPERTY_FUNCS(border_right_style); PROPERTY_FUNCS(border_bottom_style); PROPERTY_FUNCS(border_left_style); PROPERTY_FUNCS(border_top_width); PROPERTY_FUNCS(border_right_width); PROPERTY_FUNCS(border_bottom_width); PROPERTY_FUNCS(border_left_width); PROPERTY_FUNCS(bottom); PROPERTY_FUNCS(break_after); PROPERTY_FUNCS(break_before); PROPERTY_FUNCS(break_inside); PROPERTY_FUNCS(caption_side); PROPERTY_FUNCS(clear); PROPERTY_FUNCS(clip); PROPERTY_FUNCS(color); PROPERTY_FUNCS(column_count); PROPERTY_FUNCS(column_fill); PROPERTY_FUNCS(column_gap); PROPERTY_FUNCS(column_rule_color); PROPERTY_FUNCS(column_rule_style); PROPERTY_FUNCS(column_rule_width); PROPERTY_FUNCS(column_span); PROPERTY_FUNCS(column_width); PROPERTY_FUNCS(content); PROPERTY_FUNCS(counter_increment); PROPERTY_FUNCS(counter_reset); PROPERTY_FUNCS(cue_after); PROPERTY_FUNCS(cue_before); PROPERTY_FUNCS(cursor); PROPERTY_FUNCS(direction); PROPERTY_FUNCS(display); PROPERTY_FUNCS(elevation); PROPERTY_FUNCS(empty_cells); PROPERTY_FUNCS(float); PROPERTY_FUNCS(font_family); PROPERTY_FUNCS(font_size); PROPERTY_FUNCS(font_style); PROPERTY_FUNCS(font_variant); PROPERTY_FUNCS(font_weight); PROPERTY_FUNCS(height); PROPERTY_FUNCS(left); PROPERTY_FUNCS(letter_spacing); PROPERTY_FUNCS(line_height); PROPERTY_FUNCS(list_style_image); PROPERTY_FUNCS(list_style_position); PROPERTY_FUNCS(list_style_type); PROPERTY_FUNCS(margin_top); PROPERTY_FUNCS(margin_right); PROPERTY_FUNCS(margin_bottom); PROPERTY_FUNCS(margin_left); PROPERTY_FUNCS(max_height); PROPERTY_FUNCS(max_width); PROPERTY_FUNCS(min_height); PROPERTY_FUNCS(min_width); PROPERTY_FUNCS(opacity); PROPERTY_FUNCS(orphans); PROPERTY_FUNCS(outline_color); PROPERTY_FUNCS(outline_style); PROPERTY_FUNCS(outline_width); PROPERTY_FUNCS(overflow_x); PROPERTY_FUNCS(overflow_y); PROPERTY_FUNCS(padding_top); PROPERTY_FUNCS(padding_right); PROPERTY_FUNCS(padding_bottom); PROPERTY_FUNCS(padding_left); PROPERTY_FUNCS(page_break_after); PROPERTY_FUNCS(page_break_before); PROPERTY_FUNCS(page_break_inside); PROPERTY_FUNCS(pause_after); PROPERTY_FUNCS(pause_before); PROPERTY_FUNCS(pitch_range); PROPERTY_FUNCS(pitch); PROPERTY_FUNCS(play_during); PROPERTY_FUNCS(position); PROPERTY_FUNCS(quotes); PROPERTY_FUNCS(richness); PROPERTY_FUNCS(right); PROPERTY_FUNCS(speak_header); PROPERTY_FUNCS(speak_numeral); PROPERTY_FUNCS(speak_punctuation); PROPERTY_FUNCS(speak); PROPERTY_FUNCS(speech_rate); PROPERTY_FUNCS(stress); PROPERTY_FUNCS(table_layout); PROPERTY_FUNCS(text_align); PROPERTY_FUNCS(text_decoration); PROPERTY_FUNCS(text_indent); PROPERTY_FUNCS(text_transform); PROPERTY_FUNCS(top); PROPERTY_FUNCS(unicode_bidi); PROPERTY_FUNCS(vertical_align); PROPERTY_FUNCS(visibility); PROPERTY_FUNCS(voice_family); PROPERTY_FUNCS(volume); PROPERTY_FUNCS(white_space); PROPERTY_FUNCS(widows); PROPERTY_FUNCS(width); PROPERTY_FUNCS(word_spacing); PROPERTY_FUNCS(writing_mode); PROPERTY_FUNCS(z_index); #undef PROPERTY_FUNCS #endif netsurf-all-3.2/libcss/src/select/properties/max_width.c0000644000175000017500000000242212377676736022505 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_max_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length_none(opv, style, state, set_max_width);; } css_error css__set_max_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_max_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_max_width(css_select_state *state) { return set_max_width(state->computed, CSS_MAX_WIDTH_NONE, 0, CSS_UNIT_PX); } css_error css__compose_max_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_max_width(child, &length, &unit); if (type == CSS_MAX_WIDTH_INHERIT) { type = get_max_width(parent, &length, &unit); } return set_max_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/speak_header.c0000644000175000017500000000242012377676736023132 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_speak_header(uint32_t opv, css_style *style, css_select_state *state) { UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case SPEAK_HEADER_ONCE: case SPEAK_HEADER_ALWAYS: /** \todo convert to public values */ break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { /** \todo speak-header */ } return CSS_OK; } css_error css__set_speak_header_from_hint(const css_hint *hint, css_computed_style *style) { UNUSED(hint); UNUSED(style); return CSS_OK; } css_error css__initial_speak_header(css_select_state *state) { UNUSED(state); return CSS_OK; } css_error css__compose_speak_header(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { UNUSED(parent); UNUSED(child); UNUSED(result); return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/float.c0000644000175000017500000000267112377676736021634 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_float(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_FLOAT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case FLOAT_LEFT: value = CSS_FLOAT_LEFT; break; case FLOAT_RIGHT: value = CSS_FLOAT_RIGHT; break; case FLOAT_NONE: value = CSS_FLOAT_NONE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_float(state->computed, value); } return CSS_OK; } css_error css__set_float_from_hint(const css_hint *hint, css_computed_style *style) { return set_float(style, hint->status); } css_error css__initial_float(css_select_state *state) { return set_float(state->computed, CSS_FLOAT_NONE); } css_error css__compose_float(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_float(child); if (type == CSS_FLOAT_INHERIT) { type = get_float(parent); } return set_float(result, type); } netsurf-all-3.2/libcss/src/select/properties/position.c0000644000175000017500000000310612377676736022365 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_position(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_POSITION_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case POSITION_STATIC: value = CSS_POSITION_STATIC; break; case POSITION_RELATIVE: value = CSS_POSITION_RELATIVE; break; case POSITION_ABSOLUTE: value = CSS_POSITION_ABSOLUTE; break; case POSITION_FIXED: value = CSS_POSITION_FIXED; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_position(state->computed, value); } return CSS_OK; } css_error css__set_position_from_hint(const css_hint *hint, css_computed_style *style) { return set_position(style, hint->status); } css_error css__initial_position(css_select_state *state) { return set_position(state->computed, CSS_POSITION_STATIC); } css_error css__compose_position(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_position(child); if (type == CSS_POSITION_INHERIT) { type = get_position(parent); } return set_position(result, type); } netsurf-all-3.2/libcss/src/select/properties/background_attachment.c0000644000175000017500000000323412377676736025052 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_background_attachment(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_BACKGROUND_ATTACHMENT_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case BACKGROUND_ATTACHMENT_FIXED: value = CSS_BACKGROUND_ATTACHMENT_FIXED; break; case BACKGROUND_ATTACHMENT_SCROLL: value = CSS_BACKGROUND_ATTACHMENT_SCROLL; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_background_attachment(state->computed, value); } return CSS_OK; } css_error css__set_background_attachment_from_hint(const css_hint *hint, css_computed_style *style) { return set_background_attachment(style, hint->status); } css_error css__initial_background_attachment(css_select_state *state) { return set_background_attachment(state->computed, CSS_BACKGROUND_ATTACHMENT_SCROLL); } css_error css__compose_background_attachment(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_background_attachment(child); if (type == CSS_BACKGROUND_ATTACHMENT_INHERIT) { type = get_background_attachment(parent); } return set_background_attachment(result, type); } netsurf-all-3.2/libcss/src/select/properties/counter_reset.c0000644000175000017500000000445512377676736023412 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_counter_reset(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_counter_increment_reset(opv, style, state, set_counter_reset); } css_error css__set_counter_reset_from_hint(const css_hint *hint, css_computed_style *style) { css_computed_counter *item; css_error error; error = set_counter_reset(style, hint->status, hint->data.counter); if (hint->status == CSS_COUNTER_RESET_NAMED && hint->data.counter != NULL) { for (item = hint->data.counter; item->name != NULL; item++) { lwc_string_unref(item->name); } } if (error != CSS_OK && hint->data.counter != NULL) free(hint->data.counter); return error; } css_error css__initial_counter_reset(css_select_state *state) { return set_counter_reset(state->computed, CSS_COUNTER_RESET_NONE, NULL); } css_error css__compose_counter_reset(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_error error; const css_computed_counter *items = NULL; uint8_t type = get_counter_reset(child, &items); if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_COUNTER_RESET_INHERIT || (child->uncommon != NULL && result != child)) { size_t n_items = 0; css_computed_counter *copy = NULL; if ((child->uncommon == NULL && parent->uncommon != NULL) || type == CSS_COUNTER_RESET_INHERIT) { type = get_counter_reset(parent, &items); } if (type == CSS_COUNTER_RESET_NAMED && items != NULL) { const css_computed_counter *i; for (i = items; i->name != NULL; i++) n_items++; copy = malloc((n_items + 1) * sizeof(css_computed_counter)); if (copy == NULL) return CSS_NOMEM; memcpy(copy, items, (n_items + 1) * sizeof(css_computed_counter)); } error = set_counter_reset(result, type, copy); if (error != CSS_OK && copy != NULL) free(copy); return error; } return CSS_OK; } netsurf-all-3.2/libcss/src/select/properties/min_width.c0000644000175000017500000000241312377676736022503 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_min_width(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_length(opv, style, state, set_min_width); } css_error css__set_min_width_from_hint(const css_hint *hint, css_computed_style *style) { return set_min_width(style, hint->status, hint->data.length.value, hint->data.length.unit); } css_error css__initial_min_width(css_select_state *state) { return set_min_width(state->computed, CSS_MIN_WIDTH_SET, 0, CSS_UNIT_PX); } css_error css__compose_min_width(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { css_fixed length = 0; css_unit unit = CSS_UNIT_PX; uint8_t type = get_min_width(child, &length, &unit); if (type == CSS_MIN_WIDTH_INHERIT) { type = get_min_width(parent, &length, &unit); } return set_min_width(result, type, length, unit); } netsurf-all-3.2/libcss/src/select/properties/visibility.c0000644000175000017500000000305412377676736022712 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_visibility(uint32_t opv, css_style *style, css_select_state *state) { uint16_t value = CSS_VISIBILITY_INHERIT; UNUSED(style); if (isInherit(opv) == false) { switch (getValue(opv)) { case VISIBILITY_VISIBLE: value = CSS_VISIBILITY_VISIBLE; break; case VISIBILITY_HIDDEN: value = CSS_VISIBILITY_HIDDEN; break; case VISIBILITY_COLLAPSE: value = CSS_VISIBILITY_COLLAPSE; break; } } if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, isInherit(opv))) { return set_visibility(state->computed, value); } return CSS_OK; } css_error css__set_visibility_from_hint(const css_hint *hint, css_computed_style *style) { return set_visibility(style, hint->status); } css_error css__initial_visibility(css_select_state *state) { return set_visibility(state->computed, CSS_VISIBILITY_VISIBLE); } css_error css__compose_visibility(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_visibility(child); if (type == CSS_VISIBILITY_INHERIT) { type = get_visibility(parent); } return set_visibility(result, type); } netsurf-all-3.2/libcss/src/select/properties/border_bottom_style.c0000644000175000017500000000232612377676736024605 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "select/propset.h" #include "select/propget.h" #include "utils/utils.h" #include "select/properties/properties.h" #include "select/properties/helpers.h" css_error css__cascade_border_bottom_style(uint32_t opv, css_style *style, css_select_state *state) { return css__cascade_border_style(opv, style, state, set_border_bottom_style); } css_error css__set_border_bottom_style_from_hint(const css_hint *hint, css_computed_style *style) { return set_border_bottom_style(style, hint->status); } css_error css__initial_border_bottom_style(css_select_state *state) { return set_border_bottom_style(state->computed, CSS_BORDER_STYLE_NONE); } css_error css__compose_border_bottom_style(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result) { uint8_t type = get_border_bottom_style(child); if (type == CSS_BORDER_STYLE_INHERIT) { type = get_border_bottom_style(parent); } return set_border_bottom_style(result, type); } netsurf-all-3.2/libcss/src/select/computed.h0000644000175000017500000001675312377676736020166 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_computed_h_ #define css_select_computed_h_ #include #include typedef struct css_computed_uncommon { /* * border_spacing 1 + 2(4) 2(4) * clip 2 + 4(4) + 4 4(4) * letter_spacing 2 + 4 4 * outline_color 2 4 * outline_width 3 + 4 4 * word_spacing 2 + 4 4 * --- --- * 52 bits 40 bytes * * Encode counter_increment and _reset as an array of name, value pairs, * terminated with a blank entry. * * counter_increment 1 sizeof(ptr) * counter_reset 1 sizeof(ptr) * --- --- * 2 bits 2sizeof(ptr) bytes * * Encode cursor uri(s) as an array of string objects, terminated with a * blank entry. * * cursor 5 sizeof(ptr) * --- --- * 5 bits sizeof(ptr) bytes * * Encode content as an array of content items, terminated with a blank entry. * * content 2 sizeof(ptr) * --- --- * 2 bits sizeof(ptr) * * ___ ___ * 61 bits 40 + 4sizeof(ptr) bytes * * 8 bytes 40 + 4sizeof(ptr) bytes * =================== * 48 + 4sizeof(ptr) bytes * * Bit allocations: * * 76543210 * 1 llllllcc letter-spacing | outline-color * 2 ooooooob outline-width | border-spacing * 3 bbbbbbbb border-spacing * 4 wwwwwwir word-spacing | counter-increment | counter-reset * 5 uuuuumm. cursor | writing-mode | * 6 cccccccc clip * 7 cccccccc clip * 8 ccccccoo clip | content */ uint8_t bits[8]; css_fixed border_spacing[2]; css_fixed clip[4]; css_fixed letter_spacing; css_color outline_color; css_fixed outline_width; css_fixed word_spacing; css_computed_counter *counter_increment; css_computed_counter *counter_reset; lwc_string **cursor; css_computed_content_item *content; } css_computed_uncommon; typedef struct css_computed_page { /* * Bit allocations: * * 76543210 * 1 aaabbbii page_break_after | page_break_before | page_break_inside * 2 ......wo widows | orphans */ uint8_t bits[2]; int32_t widows; int32_t orphans; } css_computed_page; struct css_computed_style { /* * background_attachment 2 * background_repeat 3 * border_collapse 2 * border_top_style 4 * border_right_style 4 * border_bottom_style 4 * border_left_style 4 * caption_side 2 * clear 3 * direction 2 * display 5 * empty_cells 2 * float 2 * font_style 2 * font_variant 2 * font_weight 4 * list_style_position 2 * list_style_type 4 * overflow 3 * outline_style 4 * position 3 * table_layout 2 * text_align 4 * text_decoration 5 * text_transform 3 * unicode_bidi 2 * visibility 2 * white_space 3 * --- * 84 bits * * Colours are 32bits of AARRGGBB * Dimensions are encoded as a fixed point value + 4 bits of unit data * * background_color 2 4 * background_image 1 sizeof(ptr) * background_position 1 + 2(4) 2(4) * border_top_color 2 4 * border_right_color 2 4 * border_bottom_color 2 4 * border_left_color 2 4 * border_top_width 3 + 4 4 * border_right_width 3 + 4 4 * border_bottom_width 3 + 4 4 * border_left_width 3 + 4 4 * top 2 + 4 4 * right 2 + 4 4 * bottom 2 + 4 4 * left 2 + 4 4 * color 1 4 * font_size 4 + 4 4 * height 2 + 4 4 * line_height 2 + 4 4 * list_style_image 1 sizeof(ptr) * margin_top 2 + 4 4 * margin_right 2 + 4 4 * margin_bottom 2 + 4 4 * margin_left 2 + 4 4 * max_height 2 + 4 4 * max_width 2 + 4 4 * min_height 1 + 4 4 * min_width 1 + 4 4 * padding_top 1 + 4 4 * padding_right 1 + 4 4 * padding_bottom 1 + 4 4 * padding_left 1 + 4 4 * text_indent 1 + 4 4 * vertical_align 4 + 4 4 * width 2 + 4 4 * z_index 2 4 * --- --- * 181 bits 140 + 2sizeof(ptr) bytes * * Encode font family as an array of string objects, terminated with a * blank entry. * * font_family 3 sizeof(ptr) * --- --- * 3 bits sizeof(ptr) * * Encode quotes as an array of string objects, terminated with a blank entry. * * quotes 1 sizeof(ptr) * --- --- * 1 bit sizeof(ptr) bytes * * ___ ___ * 269 bits 140 + 4sizeof(ptr) bytes * * 34 bytes 140 + 4sizeof(ptr) bytes * =================== * 174 + 4sizeof(ptr) bytes * * Bit allocations: * * 76543210 * 1 vvvvvvvv vertical-align * 2 ffffffff font-size * 3 ttttttti border-top-width | background-image * 4 rrrrrrrc border-right-width | color * 5 bbbbbbbl border-bottom-width | list-style-image * 6 lllllllq border-left-width | quotes * 7 ttttttcc top | border-top-color * 8 rrrrrrcc right | border-right-color * 9 bbbbbbcc bottom | border-bottom-color * 10 llllllcc left | border-left-color * 11 hhhhhhbb height | background-color * 12 llllllzz line-height | z-index * 13 ttttttbb margin-top | background-attachment * 14 rrrrrrbb margin-right | border-collapse * 15 bbbbbbcc margin-bottom | caption-side * 16 lllllldd margin-left | direction * 17 mmmmmmee max-height | empty-cells * 18 mmmmmmff max-width | float * 19 wwwwwwff width | font-style * 20 mmmmmbbb min-height | background-repeat * 21 mmmmmccc min-width | clear * 22 tttttxxx padding-top | overflow-x * 23 rrrrrppp padding-right | position * 24 bbbbbo.. padding-bottom | opacity | * 25 lllllttt padding-left | text-transform * 26 tttttwww text-indent | white-space * 27 bbbbbbbb background-position * 28 bdddddff background-position | display | font-variant * 29 tttttfff text-decoration | font-family * 30 ttttrrrr border-top-style | border-right-style * 31 bbbbllll border-bottom-style | border-left-style * 32 ffffllll font-weight | list-style-type * 33 oooottuu outline-style | table-layout | unicode-bidi * 34 vvlltttt visibility | list-style-position | text-align * 35 yyy..... overflow-y | */ uint8_t bits[35]; uint8_t unused[1]; css_color background_color; lwc_string *background_image; css_fixed background_position[2]; css_color border_color[4]; css_fixed border_width[4]; css_fixed top; css_fixed right; css_fixed bottom; css_fixed left; css_color color; css_fixed font_size; css_fixed height; css_fixed line_height; lwc_string *list_style_image; css_fixed margin[4]; css_fixed max_height; css_fixed max_width; css_fixed min_height; css_fixed min_width; css_fixed opacity; css_fixed padding[4]; css_fixed text_indent; css_fixed vertical_align; css_fixed width; int32_t z_index; lwc_string **font_family; lwc_string **quotes; css_computed_uncommon *uncommon;/**< Uncommon properties */ void *aural; /**< Aural properties */ css_computed_page *page; /**< Page properties */ }; css_error css__compute_absolute_values(const css_computed_style *parent, css_computed_style *style, css_error (*compute_font_size)(void *pw, const css_hint *parent, css_hint *size), void *pw); #endif netsurf-all-3.2/libcss/src/select/font_face.h0000644000175000017500000000204512377676736020257 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2011 Things Made Out Of Other Things Ltd. * Written by James Montgomerie */ #ifndef css_select_font_face_h_ #define css_select_font_face_h_ #include struct css_font_face_src { lwc_string *location; /* * Bit allocations: * * 76543210 * 1 _fffffll format | location type */ uint8_t bits[1]; }; struct css_font_face { lwc_string *font_family; css_font_face_src *srcs; uint32_t n_srcs; /* * Bit allocations: * * 76543210 * 1 __wwwwss font-weight | font-style */ uint8_t bits[1]; }; css_error css__font_face_create(css_font_face **result); css_error css__font_face_destroy(css_font_face *font_face); css_error css__font_face_set_font_family(css_font_face *font_face, lwc_string *font_family); css_error css__font_face_set_srcs(css_font_face *font_face, css_font_face_src *srcs, uint32_t n_srcs); #endif netsurf-all-3.2/libcss/src/select/bloom.h0000644000175000017500000001043212377676736017442 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2013 Michael Drake */ /** \file * Bloom filter for CSS style selection optimisation. * * Attempting to match CSS rules by querying the client about DOM nodes via * the selection callbacks is slow. To avoid this, clients may pass a node * bloom filter to css_get_style. This bloom filter has bits set according * to the node's ancestor element names, class names and id names. * * Generate the bloom filter by adding calling css_bloom_add_hash() on each * ancestor element name, class name and id name for the node. * * Use the insesnsitive lwc_string: * * lwc_string_hash_value(str->insensitive) */ #ifndef libcss_bloom_h_ #define libcss_bloom_h_ #ifdef __cplusplus extern "C" { #endif #include /* Size of bloom filter as multiple of 32 bits. * Has to be 4, 8, or 16. * Larger increases optimisation of style selection engine but uses more memory. */ #define CSS_BLOOM_SIZE 4 /* Check valid bloom filter size */ #if !(CSS_BLOOM_SIZE == 4 || CSS_BLOOM_SIZE == 8 || CSS_BLOOM_SIZE == 16) # error Unsupported bloom filter size. Size must be {4|8|16}. #endif /* Setup index bit mask */ #define INDEX_BITS_N (CSS_BLOOM_SIZE - 1) /* type for bloom */ typedef uint32_t css_bloom; /** * Add a hash value to the bloom filter. * * \param bloom bloom filter to insert into * \param hash libwapcaplet hash value to insert */ static inline void css_bloom_add_hash(css_bloom bloom[CSS_BLOOM_SIZE], lwc_hash hash) { unsigned int bit = hash & 0x1f; /* Top 5 bits */ unsigned int index = (hash >> 5) & INDEX_BITS_N; /* Next N bits */ bloom[index] |= (1 << bit); } /** * Test whether bloom filter contains given hash value. * * \param bloom bloom filter to check inside * \param hash libwapcaplet hash value to look for * \return true hash value is already set in bloom */ static inline bool css_bloom_has_hash(const css_bloom bloom[CSS_BLOOM_SIZE], lwc_hash hash) { unsigned int bit = hash & 0x1f; /* Top 5 bits */ unsigned int index = (hash >> 5) & INDEX_BITS_N; /* Next N bits */ return (bloom[index] & (1 << bit)); } /** * Test whether bloom 'a' is a subset of bloom 'b'. * * \param a potential subset bloom to test * \param b superset bloom * \return true iff 'a' is subset of 'b' */ static inline bool css_bloom_in_bloom(const css_bloom a[CSS_BLOOM_SIZE], const css_bloom b[CSS_BLOOM_SIZE]) { if ((a[0] & b[0]) != a[0]) return false; if ((a[1] & b[1]) != a[1]) return false; if ((a[2] & b[2]) != a[2]) return false; if ((a[3] & b[3]) != a[3]) return false; #if (CSS_BLOOM_SIZE > 4) if ((a[4] & b[4]) != a[4]) return false; if ((a[5] & b[5]) != a[5]) return false; if ((a[6] & b[6]) != a[6]) return false; if ((a[7] & b[7]) != a[7]) return false; #endif #if (CSS_BLOOM_SIZE > 8) if ((a[8] & b[8]) != a[8]) return false; if ((a[9] & b[9]) != a[9]) return false; if ((a[10] & b[10]) != a[10]) return false; if ((a[11] & b[11]) != a[11]) return false; if ((a[12] & b[12]) != a[12]) return false; if ((a[13] & b[13]) != a[13]) return false; if ((a[14] & b[14]) != a[14]) return false; if ((a[15] & b[15]) != a[15]) return false; #endif return true; } /** * Merge bloom 'a' into bloom 'b'. * * \param a bloom to insert * \param b target bloom */ static inline void css_bloom_merge(const css_bloom a[CSS_BLOOM_SIZE], css_bloom b[CSS_BLOOM_SIZE]) { b[0] |= a[0]; b[1] |= a[1]; b[2] |= a[2]; b[3] |= a[3]; #if (CSS_BLOOM_SIZE > 4) b[4] |= a[4]; b[5] |= a[5]; b[6] |= a[6]; b[7] |= a[7]; #endif #if (CSS_BLOOM_SIZE > 8) b[8] |= a[8]; b[9] |= a[9]; b[10] |= a[10]; b[11] |= a[11]; b[12] |= a[12]; b[13] |= a[13]; b[14] |= a[14]; b[15] |= a[15]; #endif } /** * Initialise a bloom filter to 0 * * \param bloom bloom filter to initialise */ static inline void css_bloom_init(css_bloom bloom[CSS_BLOOM_SIZE]) { bloom[0] = 0; bloom[1] = 0; bloom[2] = 0; bloom[3] = 0; #if (CSS_BLOOM_SIZE > 4) bloom[4] = 0; bloom[5] = 0; bloom[6] = 0; bloom[7] = 0; #endif #if (CSS_BLOOM_SIZE > 8) bloom[8] = 0; bloom[9] = 0; bloom[10] = 0; bloom[11] = 0; bloom[12] = 0; bloom[13] = 0; bloom[14] = 0; bloom[15] = 0; #endif } #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libcss/src/select/Makefile0000644000175000017500000000015712377676736017624 0ustar vincevince# Sources DIR_SOURCES := computed.c dispatch.c hash.c select.c font_face.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libcss/src/select/propset.h0000644000175000017500000013533712377676736020042 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_propset_h_ #define css_select_propset_h_ #include #include #include "computed.h" /* Important: keep this file in sync with computed.h */ /** \todo Is there a better way to ensure this happens? */ static const css_computed_uncommon default_uncommon = { { (CSS_LETTER_SPACING_INHERIT << 2) | CSS_OUTLINE_COLOR_INVERT, (CSS_OUTLINE_WIDTH_MEDIUM << 1) | CSS_BORDER_SPACING_INHERIT, 0, (CSS_WORD_SPACING_INHERIT << 2) | (CSS_COUNTER_INCREMENT_NONE << 1) | CSS_COUNTER_RESET_NONE, (CSS_CURSOR_INHERIT << 3) | (CSS_WRITING_MODE_INHERIT << 1) | 0, 0, 0, (CSS_CLIP_AUTO << 2) | CSS_CONTENT_NORMAL }, { 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, NULL, NULL, NULL, NULL }; #define ENSURE_UNCOMMON do { \ if (style->uncommon == NULL) { \ style->uncommon = malloc(sizeof(css_computed_uncommon));\ if (style->uncommon == NULL) \ return CSS_NOMEM; \ \ memcpy(style->uncommon, &default_uncommon, \ sizeof(css_computed_uncommon)); \ } \ } while(0) static const css_computed_page default_page = { { (CSS_PAGE_BREAK_INSIDE_AUTO << 6) | (CSS_PAGE_BREAK_BEFORE_AUTO << 3) | CSS_PAGE_BREAK_AFTER_AUTO, (CSS_WIDOWS_SET << 1) | CSS_ORPHANS_SET }, 2 << CSS_RADIX_POINT, 2 << CSS_RADIX_POINT }; #define ENSURE_PAGE do { \ if (style->page == NULL) { \ style->page = malloc(sizeof(css_computed_page)); \ if (style->page == NULL) \ return CSS_NOMEM; \ \ memcpy(style->page, &default_page, \ sizeof(css_computed_page)); \ } \ } while(0) #define LETTER_SPACING_INDEX 0 #define LETTER_SPACING_SHIFT 2 #define LETTER_SPACING_MASK 0xfc static inline css_error set_letter_spacing( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[LETTER_SPACING_INDEX]; /* 6bits: uuuutt : unit | type */ *bits = (*bits & ~LETTER_SPACING_MASK) | (((type & 0x3) | unit << 2) << LETTER_SPACING_SHIFT); style->uncommon->letter_spacing = length; return CSS_OK; } #undef LETTER_SPACING_MASK #undef LETTER_SPACING_SHIFT #undef LETTER_SPACING_INDEX #define OUTLINE_COLOR_INDEX 0 #define OUTLINE_COLOR_SHIFT 0 #define OUTLINE_COLOR_MASK 0x3 static inline css_error set_outline_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[OUTLINE_COLOR_INDEX]; /* 2bits: tt : type */ *bits = (*bits & ~OUTLINE_COLOR_MASK) | ((type & 0x3) << OUTLINE_COLOR_SHIFT); style->uncommon->outline_color = color; return CSS_OK; } #undef OUTLINE_COLOR_MASK #undef OUTLINE_COLOR_SHIFT #undef OUTLINE_COLOR_INDEX #define OUTLINE_WIDTH_INDEX 1 #define OUTLINE_WIDTH_SHIFT 1 #define OUTLINE_WIDTH_MASK 0xfe static inline css_error set_outline_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[OUTLINE_WIDTH_INDEX]; /* 7bits: uuuuttt : unit | type */ *bits = (*bits & ~OUTLINE_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << OUTLINE_WIDTH_SHIFT); style->uncommon->outline_width = length; return CSS_OK; } #undef OUTLINE_WIDTH_MASK #undef OUTLINE_WIDTH_SHIFT #undef OUTLINE_WIDTH_INDEX #define BORDER_SPACING_INDEX 1 #define BORDER_SPACING_SHIFT 0 #define BORDER_SPACING_MASK 0x1 #define BORDER_SPACING_INDEX1 2 #define BORDER_SPACING_SHIFT1 0 static inline css_error set_border_spacing( css_computed_style *style, uint8_t type, css_fixed hlength, css_unit hunit, css_fixed vlength, css_unit vunit) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[BORDER_SPACING_INDEX]; /* 1 bit: type */ *bits = (*bits & ~BORDER_SPACING_MASK) | ((type & 0x1) << BORDER_SPACING_SHIFT); bits = &style->uncommon->bits[BORDER_SPACING_INDEX1]; /* 8bits: hhhhvvvv : hunit | vunit */ *bits = (((hunit << 4) | vunit) << BORDER_SPACING_SHIFT1); style->uncommon->border_spacing[0] = hlength; style->uncommon->border_spacing[1] = vlength; return CSS_OK; } #undef BORDER_SPACING_SHIFT1 #undef BORDER_SPACING_INDEX1 #undef BORDER_SPACING_MASK #undef BORDER_SPACING_SHIFT #undef BORDER_SPACING_INDEX #define WORD_SPACING_INDEX 3 #define WORD_SPACING_SHIFT 2 #define WORD_SPACING_MASK 0xfc static inline css_error set_word_spacing( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[WORD_SPACING_INDEX]; /* 6bits: uuuutt : unit | type */ *bits = (*bits & ~WORD_SPACING_MASK) | (((type & 0x3) | (unit << 2)) << WORD_SPACING_SHIFT); style->uncommon->word_spacing = length; return CSS_OK; } #undef WORD_SPACING_MASK #undef WORD_SPACING_SHIFT #undef WORD_SPACING_INDEX #define WRITING_MODE_INDEX 4 #define WRITING_MODE_SHIFT 1 #define WRITING_MODE_MASK 0x6 static inline css_error set_writing_mode( css_computed_style *style, uint8_t type) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[WRITING_MODE_INDEX]; /* 2bits: type */ *bits = (*bits & ~WRITING_MODE_MASK) | ((type & 0x3) << WRITING_MODE_SHIFT); return CSS_OK; } #undef WRITING_MODE_MASK #undef WRITING_MODE_SHIFT #undef WRITING_MODE_INDEX #define COUNTER_INCREMENT_INDEX 3 #define COUNTER_INCREMENT_SHIFT 1 #define COUNTER_INCREMENT_MASK 0x2 static inline css_error set_counter_increment( css_computed_style *style, uint8_t type, css_computed_counter *counters) { uint8_t *bits; css_computed_counter *oldcounters; css_computed_counter *c; ENSURE_UNCOMMON; bits = &style->uncommon->bits[COUNTER_INCREMENT_INDEX]; oldcounters = style->uncommon->counter_increment; /* 1bit: type */ *bits = (*bits & ~COUNTER_INCREMENT_MASK) | ((type & 0x1) << COUNTER_INCREMENT_SHIFT); for (c = counters; c != NULL && c->name != NULL; c++) c->name = lwc_string_ref(c->name); style->uncommon->counter_increment = counters; /* Free existing array */ if (oldcounters != NULL) { for (c = oldcounters; c->name != NULL; c++) lwc_string_unref(c->name); if (oldcounters != counters) free(oldcounters); } return CSS_OK; } #undef COUNTER_INCREMENT_MASK #undef COUNTER_INCREMENT_SHIFT #undef COUNTER_INCREMENT_INDEX #define COUNTER_RESET_INDEX 3 #define COUNTER_RESET_SHIFT 0 #define COUNTER_RESET_MASK 0x1 static inline css_error set_counter_reset( css_computed_style *style, uint8_t type, css_computed_counter *counters) { uint8_t *bits; css_computed_counter *oldcounters; css_computed_counter *c; ENSURE_UNCOMMON; bits = &style->uncommon->bits[COUNTER_RESET_INDEX]; oldcounters = style->uncommon->counter_reset; /* 1bit: type */ *bits = (*bits & ~COUNTER_RESET_MASK) | ((type & 0x1) << COUNTER_RESET_SHIFT); for (c = counters; c != NULL && c->name != NULL; c++) c->name = lwc_string_ref(c->name); style->uncommon->counter_reset = counters; /* Free existing array */ if (oldcounters != NULL) { for (c = oldcounters; c->name != NULL; c++) lwc_string_unref(c->name); if (oldcounters != counters) free(oldcounters); } return CSS_OK; } #undef COUNTER_RESET_MASK #undef COUNTER_RESET_SHIFT #undef COUNTER_RESET_INDEX #define CURSOR_INDEX 4 #define CURSOR_SHIFT 3 #define CURSOR_MASK 0xf8 static inline css_error set_cursor( css_computed_style *style, uint8_t type, lwc_string **urls) { uint8_t *bits; lwc_string **oldurls; lwc_string **s; ENSURE_UNCOMMON; bits = &style->uncommon->bits[CURSOR_INDEX]; oldurls = style->uncommon->cursor; /* 5bits: type */ *bits = (*bits & ~CURSOR_MASK) | ((type & 0x1f) << CURSOR_SHIFT); for (s = urls; s != NULL && *s != NULL; s++) *s = lwc_string_ref(*s); style->uncommon->cursor = urls; /* Free existing array */ if (oldurls != NULL) { for (s = oldurls; *s != NULL; s++) lwc_string_unref(*s); if (oldurls != urls) free(oldurls); } return CSS_OK; } #undef CURSOR_MASK #undef CURSOR_SHIFT #undef CURSOR_INDEX #define CLIP_INDEX 7 #define CLIP_SHIFT 2 #define CLIP_MASK 0xfc #define CLIP_INDEX1 5 #define CLIP_SHIFT1 0 #define CLIP_INDEX2 6 #define CLIP_SHIFT2 0 static inline css_error set_clip( css_computed_style *style, uint8_t type, css_computed_clip_rect *rect) { uint8_t *bits; ENSURE_UNCOMMON; bits = &style->uncommon->bits[CLIP_INDEX]; /* 6bits: trblyy : top | right | bottom | left | type */ *bits = (*bits & ~CLIP_MASK) | ((type & 0x3) << CLIP_SHIFT); if (type == CSS_CLIP_RECT) { *bits |= (((rect->top_auto ? 0x20 : 0) | (rect->right_auto ? 0x10 : 0) | (rect->bottom_auto ? 0x8 : 0) | (rect->left_auto ? 0x4 : 0)) << CLIP_SHIFT); bits = &style->uncommon->bits[CLIP_INDEX1]; /* 8bits: ttttrrrr : top | right */ *bits = (((rect->tunit << 4) | rect->runit) << CLIP_SHIFT1); bits = &style->uncommon->bits[CLIP_INDEX2]; /* 8bits: bbbbllll : bottom | left */ *bits = (((rect->bunit << 4) | rect->lunit) << CLIP_SHIFT2); style->uncommon->clip[0] = rect->top; style->uncommon->clip[1] = rect->right; style->uncommon->clip[2] = rect->bottom; style->uncommon->clip[3] = rect->left; } return CSS_OK; } #undef CLIP_SHIFT2 #undef CLIP_INDEX2 #undef CLIP_SHIFT1 #undef CLIP_INDEX1 #undef CLIP_MASK #undef CLIP_SHIFT #undef CLIP_INDEX #define CONTENT_INDEX 7 #define CONTENT_SHIFT 0 #define CONTENT_MASK 0x3 static inline css_error set_content( css_computed_style *style, uint8_t type, css_computed_content_item *content) { uint8_t *bits; css_computed_content_item *oldcontent; css_computed_content_item *c; ENSURE_UNCOMMON; /* 2bits: type */ bits = &style->uncommon->bits[CONTENT_INDEX]; oldcontent = style->uncommon->content; *bits = (*bits & ~CONTENT_MASK) | ((type & 0x3) << CONTENT_SHIFT); for (c = content; c != NULL && c->type != CSS_COMPUTED_CONTENT_NONE; c++) { switch (c->type) { case CSS_COMPUTED_CONTENT_STRING: c->data.string = lwc_string_ref(c->data.string); break; case CSS_COMPUTED_CONTENT_URI: c->data.uri = lwc_string_ref(c->data.uri); break; case CSS_COMPUTED_CONTENT_ATTR: c->data.attr = lwc_string_ref(c->data.attr); break; case CSS_COMPUTED_CONTENT_COUNTER: c->data.counter.name = lwc_string_ref(c->data.counter.name); break; case CSS_COMPUTED_CONTENT_COUNTERS: c->data.counters.name = lwc_string_ref(c->data.counters.name); c->data.counters.sep = lwc_string_ref(c->data.counters.sep); break; default: break; } } style->uncommon->content = content; /* Free existing array */ if (oldcontent != NULL) { for (c = oldcontent; c->type != CSS_COMPUTED_CONTENT_NONE; c++) { switch (c->type) { case CSS_COMPUTED_CONTENT_STRING: lwc_string_unref(c->data.string); break; case CSS_COMPUTED_CONTENT_URI: lwc_string_unref(c->data.uri); break; case CSS_COMPUTED_CONTENT_ATTR: lwc_string_unref(c->data.attr); break; case CSS_COMPUTED_CONTENT_COUNTER: lwc_string_unref(c->data.counter.name); break; case CSS_COMPUTED_CONTENT_COUNTERS: lwc_string_unref(c->data.counters.name); lwc_string_unref(c->data.counters.sep); break; default: break; } } if (oldcontent != content) free(oldcontent); } return CSS_OK; } #undef CONTENT_MASK #undef CONTENT_SHIFT #undef CONTENT_INDEX #define VERTICAL_ALIGN_INDEX 0 #define VERTICAL_ALIGN_SHIFT 0 static inline css_error set_vertical_align( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[VERTICAL_ALIGN_INDEX]; /* 8bits: uuuutttt : units | type */ *bits = (((type & 0xf) | (unit << 4)) << VERTICAL_ALIGN_SHIFT); style->vertical_align = length; return CSS_OK; } #undef VERTICAL_ALIGN_SHIFT #undef VERTICAL_ALIGN_INDEX #define FONT_SIZE_INDEX 1 #define FONT_SIZE_SHIFT 0 static inline css_error set_font_size( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[FONT_SIZE_INDEX]; /* 8bits: uuuutttt : units | type */ *bits = (((type & 0xf) | (unit << 4)) << FONT_SIZE_SHIFT); style->font_size = length; return CSS_OK; } #undef FONT_SIZE_SHIFT #undef FONT_SIZE_INDEX #define BORDER_TOP_WIDTH_INDEX 2 #define BORDER_TOP_WIDTH_SHIFT 1 #define BORDER_TOP_WIDTH_MASK 0xfe static inline css_error set_border_top_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_TOP_WIDTH_INDEX]; /* 7bits: uuuuttt : units | type */ *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << BORDER_TOP_WIDTH_SHIFT); style->border_width[0] = length; return CSS_OK; } #undef BORDER_TOP_WIDTH_MASK #undef BORDER_TOP_WIDTH_SHIFT #undef BORDER_TOP_WIDTH_INDEX #define BORDER_RIGHT_WIDTH_INDEX 3 #define BORDER_RIGHT_WIDTH_SHIFT 1 #define BORDER_RIGHT_WIDTH_MASK 0xfe static inline css_error set_border_right_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_RIGHT_WIDTH_INDEX]; /* 7bits: uuuuttt : units | type */ *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << BORDER_RIGHT_WIDTH_SHIFT); style->border_width[1] = length; return CSS_OK; } #undef BORDER_RIGHT_WIDTH_MASK #undef BORDER_RIGHT_WIDTH_SHIFT #undef BORDER_RIGHT_WIDTH_INDEX #define BORDER_BOTTOM_WIDTH_INDEX 4 #define BORDER_BOTTOM_WIDTH_SHIFT 1 #define BORDER_BOTTOM_WIDTH_MASK 0xfe static inline css_error set_border_bottom_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_BOTTOM_WIDTH_INDEX]; /* 7bits: uuuuttt : units | type */ *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << BORDER_BOTTOM_WIDTH_SHIFT); style->border_width[2] = length; return CSS_OK; } #undef BORDER_BOTTOM_WIDTH_MASK #undef BORDER_BOTTOM_WIDTH_SHIFT #undef BORDER_BOTTOM_WIDTH_INDEX #define BORDER_LEFT_WIDTH_INDEX 5 #define BORDER_LEFT_WIDTH_SHIFT 1 #define BORDER_LEFT_WIDTH_MASK 0xfe static inline css_error set_border_left_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BORDER_LEFT_WIDTH_INDEX]; /* 7bits: uuuuttt : units | type */ *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | (((type & 0x7) | (unit << 3)) << BORDER_LEFT_WIDTH_SHIFT); style->border_width[3] = length; return CSS_OK; } #undef BORDER_LEFT_WIDTH_MASK #undef BORDER_LEFT_WIDTH_SHIFT #undef BORDER_LEFT_WIDTH_INDEX #define BACKGROUND_IMAGE_INDEX 2 #define BACKGROUND_IMAGE_SHIFT 0 #define BACKGROUND_IMAGE_MASK 0x1 static inline css_error set_background_image( css_computed_style *style, uint8_t type, lwc_string *url) { uint8_t *bits = &style->bits[BACKGROUND_IMAGE_INDEX]; lwc_string *oldurl = style->background_image; /* 1bit: type */ *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | ((type & 0x1) << BACKGROUND_IMAGE_SHIFT); if (url != NULL) { style->background_image = lwc_string_ref(url); } else { style->background_image = NULL; } if (oldurl != NULL) lwc_string_unref(oldurl); return CSS_OK; } #undef BACKGROUND_IMAGE_MASK #undef BACKGROUND_IMAGE_SHIFT #undef BACKGROUND_IMAGE_INDEX #define COLOR_INDEX 3 #define COLOR_SHIFT 0 #define COLOR_MASK 0x1 static inline css_error set_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[COLOR_INDEX]; /* 1bit: type */ *bits = (*bits & ~COLOR_MASK) | ((type & 0x1) << COLOR_SHIFT); style->color = color; return CSS_OK; } #undef COLOR_MASK #undef COLOR_SHIFT #undef COLOR_INDEX #define LIST_STYLE_IMAGE_INDEX 4 #define LIST_STYLE_IMAGE_SHIFT 0 #define LIST_STYLE_IMAGE_MASK 0x1 static inline css_error set_list_style_image( css_computed_style *style, uint8_t type, lwc_string *url) { uint8_t *bits = &style->bits[LIST_STYLE_IMAGE_INDEX]; lwc_string *oldurl = style->list_style_image; /* 1bit: type */ *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | ((type & 0x1) << LIST_STYLE_IMAGE_SHIFT); if (url != NULL) { style->list_style_image = lwc_string_ref(url); } else { style->list_style_image = NULL; } if (oldurl != NULL) lwc_string_unref(oldurl); return CSS_OK; } #undef LIST_STYLE_IMAGE_MASK #undef LIST_STYLE_IMAGE_SHIFT #undef LIST_STYLE_IMAGE_INDEX #define QUOTES_INDEX 5 #define QUOTES_SHIFT 0 #define QUOTES_MASK 0x1 static inline css_error set_quotes( css_computed_style *style, uint8_t type, lwc_string **quotes) { uint8_t *bits = &style->bits[QUOTES_INDEX]; lwc_string **oldquotes = style->quotes; lwc_string **s; /* 1bit: type */ *bits = (*bits & ~QUOTES_MASK) | ((type & 0x1) << QUOTES_SHIFT); for (s = quotes; s != NULL && *s != NULL; s++) *s = lwc_string_ref(*s); style->quotes = quotes; /* Free current quotes */ if (oldquotes != NULL) { for (s = oldquotes; *s != NULL; s++) lwc_string_unref(*s); if (oldquotes != quotes) free(oldquotes); } return CSS_OK; } #undef QUOTES_MASK #undef QUOTES_SHIFT #undef QUOTES_INDEX #define TOP_INDEX 6 #define TOP_SHIFT 2 #define TOP_MASK 0xfc static inline css_error set_top( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[TOP_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~TOP_MASK) | (((type & 0x3) | (unit << 2)) << TOP_SHIFT); style->top = length; return CSS_OK; } #undef TOP_MASK #undef TOP_SHIFT #undef TOP_INDEX #define RIGHT_INDEX 7 #define RIGHT_SHIFT 2 #define RIGHT_MASK 0xfc static inline css_error set_right( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[RIGHT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << RIGHT_SHIFT); style->right = length; return CSS_OK; } #undef RIGHT_MASK #undef RIGHT_SHIFT #undef RIGHT_INDEX #define BOTTOM_INDEX 8 #define BOTTOM_SHIFT 2 #define BOTTOM_MASK 0xfc static inline css_error set_bottom( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[BOTTOM_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) << BOTTOM_SHIFT); style->bottom = length; return CSS_OK; } #undef BOTTOM_MASK #undef BOTTOM_SHIFT #undef BOTTOM_INDEX #define LEFT_INDEX 9 #define LEFT_SHIFT 2 #define LEFT_MASK 0xfc static inline css_error set_left( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[LEFT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~LEFT_MASK) | (((type & 0x3) | (unit << 2)) << LEFT_SHIFT); style->left = length; return CSS_OK; } #undef LEFT_MASK #undef LEFT_SHIFT #undef LEFT_INDEX #define BORDER_TOP_COLOR_INDEX 6 #define BORDER_TOP_COLOR_SHIFT 0 #define BORDER_TOP_COLOR_MASK 0x3 static inline css_error set_border_top_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_TOP_COLOR_INDEX]; /* 2bits: type */ *bits = (*bits & ~BORDER_TOP_COLOR_MASK) | ((type & 0x3) << BORDER_TOP_COLOR_SHIFT); style->border_color[0] = color; return CSS_OK; } #undef BORDER_TOP_COLOR_MASK #undef BORDER_TOP_COLOR_SHIFT #undef BORDER_TOP_COLOR_INDEX #define BORDER_RIGHT_COLOR_INDEX 7 #define BORDER_RIGHT_COLOR_SHIFT 0 #define BORDER_RIGHT_COLOR_MASK 0x3 static inline css_error set_border_right_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_RIGHT_COLOR_INDEX]; /* 2bits: type */ *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | ((type & 0x3) << BORDER_RIGHT_COLOR_SHIFT); style->border_color[1] = color; return CSS_OK; } #undef BORDER_RIGHT_COLOR_MASK #undef BORDER_RIGHT_COLOR_SHIFT #undef BORDER_RIGHT_COLOR_INDEX #define BORDER_BOTTOM_COLOR_INDEX 8 #define BORDER_BOTTOM_COLOR_SHIFT 0 #define BORDER_BOTTOM_COLOR_MASK 0x3 static inline css_error set_border_bottom_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_BOTTOM_COLOR_INDEX]; /* 2bits: type */ *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | ((type & 0x3) << BORDER_BOTTOM_COLOR_SHIFT); style->border_color[2] = color; return CSS_OK; } #undef BORDER_BOTTOM_COLOR_MASK #undef BORDER_BOTTOM_COLOR_SHIFT #undef BORDER_BOTTOM_COLOR_INDEX #define BORDER_LEFT_COLOR_INDEX 9 #define BORDER_LEFT_COLOR_SHIFT 0 #define BORDER_LEFT_COLOR_MASK 0x3 static inline css_error set_border_left_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BORDER_LEFT_COLOR_INDEX]; /* 2bits: type */ *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | ((type & 0x3) << BORDER_LEFT_COLOR_SHIFT); style->border_color[3] = color; return CSS_OK; } #undef BORDER_LEFT_COLOR_MASK #undef BORDER_LEFT_COLOR_SHIFT #undef BORDER_LEFT_COLOR_INDEX #define HEIGHT_INDEX 10 #define HEIGHT_SHIFT 2 #define HEIGHT_MASK 0xfc static inline css_error set_height( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[HEIGHT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << HEIGHT_SHIFT); style->height = length; return CSS_OK; } #undef HEIGHT_MASK #undef HEIGHT_SHIFT #undef HEIGHT_INDEX #define LINE_HEIGHT_INDEX 11 #define LINE_HEIGHT_SHIFT 2 #define LINE_HEIGHT_MASK 0xfc static inline css_error set_line_height( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[LINE_HEIGHT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~LINE_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << LINE_HEIGHT_SHIFT); style->line_height = length; return CSS_OK; } #undef LINE_HEIGHT_MASK #undef LINE_HEIGHT_SHIFT #undef LINE_HEIGHT_INDEX #define BACKGROUND_COLOR_INDEX 10 #define BACKGROUND_COLOR_SHIFT 0 #define BACKGROUND_COLOR_MASK 0x3 static inline css_error set_background_color( css_computed_style *style, uint8_t type, css_color color) { uint8_t *bits = &style->bits[BACKGROUND_COLOR_INDEX]; /* 2bits: type */ *bits = (*bits & ~BACKGROUND_COLOR_MASK) | ((type & 0x3) << BACKGROUND_COLOR_SHIFT); style->background_color = color; return CSS_OK; } #undef BACKGROUND_COLOR_MASK #undef BACKGROUND_COLOR_SHIFT #undef BACKGROUND_COLOR_INDEX #define Z_INDEX_INDEX 11 #define Z_INDEX_SHIFT 0 #define Z_INDEX_MASK 0x3 static inline css_error set_z_index( css_computed_style *style, uint8_t type, int32_t z_index) { uint8_t *bits = &style->bits[Z_INDEX_INDEX]; /* 2bits: type */ *bits = (*bits & ~Z_INDEX_MASK) | ((type & 0x3) << Z_INDEX_SHIFT); style->z_index = z_index; return CSS_OK; } #undef Z_INDEX_MASK #undef Z_INDEX_SHIFT #undef Z_INDEX_INDEX #define MARGIN_TOP_INDEX 12 #define MARGIN_TOP_SHIFT 2 #define MARGIN_TOP_MASK 0xfc static inline css_error set_margin_top( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_TOP_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MARGIN_TOP_MASK) | (((type & 0x3) | (unit << 2)) << MARGIN_TOP_SHIFT); style->margin[0] = length; return CSS_OK; } #undef MARGIN_TOP_MASK #undef MARGIN_TOP_SHIFT #undef MARGIN_TOP_INDEX #define MARGIN_RIGHT_INDEX 13 #define MARGIN_RIGHT_SHIFT 2 #define MARGIN_RIGHT_MASK 0xfc static inline css_error set_margin_right( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_RIGHT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MARGIN_RIGHT_MASK) | (((type & 0x3) | (unit << 2)) << MARGIN_RIGHT_SHIFT); style->margin[1] = length; return CSS_OK; } #undef MARGIN_RIGHT_MASK #undef MARGIN_RIGHT_SHIFT #undef MARGIN_RIGHT_INDEX #define MARGIN_BOTTOM_INDEX 14 #define MARGIN_BOTTOM_SHIFT 2 #define MARGIN_BOTTOM_MASK 0xfc static inline css_error set_margin_bottom( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_BOTTOM_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MARGIN_BOTTOM_MASK) | (((type & 0x3) | (unit << 2)) << MARGIN_BOTTOM_SHIFT); style->margin[2] = length; return CSS_OK; } #undef MARGIN_BOTTOM_MASK #undef MARGIN_BOTTOM_SHIFT #undef MARGIN_BOTTOM_INDEX #define MARGIN_LEFT_INDEX 15 #define MARGIN_LEFT_SHIFT 2 #define MARGIN_LEFT_MASK 0xfc static inline css_error set_margin_left( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MARGIN_LEFT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MARGIN_LEFT_MASK) | (((type & 0x3) | (unit << 2)) << MARGIN_LEFT_SHIFT); style->margin[3] = length; return CSS_OK; } #undef MARGIN_LEFT_MASK #undef MARGIN_LEFT_SHIFT #undef MARGIN_LEFT_INDEX #define BACKGROUND_ATTACHMENT_INDEX 12 #define BACKGROUND_ATTACHMENT_SHIFT 0 #define BACKGROUND_ATTACHMENT_MASK 0x3 static inline css_error set_background_attachment( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BACKGROUND_ATTACHMENT_INDEX]; /* 2bits: type */ *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | ((type & 0x3) << BACKGROUND_ATTACHMENT_SHIFT); return CSS_OK; } #undef BACKGROUND_ATTACHMENT_MASK #undef BACKGROUND_ATTACHMENT_SHIFT #undef BACKGROUND_ATTACHMENT_INDEX #define BORDER_COLLAPSE_INDEX 13 #define BORDER_COLLAPSE_SHIFT 0 #define BORDER_COLLAPSE_MASK 0x3 static inline css_error set_border_collapse( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BORDER_COLLAPSE_INDEX]; /* 2bits: type */ *bits = (*bits & ~BORDER_COLLAPSE_MASK) | ((type & 0x3) << BORDER_COLLAPSE_SHIFT); return CSS_OK; } #undef BORDER_COLLAPSE_MASK #undef BORDER_COLLAPSE_SHIFT #undef BORDER_COLLAPSE_INDEX #define CAPTION_SIDE_INDEX 14 #define CAPTION_SIDE_SHIFT 0 #define CAPTION_SIDE_MASK 0x3 static inline css_error set_caption_side( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[CAPTION_SIDE_INDEX]; /* 2bits: type */ *bits = (*bits & ~CAPTION_SIDE_MASK) | ((type & 0x3) << CAPTION_SIDE_SHIFT); return CSS_OK; } #undef CAPTION_SIDE_MASK #undef CAPTION_SIDE_SHIFT #undef CAPTION_SIDE_INDEX #define DIRECTION_INDEX 15 #define DIRECTION_SHIFT 0 #define DIRECTION_MASK 0x3 static inline css_error set_direction( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[DIRECTION_INDEX]; /* 2bits: type */ *bits = (*bits & ~DIRECTION_MASK) | ((type & 0x3) << DIRECTION_SHIFT); return CSS_OK; } #undef DIRECTION_MASK #undef DIRECTION_SHIFT #undef DIRECTION_INDEX #define MAX_HEIGHT_INDEX 16 #define MAX_HEIGHT_SHIFT 2 #define MAX_HEIGHT_MASK 0xfc static inline css_error set_max_height( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MAX_HEIGHT_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MAX_HEIGHT_MASK) | (((type & 0x3) | (unit << 2)) << MAX_HEIGHT_SHIFT); style->max_height = length; return CSS_OK; } #undef MAX_HEIGHT_MASK #undef MAX_HEIGHT_SHIFT #undef MAX_HEIGHT_INDEX #define MAX_WIDTH_INDEX 17 #define MAX_WIDTH_SHIFT 2 #define MAX_WIDTH_MASK 0xfc static inline css_error set_max_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MAX_WIDTH_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~MAX_WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << MAX_WIDTH_SHIFT); style->max_width = length; return CSS_OK; } #undef MAX_WIDTH_MASK #undef MAX_WIDTH_SHIFT #undef MAX_WIDTH_INDEX #define WIDTH_INDEX 18 #define WIDTH_SHIFT 2 #define WIDTH_MASK 0xfc static inline css_error set_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[WIDTH_INDEX]; /* 6bits: uuuutt : units | type */ *bits = (*bits & ~WIDTH_MASK) | (((type & 0x3) | (unit << 2)) << WIDTH_SHIFT); style->width = length; return CSS_OK; } #undef WIDTH_MASK #undef WIDTH_SHIFT #undef WIDTH_INDEX #define EMPTY_CELLS_INDEX 16 #define EMPTY_CELLS_SHIFT 0 #define EMPTY_CELLS_MASK 0x3 static inline css_error set_empty_cells( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[EMPTY_CELLS_INDEX]; /* 2bits: type */ *bits = (*bits & ~EMPTY_CELLS_MASK) | ((type & 0x3) << EMPTY_CELLS_SHIFT); return CSS_OK; } #undef EMPTY_CELLS_MASK #undef EMPTY_CELLS_SHIFT #undef EMPTY_CELLS_INDEX #define FLOAT_INDEX 17 #define FLOAT_SHIFT 0 #define FLOAT_MASK 0x3 static inline css_error set_float( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[FLOAT_INDEX]; /* 2bits: type */ *bits = (*bits & ~FLOAT_MASK) | ((type & 0x3) << FLOAT_SHIFT); return CSS_OK; } #undef FLOAT_MASK #undef FLOAT_SHIFT #undef FLOAT_INDEX #define FONT_STYLE_INDEX 18 #define FONT_STYLE_SHIFT 0 #define FONT_STYLE_MASK 0x3 static inline css_error set_font_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[FONT_STYLE_INDEX]; /* 2bits: type */ *bits = (*bits & ~FONT_STYLE_MASK) | ((type & 0x3) << FONT_STYLE_SHIFT); return CSS_OK; } #undef FONT_STYLE_MASK #undef FONT_STYLE_SHIFT #undef FONT_STYLE_INDEX #define MIN_HEIGHT_INDEX 19 #define MIN_HEIGHT_SHIFT 3 #define MIN_HEIGHT_MASK 0xf8 static inline css_error set_min_height( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MIN_HEIGHT_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~MIN_HEIGHT_MASK) | (((type & 0x1) | (unit << 1)) << MIN_HEIGHT_SHIFT); style->min_height = length; return CSS_OK; } #undef MIN_HEIGHT_MASK #undef MIN_HEIGHT_SHIFT #undef MIN_HEIGHT_INDEX #define MIN_WIDTH_INDEX 20 #define MIN_WIDTH_SHIFT 3 #define MIN_WIDTH_MASK 0xf8 static inline css_error set_min_width( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[MIN_WIDTH_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~MIN_WIDTH_MASK) | (((type & 0x1) | (unit << 1)) << MIN_WIDTH_SHIFT); style->min_width = length; return CSS_OK; } #undef MIN_WIDTH_MASK #undef MIN_WIDTH_SHIFT #undef MIN_WIDTH_INDEX #define BACKGROUND_REPEAT_INDEX 19 #define BACKGROUND_REPEAT_SHIFT 0 #define BACKGROUND_REPEAT_MASK 0x7 static inline css_error set_background_repeat( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BACKGROUND_REPEAT_INDEX]; /* 3bits: type */ *bits = (*bits & ~BACKGROUND_REPEAT_MASK) | ((type & 0x7) << BACKGROUND_REPEAT_SHIFT); return CSS_OK; } #undef BACKGROUND_REPEAT_MASK #undef BACKGROUND_REPEAT_SHIFT #undef BACKGROUND_REPEAT_INDEX #define CLEAR_INDEX 20 #define CLEAR_SHIFT 0 #define CLEAR_MASK 0x7 static inline css_error set_clear( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[CLEAR_INDEX]; /* 3bits: type */ *bits = (*bits & ~CLEAR_MASK) | ((type & 0x7) << CLEAR_SHIFT); return CSS_OK; } #undef CLEAR_MASK #undef CLEAR_SHIFT #undef CLEAR_INDEX #define PADDING_TOP_INDEX 21 #define PADDING_TOP_SHIFT 3 #define PADDING_TOP_MASK 0xf8 static inline css_error set_padding_top( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_TOP_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~PADDING_TOP_MASK) | (((type & 0x1) | (unit << 1)) << PADDING_TOP_SHIFT); style->padding[0] = length; return CSS_OK; } #undef PADDING_TOP_MASK #undef PADDING_TOP_SHIFT #undef PADDING_TOP_INDEX #define PADDING_RIGHT_INDEX 22 #define PADDING_RIGHT_SHIFT 3 #define PADDING_RIGHT_MASK 0xf8 static inline css_error set_padding_right( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_RIGHT_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~PADDING_RIGHT_MASK) | (((type & 0x1) | (unit << 1)) << PADDING_RIGHT_SHIFT); style->padding[1] = length; return CSS_OK; } #undef PADDING_RIGHT_MASK #undef PADDING_RIGHT_SHIFT #undef PADDING_RIGHT_INDEX #define PADDING_BOTTOM_INDEX 23 #define PADDING_BOTTOM_SHIFT 3 #define PADDING_BOTTOM_MASK 0xf8 static inline css_error set_padding_bottom( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_BOTTOM_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~PADDING_BOTTOM_MASK) | (((type & 0x1) | (unit << 1)) << PADDING_BOTTOM_SHIFT); style->padding[2] = length; return CSS_OK; } #undef PADDING_BOTTOM_MASK #undef PADDING_BOTTOM_SHIFT #undef PADDING_BOTTOM_INDEX #define PADDING_LEFT_INDEX 24 #define PADDING_LEFT_SHIFT 3 #define PADDING_LEFT_MASK 0xf8 static inline css_error set_padding_left( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[PADDING_LEFT_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~PADDING_LEFT_MASK) | (((type & 0x1) | (unit << 1)) << PADDING_LEFT_SHIFT); style->padding[3] = length; return CSS_OK; } #undef PADDING_LEFT_MASK #undef PADDING_LEFT_SHIFT #undef PADDING_LEFT_INDEX #define OVERFLOW_X_INDEX 21 #define OVERFLOW_X_SHIFT 0 #define OVERFLOW_X_MASK 0x7 static inline css_error set_overflow_x( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[OVERFLOW_X_INDEX]; /* 3bits: type */ *bits = (*bits & ~OVERFLOW_X_MASK) | ((type & 0x7) << OVERFLOW_X_SHIFT); return CSS_OK; } #undef OVERFLOW_X_MASK #undef OVERFLOW_X_SHIFT #undef OVERFLOW_X_INDEX #define OVERFLOW_Y_INDEX 34 #define OVERFLOW_Y_SHIFT 5 #define OVERFLOW_Y_MASK 0xe0 static inline css_error set_overflow_y( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[OVERFLOW_Y_INDEX]; /* 3bits: type */ *bits = (*bits & ~OVERFLOW_Y_MASK) | ((type & 0x7) << OVERFLOW_Y_SHIFT); return CSS_OK; } #undef OVERFLOW_Y_MASK #undef OVERFLOW_Y_SHIFT #undef OVERFLOW_Y_INDEX #define POSITION_INDEX 22 #define POSITION_SHIFT 0 #define POSITION_MASK 0x7 static inline css_error set_position( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[POSITION_INDEX]; /* 3bits: type */ *bits = (*bits & ~POSITION_MASK) | ((type & 0x7) << POSITION_SHIFT); return CSS_OK; } #undef POSITION_MASK #undef POSITION_SHIFT #undef POSITION_INDEX #define OPACITY_INDEX 23 #define OPACITY_SHIFT 2 #define OPACITY_MASK 0x04 static inline css_error set_opacity( css_computed_style *style, uint8_t type, css_fixed opacity) { uint8_t *bits = &style->bits[OPACITY_INDEX]; /* 1bit: t : type */ *bits = (*bits & ~OPACITY_MASK) | ((type & 0x1) << OPACITY_SHIFT); style->opacity = opacity; return CSS_OK; } #undef OPACITY_MASK #undef OPACITY_SHIFT #undef OPACITY_INDEX #define TEXT_TRANSFORM_INDEX 24 #define TEXT_TRANSFORM_SHIFT 0 #define TEXT_TRANSFORM_MASK 0x7 static inline css_error set_text_transform( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[TEXT_TRANSFORM_INDEX]; /* 3bits: type */ *bits = (*bits & ~TEXT_TRANSFORM_MASK) | ((type & 0x7) << TEXT_TRANSFORM_SHIFT); return CSS_OK; } #undef TEXT_TRANSFORM_MASK #undef TEXT_TRANSFORM_SHIFT #undef TEXT_TRANSFORM_INDEX #define TEXT_INDENT_INDEX 25 #define TEXT_INDENT_SHIFT 3 #define TEXT_INDENT_MASK 0xf8 static inline css_error set_text_indent( css_computed_style *style, uint8_t type, css_fixed length, css_unit unit) { uint8_t *bits = &style->bits[TEXT_INDENT_INDEX]; /* 5bits: uuuut : units | type */ *bits = (*bits & ~TEXT_INDENT_MASK) | (((type & 0x1) | (unit << 1)) << TEXT_INDENT_SHIFT); style->text_indent = length; return CSS_OK; } #undef TEXT_INDENT_MASK #undef TEXT_INDENT_SHIFT #undef TEXT_INDENT_INDEX #define WHITE_SPACE_INDEX 25 #define WHITE_SPACE_SHIFT 0 #define WHITE_SPACE_MASK 0x7 static inline css_error set_white_space( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[WHITE_SPACE_INDEX]; /* 3bits: type */ *bits = (*bits & ~WHITE_SPACE_MASK) | ((type & 0x7) << WHITE_SPACE_SHIFT); return CSS_OK; } #undef WHITE_SPACE_MASK #undef WHITE_SPACE_SHIFT #undef WHITE_SPACE_INDEX #define BACKGROUND_POSITION_INDEX 27 #define BACKGROUND_POSITION_SHIFT 7 #define BACKGROUND_POSITION_MASK 0x80 #define BACKGROUND_POSITION_INDEX1 26 #define BACKGROUND_POSITION_SHIFT1 0 static inline css_error set_background_position( css_computed_style *style, uint8_t type, css_fixed hlength, css_unit hunit, css_fixed vlength, css_unit vunit) { uint8_t *bits; bits = &style->bits[BACKGROUND_POSITION_INDEX]; /* 1 bit: type */ *bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((type & 0x1) << BACKGROUND_POSITION_SHIFT); bits = &style->bits[BACKGROUND_POSITION_INDEX1]; /* 8bits: hhhhvvvv : hunit | vunit */ *bits = (((hunit << 4) | vunit) << BACKGROUND_POSITION_SHIFT1); style->background_position[0] = hlength; style->background_position[1] = vlength; return CSS_OK; } #undef BACKGROUND_POSITION_SHIFT1 #undef BACKGROUND_POSITION_INDEX1 #undef BACKGROUND_POSITION_MASK #undef BACKGROUND_POSITION_SHIFT #undef BACKGROUND_POSITION_INDEX #define DISPLAY_INDEX 27 #define DISPLAY_SHIFT 2 #define DISPLAY_MASK 0x7c static inline css_error set_display( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[DISPLAY_INDEX]; /* 5bits: type */ *bits = (*bits & ~DISPLAY_MASK) | ((type & 0x1f) << DISPLAY_SHIFT); return CSS_OK; } #undef DISPLAY_MASK #undef DISPLAY_SHIFT #undef DISPLAY_INDEX #define FONT_VARIANT_INDEX 27 #define FONT_VARIANT_SHIFT 0 #define FONT_VARIANT_MASK 0x3 static inline css_error set_font_variant( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[FONT_VARIANT_INDEX]; /* 2bits: type */ *bits = (*bits & ~FONT_VARIANT_MASK) | ((type & 0x3) << FONT_VARIANT_SHIFT); return CSS_OK; } #undef FONT_VARIANT_MASK #undef FONT_VARIANT_SHIFT #undef FONT_VARIANT_INDEX #define TEXT_DECORATION_INDEX 28 #define TEXT_DECORATION_SHIFT 3 #define TEXT_DECORATION_MASK 0xf8 static inline css_error set_text_decoration( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[TEXT_DECORATION_INDEX]; /* 5bits: type */ *bits = (*bits & ~TEXT_DECORATION_MASK) | ((type & 0x1f) << TEXT_DECORATION_SHIFT); return CSS_OK; } #undef TEXT_DECORATION_MASK #undef TEXT_DECORATION_SHIFT #undef TEXT_DECORATION_INDEX #define FONT_FAMILY_INDEX 28 #define FONT_FAMILY_SHIFT 0 #define FONT_FAMILY_MASK 0x7 static inline css_error set_font_family( css_computed_style *style, uint8_t type, lwc_string **names) { uint8_t *bits = &style->bits[FONT_FAMILY_INDEX]; lwc_string **oldnames = style->font_family; lwc_string **s; /* 3bits: type */ *bits = (*bits & ~FONT_FAMILY_MASK) | ((type & 0x7) << FONT_FAMILY_SHIFT); for (s = names; s != NULL && *s != NULL; s++) *s = lwc_string_ref(*s); style->font_family = names; /* Free existing families */ if (oldnames != NULL) { for (s = oldnames; *s != NULL; s++) lwc_string_unref(*s); if (oldnames != names) free(oldnames); } return CSS_OK; } #undef FONT_FAMILY_MASK #undef FONT_FAMILY_SHIFT #undef FONT_FAMILY_INDEX #define BORDER_TOP_STYLE_INDEX 29 #define BORDER_TOP_STYLE_SHIFT 4 #define BORDER_TOP_STYLE_MASK 0xf0 static inline css_error set_border_top_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BORDER_TOP_STYLE_INDEX]; /* 4bits: type */ *bits = (*bits & ~BORDER_TOP_STYLE_MASK) | ((type & 0xf) << BORDER_TOP_STYLE_SHIFT); return CSS_OK; } #undef BORDER_TOP_STYLE_MASK #undef BORDER_TOP_STYLE_SHIFT #undef BORDER_TOP_STYLE_INDEX #define BORDER_RIGHT_STYLE_INDEX 29 #define BORDER_RIGHT_STYLE_SHIFT 0 #define BORDER_RIGHT_STYLE_MASK 0xf static inline css_error set_border_right_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BORDER_RIGHT_STYLE_INDEX]; /* 4bits: type */ *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | ((type & 0xf) << BORDER_RIGHT_STYLE_SHIFT); return CSS_OK; } #undef BORDER_RIGHT_STYLE_MASK #undef BORDER_RIGHT_STYLE_SHIFT #undef BORDER_RIGHT_STYLE_INDEX #define BORDER_BOTTOM_STYLE_INDEX 30 #define BORDER_BOTTOM_STYLE_SHIFT 4 #define BORDER_BOTTOM_STYLE_MASK 0xf0 static inline css_error set_border_bottom_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BORDER_BOTTOM_STYLE_INDEX]; /* 4bits: type */ *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | ((type & 0xf) << BORDER_BOTTOM_STYLE_SHIFT); return CSS_OK; } #undef BORDER_BOTTOM_STYLE_MASK #undef BORDER_BOTTOM_STYLE_SHIFT #undef BORDER_BOTTOM_STYLE_INDEX #define BORDER_LEFT_STYLE_INDEX 30 #define BORDER_LEFT_STYLE_SHIFT 0 #define BORDER_LEFT_STYLE_MASK 0xf static inline css_error set_border_left_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[BORDER_LEFT_STYLE_INDEX]; /* 4bits: type */ *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | ((type & 0xf) << BORDER_LEFT_STYLE_SHIFT); return CSS_OK; } #undef BORDER_LEFT_STYLE_MASK #undef BORDER_LEFT_STYLE_SHIFT #undef BORDER_LEFT_STYLE_INDEX #define FONT_WEIGHT_INDEX 31 #define FONT_WEIGHT_SHIFT 4 #define FONT_WEIGHT_MASK 0xf0 static inline css_error set_font_weight( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[FONT_WEIGHT_INDEX]; /* 4bits: type */ *bits = (*bits & ~FONT_WEIGHT_MASK) | ((type & 0xf) << FONT_WEIGHT_SHIFT); return CSS_OK; } #undef FONT_WEIGHT_MASK #undef FONT_WEIGHT_SHIFT #undef FONT_WEIGHT_INDEX #define LIST_STYLE_TYPE_INDEX 31 #define LIST_STYLE_TYPE_SHIFT 0 #define LIST_STYLE_TYPE_MASK 0xf static inline css_error set_list_style_type( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[LIST_STYLE_TYPE_INDEX]; /* 4bits: type */ *bits = (*bits & ~LIST_STYLE_TYPE_MASK) | ((type & 0xf) << LIST_STYLE_TYPE_SHIFT); return CSS_OK; } #undef LIST_STYLE_TYPE_MASK #undef LIST_STYLE_TYPE_SHIFT #undef LIST_STYLE_TYPE_INDEX #define OUTLINE_STYLE_INDEX 32 #define OUTLINE_STYLE_SHIFT 4 #define OUTLINE_STYLE_MASK 0xf0 static inline css_error set_outline_style( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[OUTLINE_STYLE_INDEX]; /* 4bits: type */ *bits = (*bits & ~OUTLINE_STYLE_MASK) | ((type & 0xf) << OUTLINE_STYLE_SHIFT); return CSS_OK; } #undef OUTLINE_STYLE_MASK #undef OUTLINE_STYLE_SHIFT #undef OUTLINE_STYLE_INDEX #define TABLE_LAYOUT_INDEX 32 #define TABLE_LAYOUT_SHIFT 2 #define TABLE_LAYOUT_MASK 0xc static inline css_error set_table_layout( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[TABLE_LAYOUT_INDEX]; /* 2bits: type */ *bits = (*bits & ~TABLE_LAYOUT_MASK) | ((type & 0x3) << TABLE_LAYOUT_SHIFT); return CSS_OK; } #undef TABLE_LAYOUT_MASK #undef TABLE_LAYOUT_SHIFT #undef TABLE_LAYOUT_INDEX #define UNICODE_BIDI_INDEX 32 #define UNICODE_BIDI_SHIFT 0 #define UNICODE_BIDI_MASK 0x3 static inline css_error set_unicode_bidi( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[UNICODE_BIDI_INDEX]; /* 2bits: type */ *bits = (*bits & ~UNICODE_BIDI_MASK) | ((type & 0x3) << UNICODE_BIDI_SHIFT); return CSS_OK; } #undef UNICODE_BIDI_MASK #undef UNICODE_BIDI_SHIFT #undef UNICODE_BIDI_INDEX #define VISIBILITY_INDEX 33 #define VISIBILITY_SHIFT 6 #define VISIBILITY_MASK 0xc0 static inline css_error set_visibility( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[VISIBILITY_INDEX]; /* 2bits: type */ *bits = (*bits & ~VISIBILITY_MASK) | ((type & 0x3) << VISIBILITY_SHIFT); return CSS_OK; } #undef VISIBILITY_MASK #undef VISIBILITY_SHIFT #undef VISIBILITY_INDEX #define LIST_STYLE_POSITION_INDEX 33 #define LIST_STYLE_POSITION_SHIFT 4 #define LIST_STYLE_POSITION_MASK 0x30 static inline css_error set_list_style_position( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[LIST_STYLE_POSITION_INDEX]; /* 2bits: type */ *bits = (*bits & ~LIST_STYLE_POSITION_MASK) | ((type & 0x3) << LIST_STYLE_POSITION_SHIFT); return CSS_OK; } #undef LIST_STYLE_POSITION_MASK #undef LIST_STYLE_POSITION_SHIFT #undef LIST_STYLE_POSITION_INDEX #define TEXT_ALIGN_INDEX 33 #define TEXT_ALIGN_SHIFT 0 #define TEXT_ALIGN_MASK 0xf static inline uint8_t set_text_align( css_computed_style *style, uint8_t type) { uint8_t *bits = &style->bits[TEXT_ALIGN_INDEX]; /* 4bits: type */ *bits = (*bits & ~TEXT_ALIGN_MASK) | ((type & 0xf) << TEXT_ALIGN_SHIFT); return CSS_OK; } #undef TEXT_ALIGN_MASK #undef TEXT_ALIGN_SHIFT #undef TEXT_ALIGN_INDEX #define PAGE_BREAK_AFTER_INDEX 0 #define PAGE_BREAK_AFTER_SHIFT 0 #define PAGE_BREAK_AFTER_MASK 0x7 static inline css_error set_page_break_after( css_computed_style *style, uint8_t type) { uint8_t *bits; if (style->page == NULL) { if (type == CSS_PAGE_BREAK_AFTER_AUTO) { return CSS_OK; } } ENSURE_PAGE; bits = &style->page->bits[PAGE_BREAK_AFTER_INDEX]; /* 3bits: type */ *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | ((type & 0x7) << PAGE_BREAK_AFTER_SHIFT); return CSS_OK; } #undef PAGE_BREAK_AFTER_INDEX #undef PAGE_BREAK_AFTER_SHIFT #undef PAGE_BREAK_AFTER_MASK #define PAGE_BREAK_BEFORE_INDEX 0 #define PAGE_BREAK_BEFORE_SHIFT 3 #define PAGE_BREAK_BEFORE_MASK 0x38 static inline css_error set_page_break_before( css_computed_style *style, uint8_t type) { uint8_t *bits; if (style->page == NULL) { if (type == CSS_PAGE_BREAK_BEFORE_AUTO) { return CSS_OK; } } ENSURE_PAGE; bits = &style->page->bits[PAGE_BREAK_BEFORE_INDEX]; /* 3bits: type */ *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | ((type & 0x7) << PAGE_BREAK_BEFORE_SHIFT); return CSS_OK; } #undef PAGE_BREAK_BEFORE_INDEX #undef PAGE_BREAK_BEFORE_SHIFT #undef PAGE_BREAK_BEFORE_MASK #define PAGE_BREAK_INSIDE_INDEX 0 #define PAGE_BREAK_INSIDE_SHIFT 6 #define PAGE_BREAK_INSIDE_MASK 0xc0 static inline css_error set_page_break_inside( css_computed_style *style, uint8_t type) { uint8_t *bits; if (style->page == NULL) { if (type == CSS_PAGE_BREAK_INSIDE_AUTO) { return CSS_OK; } } ENSURE_PAGE; bits = &style->page->bits[PAGE_BREAK_INSIDE_INDEX]; /* 2bits: type */ *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | ((type & 0x3) << PAGE_BREAK_INSIDE_SHIFT); return CSS_OK; } #undef PAGE_BREAK_INSIDE_INDEX #undef PAGE_BREAK_INSIDE_SHIFT #undef PAGE_BREAK_INSIDE_MASK #define ORPHANS_INDEX 1 #define ORPHANS_SHIFT 0 #define ORPHANS_MASK 0x1 static inline css_error set_orphans( css_computed_style *style, uint8_t type, int32_t count) { uint8_t *bits; if (style->page == NULL) { if (type == CSS_ORPHANS_SET && count == 2) { return CSS_OK; } } ENSURE_PAGE; bits = &style->page->bits[ORPHANS_INDEX]; /* 1bit: type */ *bits = (*bits & ~ORPHANS_MASK) | ((type & 0x1) << ORPHANS_SHIFT); style->page->orphans = count; return CSS_OK; } #undef ORPHANS_INDEX #undef ORPHANS_SHIFT #undef ORPHANS_MASK #define WIDOWS_INDEX 1 #define WIDOWS_SHIFT 1 #define WIDOWS_MASK 0x2 static inline css_error set_widows( css_computed_style *style, uint8_t type, int32_t count) { uint8_t *bits; if (style->page == NULL) { if (type == CSS_WIDOWS_SET && count == 2) { return CSS_OK; } } ENSURE_PAGE; bits = &style->page->bits[WIDOWS_INDEX]; /* 1bit: type */ *bits = (*bits & ~WIDOWS_MASK) | ((type & 0x1) << WIDOWS_SHIFT); style->page->widows = count; return CSS_OK; } #undef WIDOWS_INDEX #undef WIDOWS_SHIFT #undef WIDOWS_MASK #endif netsurf-all-3.2/libcss/src/select/dispatch.c0000644000175000017500000001576012377676736020135 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include "select/dispatch.h" #include "select/properties/properties.h" /** * Dispatch table for properties, indexed by opcode */ #define PROPERTY_FUNCS(pname) \ css__cascade_##pname, \ css__set_##pname##_from_hint, \ css__initial_##pname, \ css__compose_##pname struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { { PROPERTY_FUNCS(azimuth), 1, GROUP_AURAL }, { PROPERTY_FUNCS(background_attachment), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(background_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(background_image), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(background_position), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(background_repeat), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_collapse), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(border_spacing), 1, GROUP_UNCOMMON }, { PROPERTY_FUNCS(border_top_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_right_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_bottom_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_left_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_top_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_right_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_bottom_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_left_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_top_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_right_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_bottom_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(border_left_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(bottom), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(caption_side), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(clear), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(clip), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(color), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(content), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(counter_increment), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(counter_reset), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(cue_after), 0, GROUP_AURAL }, { PROPERTY_FUNCS(cue_before), 0, GROUP_AURAL }, { PROPERTY_FUNCS(cursor), 1, GROUP_UNCOMMON }, { PROPERTY_FUNCS(direction), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(display), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(elevation), 1, GROUP_AURAL }, { PROPERTY_FUNCS(empty_cells), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(float), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(font_family), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(font_size), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(font_style), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(font_variant), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(font_weight), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(height), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(left), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(letter_spacing), 1, GROUP_UNCOMMON }, { PROPERTY_FUNCS(line_height), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(list_style_image), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(list_style_position), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(list_style_type), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(margin_top), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(margin_right), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(margin_bottom), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(margin_left), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(max_height), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(max_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(min_height), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(min_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(orphans), 1, GROUP_PAGE }, { PROPERTY_FUNCS(outline_color), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(outline_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(outline_width), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(overflow_x), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(padding_top), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(padding_right), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(padding_bottom), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(padding_left), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(page_break_after), 0, GROUP_PAGE }, { PROPERTY_FUNCS(page_break_before), 0, GROUP_PAGE }, { PROPERTY_FUNCS(page_break_inside), 1, GROUP_PAGE }, { PROPERTY_FUNCS(pause_after), 0, GROUP_AURAL }, { PROPERTY_FUNCS(pause_before), 0, GROUP_AURAL }, { PROPERTY_FUNCS(pitch_range), 1, GROUP_AURAL }, { PROPERTY_FUNCS(pitch), 1, GROUP_AURAL }, { PROPERTY_FUNCS(play_during), 0, GROUP_AURAL }, { PROPERTY_FUNCS(position), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(quotes), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(richness), 1, GROUP_AURAL }, { PROPERTY_FUNCS(right), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(speak_header), 1, GROUP_AURAL }, { PROPERTY_FUNCS(speak_numeral), 1, GROUP_AURAL }, { PROPERTY_FUNCS(speak_punctuation), 1, GROUP_AURAL }, { PROPERTY_FUNCS(speak), 1, GROUP_AURAL }, { PROPERTY_FUNCS(speech_rate), 1, GROUP_AURAL }, { PROPERTY_FUNCS(stress), 1, GROUP_AURAL }, { PROPERTY_FUNCS(table_layout), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(text_align), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(text_decoration), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(text_indent), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(text_transform), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(top), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(unicode_bidi), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(vertical_align), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(visibility), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(voice_family), 1, GROUP_AURAL }, { PROPERTY_FUNCS(volume), 1, GROUP_AURAL }, { PROPERTY_FUNCS(white_space), 1, GROUP_NORMAL }, { PROPERTY_FUNCS(widows), 1, GROUP_PAGE }, { PROPERTY_FUNCS(width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(word_spacing), 1, GROUP_UNCOMMON }, { PROPERTY_FUNCS(z_index), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(opacity), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(break_after), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(break_before), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(break_inside), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_count), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_fill), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_gap), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_rule_color), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_rule_style), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_rule_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_span), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(column_width), 0, GROUP_NORMAL }, { PROPERTY_FUNCS(writing_mode), 0, GROUP_UNCOMMON }, { PROPERTY_FUNCS(overflow_y), 0, GROUP_NORMAL } }; netsurf-all-3.2/libcss/src/select/hash.h0000644000175000017500000000433212377676736017257 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_hash_h_ #define css_select_hash_h_ #include #include #include #include "select/bloom.h" /* Ugh. We need this to avoid circular includes. Happy! */ struct css_selector; typedef struct css_selector_hash css_selector_hash; struct css_hash_selection_requirments { css_qname qname; /* Element name, or universal "*" */ lwc_string *class; /* Name of class, or NULL */ lwc_string *id; /* Name of id, or NULL */ lwc_string *uni; /* Universal element string "*" */ uint64_t media; /* Media type(s) we're selecting for */ const css_bloom *node_bloom; /* Node's bloom filter */ }; typedef css_error (*css_selector_hash_iterator)( const struct css_hash_selection_requirments *req, const struct css_selector **current, const struct css_selector ***next); css_error css__selector_hash_create(css_selector_hash **hash); css_error css__selector_hash_destroy(css_selector_hash *hash); css_error css__selector_hash_insert(css_selector_hash *hash, const struct css_selector *selector); css_error css__selector_hash_remove(css_selector_hash *hash, const struct css_selector *selector); css_error css__selector_hash_find(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const struct css_selector ***matched); css_error css__selector_hash_find_by_class(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const struct css_selector ***matched); css_error css__selector_hash_find_by_id(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const struct css_selector ***matched); css_error css__selector_hash_find_universal(css_selector_hash *hash, const struct css_hash_selection_requirments *req, css_selector_hash_iterator *iterator, const struct css_selector ***matched); css_error css__selector_hash_size(css_selector_hash *hash, size_t *size); #endif netsurf-all-3.2/libcss/src/select/dispatch.h0000644000175000017500000000176612377676736020143 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef css_select_dispatch_h_ #define css_select_dispatch_h_ #include #include #include #include "stylesheet.h" #include "bytecode/bytecode.h" #include "select/select.h" /** * Enumeration of property groups */ enum prop_group { GROUP_NORMAL = 0x0, GROUP_UNCOMMON = 0x1, GROUP_PAGE = 0x2, GROUP_AURAL = 0x3 }; extern struct prop_table { css_error (*cascade)(uint32_t opv, css_style *style, css_select_state *state); css_error (*set_from_hint)(const css_hint *hint, css_computed_style *style); css_error (*initial)(css_select_state *state); css_error (*compose)(const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); unsigned int inherited; unsigned int group; } prop_dispatch[CSS_N_PROPERTIES]; #endif netsurf-all-3.2/libcss/src/select/select.c0000644000175000017500000020004212377676736017602 0ustar vincevince/* * This file is part of LibCSS * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #include #include #include #include #include "bytecode/bytecode.h" #include "bytecode/opcodes.h" #include "stylesheet.h" #include "select/computed.h" #include "select/dispatch.h" #include "select/hash.h" #include "select/propset.h" #include "select/font_face.h" #include "select/select.h" #include "utils/parserutilserror.h" #include "utils/utils.h" /* Define this to enable verbose messages when matching selector chains */ #undef DEBUG_CHAIN_MATCHING /** * Container for stylesheet selection info */ typedef struct css_select_sheet { const css_stylesheet *sheet; /**< Stylesheet */ css_origin origin; /**< Stylesheet origin */ uint64_t media; /**< Applicable media */ } css_select_sheet; /** * CSS selection context */ struct css_select_ctx { uint32_t n_sheets; /**< Number of sheets */ css_select_sheet *sheets; /**< Array of sheets */ void *pw; /**< Client's private selection context */ /* Useful interned strings */ lwc_string *universal; lwc_string *first_child; lwc_string *link; lwc_string *visited; lwc_string *hover; lwc_string *active; lwc_string *focus; lwc_string *nth_child; lwc_string *nth_last_child; lwc_string *nth_of_type; lwc_string *nth_last_of_type; lwc_string *last_child; lwc_string *first_of_type; lwc_string *last_of_type; lwc_string *only_child; lwc_string *only_of_type; lwc_string *root; lwc_string *empty; lwc_string *target; lwc_string *lang; lwc_string *enabled; lwc_string *disabled; lwc_string *checked; lwc_string *first_line; lwc_string *first_letter; lwc_string *before; lwc_string *after; }; /** * Container for selected font faces */ typedef struct css_select_font_faces_list { const css_font_face **font_faces; size_t count; } css_select_font_faces_list; /** * Font face selection state */ typedef struct css_select_font_faces_state { lwc_string *font_family; uint64_t media; css_select_font_faces_list ua_font_faces; css_select_font_faces_list user_font_faces; css_select_font_faces_list author_font_faces; } css_select_font_faces_state; /** * CSS rule source */ typedef struct css_select_rule_source { enum { CSS_SELECT_RULE_SRC_ELEMENT, CSS_SELECT_RULE_SRC_CLASS, CSS_SELECT_RULE_SRC_ID, CSS_SELECT_RULE_SRC_UNIVERSAL } source; uint32_t class; } css_select_rule_source; static css_error set_hint(css_select_state *state, uint32_t prop); static css_error set_initial(css_select_state *state, uint32_t prop, css_pseudo_element pseudo, void *parent); static css_error intern_strings(css_select_ctx *ctx); static void destroy_strings(css_select_ctx *ctx); static css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_origin origin, css_select_state *state); static css_error match_selectors_in_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_select_state *state); static css_error match_selector_chain(css_select_ctx *ctx, const css_selector *selector, css_select_state *state); static css_error match_named_combinator(css_select_ctx *ctx, css_combinator type, const css_selector *selector, css_select_state *state, void *node, void **next_node); static css_error match_universal_combinator(css_select_ctx *ctx, css_combinator type, const css_selector *selector, css_select_state *state, void *node, bool may_optimise, bool *rejected_by_cache, void **next_node); static css_error match_details(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match, css_pseudo_element *pseudo_element); static css_error match_detail(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match, css_pseudo_element *pseudo_element); static css_error cascade_style(const css_style *style, css_select_state *state); static css_error select_font_faces_from_sheet( const css_stylesheet *sheet, css_origin origin, css_select_font_faces_state *state); #ifdef DEBUG_CHAIN_MATCHING static void dump_chain(const css_selector *selector); #endif /* Exported function documented in public select.h header. */ css_error css_libcss_node_data_handler(css_select_handler *handler, css_node_data_action action, void *pw, void *node, void *clone_node, void *libcss_node_data) { css_bloom *bloom = libcss_node_data; css_bloom *clone_bloom = NULL; css_error error; unsigned int i; if (handler == NULL || libcss_node_data == NULL || handler->handler_version != CSS_SELECT_HANDLER_VERSION_1) { return CSS_BADPARM; } switch (action) { case CSS_NODE_DELETED: free(bloom); break; case CSS_NODE_MODIFIED: case CSS_NODE_ANCESTORS_MODIFIED: if (node == NULL) { return CSS_BADPARM; } free(bloom); /* Don't bother rebuilding bloom here, it can be done * when the node is selected for. Just ensure the * client drops its reference to the libcss_node_data. */ error = handler->set_libcss_node_data(pw, node, NULL); if (error != CSS_OK) { return error; } break; case CSS_NODE_CLONED: if (node == NULL || clone_node == NULL) { return CSS_BADPARM; } clone_bloom = malloc(sizeof(css_bloom) * CSS_BLOOM_SIZE); if (clone_bloom == NULL) { return CSS_NOMEM; } for (i = 0; i < CSS_BLOOM_SIZE; i++) { clone_bloom[i] = bloom[i]; } error = handler->set_libcss_node_data(pw, clone_node, clone_bloom); if (error != CSS_OK) { free(clone_bloom); return error; } break; default: return CSS_BADPARM; } return CSS_OK; } /** * Create a selection context * * \param result Pointer to location to receive created context * \return CSS_OK on success, appropriate error otherwise. */ css_error css_select_ctx_create(css_select_ctx **result) { css_select_ctx *c; css_error error; if (result == NULL) return CSS_BADPARM; c = malloc(sizeof(css_select_ctx)); if (c == NULL) return CSS_NOMEM; memset(c, 0, sizeof(css_select_ctx)); error = intern_strings(c); if (error != CSS_OK) { free(c); return error; } *result = c; return CSS_OK; } /** * Destroy a selection context * * \param ctx The context to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_destroy(css_select_ctx *ctx) { if (ctx == NULL) return CSS_BADPARM; destroy_strings(ctx); if (ctx->sheets != NULL) free(ctx->sheets); free(ctx); return CSS_OK; } /** * Append a stylesheet to a selection context * * \param ctx The context to append to * \param sheet The sheet to append * \param origin Origin of the sheet * \param media Media types to which the sheet applies * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_append_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_origin origin, uint64_t media) { if (ctx == NULL || sheet == NULL) return CSS_BADPARM; return css_select_ctx_insert_sheet(ctx, sheet, ctx->n_sheets, origin, media); } /** * Insert a stylesheet into a selection context * * \param ctx The context to insert into * \param sheet Sheet to insert * \param index Index in context to insert sheet * \param origin Origin of the sheet * \param media Media types to which the sheet applies * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_insert_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, uint32_t index, css_origin origin, uint64_t media) { css_select_sheet *temp; if (ctx == NULL || sheet == NULL) return CSS_BADPARM; /* Inline styles cannot be inserted into a selection context */ if (sheet->inline_style) return CSS_INVALID; /* Index must be in the range [0, n_sheets] * The latter being equivalent to append */ if (index > ctx->n_sheets) return CSS_INVALID; temp = realloc(ctx->sheets, (ctx->n_sheets + 1) * sizeof(css_select_sheet)); if (temp == NULL) return CSS_NOMEM; ctx->sheets = temp; if (index < ctx->n_sheets) { memmove(&ctx->sheets[index + 1], &ctx->sheets[index], (ctx->n_sheets - index) * sizeof(css_select_sheet)); } ctx->sheets[index].sheet = sheet; ctx->sheets[index].origin = origin; ctx->sheets[index].media = media; ctx->n_sheets++; return CSS_OK; } /** * Remove a sheet from a selection context * * \param ctx The context to remove from * \param sheet Sheet to remove * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_remove_sheet(css_select_ctx *ctx, const css_stylesheet *sheet) { uint32_t index; if (ctx == NULL || sheet == NULL) return CSS_BADPARM; for (index = 0; index < ctx->n_sheets; index++) { if (ctx->sheets[index].sheet == sheet) break; } if (index == ctx->n_sheets) return CSS_INVALID; memmove(&ctx->sheets[index], &ctx->sheets[index + 1], (ctx->n_sheets - index) * sizeof(css_select_sheet)); ctx->n_sheets--; return CSS_OK; } /** * Count the number of top-level sheets in a selection context * * \param ctx Context to consider * \param count Pointer to location to receive count of sheets * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_count_sheets(css_select_ctx *ctx, uint32_t *count) { if (ctx == NULL || count == NULL) return CSS_BADPARM; *count = ctx->n_sheets; return CSS_OK; } /** * Retrieve a sheet from a selection context * * \param ctx Context to look in * \param index Index in context to look * \param sheet Pointer to location to receive sheet * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_ctx_get_sheet(css_select_ctx *ctx, uint32_t index, const css_stylesheet **sheet) { if (ctx == NULL || sheet == NULL) return CSS_BADPARM; if (index > ctx->n_sheets) return CSS_INVALID; *sheet = ctx->sheets[index].sheet; return CSS_OK; } /** * Select a style for the given node * * \param ctx Selection context to use * \param node Node to select style for * \param bloom Node's bloom filter filled with ancestor tag,id,class * \param media Currently active media types * \param inline_style Corresponding inline style for node, or NULL * \param handler Dispatch table of handler functions * \param pw Client-specific private data for handler functions * \param result Pointer to location to receive result set * \return CSS_OK on success, appropriate error otherwise. * * In computing the style, no reference is made to the parent node's * style. Therefore, the resultant computed style is not ready for * immediate use, as some properties may be marked as inherited. * Use css_computed_style_compose() to obtain a fully computed style. * * This two-step approach to style computation is designed to allow * the client to store the partially computed style and efficiently * update the fully computed style for a node when layout changes. */ css_error css_select_style(css_select_ctx *ctx, void *node, uint64_t media, const css_stylesheet *inline_style, css_select_handler *handler, void *pw, css_select_results **result) { uint32_t i, j; css_error error; css_select_state state; void *parent = NULL; css_bloom *bloom = NULL; css_bloom *parent_bloom = NULL; if (ctx == NULL || node == NULL || result == NULL || handler == NULL || handler->handler_version != CSS_SELECT_HANDLER_VERSION_1) return CSS_BADPARM; /* Set up the selection state */ memset(&state, 0, sizeof(css_select_state)); state.node = node; state.media = media; state.handler = handler; state.pw = pw; state.next_reject = state.reject_cache + (N_ELEMENTS(state.reject_cache) - 1); /* Allocate the result set */ state.results = malloc(sizeof(css_select_results)); if (state.results == NULL) return CSS_NOMEM; for (i = 0; i < CSS_PSEUDO_ELEMENT_COUNT; i++) state.results->styles[i] = NULL; /* Base element style is guaranteed to exist */ error = css_computed_style_create( &state.results->styles[CSS_PSEUDO_ELEMENT_NONE]); if (error != CSS_OK) { free(state.results); return error; } /* Create the node's bloom */ bloom = calloc(sizeof(css_bloom), CSS_BLOOM_SIZE); if (bloom == NULL) { error = CSS_NOMEM; goto cleanup; } error = handler->parent_node(pw, node, &parent); if (error != CSS_OK) goto cleanup; /* Get parent node's bloom filter */ if (parent != NULL) { /* Get parent bloom filter */ /* Hideous casting to avoid warnings on all platforms * we build for. */ error = handler->get_libcss_node_data(pw, parent, (void **) (void *) &state.bloom); if (error != CSS_OK) goto cleanup; /* TODO: * If state.bloom == NULL, build & set parent node's bloom, * and use it as state.bloom. This will speed up the case * where DOM change has caused bloom to get deleted. * For now we fall back to a fully satruated bloom filter, * which is slower but perfectly valid. */ } if (state.bloom == NULL) { /* Need to create parent bloom */ parent_bloom = malloc(sizeof(css_bloom) * CSS_BLOOM_SIZE); if (parent_bloom == NULL) { error = CSS_NOMEM; goto cleanup; } if (parent != NULL) { /* Have to make up fully saturated bloom filter */ for (i = 0; i < CSS_BLOOM_SIZE; i++) { parent_bloom[i] = ~0; } } else { /* Empty bloom filter */ for (i = 0; i < CSS_BLOOM_SIZE; i++) { parent_bloom[i] = 0; } } state.bloom = parent_bloom; } /* Get node's name */ error = handler->node_name(pw, node, &state.element); if (error != CSS_OK) goto cleanup; /* Get node's ID, if any */ error = handler->node_id(pw, node, &state.id); if (error != CSS_OK) goto cleanup; /* Get node's classes, if any */ error = handler->node_classes(pw, node, &state.classes, &state.n_classes); if (error != CSS_OK) goto cleanup; /* Iterate through the top-level stylesheets, selecting styles * from those which apply to our current media requirements and * are not disabled */ for (i = 0; i < ctx->n_sheets; i++) { const css_select_sheet s = ctx->sheets[i]; if ((s.media & media) != 0 && s.sheet->disabled == false) { error = select_from_sheet(ctx, s.sheet, s.origin, &state); if (error != CSS_OK) goto cleanup; } } /* Consider any inline style for the node */ if (inline_style != NULL) { css_rule_selector *sel = (css_rule_selector *) inline_style->rule_list; /* Sanity check style */ if (inline_style->rule_count != 1 || inline_style->rule_list->type != CSS_RULE_SELECTOR || inline_style->rule_list->items != 0) { error = CSS_INVALID; goto cleanup; } /* No bytecode if input was empty or wholly invalid */ if (sel->style != NULL) { /* Inline style applies to base element only */ state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE; state.computed = state.results->styles[ CSS_PSEUDO_ELEMENT_NONE]; error = cascade_style(sel->style, &state); if (error != CSS_OK) goto cleanup; } } /* Take account of presentational hints and fix up any remaining * unset properties. */ /* Base element */ state.current_pseudo = CSS_PSEUDO_ELEMENT_NONE; state.computed = state.results->styles[CSS_PSEUDO_ELEMENT_NONE]; for (i = 0; i < CSS_N_PROPERTIES; i++) { const prop_state *prop = &state.props[i][CSS_PSEUDO_ELEMENT_NONE]; /* Apply presentational hints if the property is unset or * the existing property value did not come from an author * stylesheet or a user sheet using !important. */ if (prop->set == false || (prop->origin != CSS_ORIGIN_AUTHOR && prop->important == false)) { error = set_hint(&state, i); if (error != CSS_OK) goto cleanup; } /* If the property is still unset or it's set to inherit * and we're the root element, then set it to its initial * value. */ if (prop->set == false || (parent == NULL && prop->inherit == true)) { error = set_initial(&state, i, CSS_PSEUDO_ELEMENT_NONE, parent); if (error != CSS_OK) goto cleanup; } } /* Pseudo elements, if any */ for (j = CSS_PSEUDO_ELEMENT_NONE + 1; j < CSS_PSEUDO_ELEMENT_COUNT; j++) { state.current_pseudo = j; state.computed = state.results->styles[j]; /* Skip non-existent pseudo elements */ if (state.computed == NULL) continue; for (i = 0; i < CSS_N_PROPERTIES; i++) { const prop_state *prop = &state.props[i][j]; /* If the property is still unset then set it * to its initial value. */ if (prop->set == false) { error = set_initial(&state, i, j, parent); if (error != CSS_OK) goto cleanup; } } } /* If this is the root element, then we must ensure that all * length values are absolute, display and float are correctly * computed, and the default border-{top,right,bottom,left}-color * is set to the computed value of color. */ if (parent == NULL) { /* Only compute absolute values for the base element */ error = css__compute_absolute_values(NULL, state.results->styles[CSS_PSEUDO_ELEMENT_NONE], handler->compute_font_size, pw); if (error != CSS_OK) goto cleanup; } /* Add node name to bloom */ if (state.element.name->insensitive == NULL) { if (lwc__intern_caseless_string( state.element.name) != lwc_error_ok) { error = CSS_NOMEM; goto cleanup; } } css_bloom_add_hash(bloom, lwc_string_hash_value( state.element.name->insensitive)); /* Add id name to bloom */ if (state.id != NULL) { if (state.id->insensitive == NULL) { if (lwc__intern_caseless_string(state.id) != lwc_error_ok) { error = CSS_NOMEM; goto cleanup; } } css_bloom_add_hash(bloom, lwc_string_hash_value( state.id->insensitive)); } /* Add class names to bloom */ if (state.classes != NULL) { lwc_string *s; for (i = 0; i < state.n_classes; i++) { s = state.classes[i]; if (s->insensitive == NULL) { if (lwc__intern_caseless_string(s) != lwc_error_ok) { error = CSS_NOMEM; goto cleanup; } } css_bloom_add_hash(bloom, lwc_string_hash_value( s->insensitive)); } } /* Merge parent bloom into node bloom */ css_bloom_merge(state.bloom, bloom); /* Set node bloom filter */ error = handler->set_libcss_node_data(pw, node, bloom); if (error != CSS_OK) goto cleanup; bloom = NULL; *result = state.results; error = CSS_OK; cleanup: /* Only clean up the results if there's an error. * If there is no error, we're going to pass ownership of * the results to the client */ if (error != CSS_OK && state.results != NULL) { css_select_results_destroy(state.results); } if (parent_bloom != NULL) { free(parent_bloom); } if (bloom != NULL) { free(bloom); } if (state.classes != NULL) { for (i = 0; i < state.n_classes; i++) lwc_string_unref(state.classes[i]); } if (state.id != NULL) lwc_string_unref(state.id); if (state.element.ns != NULL) lwc_string_unref(state.element.ns); lwc_string_unref(state.element.name); return error; } /** * Destroy a selection result set * * \param results Result set to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_results_destroy(css_select_results *results) { uint32_t i; if (results == NULL) return CSS_BADPARM; for (i = 0; i < CSS_PSEUDO_ELEMENT_COUNT; i++) { if (results->styles[i] != NULL) css_computed_style_destroy(results->styles[i]); } free(results); return CSS_OK; } /** * Search a selection context for defined font faces * * \param ctx Selection context * \param media Currently active media types * \param font_family Font family to search for * \param result Pointer to location to receive result * \return CSS_OK on success, appropriate error otherwise. */ css_error css_select_font_faces(css_select_ctx *ctx, uint64_t media, lwc_string *font_family, css_select_font_faces_results **result) { uint32_t i; css_error error; css_select_font_faces_state state; uint32_t n_font_faces; if (ctx == NULL || font_family == NULL || result == NULL) return CSS_BADPARM; memset(&state, 0, sizeof(css_select_font_faces_state)); state.font_family = font_family; state.media = media; /* Iterate through the top-level stylesheets, selecting font-faces * from those which apply to our current media requirements and * are not disabled */ for (i = 0; i < ctx->n_sheets; i++) { const css_select_sheet s = ctx->sheets[i]; if ((s.media & media) != 0 && s.sheet->disabled == false) { error = select_font_faces_from_sheet(s.sheet, s.origin, &state); if (error != CSS_OK) goto cleanup; } } n_font_faces = state.ua_font_faces.count + state.user_font_faces.count + state.author_font_faces.count; if (n_font_faces > 0) { /* We found some matching faces. Make a results structure with * the font faces in priority order. */ css_select_font_faces_results *results; results = malloc(sizeof(css_select_font_faces_results)); if (results == NULL) { error = CSS_NOMEM; goto cleanup; } results->font_faces = malloc( n_font_faces * sizeof(css_font_face *)); if (results->font_faces == NULL) { free(results); error = CSS_NOMEM; goto cleanup; } results->n_font_faces = n_font_faces; i = 0; if (state.ua_font_faces.count != 0) { memcpy(results->font_faces, state.ua_font_faces.font_faces, sizeof(css_font_face *) * state.ua_font_faces.count); i += state.ua_font_faces.count; } if (state.user_font_faces.count != 0) { memcpy(results->font_faces + i, state.user_font_faces.font_faces, sizeof(css_font_face *) * state.user_font_faces.count); i += state.user_font_faces.count; } if (state.author_font_faces.count != 0) { memcpy(results->font_faces + i, state.author_font_faces.font_faces, sizeof(css_font_face *) * state.author_font_faces.count); } *result = results; } error = CSS_OK; cleanup: if (state.ua_font_faces.count != 0) free(state.ua_font_faces.font_faces); if (state.user_font_faces.count != 0) free(state.user_font_faces.font_faces); if (state.author_font_faces.count != 0) free(state.author_font_faces.font_faces); return error; } /** * Destroy a font-face result set * * \param results Result set to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css_select_font_faces_results_destroy( css_select_font_faces_results *results) { if (results == NULL) return CSS_BADPARM; if (results->font_faces != NULL) { /* Don't destroy the individual css_font_faces, they're owned by their respective sheets */ free(results->font_faces); } free(results); return CSS_OK; } /****************************************************************************** * Selection engine internals below here * ******************************************************************************/ css_error intern_strings(css_select_ctx *ctx) { lwc_error error; /* Universal selector */ error = lwc_intern_string("*", SLEN("*"), &ctx->universal); if (error != lwc_error_ok) return css_error_from_lwc_error(error); /* Pseudo classes */ error = lwc_intern_string( "first-child", SLEN("first-child"), &ctx->first_child); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "link", SLEN("link"), &ctx->link); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "visited", SLEN("visited"), &ctx->visited); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "hover", SLEN("hover"), &ctx->hover); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "active", SLEN("active"), &ctx->active); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "focus", SLEN("focus"), &ctx->focus); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "nth-child", SLEN("nth-child"), &ctx->nth_child); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "nth-last-child", SLEN("nth-last-child"), &ctx->nth_last_child); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "nth-of-type", SLEN("nth-of-type"), &ctx->nth_of_type); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "nth-last-of-type", SLEN("nth-last-of-type"), &ctx->nth_last_of_type); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "last-child", SLEN("last-child"), &ctx->last_child); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "first-of-type", SLEN("first-of-type"), &ctx->first_of_type); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "last-of-type", SLEN("last-of-type"), &ctx->last_of_type); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "only-child", SLEN("only-child"), &ctx->only_child); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "only-of-type", SLEN("only-of-type"), &ctx->only_of_type); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "root", SLEN("root"), &ctx->root); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "empty", SLEN("empty"), &ctx->empty); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "target", SLEN("target"), &ctx->target); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "lang", SLEN("lang"), &ctx->lang); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "enabled", SLEN("enabled"), &ctx->enabled); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "disabled", SLEN("disabled"), &ctx->disabled); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "checked", SLEN("checked"), &ctx->checked); if (error != lwc_error_ok) return css_error_from_lwc_error(error); /* Pseudo elements */ error = lwc_intern_string( "first-line", SLEN("first-line"), &ctx->first_line); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "first_letter", SLEN("first-letter"), &ctx->first_letter); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "before", SLEN("before"), &ctx->before); if (error != lwc_error_ok) return css_error_from_lwc_error(error); error = lwc_intern_string( "after", SLEN("after"), &ctx->after); if (error != lwc_error_ok) return css_error_from_lwc_error(error); return CSS_OK; } void destroy_strings(css_select_ctx *ctx) { if (ctx->universal != NULL) lwc_string_unref(ctx->universal); if (ctx->first_child != NULL) lwc_string_unref(ctx->first_child); if (ctx->link != NULL) lwc_string_unref(ctx->link); if (ctx->visited != NULL) lwc_string_unref(ctx->visited); if (ctx->hover != NULL) lwc_string_unref(ctx->hover); if (ctx->active != NULL) lwc_string_unref(ctx->active); if (ctx->focus != NULL) lwc_string_unref(ctx->focus); if (ctx->nth_child != NULL) lwc_string_unref(ctx->nth_child); if (ctx->nth_last_child != NULL) lwc_string_unref(ctx->nth_last_child); if (ctx->nth_of_type != NULL) lwc_string_unref(ctx->nth_of_type); if (ctx->nth_last_of_type != NULL) lwc_string_unref(ctx->nth_last_of_type); if (ctx->last_child != NULL) lwc_string_unref(ctx->last_child); if (ctx->first_of_type != NULL) lwc_string_unref(ctx->first_of_type); if (ctx->last_of_type != NULL) lwc_string_unref(ctx->last_of_type); if (ctx->only_child != NULL) lwc_string_unref(ctx->only_child); if (ctx->only_of_type != NULL) lwc_string_unref(ctx->only_of_type); if (ctx->root != NULL) lwc_string_unref(ctx->root); if (ctx->empty != NULL) lwc_string_unref(ctx->empty); if (ctx->target != NULL) lwc_string_unref(ctx->target); if (ctx->lang != NULL) lwc_string_unref(ctx->lang); if (ctx->enabled != NULL) lwc_string_unref(ctx->enabled); if (ctx->disabled != NULL) lwc_string_unref(ctx->disabled); if (ctx->checked != NULL) lwc_string_unref(ctx->checked); if (ctx->first_line != NULL) lwc_string_unref(ctx->first_line); if (ctx->first_letter != NULL) lwc_string_unref(ctx->first_letter); if (ctx->before != NULL) lwc_string_unref(ctx->before); if (ctx->after != NULL) lwc_string_unref(ctx->after); } css_error set_hint(css_select_state *state, uint32_t prop) { css_hint hint; css_error error; /* Initialise hint */ memset(&hint, 0, sizeof(css_hint)); /* Retrieve this property's hint from the client */ error = state->handler->node_presentational_hint(state->pw, state->node, prop, &hint); if (error != CSS_OK) return (error == CSS_PROPERTY_NOT_SET) ? CSS_OK : error; /* Hint defined -- set it in the result */ error = prop_dispatch[prop].set_from_hint(&hint, state->computed); if (error != CSS_OK) return error; /* Keep selection state in sync with reality */ state->props[prop][CSS_PSEUDO_ELEMENT_NONE].set = 1; state->props[prop][CSS_PSEUDO_ELEMENT_NONE].specificity = 0; state->props[prop][CSS_PSEUDO_ELEMENT_NONE].origin = CSS_ORIGIN_AUTHOR; state->props[prop][CSS_PSEUDO_ELEMENT_NONE].important = 0; state->props[prop][CSS_PSEUDO_ELEMENT_NONE].inherit = (hint.status == 0); return CSS_OK; } css_error set_initial(css_select_state *state, uint32_t prop, css_pseudo_element pseudo, void *parent) { css_error error; /* Do nothing if this property is inherited (the default state * of a clean computed style is for everything to be set to inherit) * * If the node is tree root and we're dealing with the base element, * everything should be defaulted. */ if (prop_dispatch[prop].inherited == false || (pseudo == CSS_PSEUDO_ELEMENT_NONE && parent == NULL)) { enum prop_group group = prop_dispatch[prop].group; /* Remaining properties are neither inherited nor * already set. Thus, we set them to their initial * values here. Except, however, if the property in * question resides in one of the extension blocks and * the extension block has yet to be allocated. In that * case, we do nothing and leave it to the property * accessors to return the initial values for the * property. */ if (group == GROUP_NORMAL) { error = prop_dispatch[prop].initial(state); if (error != CSS_OK) return error; } else if (group == GROUP_UNCOMMON && state->computed->uncommon != NULL) { error = prop_dispatch[prop].initial(state); if (error != CSS_OK) return error; } else if (group == GROUP_PAGE && state->computed->page != NULL) { error = prop_dispatch[prop].initial(state); if (error != CSS_OK) return error; } else if (group == GROUP_AURAL && state->computed->aural != NULL) { error = prop_dispatch[prop].initial(state); if (error != CSS_OK) return error; } } return CSS_OK; } #define IMPORT_STACK_SIZE 256 css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_origin origin, css_select_state *state) { const css_stylesheet *s = sheet; const css_rule *rule = s->rule_list; uint32_t sp = 0; const css_rule *import_stack[IMPORT_STACK_SIZE]; do { /* Find first non-charset rule, if we're at the list head */ if (rule == s->rule_list) { while (rule != NULL && rule->type == CSS_RULE_CHARSET) rule = rule->next; } if (rule != NULL && rule->type == CSS_RULE_IMPORT) { /* Current rule is an import */ const css_rule_import *import = (const css_rule_import *) rule; if (import->sheet != NULL && (import->media & state->media) != 0) { /* It's applicable, so process it */ if (sp >= IMPORT_STACK_SIZE) return CSS_NOMEM; import_stack[sp++] = rule; s = import->sheet; rule = s->rule_list; } else { /* Not applicable; skip over it */ rule = rule->next; } } else { /* Gone past import rules in this sheet */ css_error error; /* Process this sheet */ state->sheet = s; state->current_origin = origin; error = match_selectors_in_sheet(ctx, s, state); if (error != CSS_OK) return error; /* Find next sheet to process */ if (sp > 0) { sp--; rule = import_stack[sp]->next; s = import_stack[sp]->parent; } else { s = NULL; } } } while (s != NULL); return CSS_OK; } static inline bool _rule_applies_to_media(const css_rule *rule, uint64_t media) { bool applies = true; const css_rule *ancestor = rule; while (ancestor != NULL) { const css_rule_media *m = (const css_rule_media *) ancestor; if (ancestor->type == CSS_RULE_MEDIA && (m->media & media) == 0) { applies = false; break; } if (ancestor->ptype != CSS_RULE_PARENT_STYLESHEET) ancestor = ancestor->parent; else ancestor = NULL; } return applies; } static css_error _select_font_face_from_rule( const css_rule_font_face *rule, css_origin origin, css_select_font_faces_state *state) { if (_rule_applies_to_media((const css_rule *) rule, state->media)) { bool correct_family = false; if (lwc_string_isequal( rule->font_face->font_family, state->font_family, &correct_family) == lwc_error_ok && correct_family) { css_select_font_faces_list *faces = NULL; const css_font_face **new_faces; uint32_t index; size_t new_size; switch (origin) { case CSS_ORIGIN_UA: faces = &state->ua_font_faces; break; case CSS_ORIGIN_USER: faces = &state->user_font_faces; break; case CSS_ORIGIN_AUTHOR: faces = &state->author_font_faces; break; } index = faces->count++; new_size = faces->count * sizeof(css_font_face *); new_faces = realloc(faces->font_faces, new_size); if (new_faces == NULL) { faces->count = 0; return CSS_NOMEM; } faces->font_faces = new_faces; faces->font_faces[index] = rule->font_face; } } return CSS_OK; } static css_error select_font_faces_from_sheet( const css_stylesheet *sheet, css_origin origin, css_select_font_faces_state *state) { const css_stylesheet *s = sheet; const css_rule *rule = s->rule_list; uint32_t sp = 0; const css_rule *import_stack[IMPORT_STACK_SIZE]; do { /* Find first non-charset rule, if we're at the list head */ if (rule == s->rule_list) { while (rule != NULL && rule->type == CSS_RULE_CHARSET) rule = rule->next; } if (rule != NULL && rule->type == CSS_RULE_IMPORT) { /* Current rule is an import */ const css_rule_import *import = (const css_rule_import *) rule; if (import->sheet != NULL && (import->media & state->media) != 0) { /* It's applicable, so process it */ if (sp >= IMPORT_STACK_SIZE) return CSS_NOMEM; import_stack[sp++] = rule; s = import->sheet; rule = s->rule_list; } else { /* Not applicable; skip over it */ rule = rule->next; } } else if (rule != NULL && rule->type == CSS_RULE_FONT_FACE) { css_error error; error = _select_font_face_from_rule( (const css_rule_font_face *) rule, origin, state); if (error != CSS_OK) return error; rule = rule->next; } else if (rule == NULL) { /* Find next sheet to process */ if (sp > 0) { sp--; rule = import_stack[sp]->next; s = import_stack[sp]->parent; } else { s = NULL; } } else { rule = rule->next; } } while (s != NULL); return CSS_OK; } #undef IMPORT_STACK_SIZE static inline bool _selectors_pending(const css_selector **node, const css_selector **id, const css_selector ***classes, uint32_t n_classes, const css_selector **univ) { bool pending = false; uint32_t i; pending |= *node != NULL; pending |= *id != NULL; pending |= *univ != NULL; if (classes != NULL && n_classes > 0) { for (i = 0; i < n_classes; i++) pending |= *(classes[i]) != NULL; } return pending; } static inline bool _selector_less_specific(const css_selector *ref, const css_selector *cand) { bool result = true; if (cand == NULL) return false; if (ref == NULL) return true; /* Sort by specificity */ if (cand->specificity < ref->specificity) { result = true; } else if (ref->specificity < cand->specificity) { result = false; } else { /* Then by rule index -- earliest wins */ if (cand->rule->index < ref->rule->index) result = true; else result = false; } return result; } static const css_selector *_selector_next(const css_selector **node, const css_selector **id, const css_selector ***classes, uint32_t n_classes, const css_selector **univ, css_select_rule_source *src) { const css_selector *ret = NULL; if (_selector_less_specific(ret, *node)) { ret = *node; src->source = CSS_SELECT_RULE_SRC_ELEMENT; } if (_selector_less_specific(ret, *id)) { ret = *id; src->source = CSS_SELECT_RULE_SRC_ID; } if (_selector_less_specific(ret, *univ)) { ret = *univ; src->source = CSS_SELECT_RULE_SRC_UNIVERSAL; } if (classes != NULL && n_classes > 0) { uint32_t i; for (i = 0; i < n_classes; i++) { if (_selector_less_specific(ret, *(classes[i]))) { ret = *(classes[i]); src->source = CSS_SELECT_RULE_SRC_CLASS; src->class = i; } } } return ret; } css_error match_selectors_in_sheet(css_select_ctx *ctx, const css_stylesheet *sheet, css_select_state *state) { static const css_selector *empty_selector = NULL; const uint32_t n_classes = state->n_classes; uint32_t i = 0; const css_selector **node_selectors = &empty_selector; css_selector_hash_iterator node_iterator; const css_selector **id_selectors = &empty_selector; css_selector_hash_iterator id_iterator; const css_selector ***class_selectors = NULL; css_selector_hash_iterator class_iterator; const css_selector **univ_selectors = &empty_selector; css_selector_hash_iterator univ_iterator; css_select_rule_source src = { CSS_SELECT_RULE_SRC_ELEMENT, 0 }; struct css_hash_selection_requirments req; css_error error; /* Set up general selector chain requirments */ req.media = state->media; req.node_bloom = state->bloom; req.uni = ctx->universal; /* Find hash chain that applies to current node */ req.qname = state->element; error = css__selector_hash_find(sheet->selectors, &req, &node_iterator, &node_selectors); if (error != CSS_OK) goto cleanup; if (state->classes != NULL && n_classes > 0) { /* Find hash chains for node classes */ class_selectors = malloc(n_classes * sizeof(css_selector **)); if (class_selectors == NULL) { error = CSS_NOMEM; goto cleanup; } for (i = 0; i < n_classes; i++) { req.class = state->classes[i]; error = css__selector_hash_find_by_class( sheet->selectors, &req, &class_iterator, &class_selectors[i]); if (error != CSS_OK) goto cleanup; } } if (state->id != NULL) { /* Find hash chain for node ID */ req.id = state->id; error = css__selector_hash_find_by_id(sheet->selectors, &req, &id_iterator, &id_selectors); if (error != CSS_OK) goto cleanup; } /* Find hash chain for universal selector */ error = css__selector_hash_find_universal(sheet->selectors, &req, &univ_iterator, &univ_selectors); if (error != CSS_OK) goto cleanup; /* Process matching selectors, if any */ while (_selectors_pending(node_selectors, id_selectors, class_selectors, n_classes, univ_selectors)) { const css_selector *selector; /* Selectors must be matched in ascending order of specificity * and rule index. (c.f. css__outranks_existing()) * * Pick the least specific/earliest occurring selector. */ selector = _selector_next(node_selectors, id_selectors, class_selectors, n_classes, univ_selectors, &src); /* We know there are selectors pending, so should have a * selector here */ assert(selector != NULL); /* Match and handle the selector chain */ error = match_selector_chain(ctx, selector, state); if (error != CSS_OK) goto cleanup; /* Advance to next selector in whichever chain we extracted * the processed selector from. */ switch (src.source) { case CSS_SELECT_RULE_SRC_ELEMENT: error = node_iterator(&req, node_selectors, &node_selectors); break; case CSS_SELECT_RULE_SRC_ID: error = id_iterator(&req, id_selectors, &id_selectors); break; case CSS_SELECT_RULE_SRC_UNIVERSAL: error = univ_iterator(&req, univ_selectors, &univ_selectors); break; case CSS_SELECT_RULE_SRC_CLASS: req.class = state->classes[src.class]; error = class_iterator(&req, class_selectors[src.class], &class_selectors[src.class]); break; } if (error != CSS_OK) goto cleanup; } error = CSS_OK; cleanup: if (class_selectors != NULL) free(class_selectors); return error; } static void update_reject_cache(css_select_state *state, css_combinator comb, const css_selector *s) { const css_selector_detail *detail = &s->data; const css_selector_detail *next_detail = NULL; if (detail->next) next_detail = detail + 1; if (state->next_reject < state->reject_cache || comb != CSS_COMBINATOR_ANCESTOR || next_detail == NULL || next_detail->next != 0 || (next_detail->type != CSS_SELECTOR_CLASS && next_detail->type != CSS_SELECTOR_ID)) return; /* Insert */ state->next_reject->type = next_detail->type; state->next_reject->value = next_detail->qname.name; state->next_reject--; } css_error match_selector_chain(css_select_ctx *ctx, const css_selector *selector, css_select_state *state) { const css_selector *s = selector; void *node = state->node; const css_selector_detail *detail = &s->data; bool match = false, may_optimise = true; bool rejected_by_cache; css_pseudo_element pseudo; css_error error; #ifdef DEBUG_CHAIN_MATCHING fprintf(stderr, "matching: "); dump_chain(selector); fprintf(stderr, "\n"); #endif /* Match the details of the first selector in the chain. * * Note that pseudo elements will only appear as details of * the first selector in the chain, as the parser will reject * any selector chains containing pseudo elements anywhere * else. */ error = match_details(ctx, node, detail, state, &match, &pseudo); if (error != CSS_OK) return error; /* Details don't match, so reject selector chain */ if (match == false) return CSS_OK; /* Iterate up the selector chain, matching combinators */ do { void *next_node = NULL; /* Consider any combinator on this selector */ if (s->data.comb != CSS_COMBINATOR_NONE && s->combinator->data.qname.name != ctx->universal) { /* Named combinator */ may_optimise &= (s->data.comb == CSS_COMBINATOR_ANCESTOR || s->data.comb == CSS_COMBINATOR_PARENT); error = match_named_combinator(ctx, s->data.comb, s->combinator, state, node, &next_node); if (error != CSS_OK) return error; /* No match for combinator, so reject selector chain */ if (next_node == NULL) return CSS_OK; } else if (s->data.comb != CSS_COMBINATOR_NONE) { /* Universal combinator */ may_optimise &= (s->data.comb == CSS_COMBINATOR_ANCESTOR || s->data.comb == CSS_COMBINATOR_PARENT); error = match_universal_combinator(ctx, s->data.comb, s->combinator, state, node, may_optimise, &rejected_by_cache, &next_node); if (error != CSS_OK) return error; /* No match for combinator, so reject selector chain */ if (next_node == NULL) { if (may_optimise && s == selector && rejected_by_cache == false) { update_reject_cache(state, s->data.comb, s->combinator); } return CSS_OK; } } /* Details matched, so progress to combining selector */ s = s->combinator; node = next_node; } while (s != NULL); /* If we got here, then the entire selector chain matched, so cascade */ state->current_specificity = selector->specificity; /* Ensure that the appropriate computed style exists */ if (state->results->styles[pseudo] == NULL) { error = css_computed_style_create( &state->results->styles[pseudo]); if (error != CSS_OK) return error; } state->current_pseudo = pseudo; state->computed = state->results->styles[pseudo]; return cascade_style(((css_rule_selector *) selector->rule)->style, state); } css_error match_named_combinator(css_select_ctx *ctx, css_combinator type, const css_selector *selector, css_select_state *state, void *node, void **next_node) { const css_selector_detail *detail = &selector->data; void *n = node; css_error error; do { bool match = false; /* Find candidate node */ switch (type) { case CSS_COMBINATOR_ANCESTOR: error = state->handler->named_ancestor_node(state->pw, n, &selector->data.qname, &n); if (error != CSS_OK) return error; break; case CSS_COMBINATOR_PARENT: error = state->handler->named_parent_node(state->pw, n, &selector->data.qname, &n); if (error != CSS_OK) return error; break; case CSS_COMBINATOR_SIBLING: error = state->handler->named_sibling_node(state->pw, n, &selector->data.qname, &n); if (error != CSS_OK) return error; break; case CSS_COMBINATOR_GENERIC_SIBLING: error = state->handler->named_generic_sibling_node( state->pw, n, &selector->data.qname, &n); if (error != CSS_OK) return error; case CSS_COMBINATOR_NONE: break; } if (n != NULL) { /* Match its details */ error = match_details(ctx, n, detail, state, &match, NULL); if (error != CSS_OK) return error; /* If we found a match, use it */ if (match == true) break; /* For parent and sibling selectors, only adjacent * nodes are valid. Thus, if we failed to match, * give up. */ if (type == CSS_COMBINATOR_PARENT || type == CSS_COMBINATOR_SIBLING) n = NULL; } } while (n != NULL); *next_node = n; return CSS_OK; } css_error match_universal_combinator(css_select_ctx *ctx, css_combinator type, const css_selector *selector, css_select_state *state, void *node, bool may_optimise, bool *rejected_by_cache, void **next_node) { const css_selector_detail *detail = &selector->data; const css_selector_detail *next_detail = NULL; void *n = node; css_error error; if (detail->next) next_detail = detail + 1; *rejected_by_cache = false; /* Consult reject cache first */ if (may_optimise && (type == CSS_COMBINATOR_ANCESTOR || type == CSS_COMBINATOR_PARENT) && next_detail != NULL && (next_detail->type == CSS_SELECTOR_CLASS || next_detail->type == CSS_SELECTOR_ID)) { reject_item *reject = state->next_reject + 1; reject_item *last = state->reject_cache + N_ELEMENTS(state->reject_cache) - 1; bool match = false; while (reject <= last) { /* Perform pessimistic matching (may hurt quirks) */ if (reject->type == next_detail->type && lwc_string_isequal(reject->value, next_detail->qname.name, &match) == lwc_error_ok && match) { /* Found it: can't match */ *next_node = NULL; *rejected_by_cache = true; return CSS_OK; } reject++; } } do { bool match = false; /* Find candidate node */ switch (type) { case CSS_COMBINATOR_ANCESTOR: case CSS_COMBINATOR_PARENT: error = state->handler->parent_node(state->pw, n, &n); if (error != CSS_OK) return error; break; case CSS_COMBINATOR_SIBLING: case CSS_COMBINATOR_GENERIC_SIBLING: error = state->handler->sibling_node(state->pw, n, &n); if (error != CSS_OK) return error; break; case CSS_COMBINATOR_NONE: break; } if (n != NULL) { /* Match its details */ error = match_details(ctx, n, detail, state, &match, NULL); if (error != CSS_OK) return error; /* If we found a match, use it */ if (match == true) break; /* For parent and sibling selectors, only adjacent * nodes are valid. Thus, if we failed to match, * give up. */ if (type == CSS_COMBINATOR_PARENT || type == CSS_COMBINATOR_SIBLING) n = NULL; } } while (n != NULL); *next_node = n; return CSS_OK; } css_error match_details(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match, css_pseudo_element *pseudo_element) { css_error error; css_pseudo_element pseudo = CSS_PSEUDO_ELEMENT_NONE; /* Skip the element selector detail, which is always first. * (Named elements are handled by match_named_combinator, so the * element selector detail always matches here.) */ if (detail->next) detail++; else detail = NULL; /* We match by default (if there are no details other than the element * selector, then we must match) */ *match = true; /** \todo Some details are easier to test than others (e.g. dashmatch * actually requires looking at data rather than simply comparing * pointers). Should we consider sorting the detail list such that the * simpler details come first (and thus the expensive match routines * can be avoided unless absolutely necessary)? */ while (detail != NULL) { error = match_detail(ctx, node, detail, state, match, &pseudo); if (error != CSS_OK) return error; /* Detail doesn't match, so reject selector chain */ if (*match == false) return CSS_OK; if (detail->next) detail++; else detail = NULL; } /* Return the applicable pseudo element, if required */ if (pseudo_element != NULL) *pseudo_element = pseudo; return CSS_OK; } static inline bool match_nth(int32_t a, int32_t b, int32_t count) { if (a == 0) { return count == b; } else { const int32_t delta = count - b; /* (count - b) / a is positive or (count - b) is 0 */ if (((delta > 0) == (a > 0)) || delta == 0) { /* (count - b) / a is integer */ return (delta % a == 0); } return false; } } css_error match_detail(css_select_ctx *ctx, void *node, const css_selector_detail *detail, css_select_state *state, bool *match, css_pseudo_element *pseudo_element) { bool is_root = false; css_error error = CSS_OK; switch (detail->type) { case CSS_SELECTOR_ELEMENT: if (detail->negate != 0) { /* Only need to test this inside not(), since * it will have been considered as a named node * otherwise. */ error = state->handler->node_has_name(state->pw, node, &detail->qname, match); } break; case CSS_SELECTOR_CLASS: error = state->handler->node_has_class(state->pw, node, detail->qname.name, match); break; case CSS_SELECTOR_ID: error = state->handler->node_has_id(state->pw, node, detail->qname.name, match); break; case CSS_SELECTOR_PSEUDO_CLASS: error = state->handler->node_is_root(state->pw, node, &is_root); if (error != CSS_OK) return error; if (is_root == false && detail->qname.name == ctx->first_child) { int32_t num_before = 0; error = state->handler->node_count_siblings(state->pw, node, false, false, &num_before); if (error == CSS_OK) *match = (num_before == 0); } else if (is_root == false && detail->qname.name == ctx->nth_child) { int32_t num_before = 0; error = state->handler->node_count_siblings(state->pw, node, false, false, &num_before); if (error == CSS_OK) { int32_t a = detail->value.nth.a; int32_t b = detail->value.nth.b; *match = match_nth(a, b, num_before + 1); } } else if (is_root == false && detail->qname.name == ctx->nth_last_child) { int32_t num_after = 0; error = state->handler->node_count_siblings(state->pw, node, false, true, &num_after); if (error == CSS_OK) { int32_t a = detail->value.nth.a; int32_t b = detail->value.nth.b; *match = match_nth(a, b, num_after + 1); } } else if (is_root == false && detail->qname.name == ctx->nth_of_type) { int32_t num_before = 0; error = state->handler->node_count_siblings(state->pw, node, true, false, &num_before); if (error == CSS_OK) { int32_t a = detail->value.nth.a; int32_t b = detail->value.nth.b; *match = match_nth(a, b, num_before + 1); } } else if (is_root == false && detail->qname.name == ctx->nth_last_of_type) { int32_t num_after = 0; error = state->handler->node_count_siblings(state->pw, node, true, true, &num_after); if (error == CSS_OK) { int32_t a = detail->value.nth.a; int32_t b = detail->value.nth.b; *match = match_nth(a, b, num_after + 1); } } else if (is_root == false && detail->qname.name == ctx->last_child) { int32_t num_after = 0; error = state->handler->node_count_siblings(state->pw, node, false, true, &num_after); if (error == CSS_OK) *match = (num_after == 0); } else if (is_root == false && detail->qname.name == ctx->first_of_type) { int32_t num_before = 0; error = state->handler->node_count_siblings(state->pw, node, true, false, &num_before); if (error == CSS_OK) *match = (num_before == 0); } else if (is_root == false && detail->qname.name == ctx->last_of_type) { int32_t num_after = 0; error = state->handler->node_count_siblings(state->pw, node, true, true, &num_after); if (error == CSS_OK) *match = (num_after == 0); } else if (is_root == false && detail->qname.name == ctx->only_child) { int32_t num_before = 0, num_after = 0; error = state->handler->node_count_siblings(state->pw, node, false, false, &num_before); if (error == CSS_OK) { error = state->handler->node_count_siblings( state->pw, node, false, true, &num_after); if (error == CSS_OK) *match = (num_before == 0) && (num_after == 0); } } else if (is_root == false && detail->qname.name == ctx->only_of_type) { int32_t num_before = 0, num_after = 0; error = state->handler->node_count_siblings(state->pw, node, true, false, &num_before); if (error == CSS_OK) { error = state->handler->node_count_siblings( state->pw, node, true, true, &num_after); if (error == CSS_OK) *match = (num_before == 0) && (num_after == 0); } } else if (detail->qname.name == ctx->root) { *match = is_root; } else if (detail->qname.name == ctx->empty) { error = state->handler->node_is_empty(state->pw, node, match); } else if (detail->qname.name == ctx->link) { error = state->handler->node_is_link(state->pw, node, match); } else if (detail->qname.name == ctx->visited) { error = state->handler->node_is_visited(state->pw, node, match); } else if (detail->qname.name == ctx->hover) { error = state->handler->node_is_hover(state->pw, node, match); } else if (detail->qname.name == ctx->active) { error = state->handler->node_is_active(state->pw, node, match); } else if (detail->qname.name == ctx->focus) { error = state->handler->node_is_focus(state->pw, node, match); } else if (detail->qname.name == ctx->target) { error = state->handler->node_is_target(state->pw, node, match); } else if (detail->qname.name == ctx->lang) { error = state->handler->node_is_lang(state->pw, node, detail->value.string, match); } else if (detail->qname.name == ctx->enabled) { error = state->handler->node_is_enabled(state->pw, node, match); } else if (detail->qname.name == ctx->disabled) { error = state->handler->node_is_disabled(state->pw, node, match); } else if (detail->qname.name == ctx->checked) { error = state->handler->node_is_checked(state->pw, node, match); } else *match = false; break; case CSS_SELECTOR_PSEUDO_ELEMENT: *match = true; if (detail->qname.name == ctx->first_line) { *pseudo_element = CSS_PSEUDO_ELEMENT_FIRST_LINE; } else if (detail->qname.name == ctx->first_letter) { *pseudo_element = CSS_PSEUDO_ELEMENT_FIRST_LETTER; } else if (detail->qname.name == ctx->before) { *pseudo_element = CSS_PSEUDO_ELEMENT_BEFORE; } else if (detail->qname.name == ctx->after) { *pseudo_element = CSS_PSEUDO_ELEMENT_AFTER; } else *match = false; break; case CSS_SELECTOR_ATTRIBUTE: error = state->handler->node_has_attribute(state->pw, node, &detail->qname, match); break; case CSS_SELECTOR_ATTRIBUTE_EQUAL: error = state->handler->node_has_attribute_equal(state->pw, node, &detail->qname, detail->value.string, match); break; case CSS_SELECTOR_ATTRIBUTE_DASHMATCH: error = state->handler->node_has_attribute_dashmatch(state->pw, node, &detail->qname, detail->value.string, match); break; case CSS_SELECTOR_ATTRIBUTE_INCLUDES: error = state->handler->node_has_attribute_includes(state->pw, node, &detail->qname, detail->value.string, match); break; case CSS_SELECTOR_ATTRIBUTE_PREFIX: error = state->handler->node_has_attribute_prefix(state->pw, node, &detail->qname, detail->value.string, match); break; case CSS_SELECTOR_ATTRIBUTE_SUFFIX: error = state->handler->node_has_attribute_suffix(state->pw, node, &detail->qname, detail->value.string, match); break; case CSS_SELECTOR_ATTRIBUTE_SUBSTRING: error = state->handler->node_has_attribute_substring(state->pw, node, &detail->qname, detail->value.string, match); break; } /* Invert match, if the detail requests it */ if (error == CSS_OK && detail->negate != 0) *match = !*match; return error; } css_error cascade_style(const css_style *style, css_select_state *state) { css_style s = *style; while (s.used > 0) { opcode_t op; css_error error; css_code_t opv = *s.bytecode; advance_bytecode(&s, sizeof(opv)); op = getOpcode(opv); error = prop_dispatch[op].cascade(opv, &s, state); if (error != CSS_OK) return error; } return CSS_OK; } bool css__outranks_existing(uint16_t op, bool important, css_select_state *state, bool inherit) { prop_state *existing = &state->props[op][state->current_pseudo]; bool outranks = false; /* Sorting on origin & importance gives the following: * * | UA, - | UA, i | USER, - | USER, i | AUTHOR, - | AUTHOR, i * |---------------------------------------------------------- * UA , - | S S Y Y Y Y * UA , i | S S Y Y Y Y * USER , - | - - S Y Y Y * USER , i | - - - S - - * AUTHOR, - | - - - Y S Y * AUTHOR, i | - - - Y - S * * Where the columns represent the origin/importance of the property * being considered and the rows represent the origin/importance of * the existing property. * * - means that the existing property must be preserved * Y means that the new property must be applied * S means that the specificities of the rules must be considered. * * If specificities are considered, the highest specificity wins. * If specificities are equal, then the rule defined last wins. * * We have no need to explicitly consider the ordering of rules if * the specificities are the same because: * * a) We process stylesheets in order * b) The selector hash chains within a sheet are ordered such that * more specific rules come after less specific ones and, when * specificities are identical, rules defined later occur after * those defined earlier. * * Therefore, where we consider specificity, below, the property * currently being considered will always be applied if its specificity * is greater than or equal to that of the existing property. */ if (existing->set == 0) { /* Property hasn't been set before, new one wins */ outranks = true; } else { assert(CSS_ORIGIN_UA < CSS_ORIGIN_USER); assert(CSS_ORIGIN_USER < CSS_ORIGIN_AUTHOR); if (existing->origin < state->current_origin) { /* New origin has more weight than existing one. * Thus, new property wins, except when the existing * one is USER, i. */ if (existing->important == 0 || existing->origin != CSS_ORIGIN_USER) { outranks = true; } } else if (existing->origin == state->current_origin) { /* Origins are identical, consider importance, except * for UA stylesheets, when specificity is always * considered (as importance is meaningless) */ if (existing->origin == CSS_ORIGIN_UA) { if (state->current_specificity >= existing->specificity) { outranks = true; } } else if (existing->important == 0 && important) { /* New is more important than old. */ outranks = true; } else if (existing->important && important == false) { /* Old is more important than new */ } else { /* Same importance, consider specificity */ if (state->current_specificity >= existing->specificity) { outranks = true; } } } else { /* Existing origin has more weight than new one. * Thus, existing property wins, except when the new * one is USER, i. */ if (state->current_origin == CSS_ORIGIN_USER && important) { outranks = true; } } } if (outranks) { /* The new property is about to replace the old one. * Update our state to reflect this. */ existing->set = 1; existing->specificity = state->current_specificity; existing->origin = state->current_origin; existing->important = important; existing->inherit = inherit; } return outranks; } /****************************************************************************** * Debug helpers * ******************************************************************************/ #ifdef DEBUG_CHAIN_MATCHING void dump_chain(const css_selector *selector) { const css_selector_detail *detail = &selector->data; if (selector->data.comb != CSS_COMBINATOR_NONE) dump_chain(selector->combinator); if (selector->data.comb == CSS_COMBINATOR_ANCESTOR) fprintf(stderr, " "); else if (selector->data.comb == CSS_COMBINATOR_SIBLING) fprintf(stderr, " + "); else if (selector->data.comb == CSS_COMBINATOR_PARENT) fprintf(stderr, " > "); do { switch (detail->type) { case CSS_SELECTOR_ELEMENT: if (lwc_string_length(detail->name) == 1 && lwc_string_data(detail->name)[0] == '*' && detail->next == 1) { break; } fprintf(stderr, "%.*s", (int) lwc_string_length(detail->name), lwc_string_data(detail->name)); break; case CSS_SELECTOR_CLASS: fprintf(stderr, ".%.*s", (int) lwc_string_length(detail->name), lwc_string_data(detail->name)); break; case CSS_SELECTOR_ID: fprintf(stderr, "#%.*s", (int) lwc_string_length(detail->name), lwc_string_data(detail->name)); break; case CSS_SELECTOR_PSEUDO_CLASS: case CSS_SELECTOR_PSEUDO_ELEMENT: fprintf(stderr, ":%.*s", (int) lwc_string_length(detail->name), lwc_string_data(detail->name)); if (detail->value != NULL) { fprintf(stderr, "(%.*s)", (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); } break; case CSS_SELECTOR_ATTRIBUTE: fprintf(stderr, "[%.*s]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name)); break; case CSS_SELECTOR_ATTRIBUTE_EQUAL: fprintf(stderr, "[%.*s=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; case CSS_SELECTOR_ATTRIBUTE_DASHMATCH: fprintf(stderr, "[%.*s|=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; case CSS_SELECTOR_ATTRIBUTE_INCLUDES: fprintf(stderr, "[%.*s~=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; case CSS_SELECTOR_ATTRIBUTE_PREFIX: fprintf(stderr, "[%.*s^=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; case CSS_SELECTOR_ATTRIBUTE_SUFFIX: fprintf(stderr, "[%.*s$=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; case CSS_SELECTOR_ATTRIBUTE_SUBSTRING: fprintf(stderr, "[%.*s*=\"%.*s\"]", (int) lwc_string_length(detail->name), lwc_string_data(detail->name), (int) lwc_string_length(detail->value), lwc_string_data(detail->value)); break; } if (detail->next) detail++; else detail = NULL; } while (detail); } #endif netsurf-all-3.2/libcss/src/lex/0000755000175000017500000000000012377713347015460 5ustar vincevincenetsurf-all-3.2/libcss/src/lex/lex.h0000644000175000017500000000343512377676736016440 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef css_lex_lex_h_ #define css_lex_lex_h_ #include #include #include #include #include typedef struct css_lexer css_lexer; /** * Lexer option types */ typedef enum css_lexer_opttype { CSS_LEXER_EMIT_COMMENTS } css_lexer_opttype; /** * Lexer option parameters */ typedef union css_lexer_optparams { bool emit_comments; } css_lexer_optparams; /** * Token type */ typedef enum css_token_type { CSS_TOKEN_IDENT, CSS_TOKEN_ATKEYWORD, CSS_TOKEN_HASH, CSS_TOKEN_FUNCTION, CSS_TOKEN_STRING, CSS_TOKEN_INVALID_STRING, CSS_TOKEN_URI, CSS_TOKEN_UNICODE_RANGE, CSS_TOKEN_CHAR, CSS_TOKEN_NUMBER, CSS_TOKEN_PERCENTAGE, CSS_TOKEN_DIMENSION, /* Those tokens that want strings interned appear above */ CSS_TOKEN_LAST_INTERN, CSS_TOKEN_CDO, CSS_TOKEN_CDC, CSS_TOKEN_S, CSS_TOKEN_COMMENT, CSS_TOKEN_INCLUDES, CSS_TOKEN_DASHMATCH, CSS_TOKEN_PREFIXMATCH, CSS_TOKEN_SUFFIXMATCH, CSS_TOKEN_SUBSTRINGMATCH, CSS_TOKEN_EOF } css_token_type; /** * Token object */ typedef struct css_token { css_token_type type; struct { uint8_t *data; size_t len; } data; lwc_string *idata; uint32_t col; uint32_t line; } css_token; css_error css__lexer_create(parserutils_inputstream *input, css_lexer **lexer); css_error css__lexer_destroy(css_lexer *lexer); css_error css__lexer_setopt(css_lexer *lexer, css_lexer_opttype type, css_lexer_optparams *params); css_error css__lexer_get_token(css_lexer *lexer, css_token **token); #endif netsurf-all-3.2/libcss/src/lex/lex.c0000644000175000017500000015234412377676736016437 0ustar vincevince/* * This file is part of LibCSS. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ /** \file CSS lexer * * See docs/Tokens for the production rules used by this lexer. * * See docs/Lexer for the inferred first characters for each token. * * See also CSS3 Syntax module and CSS2.1 $4.1.1 + errata * * The lexer assumes that all invalid Unicode codepoints have been converted * to U+FFFD by the input stream. * * The lexer comprises a state machine, the top-level of which is derived from * the First sets in docs/Lexer. Each top-level state may contain a number of * sub states. These enable restarting of the parser. */ #include #include #include #include #include #include #include #include #include "lex/lex.h" #include "utils/parserutilserror.h" #include "utils/utils.h" /** \todo Optimisation -- we're currently revisiting a bunch of input * characters (Currently, we're calling parserutils_inputstream_peek * about 1.5x the number of characters in the input stream). Ideally, * we'll visit each character in the input exactly once. In reality, * the upper bound is twice, due to the need, in some cases, to read * one character beyond the end of a token's input to detect the end * of the token. Resumability adds a little overhead here, unless * we're somewhat more clever when it comes to having support for * restarting mid-escape sequence. Currently, we rewind back to the * start of the sequence and process the whole thing again. */ enum { sSTART = 0, sATKEYWORD = 1, sSTRING = 2, sHASH = 3, sNUMBER = 4, sCDO = 5, sCDC = 6, sS = 7, sCOMMENT = 8, sMATCH = 9, sURI = 10, sIDENT = 11, sESCAPEDIDENT = 12, sURL = 13, sUCR = 14 }; /** * CSS lexer object */ struct css_lexer { parserutils_inputstream *input; /**< Inputstream containing CSS */ size_t bytesReadForToken; /**< Total bytes read from the * inputstream for the current token */ css_token token; /**< The current token */ bool escapeSeen; /**< Whether an escape sequence has * been seen while processing the input * for the current token */ parserutils_buffer *unescapedTokenData; /**< Buffer containing * unescaped token data * (used iff escapeSeen == true) */ unsigned int state : 4, /**< Current state */ substate : 4; /**< Current substate */ struct { uint8_t first; /**< First character read for token */ size_t origBytes; /**< Storage of current number of * bytes read, for rewinding */ bool lastWasStar; /**< Whether the previous character * was an asterisk */ bool lastWasCR; /**< Whether the previous character * was CR */ size_t bytesForURL; /**< Input bytes read for "url(", for * rewinding */ size_t dataLenForURL; /**< Output length for "url(", for * rewinding */ int hexCount; /**< Counter for reading hex digits */ } context; /**< Context for the current state */ bool emit_comments; /**< Whether to emit comment tokens */ uint32_t currentCol; /**< Current column in source */ uint32_t currentLine; /**< Current line in source */ }; #define APPEND(lexer, data, len) \ do { \ css_error error; \ error = appendToTokenData((lexer), \ (const uint8_t *) (data), (len)); \ if (error != CSS_OK) \ return error; \ (lexer)->bytesReadForToken += (len); \ (lexer)->currentCol += (len); \ } while(0) \ static css_error appendToTokenData(css_lexer *lexer, const uint8_t *data, size_t len); static css_error emitToken(css_lexer *lexer, css_token_type type, css_token **token); static css_error AtKeyword(css_lexer *lexer, css_token **token); static css_error CDCOrIdentOrFunctionOrNPD(css_lexer *lexer, css_token **token); static css_error CDO(css_lexer *lexer, css_token **token); static css_error Comment(css_lexer *lexer, css_token **token); static css_error EscapedIdentOrFunction(css_lexer *lexer, css_token **token); static css_error Hash(css_lexer *lexer, css_token **token); static css_error IdentOrFunction(css_lexer *lexer, css_token **token); static css_error Match(css_lexer *lexer, css_token **token); static css_error NumberOrPercentageOrDimension(css_lexer *lexer, css_token **token); static css_error S(css_lexer *lexer, css_token **token); static css_error Start(css_lexer *lexer, css_token **token); static css_error String(css_lexer *lexer, css_token **token); static css_error URIOrUnicodeRangeOrIdentOrFunction( css_lexer *lexer, css_token **token); static css_error URI(css_lexer *lexer, css_token **token); static css_error UnicodeRange(css_lexer *lexer, css_token **token); static css_error consumeDigits(css_lexer *lexer); static css_error consumeEscape(css_lexer *lexer, bool nl); static css_error consumeNMChars(css_lexer *lexer); static css_error consumeString(css_lexer *lexer); static css_error consumeStringChars(css_lexer *lexer); static css_error consumeUnicode(css_lexer *lexer, uint32_t ucs); static css_error consumeURLChars(css_lexer *lexer); static css_error consumeWChars(css_lexer *lexer); static inline bool startNMChar(uint8_t c); static inline bool startNMStart(uint8_t c); static inline bool startStringChar(uint8_t c); static inline bool startURLChar(uint8_t c); static inline bool isSpace(uint8_t c); /** * Create a lexer instance * * \param input The inputstream to read from * \param lexer Pointer to location to receive lexer instance * \return CSS_OK on success, * CSS_BADPARM on bad parameters, * CSS_NOMEM on memory exhaustion */ css_error css__lexer_create(parserutils_inputstream *input, css_lexer **lexer) { css_lexer *lex; if (input == NULL || lexer == NULL) return CSS_BADPARM; lex = malloc(sizeof(css_lexer)); if (lex == NULL) return CSS_NOMEM; lex->input = input; lex->bytesReadForToken = 0; lex->token.type = CSS_TOKEN_EOF; lex->token.data.data = NULL; lex->token.data.len = 0; lex->escapeSeen = false; lex->unescapedTokenData = NULL; lex->state = sSTART; lex->substate = 0; lex->emit_comments = false; lex->currentCol = 1; lex->currentLine = 1; *lexer = lex; return CSS_OK; } /** * Destroy a lexer instance * * \param lexer The instance to destroy * \return CSS_OK on success, appropriate error otherwise */ css_error css__lexer_destroy(css_lexer *lexer) { if (lexer == NULL) return CSS_BADPARM; if (lexer->unescapedTokenData != NULL) parserutils_buffer_destroy(lexer->unescapedTokenData); free(lexer); return CSS_OK; } /** * Configure a lexer instance * * \param lexer The lexer to configure * \param type The option type to modify * \param params Option-specific parameters * \return CSS_OK on success, appropriate error otherwise */ css_error css__lexer_setopt(css_lexer *lexer, css_lexer_opttype type, css_lexer_optparams *params) { if (lexer == NULL || params == NULL) return CSS_BADPARM; switch (type) { case CSS_LEXER_EMIT_COMMENTS: lexer->emit_comments = params->emit_comments; break; default: return CSS_BADPARM; } return CSS_OK; } /** * Retrieve a token from a lexer * * \param lexer The lexer instance to read from * \param token Pointer to location to receive pointer to token * \return CSS_OK on success, appropriate error otherwise * * The returned token object is owned by the lexer. However, the client is * permitted to modify the data members of the token. The token must not be * freed by the client (it may not have been allocated in the first place), * nor may any of the pointers contained within it. The client may, if they * wish, overwrite any data member of the returned token object -- the lexer * does not depend on these remaining constant. This allows the client code * to efficiently implement a push-back buffer with interned string data. */ css_error css__lexer_get_token(css_lexer *lexer, css_token **token) { css_error error; if (lexer == NULL || token == NULL) return CSS_BADPARM; switch (lexer->state) { case sSTART: start: return Start(lexer, token); case sATKEYWORD: return AtKeyword(lexer, token); case sSTRING: return String(lexer, token); case sHASH: return Hash(lexer, token); case sNUMBER: return NumberOrPercentageOrDimension(lexer, token); case sCDO: return CDO(lexer, token); case sCDC: return CDCOrIdentOrFunctionOrNPD(lexer, token); case sS: return S(lexer, token); case sCOMMENT: error = Comment(lexer, token); if (!lexer->emit_comments && error == CSS_OK && (*token)->type == CSS_TOKEN_COMMENT) goto start; return error; case sMATCH: return Match(lexer, token); case sURI: return URI(lexer, token); case sIDENT: return IdentOrFunction(lexer, token); case sESCAPEDIDENT: return EscapedIdentOrFunction(lexer, token); case sURL: return URI(lexer, token); case sUCR: return UnicodeRange(lexer, token); } /* Should never be reached */ assert(0); return CSS_OK; } /****************************************************************************** * Utility routines * ******************************************************************************/ /** * Append some data to the current token * * \param lexer The lexer instance * \param data Pointer to data to append * \param len Length, in bytes, of data * \return CSS_OK on success, appropriate error otherwise * * This should not be called directly without good reason. Use the APPEND() * macro instead. */ css_error appendToTokenData(css_lexer *lexer, const uint8_t *data, size_t len) { css_token *token = &lexer->token; if (lexer->escapeSeen) { css_error error = css_error_from_parserutils_error( parserutils_buffer_append( lexer->unescapedTokenData, data, len)); if (error != CSS_OK) return error; } token->data.len += len; return CSS_OK; } /** * Prepare a token for consumption and emit it to the client * * \param lexer The lexer instance * \param type The type of token to emit * \param token Pointer to location to receive pointer to token * \return CSS_OK on success, appropriate error otherwise */ css_error emitToken(css_lexer *lexer, css_token_type type, css_token **token) { css_token *t = &lexer->token; t->type = type; /* Calculate token data start pointer. We have to do this here as * the inputstream's buffer may have moved under us. */ if (lexer->escapeSeen) { t->data.data = lexer->unescapedTokenData->data; } else { size_t clen; const uint8_t *data; parserutils_error error; error = parserutils_inputstream_peek(lexer->input, 0, &data, &clen); #ifndef NDEBUG assert(type == CSS_TOKEN_EOF || error == PARSERUTILS_OK); #else (void) error; #endif t->data.data = (type == CSS_TOKEN_EOF) ? NULL : (uint8_t *) data; } switch (type) { case CSS_TOKEN_ATKEYWORD: /* Strip the '@' from the front */ t->data.data += 1; t->data.len -= 1; break; case CSS_TOKEN_STRING: /* Strip the leading quote */ t->data.data += 1; t->data.len -= 1; /* Strip the trailing quote, iff it exists (may have hit EOF) */ if (t->data.len > 0 && (t->data.data[t->data.len - 1] == '"' || t->data.data[t->data.len - 1] == '\'')) { t->data.len -= 1; } break; case CSS_TOKEN_INVALID_STRING: /* Strip the leading quote */ t->data.data += 1; t->data.len -= 1; break; case CSS_TOKEN_HASH: /* Strip the '#' from the front */ t->data.data += 1; t->data.len -= 1; break; case CSS_TOKEN_PERCENTAGE: /* Strip the '%' from the end */ t->data.len -= 1; break; case CSS_TOKEN_DIMENSION: break; case CSS_TOKEN_URI: /* Strip the "url(" from the start */ t->data.data += SLEN("url("); t->data.len -= SLEN("url("); /* Strip any leading whitespace */ while (isSpace(t->data.data[0])) { t->data.data++; t->data.len--; } /* Strip any leading quote */ if (t->data.data[0] == '"' || t->data.data[0] == '\'') { t->data.data += 1; t->data.len -= 1; } /* Strip the trailing ')' */ t->data.len -= 1; /* Strip any trailing whitespace */ while (t->data.len > 0 && isSpace(t->data.data[t->data.len - 1])) { t->data.len--; } /* Strip any trailing quote */ if (t->data.len > 0 && (t->data.data[t->data.len - 1] == '"' || t->data.data[t->data.len - 1] == '\'')) { t->data.len -= 1; } break; case CSS_TOKEN_UNICODE_RANGE: /* Remove "U+" from the start */ t->data.data += SLEN("U+"); t->data.len -= SLEN("U+"); break; case CSS_TOKEN_COMMENT: /* Strip the leading '/' and '*' */ t->data.data += SLEN("/*"); t->data.len -= SLEN("/*"); /* Strip the trailing '*' and '/' */ t->data.len -= SLEN("*/"); break; case CSS_TOKEN_FUNCTION: /* Strip the trailing '(' */ t->data.len -= 1; break; default: break; } *token = t; /* Reset the lexer's state */ lexer->state = sSTART; lexer->substate = 0; return CSS_OK; } /****************************************************************************** * State machine components * ******************************************************************************/ css_error AtKeyword(css_lexer *lexer, css_token **token) { const uint8_t *cptr; uint8_t c; size_t clen; css_error error; parserutils_error perror; enum { Initial = 0, Escape = 1, NMChar = 2 }; /* ATKEYWORD = '@' ident * * The '@' has been consumed. */ switch (lexer->substate) { case Initial: perror = parserutils_inputstream_peek(lexer->input, lexer->bytesReadForToken, &cptr, &clen); if (perror != PARSERUTILS_OK && perror != PARSERUTILS_EOF) return css_error_from_parserutils_error(perror); if (perror == PARSERUTILS_EOF) return emitToken(lexer, CSS_TOKEN_CHAR, token); c = *cptr; if (!startNMStart(c)) return emitToken(lexer, CSS_TOKEN_CHAR, token); if (c != '\\') { APPEND(lexer, cptr, clen); } else { lexer->bytesReadForToken += clen; goto escape; } /* Fall through */ case NMChar: nmchar: lexer->substate = NMChar; error = consumeNMChars(lexer); if (error != CSS_OK) return error; break; case Escape: escape: lexer->substate = Escape; error = consumeEscape(lexer, false); if (error != CSS_OK) { if (error == CSS_EOF || error == CSS_INVALID) { /* Rewind the '\\' */ lexer->bytesReadForToken -= 1; return emitToken(lexer, CSS_TOKEN_CHAR, token); } return error; } goto nmchar; } return emitToken(lexer, CSS_TOKEN_ATKEYWORD, token); } css_error CDCOrIdentOrFunctionOrNPD(css_lexer *lexer, css_token **token) { css_token *t = &lexer->token; const uint8_t *cptr; uint8_t c; size_t clen; css_error error; parserutils_error perror; enum { Initial = 0, Escape = 1, Gt = 2 }; /* CDC = "-->" * IDENT = [-]? nmstart nmchar* * FUNCTION = [-]? nmstart nmchar* '(' * NUMBER = num = [-+]? ([0-9]+ | [0-9]* '.' [0-9]+) * PERCENTAGE = num '%' * DIMENSION = num ident * * The first dash has been consumed. Thus, we must consume the next * character in the stream. If it's a dash, then we're dealing with * CDC. If it's a digit or dot, then we're dealing with NPD. * Otherwise, we're dealing with IDENT/FUNCTION. */ switch (lexer->substate) { case Initial: perror = parserutils_inputstream_peek(lexer->input, lexer->bytesReadForToken, &cptr, &clen); if (perror != PARSERUTILS_OK && perror != PARSERUTILS_EOF) return css_error_from_parserutils_error(perror); if (perror == PARSERUTILS_EOF) { /* We can only match char with what we've read so far */ return emitToken(lexer, CSS_TOKEN_CHAR, token); } c = *cptr; if (isDigit(c) || c == '.') { /* NPD */ APPEND(lexer, cptr, clen); lexer->state = sNUMBER; lexer->substate = 0; /* Abuse "first" to store first non-sign character */ lexer->context.first = c; return NumberOrPercentageOrDimension(lexer, token); } if (c != '-' && !startNMStart(c)) { /* Can only be CHAR */ return emitToken(lexer, CSS_TOKEN_CHAR, token); } if (c != '\\') { APPEND(lexer, cptr, clen); } if (c != '-') { if (c == '\\') { lexer->bytesReadForToken += clen; goto escape; } lexer->state = sIDENT; lexer->substate = 0; return IdentOrFunction(lexer, token); } /* Fall through */ case Gt: lexer->substate = Gt; /* Ok, so we're dealing with CDC. Expect a '>' */ perror = parserutils_inputstream_peek(lexer->input, lexer->bytesReadForToken, &cptr, &clen); if (perror != PARSERUTILS_OK && perror != PARSERUTILS_EOF) return css_error_from_parserutils_error(perror); if (perror == PARSERUTILS_EOF) { /* CHAR is the only match here */ /* Remove the '-' we read above */ lexer->bytesReadForToken -= 1; t->data.len -= 1; return emitToken(lexer, CSS_TOKEN_CHAR, token); } c = *cptr; if (c == '>') { APPEND(lexer, cptr, clen); t->type = CSS_TOKEN_CDC; } else { /* Remove the '-' we read above */ lexer->bytesReadForToken -= 1; t->data.len -= 1; t->type = CSS_TOKEN_CHAR; } break; case Escape: escape: lexer->substate = Escape; error = consumeEscape(lexer, false); if (error != CSS_OK) { if (error == CSS_EOF || error == CSS_INVALID) { /* Rewind the '\\' */ lexer->bytesReadForToken -= 1; return emitToken(lexer, CSS_TOKEN_CHAR, token); } return error; } lexer->state = sIDENT; lexer->substate = 0; return IdentOrFunction(lexer, token); } return emitToken(lexer, t->type, token); } css_error CDO(css_lexer *lexer, css_token **token) { css_token *t = &lexer->token; const uint8_t *cptr; uint8_t c; size_t clen; parserutils_error perror; enum { Initial = 0, Dash1 = 1, Dash2 = 2 }; /* CDO = " Glyph width : x1 - x0 * | | | Glyph height : y1 - y0 * | +-----+-------- y0 Right side bearing: aX - x1 * | * * The rectangle (x0,y0),(x1,y1) is the glyph bounding box. * * Glyph Metrics for vertical text: * * -------o---------> * y1--+--|--+ Xbearing : x0 - oX * | | | Ybearing : oY - y1 * | | | Xadvance : 0 * | | | Yadvance : aY - oY * | | | Glyph width : x1 - x0 * y0--+-----+ Glyph height : y1 - y0 * ------a----------- Right side bearing: N/A * x0 v x1 * * The rectangle (x0,y0),(x1,y1) is the glyph bounding box. * * * In order to extract the information we want from the * Font Manager, a little bit of hackery is required. * * Firstly, we can take the origin as being (0,0). This is an * arbitrary choice but makes the maths simpler. * * Secondly, the bounding box returned by Font_CharBBox / * Font_ScanString / Font_StringBBox represents the ink area of * the glyph (i.e. the smallest box needed to contain all the * glyph path segments). This means that, for glyphs with no * displayed content (such as a space), the bounding box will be 0. * These SWIs therefore allow us to retrieve the (x0,y0),(x1,y1) * coordinates marked in the diagrams above. * * Finally, we need to retrieve the glyph advance distance. This is * returned in R3/R4 on exit from Font_ScanString (providing bit 17 * of the flags word on entry is clear). It is important to note, * however, that the height will be returned as 0 for fonts with no * Yadvance values in the font data file. Therefore, in order to * achieve vertical layout of text, further work will be needed * (We're also ignoring the fact that the X coordinates of all * values will be in the wrong place and the Y coordinates will have * the wrong sign due to the differing definitions of the Y axis for * horizontal and vertical text.) * * Note that all values (that we're interested in, at least) * returned by the SWIs mentioned above are in _millipoints_. */ block.space.x = block.space.y = 0; block.letter.x = block.letter.y = 0; block.split_char = -1; flags = font_GIVEN_BLOCK | font_GIVEN_LENGTH | font_GIVEN_FONT | font_RETURN_BBOX; u1[0] = (unsigned short)u; u1[1] = 0; if (font1 == rufl_CACHE_CORPUS) { /* Fallback Glyph */ /** \todo implement this properly */ xa = 1000 * font_size; ya = 0; block.bbox.x0 = block.bbox.y0 = 0; block.bbox.x1 = block.bbox.y1 = xa; } else if (rufl_old_font_manager) { /* Old Font Manager */ char s[2]; /* We found the correct umap entry when * looking for the font encoding */ s[0] = umap_entry->c; s[1] = 0; rufl_fm_error = xfont_scan_string(f, s, flags, 0x7fffffff, 0x7fffffff, &block, 0, 1, 0, &xa, &ya, 0); if (rufl_fm_error) { LOG("xfont_scan_string: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); return rufl_FONT_MANAGER_ERROR; } } else { /* UCS Font Manager */ rufl_fm_error = xfont_scan_string(f, (const char *)u1, flags | font_GIVEN16_BIT, 0x7fffffff, 0x7fffffff, &block, 0, 2, 0, &xa, &ya, 0); if (rufl_fm_error) { LOG("xfont_scan_string: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); return rufl_FONT_MANAGER_ERROR; } } /** \todo handle vertical text */ if (x_bearing) (*x_bearing) = block.bbox.x0; if (y_bearing) (*y_bearing) = block.bbox.y1; if (width) (*width) = block.bbox.x1 - block.bbox.x0; if (height) (*height) = block.bbox.y1 - block.bbox.y0; if (x_advance) (*x_advance) = xa; if (y_advance) (*y_advance) = ya; return rufl_OK; } int rufl_unicode_map_search_cmp(const void *keyval, const void *datum) { const unsigned short *key = keyval; const struct rufl_unicode_map_entry *entry = datum; if (*key < entry->u) return -1; else if (entry->u < *key) return 1; return 0; } netsurf-all-3.2/librufl/src/rufl_find.c0000644000175000017500000001154012377676764017200 0ustar vincevince/* * This file is part of RUfl * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license * Copyright 2005 James Bursa * Copyright 2005 John-Mark Bell */ #include #include #include #include #include #include "rufl_internal.h" static int rufl_family_list_cmp(const void *keyval, const void *datum); static rufl_code rufl_place_in_cache(unsigned int font, unsigned int font_size, const char *encoding, font_f f); /** * Find a font family. */ rufl_code rufl_find_font_family(const char *font_family, rufl_style font_style, unsigned int *font, unsigned int *slanted, struct rufl_character_set **charset) { const char **family; unsigned int f; unsigned int weight, slant, used_weight; unsigned int search_direction; family = bsearch(font_family, rufl_family_list, rufl_family_list_entries, sizeof rufl_family_list[0], rufl_family_list_cmp); if (!family) return rufl_FONT_NOT_FOUND; weight = (font_style & 0xf) - 1; assert(weight <= 8); slant = font_style & rufl_SLANTED ? 1 : 0; struct rufl_family_map_entry *e = &rufl_family_map[family - rufl_family_list]; used_weight = weight; if (weight <= 2) search_direction = -1; else search_direction = +1; while (1) { if (e->font[used_weight][slant] != NO_FONT) { /* the weight and slant is available */ f = e->font[used_weight][slant]; break; } if (e->font[used_weight][1 - slant] != NO_FONT) { /* slanted, and non-slanted weight exists, or vv. */ f = e->font[used_weight][1 - slant]; break; } if (used_weight == 0) { /* searched down without finding a weight: search up */ used_weight = weight + 1; search_direction = +1; } else if (used_weight == 8) { /* searched up without finding a weight: search down */ used_weight = weight - 1; search_direction = -1; } else { /* try the next weight in the current direction */ used_weight += search_direction; } } if (font) (*font) = f; if (slanted) (*slanted) = slant; if (charset) (*charset) = rufl_font_list[f].charset; return rufl_OK; } /** * Find a sized font, placing in the cache if necessary. */ rufl_code rufl_find_font(unsigned int font, unsigned int font_size, const char *encoding, font_f *fhandle) { font_f f; char font_name[80]; unsigned int i; rufl_code code; assert(fhandle != NULL); for (i = 0; i != rufl_CACHE_SIZE; i++) { /* Comparing pointers for the encoding is fine, as the * encoding string passed to us is either: * * a) NULL * or b) statically allocated * or c) resides in the font's umap, which is constant * for the lifetime of the application. */ if (rufl_cache[i].font == font && rufl_cache[i].size == font_size && rufl_cache[i].encoding == encoding) break; } if (i != rufl_CACHE_SIZE) { /* found in cache */ f = rufl_cache[i].f; rufl_cache[i].last_used = rufl_cache_time++; } else { /* not found */ if (font == rufl_CACHE_CORPUS) { if (encoding) snprintf(font_name, sizeof font_name, "Corpus.Medium\\E%s", encoding); else snprintf(font_name, sizeof font_name, "Corpus.Medium"); } else { if (encoding) snprintf(font_name, sizeof font_name, "%s\\E%s", rufl_font_list[font].identifier, encoding); else snprintf(font_name, sizeof font_name, "%s", rufl_font_list[font].identifier); } rufl_fm_error = xfont_find_font(font_name, font_size, font_size, 0, 0, &f, 0, 0); if (rufl_fm_error) { LOG("xfont_find_font: 0x%x: %s", rufl_fm_error->errnum, rufl_fm_error->errmess); return rufl_FONT_MANAGER_ERROR; } /* place in cache */ code = rufl_place_in_cache(font, font_size, encoding, f); if (code != rufl_OK) return code; } (*fhandle) = f; return rufl_OK; } int rufl_family_list_cmp(const void *keyval, const void *datum) { const char *key = keyval; const char * const *entry = datum; return strcasecmp(key, *entry); } /** * Place a font into the recent-use cache, making space if necessary. */ rufl_code rufl_place_in_cache(unsigned int font, unsigned int font_size, const char *encoding, font_f f) { unsigned int i; unsigned int max_age = 0; unsigned int evict = 0; for (i = 0; i != rufl_CACHE_SIZE; i++) { if (rufl_cache[i].font == rufl_CACHE_NONE) { evict = i; break; } else if (max_age < rufl_cache_time - rufl_cache[i].last_used) { max_age = rufl_cache_time - rufl_cache[i].last_used; evict = i; } } if (rufl_cache[evict].font != rufl_CACHE_NONE) { rufl_fm_error = xfont_lose_font(rufl_cache[evict].f); if (rufl_fm_error) return rufl_FONT_MANAGER_ERROR; } rufl_cache[evict].font = font; rufl_cache[evict].size = font_size; rufl_cache[evict].encoding = encoding; rufl_cache[evict].f = f; rufl_cache[evict].last_used = rufl_cache_time++; return rufl_OK; } netsurf-all-3.2/librufl/Makefile0000644000175000017500000000240512377676764015735 0ustar vincevince# Component settings COMPONENT := rufl COMPONENT_VERSION := 0.0.3 # Default to a static library COMPONENT_TYPE ?= lib-static # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER := $(ECHO) # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -pedantic # BeOS/Haiku/AmigaOS4 standard library headers create warnings ifneq ($(TARGET),beos) ifneq ($(TARGET),AmigaOS) WARNFLAGS := $(WARNFLAGS) -Werror endif endif CFLAGS := -I$(CURDIR)/include/ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif # OSLib ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) ifeq ($(TARGET),riscos) CFLAGS := $(CFLAGS) -I$(PREFIX)/include LDFLAGS := $(LDFLAGS) -lOSLib32 endif endif include $(NSBUILD)/Makefile.top # Extra installation rules I := /include INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/rufl.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) netsurf-all-3.2/librufl/tools/0000755000175000017500000000000012377713350015413 5ustar vincevincenetsurf-all-3.2/librufl/tools/makeglyphs0000755000175000017500000000123112377676764017523 0ustar vincevince#!/usr/bin/perl -W %name = (); print "#include \n"; print "#include \"rufl_internal.h\"\n"; print "const struct rufl_glyph_map_entry rufl_glyph_map[] = {\n"; print "\t{\" \", 0}, /* sentinel */\n"; while (<>) { if (/^([0-9A-F]{4});([a-zA-Z0-9]+);/) { $name{"$1:$2"} = 1; } } @glyph = (); while (($un, ) = each %name) { ($u, $n) = split ':', $un; push @glyph, [$n, $u]; } foreach $z (sort {$$a[0] cmp $$b[0] or $$a[1] cmp $$b[1]} @glyph) { print "\t{\"$$z[0]\", 0x$$z[1]},\n"; } print "\t{\"~\", 0} /* sentinel */\n"; print "};\n"; print "const size_t rufl_glyph_map_size = sizeof rufl_glyph_map /\n"; print " sizeof rufl_glyph_map[0];\n"; netsurf-all-3.2/libparserutils/0000755000175000017500000000000012377713347015666 5ustar vincevincenetsurf-all-3.2/libparserutils/docs/0000755000175000017500000000000012377713347016616 5ustar vincevincenetsurf-all-3.2/libparserutils/docs/Todo0000644000175000017500000000012412377676760017452 0ustar vincevinceTodo list --------- + Charset conversion should use Unicode Normalisation Form C. netsurf-all-3.2/libparserutils/include/0000755000175000017500000000000012377713347017311 5ustar vincevincenetsurf-all-3.2/libparserutils/include/parserutils/0000755000175000017500000000000012377713347021666 5ustar vincevincenetsurf-all-3.2/libparserutils/include/parserutils/parserutils.h0000644000175000017500000000071212377676760024423 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_parserutils_h_ #define parserutils_parserutils_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/charset/0000755000175000017500000000000012377713347023317 5ustar vincevincenetsurf-all-3.2/libparserutils/include/parserutils/charset/mibenum.h0000644000175000017500000000153312377676760025135 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_charset_mibenum_h_ #define parserutils_charset_mibenum_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include /* Convert an encoding alias to a MIB enum value */ uint16_t parserutils_charset_mibenum_from_name(const char *alias, size_t len); /* Convert a MIB enum value into an encoding alias */ const char *parserutils_charset_mibenum_to_name(uint16_t mibenum); /* Determine if a MIB enum value represents a Unicode variant */ bool parserutils_charset_mibenum_is_unicode(uint16_t mibenum); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/charset/codec.h0000644000175000017500000000734012377676760024560 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_charset_codec_h_ #define parserutils_charset_codec_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include typedef struct parserutils_charset_codec parserutils_charset_codec; #define PARSERUTILS_CHARSET_CODEC_NULL (0xffffffffU) /** * Charset codec error mode * * A codec's error mode determines its behaviour in the face of: * * + characters which are unrepresentable in the destination charset (if * encoding data) or which cannot be converted to UCS-4 (if decoding data). * + invalid byte sequences (both encoding and decoding) * * The options provide a choice between the following approaches: * * + draconian, "stop processing" ("strict") * + "replace the unrepresentable character with something else" ("loose") * + "attempt to transliterate, or replace if unable" ("translit") * * The default error mode is "loose". * * * In the "loose" case, the replacement character will depend upon: * * + Whether the operation was encoding or decoding * + If encoding, what the destination charset is. * * If decoding, the replacement character will be: * * U+FFFD (REPLACEMENT CHARACTER) * * If encoding, the replacement character will be: * * U+003F (QUESTION MARK) if the destination charset is not UTF-(8|16|32) * U+FFFD (REPLACEMENT CHARACTER) otherwise. * * * In the "translit" case, the codec will attempt to transliterate into * the destination charset, if encoding. If decoding, or if transliteration * fails, this option is identical to "loose". */ typedef enum parserutils_charset_codec_errormode { /** Abort processing if unrepresentable character encountered */ PARSERUTILS_CHARSET_CODEC_ERROR_STRICT = 0, /** Replace unrepresentable characters with single alternate */ PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE = 1, /** Transliterate unrepresentable characters, if possible */ PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT = 2 } parserutils_charset_codec_errormode; /** * Charset codec option types */ typedef enum parserutils_charset_codec_opttype { /** Set codec error mode */ PARSERUTILS_CHARSET_CODEC_ERROR_MODE = 1 } parserutils_charset_codec_opttype; /** * Charset codec option parameters */ typedef union parserutils_charset_codec_optparams { /** Parameters for error mode setting */ struct { /** The desired error handling mode */ parserutils_charset_codec_errormode mode; } error_mode; } parserutils_charset_codec_optparams; /* Create a charset codec */ parserutils_error parserutils_charset_codec_create(const char *charset, parserutils_charset_codec **codec); /* Destroy a charset codec */ parserutils_error parserutils_charset_codec_destroy( parserutils_charset_codec *codec); /* Configure a charset codec */ parserutils_error parserutils_charset_codec_setopt( parserutils_charset_codec *codec, parserutils_charset_codec_opttype type, parserutils_charset_codec_optparams *params); /* Encode a chunk of UCS-4 data into a codec's charset */ parserutils_error parserutils_charset_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); /* Decode a chunk of data in a codec's charset into UCS-4 */ parserutils_error parserutils_charset_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); /* Reset a charset codec */ parserutils_error parserutils_charset_codec_reset( parserutils_charset_codec *codec); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/charset/utf16.h0000644000175000017500000000232712377676760024450 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ /** \file * UTF-16 manipulation functions (interface). */ #ifndef parserutils_charset_utf16_h_ #define parserutils_charset_utf16_h_ #ifdef __cplusplus extern "C" { #endif #include #include parserutils_error parserutils_charset_utf16_to_ucs4(const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen); parserutils_error parserutils_charset_utf16_from_ucs4(uint32_t ucs4, uint8_t *s, size_t *len); parserutils_error parserutils_charset_utf16_length(const uint8_t *s, size_t max, size_t *len); parserutils_error parserutils_charset_utf16_char_byte_length(const uint8_t *s, size_t *len); parserutils_error parserutils_charset_utf16_prev(const uint8_t *s, uint32_t off, uint32_t *prevoff); parserutils_error parserutils_charset_utf16_next(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff); parserutils_error parserutils_charset_utf16_next_paranoid(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/charset/utf8.h0000644000175000017500000000231212377676760024363 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ /** \file * UTF-8 manipulation functions (interface). */ #ifndef parserutils_charset_utf8_h_ #define parserutils_charset_utf8_h_ #ifdef __cplusplus extern "C" { #endif #include #include parserutils_error parserutils_charset_utf8_to_ucs4(const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen); parserutils_error parserutils_charset_utf8_from_ucs4(uint32_t ucs4, uint8_t **s, size_t *len); parserutils_error parserutils_charset_utf8_length(const uint8_t *s, size_t max, size_t *len); parserutils_error parserutils_charset_utf8_char_byte_length(const uint8_t *s, size_t *len); parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off, uint32_t *prevoff); parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff); parserutils_error parserutils_charset_utf8_next_paranoid(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/errors.h0000644000175000017500000000167212377676760023370 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_errors_h_ #define parserutils_errors_h_ #ifdef __cplusplus extern "C" { #endif #include typedef enum parserutils_error { PARSERUTILS_OK = 0, PARSERUTILS_NOMEM = 1, PARSERUTILS_BADPARM = 2, PARSERUTILS_INVALID = 3, PARSERUTILS_FILENOTFOUND = 4, PARSERUTILS_NEEDDATA = 5, PARSERUTILS_BADENCODING = 6, PARSERUTILS_EOF = 7 } parserutils_error; /* Convert a parserutils error value to a string */ const char *parserutils_error_to_string(parserutils_error error); /* Convert a string to a parserutils error value */ parserutils_error parserutils_error_from_string(const char *str, size_t len); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/utils/0000755000175000017500000000000012377713347023026 5ustar vincevincenetsurf-all-3.2/libparserutils/include/parserutils/utils/buffer.h0000644000175000017500000000226212377676760024461 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef parserutils_utils_buffer_h_ #define parserutils_utils_buffer_h_ #ifdef __cplusplus extern "C" { #endif #include #include struct parserutils_buffer { uint8_t *data; size_t length; size_t allocated; }; typedef struct parserutils_buffer parserutils_buffer; parserutils_error parserutils_buffer_create(parserutils_buffer **buffer); parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer); parserutils_error parserutils_buffer_append(parserutils_buffer *buffer, const uint8_t *data, size_t len); parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer, size_t offset, const uint8_t *data, size_t len); parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer, size_t offset, size_t len); parserutils_error parserutils_buffer_grow(parserutils_buffer *buffer); parserutils_error parserutils_buffer_randomise(parserutils_buffer *buffer); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/utils/stack.h0000644000175000017500000000165612377676760024323 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef parserutils_utils_stack_h_ #define parserutils_utils_stack_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include struct parserutils_stack; typedef struct parserutils_stack parserutils_stack; parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size, parserutils_stack **stack); parserutils_error parserutils_stack_destroy(parserutils_stack *stack); parserutils_error parserutils_stack_push(parserutils_stack *stack, const void *item); parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item); void *parserutils_stack_get_current(parserutils_stack *stack); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/utils/vector.h0000644000175000017500000000231712377676760024513 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef parserutils_utils_vector_h_ #define parserutils_utils_vector_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include struct parserutils_vector; typedef struct parserutils_vector parserutils_vector; parserutils_error parserutils_vector_create(size_t item_size, size_t chunk_size, parserutils_vector **vector); parserutils_error parserutils_vector_destroy(parserutils_vector *vector); parserutils_error parserutils_vector_append(parserutils_vector *vector, void *item); parserutils_error parserutils_vector_clear(parserutils_vector *vector); parserutils_error parserutils_vector_remove_last(parserutils_vector *vector); parserutils_error parserutils_vector_get_length(parserutils_vector *vector, size_t *length); const void *parserutils_vector_iterate(const parserutils_vector *vector, int32_t *ctx); const void *parserutils_vector_peek(const parserutils_vector *vector, int32_t ctx); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/input/0000755000175000017500000000000012377713347023025 5ustar vincevincenetsurf-all-3.2/libparserutils/include/parserutils/input/inputstream.h0000644000175000017500000001220212377676760025555 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_input_inputstream_h_ #define parserutils_input_inputstream_h_ #ifdef __cplusplus extern "C" { #endif #include #ifndef NDEBUG #include #endif #include #include #include #include #include #include #include /** * Type of charset detection function */ typedef parserutils_error (*parserutils_charset_detect_func)( const uint8_t *data, size_t len, uint16_t *mibenum, uint32_t *source); /** * Input stream object */ typedef struct parserutils_inputstream { parserutils_buffer *utf8; /**< Buffer containing UTF-8 data */ uint32_t cursor; /**< Byte offset of current position */ bool had_eof; /**< Whether EOF has been reached */ } parserutils_inputstream; /* Create an input stream */ parserutils_error parserutils_inputstream_create(const char *enc, uint32_t encsrc, parserutils_charset_detect_func csdetect, parserutils_inputstream **stream); /* Destroy an input stream */ parserutils_error parserutils_inputstream_destroy( parserutils_inputstream *stream); /* Append data to an input stream */ parserutils_error parserutils_inputstream_append( parserutils_inputstream *stream, const uint8_t *data, size_t len); /* Insert data into stream at current location */ parserutils_error parserutils_inputstream_insert( parserutils_inputstream *stream, const uint8_t *data, size_t len); /* Slow form of css_inputstream_peek. */ parserutils_error parserutils_inputstream_peek_slow( parserutils_inputstream *stream, size_t offset, const uint8_t **ptr, size_t *length); /** * Look at the character in the stream that starts at * offset bytes from the cursor * * \param stream Stream to look in * \param offset Byte offset of start of character * \param ptr Pointer to location to receive pointer to character data * \param length Pointer to location to receive character length (in bytes) * \return PARSERUTILS_OK on success, * _NEEDDATA on reaching the end of available input, * _EOF on reaching the end of all input, * _BADENCODING if the input cannot be decoded, * _NOMEM on memory exhaustion, * _BADPARM if bad parameters are passed. * * Once the character pointed to by the result of this call has been advanced * past (i.e. parserutils_inputstream_advance has caused the stream cursor to * pass over the character), then no guarantee is made as to the validity of * the data pointed to. Thus, any attempt to dereference the pointer after * advancing past the data it points to is a bug. */ static inline parserutils_error parserutils_inputstream_peek( parserutils_inputstream *stream, size_t offset, const uint8_t **ptr, size_t *length) { parserutils_error error = PARSERUTILS_OK; const parserutils_buffer *utf8; const uint8_t *utf8_data; size_t len, off, utf8_len; if (stream == NULL || ptr == NULL || length == NULL) return PARSERUTILS_BADPARM; #ifndef NDEBUG #ifdef VERBOSE_INPUTSTREAM fprintf(stdout, "Peek: len: %zu cur: %u off: %zu\n", stream->utf8->length, stream->cursor, offset); #endif #ifdef RANDOMISE_INPUTSTREAM parserutils_buffer_randomise(stream->utf8); #endif #endif utf8 = stream->utf8; utf8_data = utf8->data; utf8_len = utf8->length; off = stream->cursor + offset; #define IS_ASCII(x) (((x) & 0x80) == 0) if (off < utf8_len) { if (IS_ASCII(utf8_data[off])) { /* Early exit for ASCII case */ (*length) = 1; (*ptr) = (utf8_data + off); return PARSERUTILS_OK; } else { error = parserutils_charset_utf8_char_byte_length( utf8_data + off, &len); if (error == PARSERUTILS_OK) { (*length) = len; (*ptr) = (utf8_data + off); return PARSERUTILS_OK; } else if (error != PARSERUTILS_NEEDDATA) { return error; } } } #undef IS_ASCII return parserutils_inputstream_peek_slow(stream, offset, ptr, length); } /** * Advance the stream's current position * * \param stream The stream whose position to advance * \param bytes The number of bytes to advance */ static inline void parserutils_inputstream_advance( parserutils_inputstream *stream, size_t bytes) { if (stream == NULL) return; #if !defined(NDEBUG) && defined(VERBOSE_INPUTSTREAM) fprintf(stdout, "Advance: len: %zu cur: %u bytes: %zu\n", stream->utf8->length, stream->cursor, bytes); #endif if (bytes > stream->utf8->length - stream->cursor) bytes = stream->utf8->length - stream->cursor; if (stream->cursor == stream->utf8->length) return; stream->cursor += bytes; } /* Read the document charset */ const char *parserutils_inputstream_read_charset( parserutils_inputstream *stream, uint32_t *source); /* Change the document charset */ parserutils_error parserutils_inputstream_change_charset( parserutils_inputstream *stream, const char *enc, uint32_t source); #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/types.h0000644000175000017500000000060712377676760023215 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_types_h_ #define parserutils_types_h_ #ifdef __cplusplus extern "C" { #endif #include #include #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/include/parserutils/functypes.h0000644000175000017500000000070312377676760024066 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007-8 John-Mark Bell */ #ifndef parserutils_functypes_h_ #define parserutils_functypes_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include #include #ifdef __cplusplus } #endif #endif netsurf-all-3.2/libparserutils/test/0000755000175000017500000000000012377713350016637 5ustar vincevincenetsurf-all-3.2/libparserutils/test/regression/0000755000175000017500000000000012377713350021017 5ustar vincevincenetsurf-all-3.2/libparserutils/test/regression/INDEX0000644000175000017500000000036412377676760021631 0ustar vincevince# Index for testcases # # Test Description DataDir filter-segv Segfault in input filtering stream-nomem Inputstream buffer expansion filter-badenc-segv Segfault on resetting bad encoding in filter buffer-discard Memmove beyond data length netsurf-all-3.2/libparserutils/test/regression/filter-badenc-segv.c0000644000175000017500000000146212377676760024644 0ustar vincevince#include #include #include #include "input/filter.h" #include "testutils.h" int main(int argc, char **argv) { parserutils_filter *input; parserutils_filter_optparams params; parserutils_error expected; #ifndef WITHOUT_ICONV_FILTER expected = PARSERUTILS_OK; #else expected = PARSERUTILS_BADENCODING; #endif UNUSED(argc); UNUSED(argv); assert(parserutils__filter_create("UTF-8", &input) == PARSERUTILS_OK); params.encoding.name = "GBK"; assert(parserutils__filter_setopt(input, PARSERUTILS_FILTER_SET_ENCODING, ¶ms) == expected); params.encoding.name = "GBK"; assert(parserutils__filter_setopt(input, PARSERUTILS_FILTER_SET_ENCODING, ¶ms) == expected); parserutils__filter_destroy(input); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/regression/buffer-discard.c0000644000175000017500000000305212377676760024060 0ustar vincevince#include #include #include #include #include "utils/utils.h" #include "testutils.h" #define BUFF_LEN 2000 int main(int argc, char **argv) { uint8_t data[BUFF_LEN]; parserutils_buffer *buf; int i; UNUSED(argc); UNUSED(argv); assert(parserutils_buffer_create(&buf) == PARSERUTILS_OK); /* Populate the data with '4's */ for (i = 0; i < BUFF_LEN; i++) data[i] = '4'; assert(parserutils_buffer_append(buf, data, BUFF_LEN) == PARSERUTILS_OK); /* Double the size, appending 'c's */ for (i = 0; i < BUFF_LEN; i++) data[i] = 'c'; assert(parserutils_buffer_append(buf, data, BUFF_LEN) == PARSERUTILS_OK); assert(buf->length == 2 * BUFF_LEN); /* Now reduce the length by half */ /* Buffer length is all '4's now */ buf->length = BUFF_LEN; /* Now discard half of the 4s from the middle of the buffer */ assert(parserutils_buffer_discard(buf, BUFF_LEN / 4, BUFF_LEN / 2) == PARSERUTILS_OK); /* Now check that the length is what we expect */ assert(buf->length == BUFF_LEN / 2); /* Now check that the buffer contains what we expect */ for (i = 0; i < BUFF_LEN / 2; i++) assert(buf->data[i] == '4'); /* Now check that the space we allocated beyond the buffer length is * as we expect, and not overwritten with 'c', which should be beyond * what the buffer_ code is allowed to move. */ for (i = BUFF_LEN / 2; i < BUFF_LEN; i++) assert(buf->data[i] != 'c'); assert(parserutils_buffer_destroy(buf) == PARSERUTILS_OK); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/regression/filter-segv.c0000644000175000017500000000055712377676760023436 0ustar vincevince#include #include #include #include "input/filter.h" #include "testutils.h" int main(int argc, char **argv) { parserutils_filter *input; UNUSED(argc); UNUSED(argv); assert(parserutils__filter_create("UTF-8", &input) == PARSERUTILS_OK); parserutils__filter_destroy(input); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/regression/Makefile0000644000175000017500000000035312377676760022475 0ustar vincevince# Tests DIR_TEST_ITEMS := filter-segv:filter-segv.c \ stream-nomem:stream-nomem.c \ filter-badenc-segv:filter-badenc-segv.c \ buffer-discard:buffer-discard.c CFLAGS := $(CFLAGS) -I$(CURDIR)/test include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/test/regression/stream-nomem.c0000644000175000017500000000402312377676760023603 0ustar vincevince#include #include #include #include #include "utils/utils.h" #include "testutils.h" int main(int argc, char **argv) { parserutils_inputstream *stream; /* This is specially calculated so that the inputstream is forced to * reallocate (it assumes that the inputstream's buffer chunk size * is 4k) */ #define BUFFER_SIZE (4096 + 4) uint8_t input_buffer[BUFFER_SIZE]; // uint8_t *buffer; // size_t buflen; const uint8_t *c; size_t clen; UNUSED(argc); UNUSED(argv); /* Populate the buffer with something sane */ memset(input_buffer, 'a', BUFFER_SIZE); /* Now, set up our test data */ input_buffer[BUFFER_SIZE - 1] = '5'; input_buffer[BUFFER_SIZE - 2] = '4'; input_buffer[BUFFER_SIZE - 3] = '\xbd'; input_buffer[BUFFER_SIZE - 4] = '\xbf'; /* This byte will occupy the 4095th byte in the buffer and * thus cause the entirety of U+FFFD to be buffered until after * the buffer has been enlarged */ input_buffer[BUFFER_SIZE - 5] = '\xef'; input_buffer[BUFFER_SIZE - 6] = '3'; input_buffer[BUFFER_SIZE - 7] = '2'; input_buffer[BUFFER_SIZE - 8] = '1'; assert(parserutils_inputstream_create("UTF-8", 0, NULL, &stream) == PARSERUTILS_OK); assert(parserutils_inputstream_append(stream, input_buffer, BUFFER_SIZE) == PARSERUTILS_OK); assert(parserutils_inputstream_append(stream, NULL, 0) == PARSERUTILS_OK); while (parserutils_inputstream_peek(stream, 0, &c, &clen) != PARSERUTILS_EOF) parserutils_inputstream_advance(stream, clen); /* assert(css_inputstream_claim_buffer(stream, &buffer, &buflen) == CSS_OK); assert(buflen == BUFFER_SIZE); printf("Buffer: '%.*s'\n", 8, buffer + (BUFFER_SIZE - 8)); assert( buffer[BUFFER_SIZE - 6] == '3' && buffer[BUFFER_SIZE - 5] == (uint8_t) '\xef' && buffer[BUFFER_SIZE - 4] == (uint8_t) '\xbf' && buffer[BUFFER_SIZE - 3] == (uint8_t) '\xbd' && buffer[BUFFER_SIZE - 2] == '4'); free(buffer); */ parserutils_inputstream_destroy(stream); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/cscodec-utf16.c0000644000175000017500000001725212377676760021375 0ustar vincevince#include #include #include /* These two are for htonl / ntohl */ #include #include #include #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { parserutils_charset_codec *codec; size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; uint8_t *exp; bool indata; bool inexp; parserutils_error exp_ret; enum { ENCODE, DECODE, BOTH } dir; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(line_ctx *ctx); int main(int argc, char **argv) { parserutils_charset_codec *codec; line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } assert(parserutils_charset_codec_create("NATS-SEFI-ADD", &codec) == PARSERUTILS_BADENCODING); assert(parserutils_charset_codec_create("UTF-16", &ctx.codec) == PARSERUTILS_OK); ctx.buflen = parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (int) ctx.buflen); return 1; } ctx.exp = malloc(ctx.buflen); if (ctx.exp == NULL) { printf("Failed allocating %u bytes\n", (int) ctx.buflen); free(ctx.buf); return 1; } ctx.explen = ctx.buflen; ctx.buf[0] = '\0'; ctx.exp[0] = '\0'; ctx.bufused = 0; ctx.expused = 0; ctx.indata = false; ctx.inexp = false; ctx.exp_ret = PARSERUTILS_OK; assert(parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') ctx.bufused -= 1; if (ctx.expused > 0 && ctx.exp[ctx.expused - 1] == '\n') ctx.expused -= 1; run_test(&ctx); free(ctx.buf); parserutils_charset_codec_destroy(ctx.codec); printf("PASS\n"); return 0; } /** * Converts hex character ('0' ... '9' or 'a' ... 'f' or 'A' ... 'F') to * digit value. * \param hex Valid hex character * \return Corresponding digit value. */ static inline int hex2digit(char hex) { return (hex <= '9') ? hex - '0' : (hex | 0x20) - 'a' + 10; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ if (ctx->buf[ctx->bufused - 1] == '\n') ctx->bufused -= 1; if (ctx->exp[ctx->expused - 1] == '\n') ctx->expused -= 1; run_test(ctx); ctx->buf[0] = '\0'; ctx->exp[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; ctx->exp_ret = PARSERUTILS_OK; } if (strncasecmp(data+1, "data", 4) == 0) { parserutils_charset_codec_optparams params; const char *ptr = data + 6; ctx->indata = true; ctx->inexp = false; if (strncasecmp(ptr, "decode", 6) == 0) ctx->dir = DECODE; else if (strncasecmp(ptr, "encode", 6) == 0) ctx->dir = ENCODE; else ctx->dir = BOTH; ptr += 7; if (strncasecmp(ptr, "LOOSE", 5) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE; ptr += 6; } else if (strncasecmp(ptr, "STRICT", 6) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_STRICT; ptr += 7; } else { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT; ptr += 9; } assert(parserutils_charset_codec_setopt(ctx->codec, PARSERUTILS_CHARSET_CODEC_ERROR_MODE, (parserutils_charset_codec_optparams *) ¶ms) == PARSERUTILS_OK); } else if (strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; ctx->exp_ret = parserutils_error_from_string(data + 10, datalen - 10 - 1 /* \n */); } else if (strncasecmp(data+1, "reset", 5) == 0) { ctx->indata = false; ctx->inexp = false; parserutils_charset_codec_reset(ctx->codec); } } else { if (ctx->indata) { /* Process "&#xNNNN" as 16-bit code units. */ while (datalen) { uint16_t nCodePoint; if (data[0] == '\n') { ctx->buf[ctx->bufused++] = *data++; --datalen; continue; } assert(datalen >= sizeof ("&#xNNNN")-1 \ && data[0] == '&' && data[1] == '#' \ && data[2] == 'x' && isxdigit(data[3]) \ && isxdigit(data[4]) && isxdigit(data[5]) \ && isxdigit(data[6])); /* UTF-16 code is always host endian (different than UCS-32 !). */ nCodePoint = (hex2digit(data[3]) << 12) | (hex2digit(data[4]) << 8) | (hex2digit(data[5]) << 4) | hex2digit(data[6]); *((uint16_t *) (void *) (ctx->buf + ctx->bufused)) = nCodePoint; ctx->bufused += 2; data += sizeof ("&#xNNNN")-1; datalen -= sizeof ("&#xNNNN")-1; } } if (ctx->inexp) { /* Process "&#xXXXXYYYY as 32-bit code units. */ while (datalen) { uint32_t nCodePoint; if (data[0] == '\n') { ctx->exp[ctx->expused++] = *data++; --datalen; continue; } assert(datalen >= sizeof ("&#xXXXXYYYY")-1 \ && data[0] == '&' && data[1] == '#' \ && data[2] == 'x' && isxdigit(data[3]) \ && isxdigit(data[4]) && isxdigit(data[5]) \ && isxdigit(data[6]) && isxdigit(data[7]) \ && isxdigit(data[8]) && isxdigit(data[9]) \ && isxdigit(data[10])); /* UCS-4 code is always big endian, so convert host endian to big endian. */ nCodePoint = htonl((hex2digit(data[3]) << 28) | (hex2digit(data[4]) << 24) | (hex2digit(data[5]) << 20) | (hex2digit(data[6]) << 16) | (hex2digit(data[7]) << 12) | (hex2digit(data[8]) << 8) | (hex2digit(data[9]) << 4) | hex2digit(data[10])); *((uint32_t *) (void *) (ctx->exp + ctx->expused)) = nCodePoint; ctx->expused += 4; data += sizeof ("&#xXXXXYYYY")-1; datalen -= sizeof ("&#xXXXXYYYY")-1; } } } return true; } void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; size_t i; if (ctx->dir == DECODE) { assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else if (ctx->dir == ENCODE) { assert(parserutils_charset_codec_encode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &ptemp, &templen) == ctx->exp_ret); /* \todo currently there is no way to specify the number of consumed & produced data in case of a deliberate bad input data set. */ if (ctx->exp_ret == PARSERUTILS_OK) { assert(temp + (ctx->bufused * 4 - templen) == ptemp); } ptemp2 = temp; templen2 = ctx->bufused * 4 - templen; assert(parserutils_charset_codec_encode(ctx->codec, &ptemp2, &templen2, &pdest, &destlen) == ctx->exp_ret); if (ctx->exp_ret == PARSERUTILS_OK) { assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); assert(ctx->buf + ctx->bufused == psrc); assert(dest + (ctx->bufused * 4 - destlen) == pdest); assert(ctx->bufused * 4 - destlen == ctx->expused); } printf("%d: Read '", ++testnum); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(dest[i] >> 4) & 0xf], "0123456789abcdef"[dest[i] & 0xf]); } printf("' Expected '"); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(ctx->exp[i] >> 4) & 0xf], "0123456789abcdef"[ctx->exp[i] & 0xf]); } printf("'\n"); assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); free(dest); } netsurf-all-3.2/libparserutils/test/data/0000755000175000017500000000000012377713350017550 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/cscodec-ext8/0000755000175000017500000000000012377713350022041 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1257.dat0000644000175000017500000000476412377676760023504 0ustar vincevince#enc Windows-1257 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~■うЖ葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :VW. y"6*;`CELrAZj{}/ z#7+<aDFMsB[k|~ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :VW. y"6*;`CELrAZj{}/ z#7+<aDFMsB[k|~ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~■うЖ葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1253.dat0000644000175000017500000000470212377676760023470 0ustar vincevince#enc Windows-1253 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :  #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :  #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1258.dat0000644000175000017500000000502212377676760023471 0ustar vincevince#enc Windows-1258 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9R     "  !" :Sx # #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9R     "  !" :Sx # #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1255.dat0000644000175000017500000000460612377676760023475 0ustar vincevince#enc Windows-1255 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班北洋椀冫嘖孛忤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :    #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0 9     "  !" :    #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班北洋椀冫嘖孛忤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1254.dat0000644000175000017500000000504612377676760023473 0ustar vincevince#enc Windows-1254 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9R     "  !"a :Sx0^1_ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9R     "  !"a :Sx0^1_ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1256.dat0000644000175000017500000000515412377676760023475 0ustar vincevince#enc Windows-1256 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ~   & ! 0y 9R     "  !" :S  !"#$%&'()*+,-./0123456789:@ABCDEFGHIJKLMNOPQR   #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ~   & ! 0y 9R     "  !" :S  !"#$%&'()*+,-./0123456789:@ABCDEFGHIJKLMNOPQR   #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/INDEX0000644000175000017500000000043612377676760022653 0ustar vincevince# Index file for charset codec tests # # Test Description cp1250.dat Windows-1250 cp1251.dat Windows-1251 cp1252.dat Windows-1252 cp1253.dat Windows-1253 cp1254.dat Windows-1254 cp1255.dat Windows-1255 cp1256.dat Windows-1256 cp1257.dat Windows-1257 cp1258.dat Windows-1258 netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1251.dat0000644000175000017500000000514212377676760023465 0ustar vincevince#enc Windows-1251 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ S  & ! 0 9   R     "  !"Y :Z\[_^VQ!TXUW !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ S  & ! 0 9   R     "  !"Y :Z\[_^VQ!TXUW !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1252.dat0000644000175000017500000000507212377676760023470 0ustar vincevince#enc Windows-1252 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9R}     "  !"a :S~x #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9R}     "  !"a :S~x #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-ext8/cp1250.dat0000644000175000017500000000507212377676760023466 0ustar vincevince#enc Windows-1250 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9Zd}y     "  !"a :[e~zA^{B_=>|T9 CGPXnpbU: DHQYoqc #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   & ! 0` 9Zd}y     "  !"a :[e~zA^{B_=>|T9 CGPXnpbU: DHQYoqc #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-utf8/0000755000175000017500000000000012377713350022037 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/cscodec-utf8/INDEX0000644000175000017500000000025612377676760022651 0ustar vincevince# Index file for charset codec tests # # Test Description simple.dat Simple tests, designed to validate testdriver UTF-8-test.txt Markus Kuhn's UTF-8 decoding test file netsurf-all-3.2/libparserutils/test/data/cscodec-utf8/UTF-8-test.txt0000644000175000017500000012006512377676760024401 0ustar vincevince#data recode LOOSE UTF-8 decoder capability and stress test ---------------------------------------- Markus Kuhn - 2003-02-19 This test file can help you examine, how your UTF-8 decoder handles various types of correct, malformed, or otherwise interesting UTF-8 sequences. This file is not meant to be a conformance test. It does not prescribes any particular outcome and therefore there is no way to "pass" or "fail" this test file, even though the texts suggests a preferable decoder behaviour at some places. The aim is instead to help you think about and test the behaviour of your UTF-8 on a systematic collection of unusual inputs. Experience so far suggests that most first-time authors of UTF-8 decoders find at least one serious problem in their decoder by using this file. The test lines below cover boundary conditions, malformed UTF-8 sequences as well as correctly encoded UTF-8 sequences of Unicode code points that should never occur in a correct UTF-8 file. According to ISO 10646-1:2000, sections D.7 and 2.3c, a device receiving UTF-8 shall interpret a "malformed sequence in the same way that it interprets a character that is outside the adopted subset" and "characters that are not within the adopted subset shall be indicated to the user" by a receiving device. A quite commonly used approach in UTF-8 decoders is to replace any malformed UTF-8 sequence by a replacement character (U+FFFD), which looks a bit like an inverted question mark, or a similar symbol. It might be a good idea to visually distinguish a malformed UTF-8 sequence from a correctly encoded Unicode character that is just not available in the current font but otherwise fully legal, even though ISO 10646-1 doesn't mandate this. In any case, just ignoring malformed sequences or unavailable characters does not conform to ISO 10646, will make debugging more difficult, and can lead to user confusion. Please check, whether a malformed UTF-8 sequence is (1) represented at all, (2) represented by exactly one single replacement character (or equivalent signal), and (3) the following quotation mark after an illegal UTF-8 sequence is correctly displayed, i.e. proper resynchronization takes place immageately after any malformed sequence. This file says "THE END" in the last line, so if you don't see that, your decoder crashed somehow before, which should always be cause for concern. All lines in this file are exactly 79 characters long (plus the line feed). In addition, all lines end with "|", except for the two test lines 2.1.1 and 2.2.1, which contain non-printable ASCII controls U+0000 and U+007F. If you display this file with a fixed-width font, these "|" characters should all line up in column 79 (right margin). This allows you to test quickly, whether your UTF-8 decoder finds the correct number of characters in every line, that is whether each malformed sequences is replaced by a single replacement character. Note that as an alternative to the notion of malformed sequence used here, it is also a perfectly acceptable (and in some situations even preferable) solution to represent each individual byte of a malformed sequence by a replacement character. If you follow this strategy in your decoder, then please ignore the "|" column. Here come the tests: | | 1 Some correct UTF-8 text | | You should see the Greek word 'kosme': "虜畚肱亮竜" | | 2 Boundary condition test cases | | 2.1 First possible sequence of a certain length | | 2.1.1 1 byte (U-00000000): "" 2.1.2 2 bytes (U-00000080): "" | 2.1.3 3 bytes (U-00000800): "" | 2.1.4 4 bytes (U-00010000): "" | 2.1.5 5 bytes (U-00200000): "" | 2.1.6 6 bytes (U-04000000): "" | | 2.2 Last possible sequence of a certain length | | 2.2.1 1 byte (U-0000007F): "" 2.2.2 2 bytes (U-000007FF): "濘" | 2.2.3 3 bytes (U-0000FFFF): "鐃" | 2.2.4 4 bytes (U-001FFFFF): "真" | 2.2.5 5 bytes (U-03FFFFFF): "真真" | 2.2.6 6 bytes (U-7FFFFFFF): "真真" | | 2.3 Other boundary conditions | | 2.3.1 U-0000D7FF = ed 9f bf = "" | 2.3.2 U-0000E000 = ee 80 80 = "" | 2.3.3 U-0000FFFD = ef bf bd = "鐃" | 2.3.4 U-0010FFFF = f4 8f bf bf = "扤" | 2.3.5 U-00110000 = f4 90 80 80 = "" | | 3 Malformed sequences | | 3.1 Unexpected continuation bytes | | Each unexpected continuation byte should be separately signalled as a | malformed sequence of its own. | | 3.1.1 First continuation byte 0x80: "" | 3.1.2 Last continuation byte 0xbf: "" | | 3.1.3 2 continuation bytes: "" | 3.1.4 3 continuation bytes: "" | 3.1.5 4 continuation bytes: "" | 3.1.6 5 continuation bytes: "" | 3.1.7 6 continuation bytes: "" | 3.1.8 7 continuation bytes: "" | | 3.1.9 Sequence of all 64 possible continuation bytes (0x80-0xbf): | | " | | 、ぅΗ┤ | 葦桶患況弦沙悉梢" | | 3.2 Lonely start characters | | 3.2.1 All 32 first bytes of 2-byte sequences (0xc0-0xdf), | each followed by a space character: | | " | " | | 3.2.2 All 16 first bytes of 3-byte sequences (0xe0-0xef), | each followed by a space character: | | " " | | 3.2.3 All 8 first bytes of 4-byte sequences (0xf0-0xf7), | each followed by a space character: | | " " | | 3.2.4 All 4 first bytes of 5-byte sequences (0xf8-0xfb), | each followed by a space character: | | " " | | 3.2.5 All 2 first bytes of 6-byte sequences (0xfc-0xfd), | each followed by a space character: | | " " | | 3.3 Sequences with last continuation byte missing | | All bytes of an incomplete sequence should be signalled as a single | malformed sequence, i.e., you should see only a single replacement | character in each of the next 10 tests. (Characters as in section 2) | | 3.3.1 2-byte sequence with last byte missing (U+0000): "" | 3.3.2 3-byte sequence with last byte missing (U+0000): "" | 3.3.3 4-byte sequence with last byte missing (U+0000): "" | 3.3.4 5-byte sequence with last byte missing (U+0000): "" | 3.3.5 6-byte sequence with last byte missing (U+0000): "" | 3.3.6 2-byte sequence with last byte missing (U-000007FF): "" | 3.3.7 3-byte sequence with last byte missing (U-0000FFFF): "鐃" | 3.3.8 4-byte sequence with last byte missing (U-001FFFFF): "真" | 3.3.9 5-byte sequence with last byte missing (U-03FFFFFF): "真" | 3.3.10 6-byte sequence with last byte missing (U-7FFFFFFF): "真真" | | 3.4 Concatenation of incomplete sequences | | All the 10 sequences of 3.3 concatenated, you should see 10 malformed | sequences being signalled: | | "窃熄雛真真雀真真" | | 3.5 Impossible bytes | | The following two bytes cannot appear in a correct UTF-8 string | | 3.5.1 fe = "" | 3.5.2 ff = "" | 3.5.3 fe fe ff ff = "" | | 4 Overlong sequences | | The following sequences are not malformed according to the letter of | the Unicode 2.0 standard. However, they are longer then necessary and | a correct UTF-8 encoder is not allowed to produce them. A "safe UTF-8 | decoder" should reject them just like malformed sequences for two | reasons: (1) It helps to debug applications if overlong sequences are | not treated as valid representations of characters, because this helps | to spot problems more quickly. (2) Overlong sequences provide | alternative representations of characters, that could maliciously be | used to bypass filters that check only for ASCII characters. For | instance, a 2-byte encoded line feed (LF) would not be caught by a | line counter that counts only 0x0a bytes, but it would still be | processed as a line feed by an unsafe UTF-8 decoder later in the | pipeline. From a security point of view, ASCII compatibility of UTF-8 | sequences means also, that ASCII characters are *only* allowed to be | represented by ASCII bytes in the range 0x00-0x7f. To ensure this | aspect of ASCII compatibility, use only "safe UTF-8 decoders" that | reject overlong UTF-8 sequences for which a shorter encoding exists. | | 4.1 Examples of an overlong ASCII character | | With a safe UTF-8 decoder, all of the following five overlong | representations of the ASCII character slash ("/") should be rejected | like a malformed UTF-8 sequence, for instance by substituting it with | a replacement character. If you see a slash below, you do not have a | safe UTF-8 decoder! | | 4.1.1 U+002F = c0 af = "政" | 4.1.2 U+002F = e0 80 af = "" | 4.1.3 U+002F = f0 80 80 af = "" | 4.1.4 U+002F = f8 80 80 80 af = "" | 4.1.5 U+002F = fc 80 80 80 80 af = "" | | 4.2 Maximum overlong sequences | | Below you see the highest Unicode value that is still resulting in an | overlong sequence if represented with the given number of bytes. This | is a boundary test for safe UTF-8 decoders. All five characters should | be rejected like malformed UTF-8 sequences. | | 4.2.1 U-0000007F = c1 bf = "楚" | 4.2.2 U-000007FF = e0 9f bf = "" | 4.2.3 U-0000FFFF = f0 8f bf bf = "扤" | 4.2.4 U-001FFFFF = f8 87 bf bf bf = "真" | 4.2.5 U-03FFFFFF = fc 83 bf bf bf bf = "真真" | | 4.3 Overlong representation of the NUL character | | The following five sequences should also be rejected like malformed | UTF-8 sequences and should not be treated like the ASCII NUL | character. | | 4.3.1 U+0000 = c0 80 = "" | 4.3.2 U+0000 = e0 80 80 = "" | 4.3.3 U+0000 = f0 80 80 80 = "" | 4.3.4 U+0000 = f8 80 80 80 80 = "" | 4.3.5 U+0000 = fc 80 80 80 80 80 = "" | | 5 Illegal code positions | | The following UTF-8 sequences should be rejected like malformed | sequences, because they never represent valid ISO 10646 characters and | a UTF-8 decoder that accepts them might introduce security problems | comparable to overlong UTF-8 sequences. | | 5.1 Single UTF-16 surrogates | | 5.1.1 U+D800 = ed a0 80 = "" | 5.1.2 U+DB7F = ed ad bf = "蹲" | 5.1.3 U+DB80 = ed ae 80 = "蹼" | 5.1.4 U+DBFF = ed af bf = "躁" | 5.1.5 U+DC00 = ed b0 80 = "躇" | 5.1.6 U+DF80 = ed be 80 = "躱" | 5.1.7 U+DFFF = ed bf bf = "躾" | | 5.2 Paired UTF-16 surrogates | | 5.2.1 U+D800 U+DC00 = ed a0 80 ed b0 80 = "躇" | 5.2.2 U+D800 U+DFFF = ed a0 80 ed bf bf = "躾" | 5.2.3 U+DB7F U+DC00 = ed ad bf ed b0 80 = "蹲錐" | 5.2.4 U+DB7F U+DFFF = ed ad bf ed bf bf = "蹲錐真" | 5.2.5 U+DB80 U+DC00 = ed ae 80 ed b0 80 = "蹼躇" | 5.2.6 U+DB80 U+DFFF = ed ae 80 ed bf bf = "蹼躾" | 5.2.7 U+DBFF U+DC00 = ed af bf ed b0 80 = "躁錐" | 5.2.8 U+DBFF U+DFFF = ed af bf ed bf bf = "躁錐真" | | 5.3 Other illegal code positions | | 5.3.1 U+FFFE = ef bf be = "鐃" | 5.3.2 U+FFFF = ef bf bf = "鐃" | | THE END | #expected CHARSET_OK UTF-8 decoder capability and stress test ---------------------------------------- Markus Kuhn - 2003-02-19 This test file can help you examine, how your UTF-8 decoder handles various types of correct, malformed, or otherwise interesting UTF-8 sequences. This file is not meant to be a conformance test. It does not prescribes any particular outcome and therefore there is no way to "pass" or "fail" this test file, even though the texts suggests a preferable decoder behaviour at some places. The aim is instead to help you think about and test the behaviour of your UTF-8 on a systematic collection of unusual inputs. Experience so far suggests that most first-time authors of UTF-8 decoders find at least one serious problem in their decoder by using this file. The test lines below cover boundary conditions, malformed UTF-8 sequences as well as correctly encoded UTF-8 sequences of Unicode code points that should never occur in a correct UTF-8 file. According to ISO 10646-1:2000, sections D.7 and 2.3c, a device receiving UTF-8 shall interpret a "malformed sequence in the same way that it interprets a character that is outside the adopted subset" and "characters that are not within the adopted subset shall be indicated to the user" by a receiving device. A quite commonly used approach in UTF-8 decoders is to replace any malformed UTF-8 sequence by a replacement character (U+FFFD), which looks a bit like an inverted question mark, or a similar symbol. It might be a good idea to visually distinguish a malformed UTF-8 sequence from a correctly encoded Unicode character that is just not available in the current font but otherwise fully legal, even though ISO 10646-1 doesn't mandate this. In any case, just ignoring malformed sequences or unavailable characters does not conform to ISO 10646, will make debugging more difficult, and can lead to user confusion. Please check, whether a malformed UTF-8 sequence is (1) represented at all, (2) represented by exactly one single replacement character (or equivalent signal), and (3) the following quotation mark after an illegal UTF-8 sequence is correctly displayed, i.e. proper resynchronization takes place immageately after any malformed sequence. This file says "THE END" in the last line, so if you don't see that, your decoder crashed somehow before, which should always be cause for concern. All lines in this file are exactly 79 characters long (plus the line feed). In addition, all lines end with "|", except for the two test lines 2.1.1 and 2.2.1, which contain non-printable ASCII controls U+0000 and U+007F. If you display this file with a fixed-width font, these "|" characters should all line up in column 79 (right margin). This allows you to test quickly, whether your UTF-8 decoder finds the correct number of characters in every line, that is whether each malformed sequences is replaced by a single replacement character. Note that as an alternative to the notion of malformed sequence used here, it is also a perfectly acceptable (and in some situations even preferable) solution to represent each individual byte of a malformed sequence by a replacement character. If you follow this strategy in your decoder, then please ignore the "|" column. Here come the tests: | | 1 Some correct UTF-8 text | | You should see the Greek word 'kosme': "虜畚肱亮竜" | | 2 Boundary condition test cases | | 2.1 First possible sequence of a certain length | | 2.1.1 1 byte (U-00000000): "" 2.1.2 2 bytes (U-00000080): "" | 2.1.3 3 bytes (U-00000800): "" | 2.1.4 4 bytes (U-00010000): "" | 2.1.5 5 bytes (U-00200000): "" | 2.1.6 6 bytes (U-04000000): "" | | 2.2 Last possible sequence of a certain length | | 2.2.1 1 byte (U-0000007F): "" 2.2.2 2 bytes (U-000007FF): "濘" | 2.2.3 3 bytes (U-0000FFFF): "鐃" | 2.2.4 4 bytes (U-001FFFFF): "真" | 2.2.5 5 bytes (U-03FFFFFF): "真真" | 2.2.6 6 bytes (U-7FFFFFFF): "真真" | | 2.3 Other boundary conditions | | 2.3.1 U-0000D7FF = ed 9f bf = "" | 2.3.2 U-0000E000 = ee 80 80 = "" | 2.3.3 U-0000FFFD = ef bf bd = "鐃" | 2.3.4 U-0010FFFF = f4 8f bf bf = "扤" | 2.3.5 U-00110000 = f4 90 80 80 = "" | | 3 Malformed sequences | | 3.1 Unexpected continuation bytes | | Each unexpected continuation byte should be separately signalled as a | malformed sequence of its own. | | 3.1.1 First continuation byte 0x80: "鐃" | 3.1.2 Last continuation byte 0xbf: "鐃" | | 3.1.3 2 continuation bytes: "鐃緒申" | 3.1.4 3 continuation bytes: "鐃緒申鐃" | 3.1.5 4 continuation bytes: "鐃緒申鐃緒申" | 3.1.6 5 continuation bytes: "鐃緒申鐃緒申鐃" | 3.1.7 6 continuation bytes: "鐃緒申鐃緒申鐃緒申" | 3.1.8 7 continuation bytes: "鐃緒申鐃緒申鐃緒申鐃" | | 3.1.9 Sequence of all 64 possible continuation bytes (0x80-0xbf): | | "鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 | 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 | 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申 | 鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申" | | 3.2 Lonely start characters | | 3.2.1 All 32 first bytes of 2-byte sequences (0xc0-0xdf), | each followed by a space character: | | "鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 | 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 " | | 3.2.2 All 16 first bytes of 3-byte sequences (0xe0-0xef), | each followed by a space character: | | "鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 " | | 3.2.3 All 8 first bytes of 4-byte sequences (0xf0-0xf7), | each followed by a space character: | | "鐃 鐃 鐃 鐃 鐃 鐃 鐃 鐃 " | | 3.2.4 All 4 first bytes of 5-byte sequences (0xf8-0xfb), | each followed by a space character: | | "鐃 鐃 鐃 鐃 " | | 3.2.5 All 2 first bytes of 6-byte sequences (0xfc-0xfd), | each followed by a space character: | | "鐃 鐃 " | | 3.3 Sequences with last continuation byte missing | | All bytes of an incomplete sequence should be signalled as a single | malformed sequence, i.e., you should see only a single replacement | character in each of the next 10 tests. (Characters as in section 2) | | 3.3.1 2-byte sequence with last byte missing (U+0000): "鐃" | 3.3.2 3-byte sequence with last byte missing (U+0000): "鐃" | 3.3.3 4-byte sequence with last byte missing (U+0000): "鐃" | 3.3.4 5-byte sequence with last byte missing (U+0000): "鐃" | 3.3.5 6-byte sequence with last byte missing (U+0000): "鐃" | 3.3.6 2-byte sequence with last byte missing (U-000007FF): "鐃" | 3.3.7 3-byte sequence with last byte missing (U-0000FFFF): "鐃" | 3.3.8 4-byte sequence with last byte missing (U-001FFFFF): "鐃" | 3.3.9 5-byte sequence with last byte missing (U-03FFFFFF): "鐃" | 3.3.10 6-byte sequence with last byte missing (U-7FFFFFFF): "鐃" | | 3.4 Concatenation of incomplete sequences | | All the 10 sequences of 3.3 concatenated, you should see 10 malformed | sequences being signalled: | | "鐃緒申鐃緒申鐃緒申鐃緒申鐃緒申" | | 3.5 Impossible bytes | | The following two bytes cannot appear in a correct UTF-8 string | | 3.5.1 fe = "鐃" | 3.5.2 ff = "鐃" | 3.5.3 fe fe ff ff = "鐃緒申鐃緒申" | | 4 Overlong sequences | | The following sequences are not malformed according to the letter of | the Unicode 2.0 standard. However, they are longer then necessary and | a correct UTF-8 encoder is not allowed to produce them. A "safe UTF-8 | decoder" should reject them just like malformed sequences for two | reasons: (1) It helps to debug applications if overlong sequences are | not treated as valid representations of characters, because this helps | to spot problems more quickly. (2) Overlong sequences provide | alternative representations of characters, that could maliciously be | used to bypass filters that check only for ASCII characters. For | instance, a 2-byte encoded line feed (LF) would not be caught by a | line counter that counts only 0x0a bytes, but it would still be | processed as a line feed by an unsafe UTF-8 decoder later in the | pipeline. From a security point of view, ASCII compatibility of UTF-8 | sequences means also, that ASCII characters are *only* allowed to be | represented by ASCII bytes in the range 0x00-0x7f. To ensure this | aspect of ASCII compatibility, use only "safe UTF-8 decoders" that | reject overlong UTF-8 sequences for which a shorter encoding exists. | | 4.1 Examples of an overlong ASCII character | | With a safe UTF-8 decoder, all of the following five overlong | representations of the ASCII character slash ("/") should be rejected | like a malformed UTF-8 sequence, for instance by substituting it with | a replacement character. If you see a slash below, you do not have a | safe UTF-8 decoder! | | 4.1.1 U+002F = c0 af = "鐃" | 4.1.2 U+002F = e0 80 af = "鐃" | 4.1.3 U+002F = f0 80 80 af = "鐃" | 4.1.4 U+002F = f8 80 80 80 af = "鐃" | 4.1.5 U+002F = fc 80 80 80 80 af = "鐃" | | 4.2 Maximum overlong sequences | | Below you see the highest Unicode value that is still resulting in an | overlong sequence if represented with the given number of bytes. This | is a boundary test for safe UTF-8 decoders. All five characters should | be rejected like malformed UTF-8 sequences. | | 4.2.1 U-0000007F = c1 bf = "鐃" | 4.2.2 U-000007FF = e0 9f bf = "鐃" | 4.2.3 U-0000FFFF = f0 8f bf bf = "鐃" | 4.2.4 U-001FFFFF = f8 87 bf bf bf = "鐃" | 4.2.5 U-03FFFFFF = fc 83 bf bf bf bf = "鐃" | | 4.3 Overlong representation of the NUL character | | The following five sequences should also be rejected like malformed | UTF-8 sequences and should not be treated like the ASCII NUL | character. | | 4.3.1 U+0000 = c0 80 = "鐃" | 4.3.2 U+0000 = e0 80 80 = "鐃" | 4.3.3 U+0000 = f0 80 80 80 = "鐃" | 4.3.4 U+0000 = f8 80 80 80 80 = "鐃" | 4.3.5 U+0000 = fc 80 80 80 80 80 = "鐃" | | 5 Illegal code positions | | The following UTF-8 sequences should be rejected like malformed | sequences, because they never represent valid ISO 10646 characters and | a UTF-8 decoder that accepts them might introduce security problems | comparable to overlong UTF-8 sequences. | | 5.1 Single UTF-16 surrogates | | 5.1.1 U+D800 = ed a0 80 = "鐃" | 5.1.2 U+DB7F = ed ad bf = "鐃" | 5.1.3 U+DB80 = ed ae 80 = "鐃" | 5.1.4 U+DBFF = ed af bf = "鐃" | 5.1.5 U+DC00 = ed b0 80 = "鐃" | 5.1.6 U+DF80 = ed be 80 = "鐃" | 5.1.7 U+DFFF = ed bf bf = "鐃" | | 5.2 Paired UTF-16 surrogates | | 5.2.1 U+D800 U+DC00 = ed a0 80 ed b0 80 = "鐃緒申" | 5.2.2 U+D800 U+DFFF = ed a0 80 ed bf bf = "鐃緒申" | 5.2.3 U+DB7F U+DC00 = ed ad bf ed b0 80 = "鐃緒申" | 5.2.4 U+DB7F U+DFFF = ed ad bf ed bf bf = "鐃緒申" | 5.2.5 U+DB80 U+DC00 = ed ae 80 ed b0 80 = "鐃緒申" | 5.2.6 U+DB80 U+DFFF = ed ae 80 ed bf bf = "鐃緒申" | 5.2.7 U+DBFF U+DC00 = ed af bf ed b0 80 = "鐃緒申" | 5.2.8 U+DBFF U+DFFF = ed af bf ed bf bf = "鐃緒申" | | 5.3 Other illegal code positions | | 5.3.1 U+FFFE = ef bf be = "鐃" | 5.3.2 U+FFFF = ef bf bf = "鐃" | | THE END | #reset netsurf-all-3.2/libparserutils/test/data/cscodec-utf8/simple.dat0000644000175000017500000000212512377676760024037 0ustar vincevince#data decode LOOSE hello!! #expected CHARSET_OK hello!! #reset #data decode STRICT hello!! #expected CHARSET_OK hello!! #reset #data decode TRANSLIT hello!! #expected CHARSET_OK hello!! #reset #data decode LOOSE hello!! #expected CHARSET_OK hello!! #reset #data decode STRICT hello!! #expected CHARSET_OK hello!! #reset #data decode TRANSLIT hello!! #expected CHARSET_OK hello!! #reset #data encode LOOSE hello!! #expected CHARSET_OK hello!! #reset #data encode STRICT hello!! #expected CHARSET_OK hello!! #reset #data encode TRANSLIT hello!! #expected CHARSET_OK hello!! #reset #data encode LOOSE hello!! #expected CHARSET_OK hello!! #reset #data encode STRICT hello!! #expected CHARSET_OK hello!! #reset #data encode TRANSLIT hello!! #expected CHARSET_OK hello!! #reset netsurf-all-3.2/libparserutils/test/data/input/0000755000175000017500000000000012377713350020707 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/input/INDEX0000644000175000017500000000016212377676760021515 0ustar vincevince# Index file for inputstream tests # # Test Description UTF-8-test.txt Markus Kuhn's UTF-8 decoding test file netsurf-all-3.2/libparserutils/test/data/input/UTF-8-test.txt0000644000175000017500000004755612377676760023266 0ustar vincevinceUTF-8 decoder capability and stress test ---------------------------------------- Markus Kuhn - 2003-02-19 This test file can help you examine, how your UTF-8 decoder handles various types of correct, malformed, or otherwise interesting UTF-8 sequences. This file is not meant to be a conformance test. It does not prescribes any particular outcome and therefore there is no way to "pass" or "fail" this test file, even though the texts suggests a preferable decoder behaviour at some places. The aim is instead to help you think about and test the behaviour of your UTF-8 on a systematic collection of unusual inputs. Experience so far suggests that most first-time authors of UTF-8 decoders find at least one serious problem in their decoder by using this file. The test lines below cover boundary conditions, malformed UTF-8 sequences as well as correctly encoded UTF-8 sequences of Unicode code points that should never occur in a correct UTF-8 file. According to ISO 10646-1:2000, sections D.7 and 2.3c, a device receiving UTF-8 shall interpret a "malformed sequence in the same way that it interprets a character that is outside the adopted subset" and "characters that are not within the adopted subset shall be indicated to the user" by a receiving device. A quite commonly used approach in UTF-8 decoders is to replace any malformed UTF-8 sequence by a replacement character (U+FFFD), which looks a bit like an inverted question mark, or a similar symbol. It might be a good idea to visually distinguish a malformed UTF-8 sequence from a correctly encoded Unicode character that is just not available in the current font but otherwise fully legal, even though ISO 10646-1 doesn't mandate this. In any case, just ignoring malformed sequences or unavailable characters does not conform to ISO 10646, will make debugging more difficult, and can lead to user confusion. Please check, whether a malformed UTF-8 sequence is (1) represented at all, (2) represented by exactly one single replacement character (or equivalent signal), and (3) the following quotation mark after an illegal UTF-8 sequence is correctly displayed, i.e. proper resynchronization takes place immageately after any malformed sequence. This file says "THE END" in the last line, so if you don't see that, your decoder crashed somehow before, which should always be cause for concern. All lines in this file are exactly 79 characters long (plus the line feed). In addition, all lines end with "|", except for the two test lines 2.1.1 and 2.2.1, which contain non-printable ASCII controls U+0000 and U+007F. If you display this file with a fixed-width font, these "|" characters should all line up in column 79 (right margin). This allows you to test quickly, whether your UTF-8 decoder finds the correct number of characters in every line, that is whether each malformed sequences is replaced by a single replacement character. Note that as an alternative to the notion of malformed sequence used here, it is also a perfectly acceptable (and in some situations even preferable) solution to represent each individual byte of a malformed sequence by a replacement character. If you follow this strategy in your decoder, then please ignore the "|" column. Here come the tests: | | 1 Some correct UTF-8 text | | You should see the Greek word 'kosme': "虜畚肱亮竜" | | 2 Boundary condition test cases | | 2.1 First possible sequence of a certain length | | 2.1.1 1 byte (U-00000000): "" 2.1.2 2 bytes (U-00000080): "" | 2.1.3 3 bytes (U-00000800): "" | 2.1.4 4 bytes (U-00010000): "" | 2.1.5 5 bytes (U-00200000): "" | 2.1.6 6 bytes (U-04000000): "" | | 2.2 Last possible sequence of a certain length | | 2.2.1 1 byte (U-0000007F): "" 2.2.2 2 bytes (U-000007FF): "濘" | 2.2.3 3 bytes (U-0000FFFF): "鐃" | 2.2.4 4 bytes (U-001FFFFF): "真" | 2.2.5 5 bytes (U-03FFFFFF): "真真" | 2.2.6 6 bytes (U-7FFFFFFF): "真真" | | 2.3 Other boundary conditions | | 2.3.1 U-0000D7FF = ed 9f bf = "" | 2.3.2 U-0000E000 = ee 80 80 = "" | 2.3.3 U-0000FFFD = ef bf bd = "鐃" | 2.3.4 U-0010FFFF = f4 8f bf bf = "扤" | 2.3.5 U-00110000 = f4 90 80 80 = "" | | 3 Malformed sequences | | 3.1 Unexpected continuation bytes | | Each unexpected continuation byte should be separately signalled as a | malformed sequence of its own. | | 3.1.1 First continuation byte 0x80: "" | 3.1.2 Last continuation byte 0xbf: "" | | 3.1.3 2 continuation bytes: "" | 3.1.4 3 continuation bytes: "" | 3.1.5 4 continuation bytes: "" | 3.1.6 5 continuation bytes: "" | 3.1.7 6 continuation bytes: "" | 3.1.8 7 continuation bytes: "" | | 3.1.9 Sequence of all 64 possible continuation bytes (0x80-0xbf): | | " | | 、ぅΗ┤ | 葦桶患況弦沙悉梢" | | 3.2 Lonely start characters | | 3.2.1 All 32 first bytes of 2-byte sequences (0xc0-0xdf), | each followed by a space character: | | " | " | | 3.2.2 All 16 first bytes of 3-byte sequences (0xe0-0xef), | each followed by a space character: | | " " | | 3.2.3 All 8 first bytes of 4-byte sequences (0xf0-0xf7), | each followed by a space character: | | " " | | 3.2.4 All 4 first bytes of 5-byte sequences (0xf8-0xfb), | each followed by a space character: | | " " | | 3.2.5 All 2 first bytes of 6-byte sequences (0xfc-0xfd), | each followed by a space character: | | " " | | 3.3 Sequences with last continuation byte missing | | All bytes of an incomplete sequence should be signalled as a single | malformed sequence, i.e., you should see only a single replacement | character in each of the next 10 tests. (Characters as in section 2) | | 3.3.1 2-byte sequence with last byte missing (U+0000): "" | 3.3.2 3-byte sequence with last byte missing (U+0000): "" | 3.3.3 4-byte sequence with last byte missing (U+0000): "" | 3.3.4 5-byte sequence with last byte missing (U+0000): "" | 3.3.5 6-byte sequence with last byte missing (U+0000): "" | 3.3.6 2-byte sequence with last byte missing (U-000007FF): "" | 3.3.7 3-byte sequence with last byte missing (U-0000FFFF): "鐃" | 3.3.8 4-byte sequence with last byte missing (U-001FFFFF): "真" | 3.3.9 5-byte sequence with last byte missing (U-03FFFFFF): "真" | 3.3.10 6-byte sequence with last byte missing (U-7FFFFFFF): "真真" | | 3.4 Concatenation of incomplete sequences | | All the 10 sequences of 3.3 concatenated, you should see 10 malformed | sequences being signalled: | | "窃熄雛真真雀真真" | | 3.5 Impossible bytes | | The following two bytes cannot appear in a correct UTF-8 string | | 3.5.1 fe = "" | 3.5.2 ff = "" | 3.5.3 fe fe ff ff = "" | | 4 Overlong sequences | | The following sequences are not malformed according to the letter of | the Unicode 2.0 standard. However, they are longer then necessary and | a correct UTF-8 encoder is not allowed to produce them. A "safe UTF-8 | decoder" should reject them just like malformed sequences for two | reasons: (1) It helps to debug applications if overlong sequences are | not treated as valid representations of characters, because this helps | to spot problems more quickly. (2) Overlong sequences provide | alternative representations of characters, that could maliciously be | used to bypass filters that check only for ASCII characters. For | instance, a 2-byte encoded line feed (LF) would not be caught by a | line counter that counts only 0x0a bytes, but it would still be | processed as a line feed by an unsafe UTF-8 decoder later in the | pipeline. From a security point of view, ASCII compatibility of UTF-8 | sequences means also, that ASCII characters are *only* allowed to be | represented by ASCII bytes in the range 0x00-0x7f. To ensure this | aspect of ASCII compatibility, use only "safe UTF-8 decoders" that | reject overlong UTF-8 sequences for which a shorter encoding exists. | | 4.1 Examples of an overlong ASCII character | | With a safe UTF-8 decoder, all of the following five overlong | representations of the ASCII character slash ("/") should be rejected | like a malformed UTF-8 sequence, for instance by substituting it with | a replacement character. If you see a slash below, you do not have a | safe UTF-8 decoder! | | 4.1.1 U+002F = c0 af = "政" | 4.1.2 U+002F = e0 80 af = "" | 4.1.3 U+002F = f0 80 80 af = "" | 4.1.4 U+002F = f8 80 80 80 af = "" | 4.1.5 U+002F = fc 80 80 80 80 af = "" | | 4.2 Maximum overlong sequences | | Below you see the highest Unicode value that is still resulting in an | overlong sequence if represented with the given number of bytes. This | is a boundary test for safe UTF-8 decoders. All five characters should | be rejected like malformed UTF-8 sequences. | | 4.2.1 U-0000007F = c1 bf = "楚" | 4.2.2 U-000007FF = e0 9f bf = "" | 4.2.3 U-0000FFFF = f0 8f bf bf = "扤" | 4.2.4 U-001FFFFF = f8 87 bf bf bf = "真" | 4.2.5 U-03FFFFFF = fc 83 bf bf bf bf = "真真" | | 4.3 Overlong representation of the NUL character | | The following five sequences should also be rejected like malformed | UTF-8 sequences and should not be treated like the ASCII NUL | character. | | 4.3.1 U+0000 = c0 80 = "" | 4.3.2 U+0000 = e0 80 80 = "" | 4.3.3 U+0000 = f0 80 80 80 = "" | 4.3.4 U+0000 = f8 80 80 80 80 = "" | 4.3.5 U+0000 = fc 80 80 80 80 80 = "" | | 5 Illegal code positions | | The following UTF-8 sequences should be rejected like malformed | sequences, because they never represent valid ISO 10646 characters and | a UTF-8 decoder that accepts them might introduce security problems | comparable to overlong UTF-8 sequences. | | 5.1 Single UTF-16 surrogates | | 5.1.1 U+D800 = ed a0 80 = "" | 5.1.2 U+DB7F = ed ad bf = "蹲" | 5.1.3 U+DB80 = ed ae 80 = "蹼" | 5.1.4 U+DBFF = ed af bf = "躁" | 5.1.5 U+DC00 = ed b0 80 = "躇" | 5.1.6 U+DF80 = ed be 80 = "躱" | 5.1.7 U+DFFF = ed bf bf = "躾" | | 5.2 Paired UTF-16 surrogates | | 5.2.1 U+D800 U+DC00 = ed a0 80 ed b0 80 = "躇" | 5.2.2 U+D800 U+DFFF = ed a0 80 ed bf bf = "躾" | 5.2.3 U+DB7F U+DC00 = ed ad bf ed b0 80 = "蹲錐" | 5.2.4 U+DB7F U+DFFF = ed ad bf ed bf bf = "蹲錐真" | 5.2.5 U+DB80 U+DC00 = ed ae 80 ed b0 80 = "蹼躇" | 5.2.6 U+DB80 U+DFFF = ed ae 80 ed bf bf = "蹼躾" | 5.2.7 U+DBFF U+DC00 = ed af bf ed b0 80 = "躁錐" | 5.2.8 U+DBFF U+DFFF = ed af bf ed bf bf = "躁錐真" | | 5.3 Other illegal code positions | | 5.3.1 U+FFFE = ef bf be = "鐃" | 5.3.2 U+FFFF = ef bf bf = "鐃" | | THE END | netsurf-all-3.2/libparserutils/test/data/cscodec-utf16/0000755000175000017500000000000012377713350022116 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/cscodec-utf16/INDEX0000644000175000017500000000017712377676760022732 0ustar vincevince# Index file for UTF-16 charset codec tests # # Test Description simple.dat Simple tests, designed to validate testdriver netsurf-all-3.2/libparserutils/test/data/cscodec-utf16/simple.dat0000644000175000017500000000107612377676760024122 0ustar vincevince# *** Simple test: #data decode STRICT @䅂 #expected PARSERUTILS_OK @䅂 #reset # *** Surrogate test: #data decode STRICT �� #expected PARSERUTILS_OK 𐌂 #reset # *** Lonely high surrogate: # This is a bit strange that end status is ok. #data decode STRICT � #expected PARSERUTILS_OK #reset # With an extra code point, the status is different. #data decode STRICT �䅂 #expected PARSERUTILS_INVALID #reset # *** Wrong low surrogate start: #data decode STRICT � #expected PARSERUTILS_INVALID #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/0000755000175000017500000000000012377713347021574 5ustar vincevincenetsurf-all-3.2/libparserutils/test/data/cscodec-8859/1.dat0000644000175000017500000000445212377676760022442 0ustar vincevince#enc ISO-8859-1 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/7.dat0000644000175000017500000000441412377676760022446 0ustar vincevince#enc ISO-8859-7 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   z  #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~   z  #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰嘖孛忤掣桀毳烙痰邃繙艾蜉謖邇關髓齡 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/6.dat0000644000175000017500000000355012377676760022445 0ustar vincevince#enc ISO-8859-6 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~が賛疎団兎波品北洋椀冫嘖孛忤掣珀矣粤肄蓍裨跋鈿韵 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:@ABCDEFGHIJKLMNOPQR #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:@ABCDEFGHIJKLMNOPQR #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~が賛疎団兎波品北洋椀冫嘖孛忤掣珀矣粤肄蓍裨跋鈿韵 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/11.dat0000644000175000017500000000433312377676760022521 0ustar vincevince#enc ISO-8859-11 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵昊珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵昊珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/5.dat0000644000175000017500000000445212377676760022446 0ustar vincevince#enc ISO-8859-5 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO!QRSTUVWXYZ[\^_ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO!QRSTUVWXYZ[\^_ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/13.dat0000644000175000017500000000445312377676760022526 0ustar vincevince#enc ISO-8859-13 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  V W. y"6*;`CELrAZj{}/ z#7+<aDFMsB[k|~  #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  V W. y"6*;`CELrAZj{}/ z#7+<aDFMsB[k|~  #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/8.dat0000644000175000017500000000370212377676760022446 0ustar vincevince#enc ISO-8859-8 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~■ぅΗ┤葦桶患況弦沙悉醤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~■ぅΗ┤葦桶患況弦沙悉醤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/3.dat0000644000175000017500000000433212377676760022441 0ustar vincevince#enc ISO-8859-3 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、うЖ葦桶患況弦沙漆請堕兎波品北洋湾厶壞嶐慵无槿渤珀矮繙艾蜉謖邇闡鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&$0^4{'%1_5|  l\  !m] #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~&$0^4{'%1_5|  l\  !m] #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、うЖ葦桶患況弦沙漆請堕兎波品北洋湾厶壞嶐慵无槿渤珀矮繙艾蜉謖邇闡鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/INDEX0000644000175000017500000000054612377676760022402 0ustar vincevince# Index file for charset codec tests # # Test Description 1.dat ISO-8859-1 2.dat ISO-8859-2 3.dat ISO-8859-3 4.dat ISO-8859-4 5.dat ISO-8859-5 6.dat ISO-8859-6 7.dat ISO-8859-7 8.dat ISO-8859-8 9.dat ISO-8859-9 10.dat ISO-8859-10 11.dat ISO-8859-11 13.dat ISO-8859-13 14.dat ISO-8859-14 15.dat ISO-8859-15 16.dat ISO-8859-16 netsurf-all-3.2/libparserutils/test/data/cscodec-8859/14.dat0000644000175000017500000000445312377676760022527 0ustar vincevince#enc ISO-8859-14 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    x !@AVW`atjvukw #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~    x !@AVW`atjvukw #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/2.dat0000644000175000017500000000445212377676760022443 0ustar vincevince#enc ISO-8859-2 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~A=Z`^dy}{B>[a_ez~|T9 CGPXnpbU: DHQYoqc #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~A=Z`^dy}{B>[a_ez~|T9 CGPXnpbU: DHQYoqc #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/15.dat0000644000175000017500000000445312377676760022530 0ustar vincevince#enc ISO-8859-15 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ `a}~RSx #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ `a}~RSx #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/9.dat0000644000175000017500000000445212377676760022452 0ustar vincevince#enc ISO-8859-9 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0^1_ #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~0^1_ #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/4.dat0000644000175000017500000000445212377676760022445 0ustar vincevince#enc ISO-8859-4 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~8V(;`"f}W)<a#gJ~K. *EL6rhj/ +FM7sik #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~8V(;`"f}W)<a#gJ~K. *EL6rhj/ +FM7sik #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/10.dat0000644000175000017500000000445312377676760022523 0ustar vincevince#enc ISO-8859-10 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"*(6;`f}jJ#+)7<ag~ kK. ELhr/ FMis8 #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"*(6;`f}jJ#+)7<ag~ kK. ELhr/ FMis8 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/data/cscodec-8859/16.dat0000644000175000017500000000445312377676760022531 0ustar vincevince#enc ISO-8859-16 #data decode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~A `ayz{ B} ~ RSx|CPZpDQ[q #reset #data encode LOOSE   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~A `ayz{ B} ~ RSx|CPZpDQ[q #expected CHARSET_OK   !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~、ぅΗ┤葦桶患況弦沙悉梢請唾津毒班碧麺力佰厶壞嶐慵无槿渤珀矣粤肄蓍裨跋鈿韵鴦 #reset netsurf-all-3.2/libparserutils/test/README0000644000175000017500000000452312377676760017540 0ustar vincevinceLibcharset testcases ==================== Testcases for Libcharset are self-contained binaries which test various parts of the charset library. These may make use of external data files to drive the testing. Testcase command lines ---------------------- Testcase command lines are in a unified format, thus: [ ] The aliases file parameter will always be specified (as it is required for the library to work at all). The data file parameter is optional and may be provided on a test-by-test basis. Testcase output --------------- Testcases may output anything at all to stdout. The final line of the output must begin with either PASS or FAIL (case sensitive), indicating the success status of the test. Test Index ---------- In the test sources directory, is a file, named INDEX, which provides an index of all available test binaries. Any new test applications should be added to this index as they are created. The test index file format is as follows: file = *line line = ( entry / comment / blank ) LF entry = testname 1*HTAB description [ 1*HTAB datadir ] comment = "#" *non-newline blank = 0 testname = 1*non-reserved description = 1*non-reserved datadir = 1*non-reserved non-newline = VCHAR / WSP non-reserved = VCHAR / SP Each entry contains a mandatory binary name and description followed by an optional data directory specifier. The data directory specifier is used to state the name of the directory containing data files for the test name. This directory will be searched for within the "data" directory in the source tree. If a data directory is specified, the test binary will be invoked for each data file listed within the data directory INDEX, passing the filename as the second parameter (, above). Data Index ---------- Each test data directory contains a file, named INDEX, which provides an index of all available test data files. The data index file format is as follows: file = *line line = ( entry / comment / blank ) LF entry = dataname 1*HTAB description comment = "#" *non-newline blank = 0 dataname = 1*non-reserved description = 1*non-reserved non-newline = VCHAR / WSP non-reserved = VCHAR / SP Each entry contains a mandatory data file name and description. netsurf-all-3.2/libparserutils/test/INDEX0000644000175000017500000000060212377676760017444 0ustar vincevince# Index for testcases # # Test Description DataDir aliases Encoding alias handling cscodec-utf8 UTF-8 charset codec implementation cscodec-utf8 cscodec-utf16 UTF-16 charset codec implementation cscodec-utf16 cscodec-ext8 Extended 8bit charset codec cscodec-ext8 cscodec-8859 ISO-8859-n codec cscodec-8859 filter Input stream filtering inputstream Inputstream handling input netsurf-all-3.2/libparserutils/test/inputstream.c0000644000175000017500000000370012377676760021373 0ustar vincevince#include #include #include #include #include #include "utils/utils.h" #include "testutils.h" #ifdef __riscos const char * const __dynamic_da_name = "InputStream"; int __dynamic_da_max_size = 128*1024*1024; #endif int main(int argc, char **argv) { parserutils_inputstream *stream; FILE *fp; size_t len; #define CHUNK_SIZE (4096) uint8_t buf[CHUNK_SIZE]; const uint8_t *c; size_t clen; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } assert(parserutils_inputstream_create("UTF-8", 1, NULL, &stream) == PARSERUTILS_OK); fp = fopen(argv[1], "rb"); if (fp == NULL) { printf("Failed opening %s\n", argv[1]); return 1; } fseek(fp, 0, SEEK_END); len = ftell(fp); fseek(fp, 0, SEEK_SET); while (len >= CHUNK_SIZE) { size_t read = fread(buf, 1, CHUNK_SIZE, fp); assert(read == CHUNK_SIZE); assert(parserutils_inputstream_append(stream, buf, CHUNK_SIZE) == PARSERUTILS_OK); len -= CHUNK_SIZE; while (parserutils_inputstream_peek(stream, 0, &c, &clen) != PARSERUTILS_NEEDDATA) { parserutils_inputstream_advance(stream, clen); if (*c == 'a') { assert(parserutils_inputstream_insert(stream, (const uint8_t *) "hello!!!", SLEN("hello!!!")) == PARSERUTILS_OK); } } } if (len > 0) { size_t read = fread(buf, 1, len, fp); assert(read == len); assert(parserutils_inputstream_append(stream, buf, len) == PARSERUTILS_OK); len = 0; } fclose(fp); assert(parserutils_inputstream_insert(stream, (const uint8_t *) "hello!!!", SLEN("hello!!!")) == PARSERUTILS_OK); assert(parserutils_inputstream_append(stream, NULL, 0) == PARSERUTILS_OK); while (parserutils_inputstream_peek(stream, 0, &c, &clen) != PARSERUTILS_EOF) { parserutils_inputstream_advance(stream, clen); } parserutils_inputstream_destroy(stream); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/cscodec-ext8.c0000644000175000017500000001360512377676760021316 0ustar vincevince#include #include #include #include #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { parserutils_charset_codec *codec; size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; uint8_t *exp; bool hadenc; bool indata; bool inexp; parserutils_error exp_ret; enum { ENCODE, DECODE, BOTH } dir; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(line_ctx *ctx); int main(int argc, char **argv) { parserutils_charset_codec *codec; line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } assert(parserutils_charset_codec_create("NATS-SEFI-ADD", &codec) == PARSERUTILS_BADENCODING); ctx.buflen = parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(2 * ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.exp = ctx.buf + ctx.buflen; ctx.explen = ctx.buflen; ctx.buf[0] = '\0'; ctx.exp[0] = '\0'; ctx.bufused = 0; ctx.expused = 0; ctx.hadenc = false; ctx.indata = false; ctx.inexp = false; ctx.exp_ret = PARSERUTILS_OK; assert(parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') ctx.bufused -= 1; if (ctx.expused > 0 && ctx.exp[ctx.expused - 1] == '\n') ctx.expused -= 1; run_test(&ctx); free(ctx.buf); parserutils_charset_codec_destroy(ctx.codec); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ if (ctx->buf[ctx->bufused - 1] == '\n') ctx->bufused -= 1; if (ctx->exp[ctx->expused - 1] == '\n') ctx->expused -= 1; run_test(ctx); ctx->buf[0] = '\0'; ctx->exp[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; ctx->exp_ret = PARSERUTILS_OK; } if (strncasecmp(data+1, "data", 4) == 0) { parserutils_charset_codec_optparams params; const char *ptr = data + 6; ctx->indata = true; ctx->inexp = false; if (strncasecmp(ptr, "decode", 6) == 0) ctx->dir = DECODE; else if (strncasecmp(ptr, "encode", 6) == 0) ctx->dir = ENCODE; else ctx->dir = BOTH; ptr += 7; if (strncasecmp(ptr, "LOOSE", 5) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE; ptr += 6; } else if (strncasecmp(ptr, "STRICT", 6) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_STRICT; ptr += 7; } else { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT; ptr += 9; } assert(parserutils_charset_codec_setopt(ctx->codec, PARSERUTILS_CHARSET_CODEC_ERROR_MODE, (parserutils_charset_codec_optparams *) ¶ms) == PARSERUTILS_OK); } else if (strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; ctx->exp_ret = parserutils_error_from_string(data + 10, datalen - 10 - 1 /* \n */); } else if (strncasecmp(data+1, "reset", 5) == 0) { ctx->indata = false; ctx->inexp = false; parserutils_charset_codec_reset(ctx->codec); } else if (strncasecmp(data+1, "enc", 3) == 0) { const char *enc = data + 5; const char *end; char *enc_name; for (end = enc; !isspace(*end); end++) ; enc_name = malloc(end - enc + 1); memcpy(enc_name, enc, end - enc); enc_name[end - enc] = 0; assert(parserutils_charset_codec_create(enc_name, &ctx->codec) == PARSERUTILS_OK); ctx->hadenc = true; free(enc_name); } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { memcpy(ctx->exp + ctx->expused, data, datalen); ctx->expused += datalen; } } return true; } void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; size_t i; if (ctx->dir == DECODE) { assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else if (ctx->dir == ENCODE) { assert(parserutils_charset_codec_encode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &ptemp, &templen) == ctx->exp_ret); /* \todo currently there is no way to specify the number of consumed & produced data in case of a deliberate bad input data set. */ if (ctx->exp_ret == PARSERUTILS_OK) { assert(temp + (ctx->bufused * 4 - templen) == ptemp); } ptemp2 = temp; templen2 = ctx->bufused * 4 - templen; assert(parserutils_charset_codec_encode(ctx->codec, &ptemp2, &templen2, &pdest, &destlen) == ctx->exp_ret); if (ctx->exp_ret == PARSERUTILS_OK) { assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); assert(ctx->buf + ctx->bufused == psrc); assert(dest + (ctx->bufused * 4 - destlen) == pdest); assert(ctx->bufused * 4 - destlen == ctx->expused); } printf("%d: Read '", ++testnum); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(dest[i] >> 4) & 0xf], "0123456789abcdef"[dest[i] & 0xf]); } printf("' Expected '"); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(ctx->exp[i] >> 4) & 0xf], "0123456789abcdef"[ctx->exp[i] & 0xf]); } printf("'\n"); assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); free(dest); } netsurf-all-3.2/libparserutils/test/cscodec-utf8.c0000644000175000017500000001301412377676760021306 0ustar vincevince#include #include #include #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { parserutils_charset_codec *codec; size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; uint8_t *exp; bool indata; bool inexp; parserutils_error exp_ret; enum { ENCODE, DECODE, BOTH } dir; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(line_ctx *ctx); int main(int argc, char **argv) { parserutils_charset_codec *codec; line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } assert(parserutils_charset_codec_create("NATS-SEFI-ADD", &codec) == PARSERUTILS_BADENCODING); assert(parserutils_charset_codec_create("UTF-8", &ctx.codec) == PARSERUTILS_OK); ctx.buflen = parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(2 * ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.exp = ctx.buf + ctx.buflen; ctx.explen = ctx.buflen; ctx.buf[0] = '\0'; ctx.exp[0] = '\0'; ctx.bufused = 0; ctx.expused = 0; ctx.indata = false; ctx.inexp = false; ctx.exp_ret = PARSERUTILS_OK; assert(parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') ctx.bufused -= 1; if (ctx.expused > 0 && ctx.exp[ctx.expused - 1] == '\n') ctx.expused -= 1; run_test(&ctx); free(ctx.buf); parserutils_charset_codec_destroy(ctx.codec); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ if (ctx->buf[ctx->bufused - 1] == '\n') ctx->bufused -= 1; if (ctx->exp[ctx->expused - 1] == '\n') ctx->expused -= 1; run_test(ctx); ctx->buf[0] = '\0'; ctx->exp[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; ctx->exp_ret = PARSERUTILS_OK; } if (strncasecmp(data+1, "data", 4) == 0) { parserutils_charset_codec_optparams params; const char *ptr = data + 6; ctx->indata = true; ctx->inexp = false; if (strncasecmp(ptr, "decode", 6) == 0) ctx->dir = DECODE; else if (strncasecmp(ptr, "encode", 6) == 0) ctx->dir = ENCODE; else ctx->dir = BOTH; ptr += 7; if (strncasecmp(ptr, "LOOSE", 5) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE; ptr += 6; } else if (strncasecmp(ptr, "STRICT", 6) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_STRICT; ptr += 7; } else { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT; ptr += 9; } assert(parserutils_charset_codec_setopt(ctx->codec, PARSERUTILS_CHARSET_CODEC_ERROR_MODE, (parserutils_charset_codec_optparams *) ¶ms) == PARSERUTILS_OK); } else if (strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; ctx->exp_ret = parserutils_error_from_string(data + 10, datalen - 10 - 1 /* \n */); } else if (strncasecmp(data+1, "reset", 5) == 0) { ctx->indata = false; ctx->inexp = false; parserutils_charset_codec_reset(ctx->codec); } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { memcpy(ctx->exp + ctx->expused, data, datalen); ctx->expused += datalen; } } return true; } void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; size_t i; if (ctx->dir == DECODE) { assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else if (ctx->dir == ENCODE) { assert(parserutils_charset_codec_encode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &ptemp, &templen) == ctx->exp_ret); /* \todo currently there is no way to specify the number of consumed & produced data in case of a deliberate bad input data set. */ if (ctx->exp_ret == PARSERUTILS_OK) { assert(temp + (ctx->bufused * 4 - templen) == ptemp); } ptemp2 = temp; templen2 = ctx->bufused * 4 - templen; assert(parserutils_charset_codec_encode(ctx->codec, &ptemp2, &templen2, &pdest, &destlen) == ctx->exp_ret); if (ctx->exp_ret == PARSERUTILS_OK) { assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); assert(ctx->buf + ctx->bufused == psrc); assert(dest + (ctx->bufused * 4 - destlen) == pdest); assert(ctx->bufused * 4 - destlen == ctx->expused); } printf("%d: Read '", ++testnum); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(dest[i] >> 4) & 0xf], "0123456789abcdef"[dest[i] & 0xf]); } printf("' Expected '"); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(ctx->exp[i] >> 4) & 0xf], "0123456789abcdef"[ctx->exp[i] & 0xf]); } printf("'\n"); assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); free(dest); } netsurf-all-3.2/libparserutils/test/filter.c0000644000175000017500000002201012377676760020300 0ustar vincevince#include #include #include #include #include #include "utils/utils.h" #include "input/filter.h" #include "testutils.h" int main(int argc, char **argv) { parserutils_filter_optparams params; parserutils_filter *input; uint8_t inbuf[64], outbuf[64]; size_t inlen, outlen; const uint8_t *in = inbuf; uint8_t *out = outbuf; UNUSED(argc); UNUSED(argv); /* Create input filter */ assert(parserutils__filter_create("UTF-8", &input) == PARSERUTILS_OK); /* Convert filter to UTF-8 encoding */ params.encoding.name = "UTF-8"; assert(parserutils__filter_setopt(input, PARSERUTILS_FILTER_SET_ENCODING, (parserutils_filter_optparams *) ¶ms) == PARSERUTILS_OK); /* Simple case - valid input & output buffer large enough */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xa0o!"); inlen = strlen((const char *) inbuf); outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xc2\xa0o!", SLEN("hell\xc2\xa0o!")) == 0); /* Too small an output buffer; no encoding edge cases */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hello!"); inlen = strlen((const char *) inbuf); outbuf[0] = '\0'; outlen = 5; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_NOMEM); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); outlen = 64 - 5 + outlen; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hello!", SLEN("hello!")) == 0); /* Illegal input sequence; output buffer large enough */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\x96o!"); inlen = strlen((const char *) inbuf); outbuf[0] = '\0'; outlen = 64; /* Input does loose decoding, converting to U+FFFD if illegal * input is encountered */ assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xef\xbf\xbdo!", SLEN("hell\xef\xbf\xbdo!")) == 0); /* Input ends mid-sequence */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xa0o!"); inlen = strlen((const char *) inbuf) - 3; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xc2\xa0o!", SLEN("hell\xc2\xa0o!")) == 0); /* Input ends mid-sequence, but second attempt has too small a * buffer, but large enough to write out the incomplete character. */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xa0o!"); inlen = strlen((const char *) inbuf) - 3; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; outlen = 3; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_NOMEM); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); outlen = 64 - 7; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xc2\xa0o!", SLEN("hell\xc2\xa0o!")) == 0); /* Input ends mid-sequence, but second attempt has too small a * buffer, not large enough to write out the incomplete character. */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xa0o!"); inlen = strlen((const char *) inbuf) - 3; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; outlen = 1; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_NOMEM); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); outlen = 60; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xc2\xa0o!", SLEN("hell\xc2\xa0o!")) == 0); /* Input ends mid-sequence, but second attempt contains * invalid character */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xc2o!"); inlen = strlen((const char *) inbuf) - 3; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; /* Input does loose decoding, converting to U+FFFD if illegal * input is encountered */ assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xef\xbf\xbd\xef\xbf\xbdo!", SLEN("hell\xef\xbf\xbd\xef\xbf\xbdo!")) == 0); /* Input ends mid-sequence, but second attempt contains another * incomplete character */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xc2\xa0\xc2\xa1o!"); inlen = strlen((const char *) inbuf) - 5; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 2; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xc2\xa0\xc2\xa1o!", SLEN("hell\xc2\xa0\xc2\xa1o!")) == 0); /* Input ends mid-sequence, but second attempt contains insufficient * data to complete the incomplete character */ in = inbuf; out = outbuf; strcpy((char *) inbuf, "hell\xe2\x80\xa2o!"); inlen = strlen((const char *) inbuf) - 4; outbuf[0] = '\0'; outlen = 64; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 1; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); inlen += 3; assert(parserutils__filter_process_chunk(input, &in, &inlen, &out, &outlen) == PARSERUTILS_OK); printf("'%.*s' %d '%.*s' %d\n", (int) inlen, in, (int) inlen, (int) (out - ((uint8_t *) outbuf)), outbuf, (int) outlen); assert(parserutils__filter_reset(input) == PARSERUTILS_OK); assert(memcmp(outbuf, "hell\xe2\x80\xa2o!", SLEN("hell\xe2\x80\xa2o!")) == 0); /* Clean up */ parserutils__filter_destroy(input); printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/testutils.h0000644000175000017500000000461512377676760021073 0ustar vincevince#ifndef test_testutils_h_ #define test_testutils_h_ #include #include #include #ifndef UNUSED #define UNUSED(x) ((x) = (x)) #endif /* Redefine assert, so we can simply use the standard assert mechanism * within testcases and exit with the right output for the testrunner * to do the right thing. */ void __assert2(const char *expr, const char *function, const char *file, int line); void __assert2(const char *expr, const char *function, const char *file, int line) { UNUSED(function); UNUSED(file); printf("FAIL - %s at line %d\n", expr, line); exit(EXIT_FAILURE); } #define assert(expr) \ ((void) ((expr) || (__assert2 (#expr, __func__, __FILE__, __LINE__), 0))) typedef bool (*line_func)(const char *data, size_t datalen, void *pw); static size_t parse_strlen(const char *str, size_t limit); bool parse_testfile(const char *filename, line_func callback, void *pw); size_t parse_filesize(const char *filename); /** * Testcase datafile parser driver * * \param filename Name of file to parse * \param callback Pointer to function to handle each line of input data * \param pw Pointer to client-specific private data * \return true on success, false otherwise. */ bool parse_testfile(const char *filename, line_func callback, void *pw) { FILE *fp; char buf[300]; fp = fopen(filename, "rb"); if (fp == NULL) { printf("Failed opening %s\n", filename); return false; } while (fgets(buf, sizeof buf, fp)) { if (buf[0] == '\n') continue; if (!callback(buf, parse_strlen(buf, sizeof buf - 1), pw)) { fclose(fp); return false; } } fclose(fp); return true; } /** * Utility string length measurer; assumes strings are '\n' terminated * * \param str String to measure length of * \param limit Upper bound on string length * \return String length */ size_t parse_strlen(const char *str, size_t limit) { size_t len = 0; if (str == NULL) return 0; while (len < limit - 1 && *str != '\n') { len++; str++; } len++; return len; } /** * Read the size of a file * * \param filename Name of file to read size of * \return File size (in bytes), or 0 on error */ size_t parse_filesize(const char *filename) { FILE *fp; size_t len = 0; fp = fopen(filename, "rb"); if (fp == NULL) { printf("Failed opening %s\n", filename); return 0; } fseek(fp, 0, SEEK_END); len = ftell(fp); fclose(fp); return len; } #endif netsurf-all-3.2/libparserutils/test/Makefile0000644000175000017500000000036512377676760020320 0ustar vincevince# Tests DIR_TEST_ITEMS := aliases:aliases.c cscodec-8859:cscodec-8859.c \ cscodec-ext8:cscodec-ext8.c cscodec-utf8:cscodec-utf8.c \ cscodec-utf16:cscodec-utf16.c filter:filter.c \ inputstream:inputstream.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/test/aliases.c0000644000175000017500000000247212377676760020446 0ustar vincevince#include #include #include "charset/aliases.h" #include "testutils.h" int main (int argc, char **argv) { parserutils_charset_aliases_canon *c; UNUSED(argc); UNUSED(argv); c = parserutils__charset_alias_canonicalise("moose", 5); if (c) { printf("FAIL - found invalid encoding 'moose'\n"); return 1; } c = parserutils__charset_alias_canonicalise("csinvariant", 11); if (c) { printf("%s %d\n", c->name, c->mib_enum); } else { printf("FAIL - failed finding encoding 'csinvariant'\n"); return 1; } c = parserutils__charset_alias_canonicalise("csinvariant\"", 12); if (c) { printf("%s %d\n", c->name, c->mib_enum); } else { printf("FAIL - failed finding encoding 'csinvariant'\n"); return 1; } c = parserutils__charset_alias_canonicalise("nats-sefi-add", 13); if (c) { printf("%s %d\n", c->name, c->mib_enum); } else { printf("FAIL - failed finding encoding 'nats-sefi-add'\n"); return 1; } printf("%d\n", parserutils_charset_mibenum_from_name(c->name, strlen(c->name))); printf("%s\n", parserutils_charset_mibenum_to_name(c->mib_enum)); c = parserutils__charset_alias_canonicalise("u.t.f.8", 7); if (c) { printf("%s %d\n", c->name, c->mib_enum); } else { printf("FAIL - failed finding encoding 'u.t.f.8'\n"); return 1; } printf("PASS\n"); return 0; } netsurf-all-3.2/libparserutils/test/cscodec-8859.c0000644000175000017500000001360512377676760021043 0ustar vincevince#include #include #include #include #include "utils/utils.h" #include "testutils.h" typedef struct line_ctx { parserutils_charset_codec *codec; size_t buflen; size_t bufused; uint8_t *buf; size_t explen; size_t expused; uint8_t *exp; bool hadenc; bool indata; bool inexp; parserutils_error exp_ret; enum { ENCODE, DECODE, BOTH } dir; } line_ctx; static bool handle_line(const char *data, size_t datalen, void *pw); static void run_test(line_ctx *ctx); int main(int argc, char **argv) { parserutils_charset_codec *codec; line_ctx ctx; if (argc != 2) { printf("Usage: %s \n", argv[0]); return 1; } assert(parserutils_charset_codec_create("NATS-SEFI-ADD", &codec) == PARSERUTILS_BADENCODING); ctx.buflen = parse_filesize(argv[1]); if (ctx.buflen == 0) return 1; ctx.buf = malloc(2 * ctx.buflen); if (ctx.buf == NULL) { printf("Failed allocating %u bytes\n", (unsigned int) ctx.buflen); return 1; } ctx.exp = ctx.buf + ctx.buflen; ctx.explen = ctx.buflen; ctx.buf[0] = '\0'; ctx.exp[0] = '\0'; ctx.bufused = 0; ctx.expused = 0; ctx.hadenc = false; ctx.indata = false; ctx.inexp = false; ctx.exp_ret = PARSERUTILS_OK; assert(parse_testfile(argv[1], handle_line, &ctx) == true); /* and run final test */ if (ctx.bufused > 0 && ctx.buf[ctx.bufused - 1] == '\n') ctx.bufused -= 1; if (ctx.expused > 0 && ctx.exp[ctx.expused - 1] == '\n') ctx.expused -= 1; run_test(&ctx); free(ctx.buf); parserutils_charset_codec_destroy(ctx.codec); printf("PASS\n"); return 0; } bool handle_line(const char *data, size_t datalen, void *pw) { line_ctx *ctx = (line_ctx *) pw; if (data[0] == '#') { if (ctx->inexp) { /* This marks end of testcase, so run it */ if (ctx->buf[ctx->bufused - 1] == '\n') ctx->bufused -= 1; if (ctx->exp[ctx->expused - 1] == '\n') ctx->expused -= 1; run_test(ctx); ctx->buf[0] = '\0'; ctx->exp[0] = '\0'; ctx->bufused = 0; ctx->expused = 0; ctx->exp_ret = PARSERUTILS_OK; } if (strncasecmp(data+1, "data", 4) == 0) { parserutils_charset_codec_optparams params; const char *ptr = data + 6; ctx->indata = true; ctx->inexp = false; if (strncasecmp(ptr, "decode", 6) == 0) ctx->dir = DECODE; else if (strncasecmp(ptr, "encode", 6) == 0) ctx->dir = ENCODE; else ctx->dir = BOTH; ptr += 7; if (strncasecmp(ptr, "LOOSE", 5) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE; ptr += 6; } else if (strncasecmp(ptr, "STRICT", 6) == 0) { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_STRICT; ptr += 7; } else { params.error_mode.mode = PARSERUTILS_CHARSET_CODEC_ERROR_TRANSLIT; ptr += 9; } assert(parserutils_charset_codec_setopt(ctx->codec, PARSERUTILS_CHARSET_CODEC_ERROR_MODE, (parserutils_charset_codec_optparams *) ¶ms) == PARSERUTILS_OK); } else if (strncasecmp(data+1, "expected", 8) == 0) { ctx->indata = false; ctx->inexp = true; ctx->exp_ret = parserutils_error_from_string(data + 10, datalen - 10 - 1 /* \n */); } else if (strncasecmp(data+1, "reset", 5) == 0) { ctx->indata = false; ctx->inexp = false; parserutils_charset_codec_reset(ctx->codec); } else if (strncasecmp(data+1, "enc", 3) == 0) { const char *enc = data + 5; const char *end; char *enc_name; for (end = enc; !isspace(*end); end++) ; enc_name = malloc(end - enc + 1); memcpy(enc_name, enc, end - enc); enc_name[end - enc] = 0; assert(parserutils_charset_codec_create(enc_name, &ctx->codec) == PARSERUTILS_OK); ctx->hadenc = true; free(enc_name); } } else { if (ctx->indata) { memcpy(ctx->buf + ctx->bufused, data, datalen); ctx->bufused += datalen; } if (ctx->inexp) { memcpy(ctx->exp + ctx->expused, data, datalen); ctx->expused += datalen; } } return true; } void run_test(line_ctx *ctx) { static int testnum; size_t destlen = ctx->bufused * 4; uint8_t *dest = malloc(destlen); uint8_t *pdest = dest; const uint8_t *psrc = ctx->buf; size_t srclen = ctx->bufused; size_t i; if (ctx->dir == DECODE) { assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else if (ctx->dir == ENCODE) { assert(parserutils_charset_codec_encode(ctx->codec, &psrc, &srclen, &pdest, &destlen) == ctx->exp_ret); } else { size_t templen = ctx->bufused * 4; uint8_t *temp = malloc(templen); uint8_t *ptemp = temp; const uint8_t *ptemp2; size_t templen2; assert(parserutils_charset_codec_decode(ctx->codec, &psrc, &srclen, &ptemp, &templen) == ctx->exp_ret); /* \todo currently there is no way to specify the number of consumed & produced data in case of a deliberate bad input data set. */ if (ctx->exp_ret == PARSERUTILS_OK) { assert(temp + (ctx->bufused * 4 - templen) == ptemp); } ptemp2 = temp; templen2 = ctx->bufused * 4 - templen; assert(parserutils_charset_codec_encode(ctx->codec, &ptemp2, &templen2, &pdest, &destlen) == ctx->exp_ret); if (ctx->exp_ret == PARSERUTILS_OK) { assert(templen2 == 0); assert(temp + (ctx->bufused * 4 - templen) == ptemp2); } free(temp); } if (ctx->exp_ret == PARSERUTILS_OK) { assert(srclen == 0); assert(ctx->buf + ctx->bufused == psrc); assert(dest + (ctx->bufused * 4 - destlen) == pdest); assert(ctx->bufused * 4 - destlen == ctx->expused); } printf("%d: Read '", ++testnum); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(dest[i] >> 4) & 0xf], "0123456789abcdef"[dest[i] & 0xf]); } printf("' Expected '"); for (i = 0; i < ctx->expused; i++) { printf("%c%c ", "0123456789abcdef"[(ctx->exp[i] >> 4) & 0xf], "0123456789abcdef"[ctx->exp[i] & 0xf]); } printf("'\n"); assert(pdest == dest + ctx->expused); assert(memcmp(dest, ctx->exp, ctx->expused) == 0); free(dest); } netsurf-all-3.2/libparserutils/build/0000755000175000017500000000000012377713347016765 5ustar vincevincenetsurf-all-3.2/libparserutils/build/make-aliases.pl0000644000175000017500000000604512377676760021672 0ustar vincevince#!/usr/bin/perl -w # This file is part of LibParserUtils. # Licensed under the MIT License, # http://www.opensource.org/licenses/mit-license.php # Copyright 2010 Daniel Silverstone # John-Mark Bell use strict; use constant ALIAS_FILE => 'build/Aliases'; use constant ALIAS_INC => 'src/charset/aliases.inc'; use constant UNICODE_CHARSETS => [ qr'^ISO-10646-UCS-[24]$', qr'^UTF-16', qr'^UTF-8$', qr'^UTF-32' ]; open(INFILE, "<", ALIAS_FILE) || die "Unable to open " . ALIAS_FILE; my %charsets; while (my $line = ) { last unless (defined $line); next if ($line =~ /^#/); chomp $line; next if ($line eq ''); my @elements = split /\s+/, $line; my $canon = shift @elements; my $mibenum = shift @elements; $charsets{$canon} = [$mibenum, \@elements]; } close(INFILE); my $unicodeexp = ""; my $output = <<'EOH'; /* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2010 The NetSurf Project. * * Note: This file is automatically generated by make-aliases.pl * * Do not edit file file, changes will be overwritten during build. */ static parserutils_charset_aliases_canon canonical_charset_names[] = { EOH my %aliases; my $canonnr = 0; foreach my $canon (sort keys %charsets) { my ($mibenum, $elements) = @{$charsets{$canon}}; # Ordering must match struct in src/charset/aliases.h $output .= "\t{ " . $mibenum . ", " . length($canon) . ', "' . $canon . '" },' . "\n"; my $isunicode = 0; foreach my $unirexp (@{UNICODE_CHARSETS()}) { $isunicode = 1 if ($canon =~ $unirexp); } if ($isunicode == 1) { $unicodeexp .= "((x) == $mibenum) || "; } $canon =~ y/A-Z/a-z/; $canon =~ s/[^a-z0-9]//g; $aliases{$canon} = $canonnr; foreach my $alias (@$elements) { $alias =~ y/A-Z/a-z/; $alias =~ s/[^a-z0-9]//g; $aliases{$alias} = $canonnr; } $canonnr += 1; } $output .= "};\n\nstatic const uint16_t charset_aliases_canon_count = ${canonnr};\n\n"; $output .= <<'EOT'; typedef struct { uint16_t name_len; const char *name; parserutils_charset_aliases_canon *canon; } parserutils_charset_aliases_alias; static parserutils_charset_aliases_alias charset_aliases[] = { EOT my $aliascount = 0; foreach my $alias (sort keys %aliases) { my $canonnr = $aliases{$alias}; $output .= "\t{ " . length($alias) . ', "' . $alias . '", &canonical_charset_names[' . $canonnr . "] },\n"; $aliascount += 1; } $output .= "};\n\n"; # Drop the final " || " chop $unicodeexp; chop $unicodeexp; chop $unicodeexp; chop $unicodeexp; $output .= <<"EOS"; static const uint16_t charset_aliases_count = ${aliascount}; #define MIBENUM_IS_UNICODE(x) ($unicodeexp) EOS if (open(EXISTING, "<", ALIAS_INC)) { local $/ = undef(); my $now = ; undef($output) if ($output eq $now); close(EXISTING); } if (defined($output)) { open(OUTF, ">", ALIAS_INC); print OUTF $output; close(OUTF); } netsurf-all-3.2/libparserutils/build/Aliases0000644000175000017500000003066612377676760020313 0ustar vincevince# > Unicode:Files.Aliases # Mapping of character set encoding names to their canonical form # # Lines starting with a '#' are comments, blank lines are ignored. # # Based on http://www.iana.org/assignments/character-sets and # http://www.iana.org/assignments/ianacharset-mib # # Canonical Form MIBenum Aliases... # US-ASCII 3 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII ISO646-US ANSI_X3.4-1968 us IBM367 cp367 csASCII ISO-10646-UTF-1 27 csISO10646UTF1 ISO_646.basic:1983 28 ref csISO646basic1983 INVARIANT 29 csINVARIANT ISO_646.irv:1983 30 iso-ir-2 irv csISO2IntlRefVersion BS_4730 20 iso-ir-4 ISO646-GB gb uk csISO4UnitedKingdom NATS-SEFI 31 iso-ir-8-1 csNATSSEFI NATS-SEFI-ADD 32 iso-ir-8-2 csNATSSEFIADD NATS-DANO 33 iso-ir-9-1 csNATSDANO NATS-DANO-ADD 34 iso-ir-9-2 csNATSDANOADD SEN_850200_B 35 iso-ir-10 FI ISO646-FI ISO646-SE se csISO10Swedish SEN_850200_C 21 iso-ir-11 ISO646-SE2 se2 csISO11SwedishForNames KS_C_5601-1987 36 iso-ir-149 KS_C_5601-1989 KSC_5601 korean csKSC56011987 ISO-2022-KR 37 csISO2022KR EUC-KR 38 csEUCKR EUCKR ISO-2022-JP 39 csISO2022JP ISO-2022-JP-2 40 csISO2022JP2 ISO-2022-CN 104 ISO-2022-CN-EXT 105 JIS_C6220-1969-jp 41 JIS_C6220-1969 iso-ir-13 katakana x0201-7 csISO13JISC6220jp JIS_C6220-1969-ro 42 iso-ir-14 jp ISO646-JP csISO14JISC6220ro IT 22 iso-ir-15 ISO646-IT csISO15Italian PT 43 iso-ir-16 ISO646-PT csISO16Portuguese ES 23 iso-ir-17 ISO646-ES csISO17Spanish greek7-old 44 iso-ir-18 csISO18Greek7Old latin-greek 45 iso-ir-19 csISO19LatinGreek DIN_66003 24 iso-ir-21 de ISO646-DE csISO21German NF_Z_62-010_(1973) 46 iso-ir-25 ISO646-FR1 csISO25French Latin-greek-1 47 iso-ir-27 csISO27LatinGreek1 ISO_5427 48 iso-ir-37 csISO5427Cyrillic JIS_C6226-1978 49 iso-ir-42 csISO42JISC62261978 BS_viewdata 50 iso-ir-47 csISO47BSViewdata INIS 51 iso-ir-49 csISO49INIS INIS-8 52 iso-ir-50 csISO50INIS8 INIS-cyrillic 53 iso-ir-51 csISO51INISCyrillic ISO_5427:1981 54 iso-ir-54 ISO5427Cyrillic1981 ISO_5428:1980 55 iso-ir-55 csISO5428Greek GB_1988-80 56 iso-ir-57 cn ISO646-CN csISO57GB1988 GB_2312-80 57 iso-ir-58 chinese csISO58GB231280 NS_4551-1 25 iso-ir-60 ISO646-NO no csISO60DanishNorwegian csISO60Norwegian1 NS_4551-2 58 ISO646-NO2 iso-ir-61 no2 csISO61Norwegian2 NF_Z_62-010 26 iso-ir-69 ISO646-FR fr csISO69French videotex-suppl 59 iso-ir-70 csISO70VideotexSupp1 PT2 60 iso-ir-84 ISO646-PT2 csISO84Portuguese2 ES2 61 iso-ir-85 ISO646-ES2 csISO85Spanish2 MSZ_7795.3 62 iso-ir-86 ISO646-HU hu csISO86Hungarian JIS_C6226-1983 63 iso-ir-87 x0208 JIS_X0208-1983 csISO87JISX0208 greek7 64 iso-ir-88 csISO88Greek7 ASMO_449 65 ISO_9036 arabic7 iso-ir-89 csISO89ASMO449 iso-ir-90 66 csISO90 JIS_C6229-1984-a 67 iso-ir-91 jp-ocr-a csISO91JISC62291984a JIS_C6229-1984-b 68 iso-ir-92 ISO646-JP-OCR-B jp-ocr-b csISO92JISC62991984b JIS_C6229-1984-b-add 69 iso-ir-93 jp-ocr-b-add csISO93JIS62291984badd JIS_C6229-1984-hand 70 iso-ir-94 jp-ocr-hand csISO94JIS62291984hand JIS_C6229-1984-hand-add 71 iso-ir-95 jp-ocr-hand-add csISO95JIS62291984handadd JIS_C6229-1984-kana 72 iso-ir-96 csISO96JISC62291984kana ISO_2033-1983 73 iso-ir-98 e13b csISO2033 ANSI_X3.110-1983 74 iso-ir-99 CSA_T500-1983 NAPLPS csISO99NAPLPS ISO-8859-1 4 iso-ir-100 ISO_8859-1 ISO_8859-1:1987 latin1 l1 IBM819 CP819 csISOLatin1 8859_1 ISO8859-1 ISO-8859-2 5 iso-ir-101 ISO_8859-2 ISO_8859-2:1987 latin2 l2 csISOLatin2 8859_2 ISO8859-2 T.61-7bit 75 iso-ir-102 csISO102T617bit T.61-8bit 76 T.61 iso-ir-103 csISO103T618bit ISO-8859-3 6 iso-ir-109 ISO_8859-3 ISO_8859-3:1988 latin3 l3 csISOLatin3 8859_3 ISO8859-3 ISO-8859-4 7 iso-ir-110 ISO_8859-4 ISO_8859-4:1988 latin4 l4 csISOLatin4 8859_4 ISO8859-4 ECMA-cyrillic 77 iso-ir-111 KOI8-E csISO111ECMACyrillic CSA_Z243.4-1985-1 78 iso-ir-121 ISO646-CA csa7-1 ca csISO121Canadian1 CSA_Z243.4-1985-2 79 iso-ir-122 ISO646-CA2 csa7-2 csISO122Canadian2 CSA_Z243.4-1985-gr 80 iso-ir-123 csISO123CSAZ24341985gr ISO-8859-6 9 iso-ir-127 ISO_8859-6 ISO_8859-6:1987 ECMA-114 ASMO-708 arabic csISOLatinArabic ISO-8859-6-E 81 csISO88596E ISO_8859-6-E ISO-8859-6-I 82 csISO88596I ISO_8859-6-I ISO-8859-7 10 iso-ir-126 ISO_8859-7 ISO_8859-7:1987 ELOT_928 ECMA-118 greek greek8 csISOLatinGreek 8859_7 ISO8859-7 T.101-G2 83 iso-ir-128 csISO128T101G2 ISO-8859-8 11 iso-ir-138 ISO_8859-8 ISO_8859-8:1988 hebrew csISOLatinHebrew 8859_8 ISO8859-8 ISO-8859-8-E 84 csISO88598E ISO_8859-8-E ISO-8859-8-I 85 csISO88598I ISO_8859-8-I CSN_369103 86 iso-ir-139 csISO139CSN369103 JUS_I.B1.002 87 iso-ir-141 ISO646-YU js yu csISO141JUSIB1002 ISO_6937-2-add 14 iso-ir-142 csISOTextComm IEC_P27-1 88 iso-ir-143 csISO143IECP271 ISO-8859-5 8 iso-ir-144 ISO_8859-5 ISO_8859-5:1988 cyrillic csISOLatinCyrillic 8859_5 ISO8859-5 JUS_I.B1.003-serb 89 iso-ir-146 serbian csISO146Serbian JUS_I.B1.003-mac 90 macedonian iso-ir-147 csISO147Macedonian ISO-8859-9 12 iso-ir-148 ISO_8859-9 ISO_8859-9:1989 latin5 l5 csISOLatin5 8859_9 ISO8859-9 greek-ccitt 91 iso-ir-150 csISO150 csISO150GreekCCITT NC_NC00-10:81 92 cuba iso-ir-151 ISO646-CU csISO151Cuba ISO_6937-2-25 93 iso-ir-152 csISO6937Add GOST_19768-74 94 ST_SEV_358-88 iso-ir-153 csISO153GOST1976874 ISO_8859-supp 95 iso-ir-154 latin1-2-5 csISO8859Supp ISO_10367-box 96 iso-ir-155 csISO10367Box ISO-8859-10 13 iso-ir-157 l6 ISO_8859-10:1992 csISOLatin6 latin6 8859_10 ISO8859-10 latin-lap 97 lap iso-ir-158 csISO158Lap JIS_X0212-1990 98 x0212 iso-ir-159 csISO159JISX02121990 DS_2089 99 DS2089 ISO646-DK dk csISO646Danish us-dk 100 csUSDK dk-us 101 csDKUS JIS_X0201 15 X0201 csHalfWidthKatakana KSC5636 102 ISO646-KR csKSC5636 ISO-10646-UCS-2 1000 csUnicode UCS-2 UCS2 ISO-10646-UCS-4 1001 csUCS4 UCS-4 UCS4 DEC-MCS 2008 dec csDECMCS hp-roman8 2004 roman8 r8 csHPRoman8 macintosh 2027 mac csMacintosh MACROMAN MAC-ROMAN X-MAC-ROMAN IBM037 2028 cp037 ebcdic-cp-us ebcdic-cp-ca ebcdic-cp-wt ebcdic-cp-nl csIBM037 IBM038 2029 EBCDIC-INT cp038 csIBM038 IBM273 2030 CP273 csIBM273 IBM274 2031 EBCDIC-BE CP274 csIBM274 IBM275 2032 EBCDIC-BR cp275 csIBM275 IBM277 2033 EBCDIC-CP-DK EBCDIC-CP-NO csIBM277 IBM278 2034 CP278 ebcdic-cp-fi ebcdic-cp-se csIBM278 IBM280 2035 CP280 ebcdic-cp-it csIBM280 IBM281 2036 EBCDIC-JP-E cp281 csIBM281 IBM284 2037 CP284 ebcdic-cp-es csIBM284 IBM285 2038 CP285 ebcdic-cp-gb csIBM285 IBM290 2039 cp290 EBCDIC-JP-kana csIBM290 IBM297 2040 cp297 ebcdic-cp-fr csIBM297 IBM420 2041 cp420 ebcdic-cp-ar1 csIBM420 IBM423 2042 cp423 ebcdic-cp-gr csIBM423 IBM424 2043 cp424 ebcdic-cp-he csIBM424 IBM437 2011 cp437 437 csPC8CodePage437 IBM500 2044 CP500 ebcdic-cp-be ebcdic-cp-ch csIBM500 IBM775 2087 cp775 csPC775Baltic IBM850 2009 cp850 850 csPC850Multilingual IBM851 2045 cp851 851 csIBM851 IBM852 2010 cp852 852 csPCp852 IBM855 2046 cp855 855 csIBM855 IBM857 2047 cp857 857 csIBM857 IBM860 2048 cp860 860 csIBM860 IBM861 2049 cp861 861 cp-is csIBM861 IBM862 2013 cp862 862 csPC862LatinHebrew IBM863 2050 cp863 863 csIBM863 IBM864 2051 cp864 csIBM864 IBM865 2052 cp865 865 csIBM865 IBM866 2086 cp866 866 csIBM866 IBM868 2053 CP868 cp-ar csIBM868 IBM869 2054 cp869 869 cp-gr csIBM869 IBM870 2055 CP870 ebcdic-cp-roece ebcdic-cp-yu csIBM870 IBM871 2056 CP871 ebcdic-cp-is csIBM871 IBM880 2057 cp880 EBCDIC-Cyrillic csIBM880 IBM891 2058 cp891 csIBM891 IBM903 2059 cp903 csIBM903 IBM904 2060 cp904 904 csIBBM904 IBM905 2061 CP905 ebcdic-cp-tr csIBM905 IBM918 2062 CP918 ebcdic-cp-ar2 csIBM918 IBM1026 2063 CP1026 csIBM1026 EBCDIC-AT-DE 2064 csIBMEBCDICATDE EBCDIC-AT-DE-A 2065 csEBCDICATDEA EBCDIC-CA-FR 2066 csEBCDICCAFR EBCDIC-DK-NO 2067 csEBCDICDKNO EBCDIC-DK-NO-A 2068 csEBCDICDKNOA EBCDIC-FI-SE 2069 csEBCDICFISE EBCDIC-FI-SE-A 2070 csEBCDICFISEA EBCDIC-FR 2071 csEBCDICFR EBCDIC-IT 2072 csEBCDICIT EBCDIC-PT 2073 csEBCDICPT EBCDIC-ES 2074 csEBCDICES EBCDIC-ES-A 2075 csEBCDICESA EBCDIC-ES-S 2076 csEBCDICESS EBCDIC-UK 2077 csEBCDICUK EBCDIC-US 2078 csEBCDICUS UNKNOWN-8BIT 2079 csUnknown8BiT MNEMONIC 2080 csMnemonic MNEM 2081 csMnem VISCII 2082 csVISCII VIQR 2083 csVIQR KOI8-R 2084 csKOI8R KOI8-U 2088 IBM00858 2089 CCSID00858 CP00858 PC-Multilingual-850+euro IBM00924 2090 CCSID00924 CP00924 ebcdic-Latin9--euro IBM01140 2091 CCSID01140 CP01140 ebcdic-us-37+euro IBM01141 2092 CCSID01141 CP01141 ebcdic-de-273+euro IBM01142 2093 CCSID01142 CP01142 ebcdic-dk-277+euro ebcdic-no-277+euro IBM01143 2094 CCSID01143 CP01143 ebcdic-fi-278+euro ebcdic-se-278+euro IBM01144 2095 CCSID01144 CP01144 ebcdic-it-280+euro IBM01145 2096 CCSID01145 CP01145 ebcdic-es-284+euro IBM01146 2097 CCSID01146 CP01146 ebcdic-gb-285+euro IBM01147 2098 CCSID01147 CP01147 ebcdic-fr-297+euro IBM01148 2099 CCSID01148 CP01148 ebcdic-international-500+euro IBM01149 2100 CCSID01149 CP01149 ebcdic-is-871+euro Big5-HKSCS 2101 IBM1047 2102 IBM-1047 PTCP154 2103 csPTCP154 PT154 CP154 Cyrillic-Asian Amiga-1251 2104 Ami1251 Amiga1251 Ami-1251 KOI7-switched 2105 UNICODE-1-1 1010 csUnicode11 SCSU 1011 UTF-7 1012 UTF-16BE 1013 UTF-16LE 1014 UTF-16 1015 CESU-8 1016 csCESU-8 UTF-32 1017 UTF-32BE 1018 UTF-32LE 1019 BOCU-1 1020 csBOCU-1 UNICODE-1-1-UTF-7 103 csUnicode11UTF7 UTF-8 106 UNICODE-1-1-UTF-8 UNICODE-2-0-UTF-8 utf8 ISO-8859-13 109 8859_13 ISO8859-13 ISO-8859-14 110 iso-ir-199 ISO_8859-14:1998 ISO_8859-14 latin8 iso-celtic l8 8859_14 ISO8859-14 ISO-8859-15 111 ISO_8859-15 Latin-9 8859_15 ISO8859-15 ISO-8859-16 112 iso-ir-226 ISO_8859-16:2001 ISO_8859-16 latin10 l10 GBK 113 CP936 MS936 windows-936 GB18030 114 OSD_EBCDIC_DF04_15 115 OSD_EBCDIC_DF03_IRV 116 OSD_EBCDIC_DF04_1 117 JIS_Encoding 16 csJISEncoding Shift_JIS 17 MS_Kanji csShiftJIS X-SJIS Shift-JIS EUC-JP 18 csEUCPkdFmtJapanese Extended_UNIX_Code_Packed_Format_for_Japanese EUCJP Extended_UNIX_Code_Fixed_Width_for_Japanese 19 csEUCFixWidJapanese ISO-10646-UCS-Basic 1002 csUnicodeASCII ISO-10646-Unicode-Latin1 1003 csUnicodeLatin1 ISO-10646 ISO-Unicode-IBM-1261 1005 csUnicodeIBM1261 ISO-Unicode-IBM-1268 1006 csUnicodeIBM1268 ISO-Unicode-IBM-1276 1007 csUnicodeIBM1276 ISO-Unicode-IBM-1264 1008 csUnicodeIBM1264 ISO-Unicode-IBM-1265 1009 csUnicodeIBM1265 ISO-8859-1-Windows-3.0-Latin-1 2000 csWindows30Latin1 ISO-8859-1-Windows-3.1-Latin-1 2001 csWindows31Latin1 ISO-8859-2-Windows-Latin-2 2002 csWindows31Latin2 ISO-8859-9-Windows-Latin-5 2003 csWindows31Latin5 Adobe-Standard-Encoding 2005 csAdobeStandardEncoding Ventura-US 2006 csVenturaUS Ventura-International 2007 csVenturaInternational PC8-Danish-Norwegian 2012 csPC8DanishNorwegian PC8-Turkish 2014 csPC8Turkish IBM-Symbols 2015 csIBMSymbols IBM-Thai 2016 csIBMThai HP-Legal 2017 csHPLegal HP-Pi-font 2018 csHPPiFont HP-Math8 2019 csHPMath8 Adobe-Symbol-Encoding 2020 csHPPSMath HP-DeskTop 2021 csHPDesktop Ventura-Math 2022 csVenturaMath Microsoft-Publishing 2023 csMicrosoftPublishing Windows-31J 2024 csWindows31J GB2312 2025 csGB2312 EUC-CN EUCCN CN-GB Big5 2026 csBig5 BIG-FIVE BIG-5 CN-BIG5 BIG_FIVE x-x-big5 windows-1250 2250 CP1250 MS-EE windows-1251 2251 CP1251 MS-CYRL windows-1252 2252 CP1252 MS-ANSI windows-1253 2253 CP1253 MS-GREEK windows-1254 2254 CP1254 MS-TURK windows-1255 2255 windows-1256 2256 CP1256 MS-ARAB windows-1257 2257 CP1257 WINBALTRIM windows-1258 2258 TIS-620 2259 HZ-GB-2312 2085 # Additional encodings not defined by IANA # Arbitrary allocations #CP737 3001 #CP853 3002 #CP856 3003 CP874 3004 WINDOWS-874 #CP922 3005 #CP1046 3006 #CP1124 3007 #CP1125 3008 WINDOWS-1125 #CP1129 3009 #CP1133 3010 IBM-CP1133 #CP1161 3011 IBM-1161 IBM1161 CSIBM1161 #CP1162 3012 IBM-1162 IBM1162 CSIBM1162 #CP1163 3013 IBM-1163 IBM1163 CSIBM1163 #GEORGIAN-ACADEMY 3014 #GEORGIAN-PS 3015 #KOI8-RU 3016 #KOI8-T 3017 #MACARABIC 3018 X-MAC-ARABIC MAC-ARABIC #MACCROATIAN 3019 X-MAC-CROATIAN MAC-CROATIAN #MACGREEK 3020 X-MAC-GREEK MAC-GREEK #MACHEBREW 3021 X-MAC-HEBREW MAC-HEBREW #MACICELAND 3022 X-MAC-ICELAND MAC-ICELAND #MACROMANIA 3023 X-MAC-ROMANIA MAC-ROMANIA #MACTHAI 3024 X-MAC-THAI MAC-THAI #MACTURKISH 3025 X-MAC-TURKISH MAC-TURKISH #MULELAO-1 3026 CP949 3027 WINDOWS-949 # From Unicode Lib ISO-IR-182 4000 ISO-IR-197 4002 ISO-2022-JP-1 4008 MACCYRILLIC 4009 X-MAC-CYRILLIC MAC-CYRILLIC MACUKRAINE 4010 X-MAC-UKRAINIAN MAC-UKRAINIAN MACCENTRALEUROPE 4011 X-MAC-CENTRALEURROMAN MAC-CENTRALEURROMAN JOHAB 4012 ISO-8859-11 4014 iso-ir-166 ISO_8859-11 ISO8859-11 8859_11 X-CURRENT 4999 X-SYSTEM X-ACORN-LATIN1 5001 X-ACORN-FUZZY 5002 netsurf-all-3.2/libparserutils/build/conv.pl0000755000175000017500000000153012377676760020300 0ustar vincevince#!/usr/bin/perl use warnings; use strict; # Convert Unicode mapping tables to C structures # Input files may be found at http://unicode.org/Public/MAPPINGS # # Usage: conv.pl die "Usage: conv.pl \n" if (scalar(@ARGV) != 1); my @table; open MAP, "<$ARGV[0]" or die "Failed opening $ARGV[0]: $!\n"; while () { next if (/^#/); my @parts = split(/\s+/); #Ignore ASCII part next if (hex($parts[0]) < 0x80); # Convert undefined entries to U+FFFF if ($parts[1] =~ /^#/) { push(@table, "0xFFFF"); } else { push(@table, $parts[1]); } } close MAP; # You'll have to go through and fix up the structure name print "static uint32_t ${ARGV[0]}[128] = {\n\t"; my $count = 0; foreach my $item (@table) { print "$item, "; $count++; if ($count % 8 == 0 && $count != 128) { print "\n\t"; } } print "\n};\n\n"; netsurf-all-3.2/libparserutils/build/Doxyfile0000644000175000017500000014372212377676760020513 0ustar vincevince# Doxyfile 1.4.6 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = Libparserutils # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = build/docs # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, # Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, # Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, # Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, # Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = YES # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = YES # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = YES # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = YES # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command , where is the value of # the FILE_VERSION_FILTER tag, and is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = include src # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = *.c *.h # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = YES # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = */.svn/* # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command , where # is the value of the INPUT_FILTER tag, and is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that a graph may be further truncated if the graph's # image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH # and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), # the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO netsurf-all-3.2/libparserutils/README0000644000175000017500000000532712377676760016564 0ustar vincevinceLibParserUtils -- a utility library for parser building ======================================================= Overview -------- LibParserUtils provides various pieces of functionality that are useful when writing parsers. These are: + A number of character set convertors + Mapping of character set names to/from MIB enum values + UTF-8 and UTF-16 (host endian) support functions + Various simple data structures (resizeable buffer, stack, vector) + A UTF-8 input stream Requirements ------------ LibParserUtils requires the following tools: + A C99 capable C compiler + GNU make or compatible + Perl (for the testcases) + Pkg-config (for the testcases) + doxygen (for the API documentation) For enhanced charset support, LibParserUtils requires an iconv() implementation. If you don't have an implementation of iconv(), this requirement may be disabled: see the "Disabling iconv() support" section, below. Compilation ----------- The exact type of build may be configured by passing parameters to make. Common usage is described below. For a static library: $ make For a shared library: $ make COMPONENT_TYPE=lib-shared For a static library with debug enabled: $ make BUILD=debug To cross-compile a static library: $ make TARGET= Verification ------------ The library's functionality may be verified, thus: $ make test If you wish to see test coverage statistics, run: $ make coverage Then open build/coverage/index.html in a web browser. In both cases, ensure that the same parameters to make are passed as when building the library. (Un)installation ---------------- To install the library: $ make install Ensure that the same parameters to make are passed as when building the library. To specify the installation prefix: $ make install PREFIX=/path/to/prefix To specify a staging directory for packaging: $ make install DESTDIR=/path/to/directory Items will be installed to $(DESTDIR)$(PREFIX)/ To uninstall: $ make uninstall API documentation ----------------- Use doxygen to auto-generate API documentation, thus: $ make docs Then open build/docs/html/index.html in a web browser. The test driver code in test/ may also provide some useful pointers. Disabling iconv() support ------------------------- Without iconv() support enabled, libparserutils only supports the following character sets: + UTF-16 (platform-native endian) + UTF-8 + ISO-8859-n + Windows-125n + US-ASCII To disable iconv() support in libparserutils, do the following: $ echo "CFLAGS += -DWITHOUT_ICONV_FILTER" \ >Makefile.config.override Then build libparserutils as normal. netsurf-all-3.2/libparserutils/Makefile.config0000644000175000017500000000030612377676760020600 0ustar vincevince# Configuration Makefile fragment # Disable use of iconv in the input filter # CFLAGS := $(CFLAGS) -DWITHOUT_ICONV_FILTER # Cater for local configuration changes -include Makefile.config.override netsurf-all-3.2/libparserutils/COPYING0000644000175000017500000000204712377676760016733 0ustar vincevinceCopyright (C) 2007-8 J-M Bell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. netsurf-all-3.2/libparserutils/src/0000755000175000017500000000000012377713347016455 5ustar vincevincenetsurf-all-3.2/libparserutils/src/charset/0000755000175000017500000000000012377713347020106 5ustar vincevincenetsurf-all-3.2/libparserutils/src/charset/codec.c0000644000175000017500000001243212377676760021340 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include "charset/aliases.h" #include "charset/codecs/codec_impl.h" extern parserutils_charset_handler charset_ascii_codec_handler; extern parserutils_charset_handler charset_8859_codec_handler; extern parserutils_charset_handler charset_ext8_codec_handler; extern parserutils_charset_handler charset_utf8_codec_handler; extern parserutils_charset_handler charset_utf16_codec_handler; static parserutils_charset_handler *handler_table[] = { &charset_utf8_codec_handler, &charset_utf16_codec_handler, &charset_8859_codec_handler, &charset_ext8_codec_handler, &charset_ascii_codec_handler, NULL, }; /** * Create a charset codec * * \param charset Target charset * \param codec Pointer to location to receive codec instance * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhaustion, * PARSERUTILS_BADENCODING on unsupported charset */ parserutils_error parserutils_charset_codec_create(const char *charset, parserutils_charset_codec **codec) { parserutils_charset_codec *c; parserutils_charset_handler **handler; const parserutils_charset_aliases_canon * canon; parserutils_error error; if (charset == NULL || codec == NULL) return PARSERUTILS_BADPARM; /* Canonicalise parserutils_charset name. */ canon = parserutils__charset_alias_canonicalise(charset, strlen(charset)); if (canon == NULL) return PARSERUTILS_BADENCODING; /* Search for handler class */ for (handler = handler_table; *handler != NULL; handler++) { if ((*handler)->handles_charset(canon->name)) break; } /* None found */ if ((*handler) == NULL) return PARSERUTILS_BADENCODING; /* Instantiate class */ error = (*handler)->create(canon->name, &c); if (error != PARSERUTILS_OK) return error; /* and initialise it */ c->mibenum = canon->mib_enum; c->errormode = PARSERUTILS_CHARSET_CODEC_ERROR_LOOSE; *codec = c; return PARSERUTILS_OK; } /** * Destroy a charset codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_codec_destroy( parserutils_charset_codec *codec) { if (codec == NULL) return PARSERUTILS_BADPARM; codec->handler.destroy(codec); free(codec); return PARSERUTILS_OK; } /** * Configure a charset codec * * \param codec The codec to configure * \param type The codec option type to configure * \param params Option-specific parameters * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_codec_setopt( parserutils_charset_codec *codec, parserutils_charset_codec_opttype type, parserutils_charset_codec_optparams *params) { if (codec == NULL || params == NULL) return PARSERUTILS_BADPARM; switch (type) { case PARSERUTILS_CHARSET_CODEC_ERROR_MODE: codec->errormode = params->error_mode.mode; break; } return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 data into a codec's charset * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, appropriate error otherwise. * * source, sourcelen, dest and destlen will be updated appropriately on exit */ parserutils_error parserutils_charset_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { if (codec == NULL || source == NULL || *source == NULL || sourcelen == NULL || dest == NULL || *dest == NULL || destlen == NULL) return PARSERUTILS_BADPARM; return codec->handler.encode(codec, source, sourcelen, dest, destlen); } /** * Decode a chunk of data in a codec's charset into UCS-4 * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, appropriate error otherwise. * * source, sourcelen, dest and destlen will be updated appropriately on exit * * Call this with a source length of 0 to flush any buffers. */ parserutils_error parserutils_charset_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { if (codec == NULL || source == NULL || *source == NULL || sourcelen == NULL || dest == NULL || *dest == NULL || destlen == NULL) return PARSERUTILS_BADPARM; return codec->handler.decode(codec, source, sourcelen, dest, destlen); } /** * Clear a charset codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_codec_reset( parserutils_charset_codec *codec) { if (codec == NULL) return PARSERUTILS_BADPARM; return codec->handler.reset(codec); } netsurf-all-3.2/libparserutils/src/charset/encodings/0000755000175000017500000000000012377713347022057 5ustar vincevincenetsurf-all-3.2/libparserutils/src/charset/encodings/utf8.c0000644000175000017500000001220012377676760023113 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ /** \file * UTF-8 manipulation functions (implementation). */ #include #include #include #include #include "charset/encodings/utf8impl.h" /** Number of continuation bytes for a given start byte */ const uint8_t numContinuations[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, }; /** * Convert a UTF-8 multibyte sequence into a single UCS-4 character * * Encoding of UCS values outside the UTF-16 plane has been removed from * RFC3629. This function conforms to RFC2279, however. * * \param s The sequence to process * \param len Length of sequence * \param ucs4 Pointer to location to receive UCS-4 character (host endian) * \param clen Pointer to location to receive byte length of UTF-8 sequence * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_to_ucs4(const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen) { parserutils_error error; UTF8_TO_UCS4(s, len, ucs4, clen, error); return error; } /** * Convert a single UCS-4 character into a UTF-8 multibyte sequence * * Encoding of UCS values outside the UTF-16 plane has been removed from * RFC3629. This function conforms to RFC2279, however. * * \param ucs4 The character to process (0 <= c <= 0x7FFFFFFF) (host endian) * \param s Pointer to pointer to output buffer, updated on exit * \param len Pointer to length, in bytes, of output buffer, updated on exit * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_from_ucs4(uint32_t ucs4, uint8_t **s, size_t *len) { parserutils_error error; UTF8_FROM_UCS4(ucs4, s, len, error); return error; } /** * Calculate the length (in characters) of a bounded UTF-8 string * * \param s The string * \param max Maximum length * \param len Pointer to location to receive length of string * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_length(const uint8_t *s, size_t max, size_t *len) { parserutils_error error; UTF8_LENGTH(s, max, len, error); return error; } /** * Calculate the length (in bytes) of a UTF-8 character * * \param s Pointer to start of character * \param len Pointer to location to receive length * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_char_byte_length(const uint8_t *s, size_t *len) { parserutils_error error; UTF8_CHAR_BYTE_LENGTH(s, len, error); return error; } /** * Find previous legal UTF-8 char in string * * \param s The string * \param off Offset in the string to start at * \param prevoff Pointer to location to receive offset of first byte of * previous legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_prev(const uint8_t *s, uint32_t off, uint32_t *prevoff) { parserutils_error error; UTF8_PREV(s, off, prevoff, error); return error; } /** * Find next legal UTF-8 char in string * * \param s The string (assumed valid) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_next(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) { parserutils_error error; UTF8_NEXT(s, len, off, nextoff, error); return error; } /** * Find next legal UTF-8 char in string * * \param s The string (assumed to be of dubious validity) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf8_next_paranoid(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) { parserutils_error error; UTF8_NEXT_PARANOID(s, len, off, nextoff, error); return error; } netsurf-all-3.2/libparserutils/src/charset/encodings/utf16.c0000644000175000017500000001417412377676760023206 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ /** \file * UTF-16 manipulation functions (implementation). */ #include #include #include #include /** * Convert a UTF-16 sequence into a single UCS-4 character * * \param s The sequence to process * \param len Length of sequence in bytes * \param ucs4 Pointer to location to receive UCS-4 character (host endian) * \param clen Pointer to location to receive byte length of UTF-16 sequence * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_to_ucs4(const uint8_t *s, size_t len, uint32_t *ucs4, size_t *clen) { const uint16_t *ss = (const uint16_t *) (const void *) s; if (s == NULL || ucs4 == NULL || clen == NULL) return PARSERUTILS_BADPARM; if (len < 2) return PARSERUTILS_NEEDDATA; if (*ss < 0xD800 || *ss > 0xDFFF) { *ucs4 = *ss; *clen = 2; } else if (0xD800 <= *ss && *ss <= 0xDBFF) { /* High-surrogate code unit. */ if (len < 4) return PARSERUTILS_NEEDDATA; if (0xDC00 <= ss[1] && ss[1] <= 0xDFFF) { /* We have a valid surrogate pair. */ *ucs4 = (((ss[0] & 0x3FF) << 10) | (ss[1] & 0x3FF)) + (1<<16); *clen = 4; } else { return PARSERUTILS_INVALID; } } else { /* Low-surrogate code unit. */ return PARSERUTILS_INVALID; } return PARSERUTILS_OK; } /** * Convert a single UCS-4 character into a UTF-16 sequence * * \param ucs4 The character to process (0 <= c <= 0x7FFFFFFF) (host endian) * \param s Pointer to 4 byte long output buffer * \param len Pointer to location to receive length of multibyte sequence * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_from_ucs4(uint32_t ucs4, uint8_t *s, size_t *len) { uint16_t *ss = (uint16_t *) (void *) s; uint32_t l = 0; if (s == NULL || len == NULL) return PARSERUTILS_BADPARM; else if (ucs4 < 0x10000) { *ss = (uint16_t) ucs4; l = 2; } else if (ucs4 < 0x110000) { ss[0] = 0xD800 | (((ucs4 >> 16) & 0x1f) - 1) | (ucs4 >> 10); ss[1] = 0xDC00 | (ucs4 & 0x3ff); l = 4; } else { return PARSERUTILS_INVALID; } *len = l; return PARSERUTILS_OK; } /** * Calculate the length (in characters) of a bounded UTF-16 string * * \param s The string * \param max Maximum length * \param len Pointer to location to receive length of string * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_length(const uint8_t *s, size_t max, size_t *len) { const uint16_t *ss = (const uint16_t *) (const void *) s; const uint16_t *end = (const uint16_t *) (const void *) (s + max); int l = 0; if (s == NULL || len == NULL) return PARSERUTILS_BADPARM; while (ss < end) { if (*ss < 0xD800 || 0xDFFF < *ss) ss++; else ss += 2; l++; } *len = l; return PARSERUTILS_OK; } /** * Calculate the length (in bytes) of a UTF-16 character * * \param s Pointer to start of character * \param len Pointer to location to receive length * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_char_byte_length(const uint8_t *s, size_t *len) { const uint16_t *ss = (const uint16_t *) (const void *) s; if (s == NULL || len == NULL) return PARSERUTILS_BADPARM; if (*ss < 0xD800 || 0xDFFF < *ss) *len = 2; else *len = 4; return PARSERUTILS_OK; } /** * Find previous legal UTF-16 char in string * * \param s The string * \param off Offset in the string to start at * \param prevoff Pointer to location to receive offset of first byte of * previous legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_prev(const uint8_t *s, uint32_t off, uint32_t *prevoff) { const uint16_t *ss = (const uint16_t *) (const void *) s; if (s == NULL || prevoff == NULL) return PARSERUTILS_BADPARM; if (off < 2) *prevoff = 0; else if (ss[-1] < 0xDC00 || ss[-1] > 0xDFFF) *prevoff = off - 2; else *prevoff = (off < 4) ? 0 : off - 4; return PARSERUTILS_OK; } /** * Find next legal UTF-16 char in string * * \param s The string (assumed valid) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_next(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) { const uint16_t *ss = (const uint16_t *) (const void *) s; if (s == NULL || off >= len || nextoff == NULL) return PARSERUTILS_BADPARM; if (len - off < 4) *nextoff = len; else if (ss[1] < 0xD800 || ss[1] > 0xDBFF) *nextoff = off + 2; else *nextoff = (len - off < 6) ? len : off + 4; return PARSERUTILS_OK; } /** * Find next legal UTF-16 char in string * * \param s The string (assumed to be of dubious validity) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_charset_utf16_next_paranoid(const uint8_t *s, uint32_t len, uint32_t off, uint32_t *nextoff) { const uint16_t *ss = (const uint16_t *) (const void *) s; if (s == NULL || off >= len || nextoff == NULL) return PARSERUTILS_BADPARM; while (1) { if (len - off < 4) { return PARSERUTILS_NEEDDATA; } else if (ss[1] < 0xD800 || ss[1] > 0xDFFF) { *nextoff = off + 2; break; } else if (ss[1] >= 0xD800 && ss[1] <= 0xDBFF) { if (len - off < 6) return PARSERUTILS_NEEDDATA; if (ss[2] >= 0xDC00 && ss[2] <= 0xDFFF) { *nextoff = off + 4; break; } else { ss++; off += 2; } } } return PARSERUTILS_OK; } netsurf-all-3.2/libparserutils/src/charset/encodings/utf8impl.h0000644000175000017500000002132112377676760024006 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_charset_encodings_utf8impl_h_ #define parserutils_charset_encodings_utf8impl_h_ /** \file * UTF-8 manipulation macros (implementation). */ #include #include #include /** Number of continuation bytes for a given start byte */ extern const uint8_t numContinuations[256]; /** * Convert a UTF-8 multibyte sequence into a single UCS-4 character * * Encoding of UCS values outside the UTF-16 plane has been removed from * RFC3629. This macro conforms to RFC2279, however. * * \param s The sequence to process * \param len Length of sequence * \param ucs4 Pointer to location to receive UCS-4 character (host endian) * \param clen Pointer to location to receive byte length of UTF-8 sequence * \param error Location to receive error code */ #define UTF8_TO_UCS4(s, len, ucs4, clen, error) \ do { \ uint32_t c, min; \ uint8_t n; \ uint8_t i; \ \ error = PARSERUTILS_OK; \ \ if (s == NULL || ucs4 == NULL || clen == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ if (len == 0) { \ error = PARSERUTILS_NEEDDATA; \ break; \ } \ \ c = s[0]; \ \ if (c < 0x80) { \ n = 1; \ min = 0; \ } else if ((c & 0xE0) == 0xC0) { \ c &= 0x1F; \ n = 2; \ min = 0x80; \ } else if ((c & 0xF0) == 0xE0) { \ c &= 0x0F; \ n = 3; \ min = 0x800; \ } else if ((c & 0xF8) == 0xF0) { \ c &= 0x07; \ n = 4; \ min = 0x10000; \ } else if ((c & 0xFC) == 0xF8) { \ c &= 0x03; \ n = 5; \ min = 0x200000; \ } else if ((c & 0xFE) == 0xFC) { \ c &= 0x01; \ n = 6; \ min = 0x4000000; \ } else { \ error = PARSERUTILS_INVALID; \ break; \ } \ \ if (len < n) { \ error = PARSERUTILS_NEEDDATA; \ break; \ } \ \ for (i = 1; i < n; i++) { \ uint32_t t = s[i]; \ \ if ((t & 0xC0) != 0x80) { \ error = PARSERUTILS_INVALID; \ break; \ } \ \ c <<= 6; \ c |= t & 0x3F; \ } \ \ if (error == PARSERUTILS_OK) { \ /* Detect overlong sequences, surrogates and fffe/ffff */ \ if (c < min || (c >= 0xD800 && c <= 0xDFFF) || \ c == 0xFFFE || c == 0xFFFF) { \ error = PARSERUTILS_INVALID; \ break; \ } \ \ *ucs4 = c; \ *clen = n; \ } \ } while(0) /** * Convert a single UCS-4 character into a UTF-8 multibyte sequence * * Encoding of UCS values outside the UTF-16 plane has been removed from * RFC3629. This macro conforms to RFC2279, however. * * \param ucs4 The character to process (0 <= c <= 0x7FFFFFFF) (host endian) * \param s Pointer to pointer to output buffer, updated on exit * \param len Pointer to length, in bytes, of output buffer, updated on exit * \param error Location to receive error code */ #define UTF8_FROM_UCS4(ucs4, s, len, error) \ do { \ uint8_t *buf; \ uint8_t l = 0; \ \ error = PARSERUTILS_OK; \ \ if (s == NULL || *s == NULL || len == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ if (ucs4 < 0x80) { \ l = 1; \ } else if (ucs4 < 0x800) { \ l = 2; \ } else if (ucs4 < 0x10000) { \ l = 3; \ } else if (ucs4 < 0x200000) { \ l = 4; \ } else if (ucs4 < 0x4000000) { \ l = 5; \ } else if (ucs4 <= 0x7FFFFFFF) { \ l = 6; \ } else { \ error = PARSERUTILS_INVALID; \ break; \ } \ \ if (l > *len) { \ error = PARSERUTILS_NOMEM; \ break; \ } \ \ buf = *s; \ \ if (l == 1) { \ buf[0] = (uint8_t) ucs4; \ } else { \ uint8_t i; \ for (i = l; i > 1; i--) { \ buf[i - 1] = 0x80 | (ucs4 & 0x3F); \ ucs4 >>= 6; \ } \ buf[0] = ~((1 << (8 - l)) - 1) | ucs4; \ } \ \ *s += l; \ *len -= l; \ } while(0) /** * Calculate the length (in characters) of a bounded UTF-8 string * * \param s The string * \param max Maximum length * \param len Pointer to location to receive length of string * \param error Location to receive error code */ #define UTF8_LENGTH(s, max, len, error) \ do { \ const uint8_t *end = s + max; \ int l = 0; \ \ error = PARSERUTILS_OK; \ \ if (s == NULL || len == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ while (s < end) { \ uint32_t c = s[0]; \ \ if ((c & 0x80) == 0x00) \ s += 1; \ else if ((c & 0xE0) == 0xC0) \ s += 2; \ else if ((c & 0xF0) == 0xE0) \ s += 3; \ else if ((c & 0xF8) == 0xF0) \ s += 4; \ else if ((c & 0xFC) == 0xF8) \ s += 5; \ else if ((c & 0xFE) == 0xFC) \ s += 6; \ else { \ error = PARSERUTILS_INVALID; \ break; \ } \ \ l++; \ } \ \ if (error == PARSERUTILS_OK) \ *len = l; \ } while(0) /** * Calculate the length (in bytes) of a UTF-8 character * * \param s Pointer to start of character * \param len Pointer to location to receive length * \param error Location to receive error code */ #define UTF8_CHAR_BYTE_LENGTH(s, len, error) \ do { \ if (s == NULL || len == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ *len = numContinuations[s[0]] + 1 /* Start byte */; \ \ error = PARSERUTILS_OK; \ } while(0) /** * Find previous legal UTF-8 char in string * * \param s The string * \param off Offset in the string to start at * \param prevoff Pointer to location to receive offset of first byte of * previous legal character * \param error Location to receive error code */ #define UTF8_PREV(s, off, prevoff, error) \ do { \ if (s == NULL || prevoff == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ while (off != 0 && (s[--off] & 0xC0) == 0x80) \ /* do nothing */; \ \ *prevoff = off; \ \ error = PARSERUTILS_OK; \ } while(0) /** * Find next legal UTF-8 char in string * * \param s The string (assumed valid) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \param error Location to receive error code */ #define UTF8_NEXT(s, len, off, nextoff, error) \ do { \ if (s == NULL || off >= len || nextoff == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ /* Skip current start byte (if present - may be mid-sequence) */\ if (s[off] < 0x80 || (s[off] & 0xC0) == 0xC0) \ off++; \ \ while (off < len && (s[off] & 0xC0) == 0x80) \ off++; \ \ *nextoff = off; \ \ error = PARSERUTILS_OK; \ } while(0) /** * Skip to start of next sequence in UTF-8 input * * \param s The string (assumed to be of dubious validity) * \param len Maximum offset in string * \param off Offset in the string to start at * \param nextoff Pointer to location to receive offset of first byte of * next legal character * \param error Location to receive error code */ #define UTF8_NEXT_PARANOID(s, len, off, nextoff, error) \ do { \ uint8_t c; \ \ error = PARSERUTILS_OK; \ \ if (s == NULL || off >= len || nextoff == NULL) { \ error = PARSERUTILS_BADPARM; \ break; \ } \ \ c = s[off]; \ \ /* If we're mid-sequence, simply advance to next byte */ \ if (!(c < 0x80 || (c & 0xC0) == 0xC0)) { \ off++; \ } else { \ uint32_t nCont = numContinuations[c]; \ uint32_t nToSkip; \ \ if (off + nCont + 1 >= len) { \ error = PARSERUTILS_NEEDDATA; \ break; \ } \ \ /* Verify continuation bytes */ \ for (nToSkip = 1; nToSkip <= nCont; nToSkip++) { \ if ((s[off + nToSkip] & 0xC0) != 0x80) \ break; \ } \ \ /* Skip over the valid bytes */ \ off += nToSkip; \ } \ \ *nextoff = off; \ } while(0) #endif netsurf-all-3.2/libparserutils/src/charset/encodings/Makefile0000644000175000017500000000011412377676760023522 0ustar vincevince# Sources DIR_SOURCES := utf8.c utf16.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/src/charset/codecs/0000755000175000017500000000000012377713347021346 5ustar vincevincenetsurf-all-3.2/libparserutils/src/charset/codecs/codec_utf8.c0000644000175000017500000003673312377676760023560 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include #include #include "charset/codecs/codec_impl.h" #include "charset/encodings/utf8impl.h" #include "utils/endian.h" #include "utils/utils.h" /** * UTF-8 charset codec */ typedef struct charset_utf8_codec { parserutils_charset_codec base; /**< Base class */ #define INVAL_BUFSIZE (32) uint8_t inval_buf[INVAL_BUFSIZE]; /**< Buffer for fixing up * incomplete input * sequences */ size_t inval_len; /*< Byte length of inval_buf **/ #define READ_BUFSIZE (8) uint32_t read_buf[READ_BUFSIZE]; /**< Buffer for partial * output sequences (decode) * (host-endian) */ size_t read_len; /**< Character length of read_buf */ #define WRITE_BUFSIZE (8) uint32_t write_buf[WRITE_BUFSIZE]; /**< Buffer for partial * output sequences (encode) * (host-endian) */ size_t write_len; /**< Character length of write_buf */ } charset_utf8_codec; static bool charset_utf8_codec_handles_charset(const char *charset); static parserutils_error charset_utf8_codec_create(const char *charset, parserutils_charset_codec **codec); static parserutils_error charset_utf8_codec_destroy( parserutils_charset_codec *codec); static parserutils_error charset_utf8_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_utf8_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_utf8_codec_reset( parserutils_charset_codec *codec); static inline parserutils_error charset_utf8_codec_read_char( charset_utf8_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_utf8_codec_output_decoded_char( charset_utf8_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen); /** * Determine whether this codec handles a specific charset * * \param charset Charset to test * \return true if handleable, false otherwise */ bool charset_utf8_codec_handles_charset(const char *charset) { return parserutils_charset_mibenum_from_name(charset, strlen(charset)) == parserutils_charset_mibenum_from_name("UTF-8", SLEN("UTF-8")); } /** * Create a UTF-8 codec * * \param charset The charset to read from / write to * \param codec Pointer to location to receive codec * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error charset_utf8_codec_create(const char *charset, parserutils_charset_codec **codec) { charset_utf8_codec *c; UNUSED(charset); c = malloc(sizeof(charset_utf8_codec)); if (c == NULL) return PARSERUTILS_NOMEM; c->inval_buf[0] = '\0'; c->inval_len = 0; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; /* Finally, populate vtable */ c->base.handler.destroy = charset_utf8_codec_destroy; c->base.handler.encode = charset_utf8_codec_encode; c->base.handler.decode = charset_utf8_codec_decode; c->base.handler.reset = charset_utf8_codec_reset; *codec = (parserutils_charset_codec *) c; return PARSERUTILS_OK; } /** * Destroy a UTF-8 codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_utf8_codec_destroy (parserutils_charset_codec *codec) { UNUSED(codec); return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 (big endian) data into UTF-8 * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read. Any remaining output for the character will be buffered by the * codec for writing on the next call. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_utf8_codec_encode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_utf8_codec *c = (charset_utf8_codec *) codec; uint32_t ucs4; uint32_t *towrite; size_t towritelen; parserutils_error error; /* Process any outstanding characters from the previous call */ if (c->write_len > 0) { uint32_t *pwrite = c->write_buf; while (c->write_len > 0) { UTF8_FROM_UCS4(pwrite[0], dest, destlen, error); if (error != PARSERUTILS_OK) { uint32_t len; assert(error == PARSERUTILS_NOMEM); /* Insufficient output buffer space */ for (len = 0; len < c->write_len; len++) { c->write_buf[len] = pwrite[len]; } return PARSERUTILS_NOMEM; } pwrite++; c->write_len--; } } /* Now process the characters for this call */ while (*sourcelen > 0) { ucs4 = endian_big_to_host(*((uint32_t *) (void *) *source)); towrite = &ucs4; towritelen = 1; /* Output current characters */ while (towritelen > 0) { UTF8_FROM_UCS4(towrite[0], dest, destlen, error); if (error != PARSERUTILS_OK) { uint32_t len; assert(error == PARSERUTILS_NOMEM); /* Insufficient output space */ assert(towritelen < WRITE_BUFSIZE); c->write_len = towritelen; /* Copy pending chars to save area, for * processing next call. */ for (len = 0; len < towritelen; len++) c->write_buf[len] = towrite[len]; /* Claim character we've just buffered, * so it's not reprocessed */ *source += 4; *sourcelen -= 4; return PARSERUTILS_NOMEM; } towrite++; towritelen--; } *source += 4; *sourcelen -= 4; } return PARSERUTILS_OK; } /** * Decode a chunk of UTF-8 data into UCS-4 (big endian) * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * If STRICT error handling is configured and an illegal sequence is split * over two calls, then _INVALID will be returned from the second call, * but ::source will point mid-way through the invalid sequence (i.e. it * will be unmodified over the second call). In addition, the internal * incomplete-sequence buffer will be emptied, such that subsequent calls * will progress, rather than re-evaluating the same invalid sequence. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. * * Call this with a source length of 0 to flush the output buffer. */ parserutils_error charset_utf8_codec_decode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_utf8_codec *c = (charset_utf8_codec *) codec; parserutils_error error; if (c->read_len > 0) { /* Output left over from last decode */ uint32_t *pread = c->read_buf; while (c->read_len > 0 && *destlen >= c->read_len * 4) { *((uint32_t *) (void *) *dest) = endian_host_to_big(pread[0]); *dest += 4; *destlen -= 4; pread++; c->read_len--; } if (*destlen < c->read_len * 4) { /* Ran out of output buffer */ size_t i; /* Shuffle remaining output down */ for (i = 0; i < c->read_len; i++) c->read_buf[i] = pread[i]; return PARSERUTILS_NOMEM; } } if (c->inval_len > 0) { /* The last decode ended in an incomplete sequence. * Fill up inval_buf with data from the start of the * new chunk and process it. */ uint8_t *in = c->inval_buf; size_t ol = c->inval_len; size_t l = min(INVAL_BUFSIZE - ol - 1, *sourcelen); size_t orig_l = l; memcpy(c->inval_buf + ol, *source, l); l += c->inval_len; error = charset_utf8_codec_read_char(c, (const uint8_t **) &in, &l, dest, destlen); if (error != PARSERUTILS_OK && error != PARSERUTILS_NOMEM) { return error; } /* And now, fix up source pointers */ *source += max((signed) (orig_l - l), 0); *sourcelen -= max((signed) (orig_l - l), 0); /* Failed to resolve an incomplete character and * ran out of buffer space. No recovery strategy * possible, so explode everywhere. */ assert((orig_l + ol) - l != 0); /* Report memory exhaustion case from above */ if (error != PARSERUTILS_OK) return error; } /* Finally, the "normal" case; process all outstanding characters */ while (*sourcelen > 0) { error = charset_utf8_codec_read_char(c, source, sourcelen, dest, destlen); if (error != PARSERUTILS_OK) { return error; } } return PARSERUTILS_OK; } /** * Clear a UTF-8 codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_utf8_codec_reset(parserutils_charset_codec *codec) { charset_utf8_codec *c = (charset_utf8_codec *) codec; c->inval_buf[0] = '\0'; c->inval_len = 0; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; return PARSERUTILS_OK; } /** * Read a character from the UTF-8 to UCS-4 (big endian) * * \param c The codec * \param source Pointer to pointer to source buffer (updated on exit) * \param sourcelen Pointer to length of source buffer (updated on exit) * \param dest Pointer to pointer to output buffer (updated on exit) * \param destlen Pointer to length of output buffer (updated on exit) * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_utf8_codec_read_char(charset_utf8_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { uint32_t ucs4; size_t sucs4; parserutils_error error; /* Convert a single character */ { const uint8_t *src = *source; size_t srclen = *sourcelen; uint32_t *uptr = &ucs4; size_t *usptr = &sucs4; UTF8_TO_UCS4(src, srclen, uptr, usptr, error); } if (error == PARSERUTILS_OK) { /* Read a character */ error = charset_utf8_codec_output_decoded_char(c, ucs4, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += sucs4; *sourcelen -= sucs4; } /* Clear inval buffer */ c->inval_buf[0] = '\0'; c->inval_len = 0; return error; } else if (error == PARSERUTILS_NEEDDATA) { /* Incomplete input sequence */ assert(*sourcelen < INVAL_BUFSIZE); memmove(c->inval_buf, *source, *sourcelen); c->inval_buf[*sourcelen] = '\0'; c->inval_len = *sourcelen; *source += *sourcelen; *sourcelen = 0; return PARSERUTILS_OK; } else if (error == PARSERUTILS_INVALID) { /* Illegal input sequence */ uint32_t nextchar; /* Strict errormode; simply flag invalid character */ if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) { /* Clear inval buffer */ c->inval_buf[0] = '\0'; c->inval_len = 0; return PARSERUTILS_INVALID; } /* Find next valid UTF-8 sequence. * We're processing client-provided data, so let's * be paranoid about its validity. */ { const uint8_t *src = *source; size_t srclen = *sourcelen; uint32_t off = 0; uint32_t *ncptr = &nextchar; UTF8_NEXT_PARANOID(src, srclen, off, ncptr, error); } if (error != PARSERUTILS_OK) { if (error == PARSERUTILS_NEEDDATA) { /* Need more data to be sure */ assert(*sourcelen < INVAL_BUFSIZE); memmove(c->inval_buf, *source, *sourcelen); c->inval_buf[*sourcelen] = '\0'; c->inval_len = *sourcelen; *source += *sourcelen; *sourcelen = 0; nextchar = 0; } else { return error; } } /* Clear inval buffer */ c->inval_buf[0] = '\0'; c->inval_len = 0; /* output U+FFFD and continue processing. */ error = charset_utf8_codec_output_decoded_char(c, 0xFFFD, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += nextchar; *sourcelen -= nextchar; } return error; } return PARSERUTILS_OK; } /** * Output a UCS-4 character (big endian) * * \param c Codec to use * \param ucs4 UCS-4 character (host endian) * \param dest Pointer to pointer to output buffer * \param destlen Pointer to output buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, */ parserutils_error charset_utf8_codec_output_decoded_char(charset_utf8_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen) { if (*destlen < 4) { /* Run out of output buffer */ c->read_len = 1; c->read_buf[0] = ucs4; return PARSERUTILS_NOMEM; } *((uint32_t *) (void *) *dest) = endian_host_to_big(ucs4); *dest += 4; *destlen -= 4; return PARSERUTILS_OK; } const parserutils_charset_handler charset_utf8_codec_handler = { charset_utf8_codec_handles_charset, charset_utf8_codec_create }; netsurf-all-3.2/libparserutils/src/charset/codecs/codec_utf16.c0000644000175000017500000003671312377676760023635 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include #include #include #include "charset/codecs/codec_impl.h" #include "utils/endian.h" #include "utils/utils.h" /** * UTF-16 charset codec */ typedef struct charset_utf16_codec { parserutils_charset_codec base; /**< Base class */ #define INVAL_BUFSIZE (32) uint8_t inval_buf[INVAL_BUFSIZE]; /**< Buffer for fixing up * incomplete input * sequences */ size_t inval_len; /*< Byte length of inval_buf **/ #define READ_BUFSIZE (8) uint32_t read_buf[READ_BUFSIZE]; /**< Buffer for partial * output sequences (decode) * (host-endian) */ size_t read_len; /**< Character length of read_buf */ #define WRITE_BUFSIZE (8) uint32_t write_buf[WRITE_BUFSIZE]; /**< Buffer for partial * output sequences (encode) * (host-endian) */ size_t write_len; /**< Character length of write_buf */ } charset_utf16_codec; static bool charset_utf16_codec_handles_charset(const char *charset); static parserutils_error charset_utf16_codec_create(const char *charset, parserutils_charset_codec **codec); static parserutils_error charset_utf16_codec_destroy( parserutils_charset_codec *codec); static parserutils_error charset_utf16_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_utf16_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_utf16_codec_reset( parserutils_charset_codec *codec); static inline parserutils_error charset_utf16_codec_read_char( charset_utf16_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_utf16_codec_output_decoded_char( charset_utf16_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen); /** * Determine whether this codec handles a specific charset * * \param charset Charset to test * \return true if handleable, false otherwise */ bool charset_utf16_codec_handles_charset(const char *charset) { return parserutils_charset_mibenum_from_name(charset, strlen(charset)) == parserutils_charset_mibenum_from_name("UTF-16", SLEN("UTF-16")); } /** * Create a UTF-16 codec * * \param charset The charset to read from / write to * \param codec Pointer to location to receive codec * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error charset_utf16_codec_create(const char *charset, parserutils_charset_codec **codec) { charset_utf16_codec *c; UNUSED(charset); c = malloc(sizeof(charset_utf16_codec)); if (c == NULL) return PARSERUTILS_NOMEM; c->inval_buf[0] = '\0'; c->inval_len = 0; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; /* Finally, populate vtable */ c->base.handler.destroy = charset_utf16_codec_destroy; c->base.handler.encode = charset_utf16_codec_encode; c->base.handler.decode = charset_utf16_codec_decode; c->base.handler.reset = charset_utf16_codec_reset; *codec = (parserutils_charset_codec *) c; return PARSERUTILS_OK; } /** * Destroy a UTF-16 codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_utf16_codec_destroy (parserutils_charset_codec *codec) { UNUSED(codec); return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 (big endian) data into UTF-16 * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read. Any remaining output for the character will be buffered by the * codec for writing on the next call. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_utf16_codec_encode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_utf16_codec *c = (charset_utf16_codec *) codec; uint32_t ucs4; uint32_t *towrite; size_t towritelen; parserutils_error error; /* Process any outstanding characters from the previous call */ if (c->write_len > 0) { uint32_t *pwrite = c->write_buf; uint8_t buf[4]; size_t len; while (c->write_len > 0) { error = parserutils_charset_utf16_from_ucs4( pwrite[0], buf, &len); assert(error == PARSERUTILS_OK); if (*destlen < len) { /* Insufficient output buffer space */ for (len = 0; len < c->write_len; len++) c->write_buf[len] = pwrite[len]; return PARSERUTILS_NOMEM; } memcpy(*dest, buf, len); *dest += len; *destlen -= len; pwrite++; c->write_len--; } } /* Now process the characters for this call */ while (*sourcelen > 0) { ucs4 = endian_big_to_host(*((uint32_t *) (void *) *source)); towrite = &ucs4; towritelen = 1; /* Output current characters */ while (towritelen > 0) { uint8_t buf[4]; size_t len; error = parserutils_charset_utf16_from_ucs4( towrite[0], buf, &len); assert(error == PARSERUTILS_OK); if (*destlen < len) { /* Insufficient output space */ assert(towritelen < WRITE_BUFSIZE); c->write_len = towritelen; /* Copy pending chars to save area, for * processing next call. */ for (len = 0; len < towritelen; len++) c->write_buf[len] = towrite[len]; /* Claim character we've just buffered, * so it's not reprocessed */ *source += 4; *sourcelen -= 4; return PARSERUTILS_NOMEM; } memcpy(*dest, buf, len); *dest += len; *destlen -= len; towrite++; towritelen--; } *source += 4; *sourcelen -= 4; } (void) error; return PARSERUTILS_OK; } /** * Decode a chunk of UTF-16 data into UCS-4 (big endian) * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * If STRICT error handling is configured and an illegal sequence is split * over two calls, then _INVALID will be returned from the second call, * but ::source will point mid-way through the invalid sequence (i.e. it * will be unmodified over the second call). In addition, the internal * incomplete-sequence buffer will be emptied, such that subsequent calls * will progress, rather than re-evaluating the same invalid sequence. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. * * Call this with a source length of 0 to flush the output buffer. */ parserutils_error charset_utf16_codec_decode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_utf16_codec *c = (charset_utf16_codec *) codec; parserutils_error error; if (c->read_len > 0) { /* Output left over from last decode */ uint32_t *pread = c->read_buf; while (c->read_len > 0 && *destlen >= c->read_len * 4) { *((uint32_t *) (void *) *dest) = endian_host_to_big(pread[0]); *dest += 4; *destlen -= 4; pread++; c->read_len--; } if (*destlen < c->read_len * 4) { /* Ran out of output buffer */ size_t i; /* Shuffle remaining output down */ for (i = 0; i < c->read_len; i++) c->read_buf[i] = pread[i]; return PARSERUTILS_NOMEM; } } if (c->inval_len > 0) { /* The last decode ended in an incomplete sequence. * Fill up inval_buf with data from the start of the * new chunk and process it. */ uint8_t *in = c->inval_buf; size_t ol = c->inval_len; size_t l = min(INVAL_BUFSIZE - ol - 1, *sourcelen); size_t orig_l = l; memcpy(c->inval_buf + ol, *source, l); l += c->inval_len; error = charset_utf16_codec_read_char(c, (const uint8_t **) &in, &l, dest, destlen); if (error != PARSERUTILS_OK && error != PARSERUTILS_NOMEM) { return error; } /* And now, fix up source pointers */ *source += max((signed) (orig_l - l), 0); *sourcelen -= max((signed) (orig_l - l), 0); /* Failed to resolve an incomplete character and * ran out of buffer space. No recovery strategy * possible, so explode everywhere. */ assert((orig_l + ol) - l != 0); /* Report memory exhaustion case from above */ if (error != PARSERUTILS_OK) return error; } /* Finally, the "normal" case; process all outstanding characters */ while (*sourcelen > 0) { error = charset_utf16_codec_read_char(c, source, sourcelen, dest, destlen); if (error != PARSERUTILS_OK) { return error; } } return PARSERUTILS_OK; } /** * Clear a UTF-16 codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_utf16_codec_reset(parserutils_charset_codec *codec) { charset_utf16_codec *c = (charset_utf16_codec *) codec; c->inval_buf[0] = '\0'; c->inval_len = 0; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; return PARSERUTILS_OK; } /** * Read a character from the UTF-16 to UCS-4 (big endian) * * \param c The codec * \param source Pointer to pointer to source buffer (updated on exit) * \param sourcelen Pointer to length of source buffer (updated on exit) * \param dest Pointer to pointer to output buffer (updated on exit) * \param destlen Pointer to length of output buffer (updated on exit) * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_utf16_codec_read_char(charset_utf16_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { uint32_t ucs4; size_t sucs4; parserutils_error error; /* Convert a single character */ error = parserutils_charset_utf16_to_ucs4(*source, *sourcelen, &ucs4, &sucs4); if (error == PARSERUTILS_OK) { /* Read a character */ error = charset_utf16_codec_output_decoded_char(c, ucs4, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += sucs4; *sourcelen -= sucs4; } /* Clear inval buffer */ c->inval_buf[0] = '\0'; c->inval_len = 0; return error; } else if (error == PARSERUTILS_NEEDDATA) { /* Incomplete input sequence */ assert(*sourcelen < INVAL_BUFSIZE); memmove(c->inval_buf, *source, *sourcelen); c->inval_buf[*sourcelen] = '\0'; c->inval_len = *sourcelen; *source += *sourcelen; *sourcelen = 0; return PARSERUTILS_OK; } else if (error == PARSERUTILS_INVALID) { /* Illegal input sequence */ uint32_t nextchar; /* Clear inval buffer */ c->inval_buf[0] = '\0'; c->inval_len = 0; /* Strict errormode; simply flag invalid character */ if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) { return PARSERUTILS_INVALID; } /* Find next valid UTF-16 sequence. * We're processing client-provided data, so let's * be paranoid about its validity. */ error = parserutils_charset_utf16_next_paranoid( *source, *sourcelen, 0, &nextchar); if (error != PARSERUTILS_OK) { if (error == PARSERUTILS_NEEDDATA) { /* Need more data to be sure */ assert(*sourcelen < INVAL_BUFSIZE); memmove(c->inval_buf, *source, *sourcelen); c->inval_buf[*sourcelen] = '\0'; c->inval_len = *sourcelen; *source += *sourcelen; *sourcelen = 0; nextchar = 0; } else { return error; } } /* output U+FFFD and continue processing. */ error = charset_utf16_codec_output_decoded_char(c, 0xFFFD, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += nextchar; *sourcelen -= nextchar; } return error; } return PARSERUTILS_OK; } /** * Output a UCS-4 character (big endian) * * \param c Codec to use * \param ucs4 UCS-4 character (host endian) * \param dest Pointer to pointer to output buffer * \param destlen Pointer to output buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, */ parserutils_error charset_utf16_codec_output_decoded_char(charset_utf16_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen) { if (*destlen < 4) { /* Run out of output buffer */ c->read_len = 1; c->read_buf[0] = ucs4; return PARSERUTILS_NOMEM; } *((uint32_t *) (void *) *dest) = endian_host_to_big(ucs4); *dest += 4; *destlen -= 4; return PARSERUTILS_OK; } const parserutils_charset_handler charset_utf16_codec_handler = { charset_utf16_codec_handles_charset, charset_utf16_codec_create }; netsurf-all-3.2/libparserutils/src/charset/codecs/codec_ascii.c0000644000175000017500000003621412377676760023754 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include #include "charset/codecs/codec_impl.h" #include "utils/endian.h" #include "utils/utils.h" /** * US-ASCII charset codec */ typedef struct charset_ascii_codec { parserutils_charset_codec base; /**< Base class */ #define READ_BUFSIZE (8) uint32_t read_buf[READ_BUFSIZE]; /**< Buffer for partial * output sequences (decode) * (host-endian) */ size_t read_len; /**< Character length of read_buf */ #define WRITE_BUFSIZE (8) uint32_t write_buf[WRITE_BUFSIZE]; /**< Buffer for partial * output sequences (encode) * (host-endian) */ size_t write_len; /**< Character length of write_buf */ } charset_ascii_codec; static bool charset_ascii_codec_handles_charset(const char *charset); static parserutils_error charset_ascii_codec_create( const char *charset, parserutils_charset_codec **codec); static parserutils_error charset_ascii_codec_destroy( parserutils_charset_codec *codec); static parserutils_error charset_ascii_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_ascii_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_ascii_codec_reset( parserutils_charset_codec *codec); static inline parserutils_error charset_ascii_codec_read_char( charset_ascii_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_ascii_codec_output_decoded_char( charset_ascii_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_ascii_from_ucs4(charset_ascii_codec *c, uint32_t ucs4, uint8_t **s, size_t *len); static inline parserutils_error charset_ascii_to_ucs4(charset_ascii_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4); /** * Determine whether this codec handles a specific charset * * \param charset Charset to test * \return true if handleable, false otherwise */ bool charset_ascii_codec_handles_charset(const char *charset) { static uint16_t ascii; uint16_t match = parserutils_charset_mibenum_from_name(charset, strlen(charset)); if (ascii == 0) { ascii = parserutils_charset_mibenum_from_name( "US-ASCII", SLEN("US-ASCII")); } if (ascii != 0 && ascii == match) return true; return false; } /** * Create a US-ASCII codec * * \param charset The charset to read from / write to * \param codec Pointer to location to receive codec * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error charset_ascii_codec_create(const char *charset, parserutils_charset_codec **codec) { charset_ascii_codec *c; UNUSED(charset); c = malloc(sizeof(charset_ascii_codec)); if (c == NULL) return PARSERUTILS_NOMEM; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; /* Finally, populate vtable */ c->base.handler.destroy = charset_ascii_codec_destroy; c->base.handler.encode = charset_ascii_codec_encode; c->base.handler.decode = charset_ascii_codec_decode; c->base.handler.reset = charset_ascii_codec_reset; *codec = (parserutils_charset_codec *) c; return PARSERUTILS_OK; } /** * Destroy a US-ASCII codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_ascii_codec_destroy (parserutils_charset_codec *codec) { UNUSED(codec); return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 (big endian) data into US-ASCII * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read. Any remaining output for the character will be buffered by the * codec for writing on the next call. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_ascii_codec_encode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_ascii_codec *c = (charset_ascii_codec *) codec; uint32_t ucs4; uint32_t *towrite; size_t towritelen; parserutils_error error; /* Process any outstanding characters from the previous call */ if (c->write_len > 0) { uint32_t *pwrite = c->write_buf; while (c->write_len > 0) { error = charset_ascii_from_ucs4(c, pwrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; assert(error == PARSERUTILS_NOMEM); for (len = 0; len < c->write_len; len++) { c->write_buf[len] = pwrite[len]; } return error; } pwrite++; c->write_len--; } } /* Now process the characters for this call */ while (*sourcelen > 0) { ucs4 = endian_big_to_host(*((uint32_t *) (void *) *source)); towrite = &ucs4; towritelen = 1; /* Output current characters */ while (towritelen > 0) { error = charset_ascii_from_ucs4(c, towrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; if (error != PARSERUTILS_NOMEM) { return error; } /* Insufficient output space */ assert(towritelen < WRITE_BUFSIZE); c->write_len = towritelen; /* Copy pending chars to save area, for * processing next call. */ for (len = 0; len < towritelen; len++) c->write_buf[len] = towrite[len]; /* Claim character we've just buffered, * so it's not reprocessed */ *source += 4; *sourcelen -= 4; return PARSERUTILS_NOMEM; } towrite++; towritelen--; } *source += 4; *sourcelen -= 4; } return PARSERUTILS_OK; } /** * Decode a chunk of US-ASCII data into UCS-4 (big endian) * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * If STRICT error handling is configured and an illegal sequence is split * over two calls, then _INVALID will be returned from the second call, * but ::source will point mid-way through the invalid sequence (i.e. it * will be unmodified over the second call). In addition, the internal * incomplete-sequence buffer will be emptied, such that subsequent calls * will progress, rather than re-evaluating the same invalid sequence. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. * * Call this with a source length of 0 to flush the output buffer. */ parserutils_error charset_ascii_codec_decode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_ascii_codec *c = (charset_ascii_codec *) codec; parserutils_error error; if (c->read_len > 0) { /* Output left over from last decode */ uint32_t *pread = c->read_buf; while (c->read_len > 0 && *destlen >= c->read_len * 4) { *((uint32_t *) (void *) *dest) = endian_host_to_big(pread[0]); *dest += 4; *destlen -= 4; pread++; c->read_len--; } if (*destlen < c->read_len * 4) { /* Ran out of output buffer */ size_t i; /* Shuffle remaining output down */ for (i = 0; i < c->read_len; i++) c->read_buf[i] = pread[i]; return PARSERUTILS_NOMEM; } } /* Finally, the "normal" case; process all outstanding characters */ while (*sourcelen > 0) { error = charset_ascii_codec_read_char(c, source, sourcelen, dest, destlen); if (error != PARSERUTILS_OK) { return error; } } return PARSERUTILS_OK; } /** * Clear a US-ASCII codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_ascii_codec_reset(parserutils_charset_codec *codec) { charset_ascii_codec *c = (charset_ascii_codec *) codec; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; return PARSERUTILS_OK; } /** * Read a character from US-ASCII to UCS-4 (big endian) * * \param c The codec * \param source Pointer to pointer to source buffer (updated on exit) * \param sourcelen Pointer to length of source buffer (updated on exit) * \param dest Pointer to pointer to output buffer (updated on exit) * \param destlen Pointer to length of output buffer (updated on exit) * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_ascii_codec_read_char(charset_ascii_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { uint32_t ucs4; parserutils_error error; /* Convert a single character */ error = charset_ascii_to_ucs4(c, *source, *sourcelen, &ucs4); if (error == PARSERUTILS_OK) { /* Read a character */ error = charset_ascii_codec_output_decoded_char(c, ucs4, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } else if (error == PARSERUTILS_NEEDDATA) { /* Can only happen if sourcelen == 0 */ return error; } else if (error == PARSERUTILS_INVALID) { /* Illegal input sequence */ /* Strict errormode; simply flag invalid character */ if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) { return PARSERUTILS_INVALID; } /* output U+FFFD and continue processing. */ error = charset_ascii_codec_output_decoded_char(c, 0xFFFD, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } return PARSERUTILS_OK; } /** * Output a UCS-4 character (big endian) * * \param c Codec to use * \param ucs4 UCS-4 character (host endian) * \param dest Pointer to pointer to output buffer * \param destlen Pointer to output buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, */ parserutils_error charset_ascii_codec_output_decoded_char( charset_ascii_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen) { if (*destlen < 4) { /* Run out of output buffer */ c->read_len = 1; c->read_buf[0] = ucs4; return PARSERUTILS_NOMEM; } *((uint32_t *) (void *) *dest) = endian_host_to_big(ucs4); *dest += 4; *destlen -= 4; return PARSERUTILS_OK; } /** * Convert a UCS4 (host endian) character to US-ASCII * * \param c The codec instance * \param ucs4 The UCS4 character to convert * \param s Pointer to pointer to destination buffer * \param len Pointer to destination buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if there's insufficient space in the output buffer, * PARSERUTILS_INVALID if the character cannot be represented * * _INVALID will only be returned if the codec's conversion mode is STRICT. * Otherwise, '?' will be output. * * On successful conversion, *s and *len will be updated. */ parserutils_error charset_ascii_from_ucs4(charset_ascii_codec *c, uint32_t ucs4, uint8_t **s, size_t *len) { uint8_t out = 0; if (*len < 1) return PARSERUTILS_NOMEM; if (ucs4 < 0x80) { /* ASCII */ out = ucs4; } else { if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) return PARSERUTILS_INVALID; else out = '?'; } *(*s) = out; (*s)++; (*len)--; return PARSERUTILS_OK; } /** * Convert a US-ASCII character to UCS4 (host endian) * * \param c The codec instance * \param s Pointer to source buffer * \param len Source buffer length * \param ucs4 Pointer to destination buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NEEDDATA if there's insufficient input data * PARSERUTILS_INVALID if the character cannot be represented */ parserutils_error charset_ascii_to_ucs4(charset_ascii_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4) { uint32_t out; UNUSED(c); if (len < 1) return PARSERUTILS_NEEDDATA; if (*s < 0x80) { out = *s; } else { return PARSERUTILS_INVALID; } *ucs4 = out; return PARSERUTILS_OK; } const parserutils_charset_handler charset_ascii_codec_handler = { charset_ascii_codec_handles_charset, charset_ascii_codec_create }; netsurf-all-3.2/libparserutils/src/charset/codecs/codec_impl.h0000644000175000017500000000253012377676760023624 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_charset_codecs_codecimpl_h_ #define parserutils_charset_codecs_codecimpl_h_ #include #include #include /** * Core charset codec definition; implementations extend this */ struct parserutils_charset_codec { uint16_t mibenum; /**< MIB enum for charset */ parserutils_charset_codec_errormode errormode; /**< error mode */ struct { parserutils_error (*destroy)(parserutils_charset_codec *codec); parserutils_error (*encode)(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); parserutils_error (*decode)(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); parserutils_error (*reset)(parserutils_charset_codec *codec); } handler; /**< Vtable for handler code */ }; /** * Codec factory component definition */ typedef struct parserutils_charset_handler { bool (*handles_charset)(const char *charset); parserutils_error (*create)(const char *charset, parserutils_charset_codec **codec); } parserutils_charset_handler; #endif netsurf-all-3.2/libparserutils/src/charset/codecs/codec_ext8.c0000644000175000017500000004071312377676760023553 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include #include "charset/codecs/codec_impl.h" #include "utils/endian.h" #include "utils/utils.h" #include "charset/codecs/ext8_tables.h" static struct { uint16_t mib; const char *name; size_t len; uint32_t *table; } known_charsets[] = { { 0, "Windows-1250", SLEN("Windows-1250"), w1250 }, { 0, "Windows-1251", SLEN("Windows-1251"), w1251 }, { 0, "Windows-1252", SLEN("Windows-1252"), w1252 }, { 0, "Windows-1253", SLEN("Windows-1253"), w1253 }, { 0, "Windows-1254", SLEN("Windows-1254"), w1254 }, { 0, "Windows-1255", SLEN("Windows-1255"), w1255 }, { 0, "Windows-1256", SLEN("Windows-1256"), w1256 }, { 0, "Windows-1257", SLEN("Windows-1257"), w1257 }, { 0, "Windows-1258", SLEN("Windows-1258"), w1258 }, }; /** * Windows charset codec */ typedef struct charset_ext8_codec { parserutils_charset_codec base; /**< Base class */ uint32_t *table; /**< Mapping table for 0x80-0xFF */ #define READ_BUFSIZE (8) uint32_t read_buf[READ_BUFSIZE]; /**< Buffer for partial * output sequences (decode) * (host-endian) */ size_t read_len; /**< Character length of read_buf */ #define WRITE_BUFSIZE (8) uint32_t write_buf[WRITE_BUFSIZE]; /**< Buffer for partial * output sequences (encode) * (host-endian) */ size_t write_len; /**< Character length of write_buf */ } charset_ext8_codec; static bool charset_ext8_codec_handles_charset(const char *charset); static parserutils_error charset_ext8_codec_create(const char *charset, parserutils_charset_codec **codec); static parserutils_error charset_ext8_codec_destroy( parserutils_charset_codec *codec); static parserutils_error charset_ext8_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_ext8_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_ext8_codec_reset( parserutils_charset_codec *codec); static inline parserutils_error charset_ext8_codec_read_char( charset_ext8_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_ext8_codec_output_decoded_char( charset_ext8_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_ext8_from_ucs4(charset_ext8_codec *c, uint32_t ucs4, uint8_t **s, size_t *len); static inline parserutils_error charset_ext8_to_ucs4(charset_ext8_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4); /** * Determine whether this codec handles a specific charset * * \param charset Charset to test * \return true if handleable, false otherwise */ bool charset_ext8_codec_handles_charset(const char *charset) { uint32_t i; uint16_t match = parserutils_charset_mibenum_from_name(charset, strlen(charset)); if (known_charsets[0].mib == 0) { for (i = 0; i < N_ELEMENTS(known_charsets); i++) { known_charsets[i].mib = parserutils_charset_mibenum_from_name( known_charsets[i].name, known_charsets[i].len); } } for (i = 0; i < N_ELEMENTS(known_charsets); i++) { if (known_charsets[i].mib == match) return true; } return false; } /** * Create an extended 8bit codec * * \param charset The charset to read from / write to * \param codec Pointer to location to receive codec * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error charset_ext8_codec_create(const char *charset, parserutils_charset_codec **codec) { uint32_t i; charset_ext8_codec *c; uint16_t match = parserutils_charset_mibenum_from_name( charset, strlen(charset)); uint32_t *table = NULL; for (i = 0; i < N_ELEMENTS(known_charsets); i++) { if (known_charsets[i].mib == match) { table = known_charsets[i].table; break; } } assert(table != NULL); c = malloc(sizeof(charset_ext8_codec)); if (c == NULL) return PARSERUTILS_NOMEM; c->table = table; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; /* Finally, populate vtable */ c->base.handler.destroy = charset_ext8_codec_destroy; c->base.handler.encode = charset_ext8_codec_encode; c->base.handler.decode = charset_ext8_codec_decode; c->base.handler.reset = charset_ext8_codec_reset; *codec = (parserutils_charset_codec *) c; return PARSERUTILS_OK; } /** * Destroy an extended 8bit codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_ext8_codec_destroy (parserutils_charset_codec *codec) { UNUSED(codec); return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 (big endian) data into extended 8bit * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read. Any remaining output for the character will be buffered by the * codec for writing on the next call. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_ext8_codec_encode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_ext8_codec *c = (charset_ext8_codec *) codec; uint32_t ucs4; uint32_t *towrite; size_t towritelen; parserutils_error error; /* Process any outstanding characters from the previous call */ if (c->write_len > 0) { uint32_t *pwrite = c->write_buf; while (c->write_len > 0) { error = charset_ext8_from_ucs4(c, pwrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; assert(error == PARSERUTILS_NOMEM); for (len = 0; len < c->write_len; len++) { c->write_buf[len] = pwrite[len]; } return error; } pwrite++; c->write_len--; } } /* Now process the characters for this call */ while (*sourcelen > 0) { ucs4 = endian_big_to_host(*((uint32_t *) (void *) *source)); towrite = &ucs4; towritelen = 1; /* Output current characters */ while (towritelen > 0) { error = charset_ext8_from_ucs4(c, towrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; if (error != PARSERUTILS_NOMEM) { return error; } /* Insufficient output space */ assert(towritelen < WRITE_BUFSIZE); c->write_len = towritelen; /* Copy pending chars to save area, for * processing next call. */ for (len = 0; len < towritelen; len++) c->write_buf[len] = towrite[len]; /* Claim character we've just buffered, * so it's not reprocessed */ *source += 4; *sourcelen -= 4; return PARSERUTILS_NOMEM; } towrite++; towritelen--; } *source += 4; *sourcelen -= 4; } return PARSERUTILS_OK; } /** * Decode a chunk of extended 8bit data into UCS-4 (big endian) * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * If STRICT error handling is configured and an illegal sequence is split * over two calls, then _INVALID will be returned from the second call, * but ::source will point mid-way through the invalid sequence (i.e. it * will be unmodified over the second call). In addition, the internal * incomplete-sequence buffer will be emptied, such that subsequent calls * will progress, rather than re-evaluating the same invalid sequence. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. * * Call this with a source length of 0 to flush the output buffer. */ parserutils_error charset_ext8_codec_decode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_ext8_codec *c = (charset_ext8_codec *) codec; parserutils_error error; if (c->read_len > 0) { /* Output left over from last decode */ uint32_t *pread = c->read_buf; while (c->read_len > 0 && *destlen >= c->read_len * 4) { *((uint32_t *) (void *) *dest) = endian_host_to_big(pread[0]); *dest += 4; *destlen -= 4; pread++; c->read_len--; } if (*destlen < c->read_len * 4) { /* Ran out of output buffer */ size_t i; /* Shuffle remaining output down */ for (i = 0; i < c->read_len; i++) c->read_buf[i] = pread[i]; return PARSERUTILS_NOMEM; } } /* Finally, the "normal" case; process all outstanding characters */ while (*sourcelen > 0) { error = charset_ext8_codec_read_char(c, source, sourcelen, dest, destlen); if (error != PARSERUTILS_OK) { return error; } } return PARSERUTILS_OK; } /** * Clear an extended 8bit codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_ext8_codec_reset(parserutils_charset_codec *codec) { charset_ext8_codec *c = (charset_ext8_codec *) codec; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; return PARSERUTILS_OK; } /** * Read a character from the extended 8bit to UCS-4 (big endian) * * \param c The codec * \param source Pointer to pointer to source buffer (updated on exit) * \param sourcelen Pointer to length of source buffer (updated on exit) * \param dest Pointer to pointer to output buffer (updated on exit) * \param destlen Pointer to length of output buffer (updated on exit) * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_ext8_codec_read_char(charset_ext8_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { uint32_t ucs4; parserutils_error error; /* Convert a single character */ error = charset_ext8_to_ucs4(c, *source, *sourcelen, &ucs4); if (error == PARSERUTILS_OK) { /* Read a character */ error = charset_ext8_codec_output_decoded_char(c, ucs4, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } else if (error == PARSERUTILS_NEEDDATA) { /* Can only happen if sourcelen == 0 */ return error; } else if (error == PARSERUTILS_INVALID) { /* Illegal input sequence */ /* Strict errormode; simply flag invalid character */ if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) { return PARSERUTILS_INVALID; } /* output U+FFFD and continue processing. */ error = charset_ext8_codec_output_decoded_char(c, 0xFFFD, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } return PARSERUTILS_OK; } /** * Output a UCS-4 character (big endian) * * \param c Codec to use * \param ucs4 UCS-4 character (host endian) * \param dest Pointer to pointer to output buffer * \param destlen Pointer to output buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, */ parserutils_error charset_ext8_codec_output_decoded_char(charset_ext8_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen) { if (*destlen < 4) { /* Run out of output buffer */ c->read_len = 1; c->read_buf[0] = ucs4; return PARSERUTILS_NOMEM; } *((uint32_t *) (void *) *dest) = endian_host_to_big(ucs4); *dest += 4; *destlen -= 4; return PARSERUTILS_OK; } /** * Convert a UCS4 (host endian) character to extended 8bit * * \param c The codec instance * \param ucs4 The UCS4 character to convert * \param s Pointer to pointer to destination buffer * \param len Pointer to destination buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if there's insufficient space in the output buffer, * PARSERUTILS_INVALID if the character cannot be represented * * _INVALID will only be returned if the codec's conversion mode is STRICT. * Otherwise, '?' will be output. * * On successful conversion, *s and *len will be updated. */ parserutils_error charset_ext8_from_ucs4(charset_ext8_codec *c, uint32_t ucs4, uint8_t **s, size_t *len) { uint8_t out = 0; if (*len < 1) return PARSERUTILS_NOMEM; if (ucs4 < 0x80) { /* ASCII */ out = ucs4; } else { uint32_t i; for (i = 0; i < 128; i++) { if (ucs4 == c->table[i]) break; } if (i == 128) { if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) return PARSERUTILS_INVALID; else out = '?'; } else { out = 0x80 + i; } } *(*s) = out; (*s)++; (*len)--; return PARSERUTILS_OK; } /** * Convert an extended 8bit character to UCS4 (host endian) * * \param c The codec instance * \param s Pointer to source buffer * \param len Source buffer length * \param ucs4 Pointer to destination buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NEEDDATA if there's insufficient input data * PARSERUTILS_INVALID if the character cannot be represented */ parserutils_error charset_ext8_to_ucs4(charset_ext8_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4) { uint32_t out; if (len < 1) return PARSERUTILS_NEEDDATA; if (*s < 0x80) { out = *s; } else { if (c->table[*s - 0x80] == 0xFFFF) return PARSERUTILS_INVALID; out = c->table[*s - 0x80]; } *ucs4 = out; return PARSERUTILS_OK; } const parserutils_charset_handler charset_ext8_codec_handler = { charset_ext8_codec_handles_charset, charset_ext8_codec_create }; netsurf-all-3.2/libparserutils/src/charset/codecs/ext8_tables.h0000644000175000017500000002404212377676760023752 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef parserutils_charset_codecs_ext8tables_h_ #define parserutils_charset_codecs_ext8tables_h_ /* Mapping tables for extended 8bit -> UCS4. * Undefined characters are mapped to U+FFFF, * which is a guaranteed non-character */ static uint32_t w1250[128] = { 0x20AC, 0xFFFF, 0x201A, 0xFFFF, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFF, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A, 0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B, 0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, }; static uint32_t w1251[128] = { 0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, 0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, 0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, 0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, 0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, 0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, 0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, }; static uint32_t w1252[128] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFF, 0x017D, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFF, 0x017E, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, }; static uint32_t w1253[128] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFF, 0x2030, 0xFFFF, 0x2039, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0xFFFF, 0x203A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0xFFFF, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0xFFFF, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFF, }; static uint32_t w1254[128] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0xFFFF, 0xFFFF, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF, }; static uint32_t w1255[128] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0xFFFF, 0x2039, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0xFFFF, 0x203A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AA, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0xFFFF, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xFFFF, 0xFFFF, 0x200E, 0x200F, 0xFFFF, }; static uint32_t w1256[128] = { 0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, 0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA, 0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F, 0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7, 0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0641, 0x0642, 0x0643, 0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF, 0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7, 0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2, }; static uint32_t w1257[128] = { 0x20AC, 0xFFFF, 0x201A, 0xFFFF, 0x201E, 0x2026, 0x2020, 0x2021, 0xFFFF, 0x2030, 0xFFFF, 0x2039, 0xFFFF, 0x00A8, 0x02C7, 0x00B8, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0xFFFF, 0x2122, 0xFFFF, 0x203A, 0xFFFF, 0x00AF, 0x02DB, 0xFFFF, 0x00A0, 0xFFFF, 0x00A2, 0x00A3, 0x00A4, 0xFFFF, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9, }; static uint32_t w1258[128] = { 0x20AC, 0xFFFF, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021, 0x02C6, 0x2030, 0xFFFF, 0x2039, 0x0152, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x02DC, 0x2122, 0xFFFF, 0x203A, 0x0153, 0xFFFF, 0xFFFF, 0x0178, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF, 0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF, 0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF, }; #endif netsurf-all-3.2/libparserutils/src/charset/codecs/8859_tables.h0000644000175000017500000003100312377676760023472 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #ifndef parserutils_charset_codecs_8859tables_h_ #define parserutils_charset_codecs_8859tables_h_ /* Mapping tables for ISO-8859-n -> UCS4. * Undefined characters are mapped to U+FFFF, * which is a guaranteed non-character */ static uint32_t t1[96] = { 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, }; static uint32_t t2[96] = { 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, 0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, 0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, 0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, 0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, 0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, 0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9, }; static uint32_t t3[96] = { 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0xFFFF, 0x0124, 0x00A7, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0xFFFF, 0x017B, 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B8, 0x0131, 0x015F, 0x011F, 0x0135, 0x00BD, 0xFFFF, 0x017C, 0x00C0, 0x00C1, 0x00C2, 0xFFFF, 0x00C4, 0x010A, 0x0108, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0xFFFF, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x0120, 0x00D6, 0x00D7, 0x011C, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x016C, 0x015C, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0xFFFF, 0x00E4, 0x010B, 0x0109, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0xFFFF, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x0121, 0x00F6, 0x00F7, 0x011D, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x016D, 0x015D, 0x02D9, }; static uint32_t t4[96] = { 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014A, 0x017E, 0x014B, 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x012A, 0x0110, 0x0145, 0x014C, 0x0136, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x0168, 0x016A, 0x00DF, 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x012B, 0x0111, 0x0146, 0x014D, 0x0137, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x0169, 0x016B, 0x02D9, }; static uint32_t t5[96] = { 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00A7, 0x045E, 0x045F, }; static uint32_t t6[96] = { 0x00A0, 0xFFFF, 0xFFFF, 0xFFFF, 0x00A4, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x060C, 0x00AD, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x061B, 0xFFFF, 0xFFFF, 0xFFFF, 0x061F, 0xFFFF, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, 0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x0651, 0x0652, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, }; static uint32_t t7[96] = { 0x00A0, 0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0xFFFF, 0x2015, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7, 0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F, 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0, 0x03A1, 0xFFFF, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0xFFFF, }; static uint32_t t8[96] = { 0x00A0, 0xFFFF, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x2017, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0xFFFF, 0xFFFF, 0x200E, 0x200F, 0xFFFF, }; static uint32_t t9[96] = { 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0130, 0x015E, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF, }; static uint32_t t10[96] = { 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x013C, 0x0111, 0x0161, 0x0167, 0x017E, 0x2015, 0x016B, 0x014B, 0x0100, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x012E, 0x010C, 0x00C9, 0x0118, 0x00CB, 0x0116, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x0145, 0x014C, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x0168, 0x00D8, 0x0172, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x0101, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x012F, 0x010D, 0x00E9, 0x0119, 0x00EB, 0x0117, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x0146, 0x014D, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x0169, 0x00F8, 0x0173, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x0138, }; static uint32_t t11[96] = { 0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, 0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F, 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F, 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37, 0x0E38, 0x0E39, 0x0E3A, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0E3F, 0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, }; static uint32_t t13[96] = { 0x00A0, 0x201D, 0x00A2, 0x00A3, 0x00A4, 0x201E, 0x00A6, 0x00A7, 0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00C6, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x201C, 0x00B5, 0x00B6, 0x00B7, 0x00F8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6, 0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112, 0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B, 0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7, 0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF, 0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113, 0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C, 0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7, 0x0173, 0x0142, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x2019, }; static uint32_t t14[96] = { 0x00A0, 0x1E02, 0x1E03, 0x00A3, 0x010A, 0x010B, 0x1E0A, 0x00A7, 0x1E80, 0x00A9, 0x1E82, 0x1E0B, 0x1EF2, 0x00AD, 0x00AE, 0x0178, 0x1E1E, 0x1E1F, 0x0120, 0x0121, 0x1E40, 0x1E41, 0x00B6, 0x1E56, 0x1E81, 0x1E57, 0x1E83, 0x1E60, 0x1EF3, 0x1E84, 0x1E85, 0x1E61, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0174, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x1E6A, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x0176, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x0175, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x1E6B, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x0177, 0x00FF, }; static uint32_t t15[96] = { 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x20AC, 0x00A5, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x017D, 0x00B5, 0x00B6, 0x00B7, 0x017E, 0x00B9, 0x00BA, 0x00BB, 0x0152, 0x0153, 0x0178, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, }; static uint32_t t16[96] = { 0x00A0, 0x0104, 0x0105, 0x0141, 0x20AC, 0x201E, 0x0160, 0x00A7, 0x0161, 0x00A9, 0x0218, 0x00AB, 0x0179, 0x00AD, 0x017A, 0x017B, 0x00B0, 0x00B1, 0x010C, 0x0142, 0x017D, 0x201D, 0x00B6, 0x00B7, 0x017E, 0x010D, 0x0219, 0x00BB, 0x0152, 0x0153, 0x0178, 0x017C, 0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0106, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0110, 0x0143, 0x00D2, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x015A, 0x0170, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x0118, 0x021A, 0x00DF, 0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x0107, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x0111, 0x0144, 0x00F2, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x015B, 0x0171, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0119, 0x021B, 0x00FF, }; #endif netsurf-all-3.2/libparserutils/src/charset/codecs/codec_8859.c0000644000175000017500000004132212377676760023275 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include #include #include "charset/codecs/codec_impl.h" #include "utils/endian.h" #include "utils/utils.h" #include "charset/codecs/8859_tables.h" static struct { uint16_t mib; const char *name; size_t len; uint32_t *table; } known_charsets[] = { { 0, "ISO-8859-1", SLEN("ISO-8859-1"), t1 }, { 0, "ISO-8859-2", SLEN("ISO-8859-2"), t2 }, { 0, "ISO-8859-3", SLEN("ISO-8859-3"), t3 }, { 0, "ISO-8859-4", SLEN("ISO-8859-4"), t4 }, { 0, "ISO-8859-5", SLEN("ISO-8859-5"), t5 }, { 0, "ISO-8859-6", SLEN("ISO-8859-6"), t6 }, { 0, "ISO-8859-7", SLEN("ISO-8859-7"), t7 }, { 0, "ISO-8859-8", SLEN("ISO-8859-8"), t8 }, { 0, "ISO-8859-9", SLEN("ISO-8859-9"), t9 }, { 0, "ISO-8859-10", SLEN("ISO-8859-10"), t10 }, { 0, "ISO-8859-11", SLEN("ISO-8859-11"), t11 }, { 0, "ISO-8859-13", SLEN("ISO-8859-13"), t13 }, { 0, "ISO-8859-14", SLEN("ISO-8859-14"), t14 }, { 0, "ISO-8859-15", SLEN("ISO-8859-15"), t15 }, { 0, "ISO-8859-16", SLEN("ISO-8859-16"), t16 } }; /** * ISO-8859-n charset codec */ typedef struct charset_8859_codec { parserutils_charset_codec base; /**< Base class */ uint32_t *table; /**< Mapping table for 0xA0-0xFF */ #define READ_BUFSIZE (8) uint32_t read_buf[READ_BUFSIZE]; /**< Buffer for partial * output sequences (decode) * (host-endian) */ size_t read_len; /**< Character length of read_buf */ #define WRITE_BUFSIZE (8) uint32_t write_buf[WRITE_BUFSIZE]; /**< Buffer for partial * output sequences (encode) * (host-endian) */ size_t write_len; /**< Character length of write_buf */ } charset_8859_codec; static bool charset_8859_codec_handles_charset(const char *charset); static parserutils_error charset_8859_codec_create(const char *charset, parserutils_charset_codec **codec); static parserutils_error charset_8859_codec_destroy( parserutils_charset_codec *codec); static parserutils_error charset_8859_codec_encode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_8859_codec_decode( parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static parserutils_error charset_8859_codec_reset( parserutils_charset_codec *codec); static inline parserutils_error charset_8859_codec_read_char( charset_8859_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_8859_codec_output_decoded_char( charset_8859_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen); static inline parserutils_error charset_8859_from_ucs4(charset_8859_codec *c, uint32_t ucs4, uint8_t **s, size_t *len); static inline parserutils_error charset_8859_to_ucs4(charset_8859_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4); /** * Determine whether this codec handles a specific charset * * \param charset Charset to test * \return true if handleable, false otherwise */ bool charset_8859_codec_handles_charset(const char *charset) { uint32_t i; uint16_t match = parserutils_charset_mibenum_from_name(charset, strlen(charset)); if (known_charsets[0].mib == 0) { for (i = 0; i < N_ELEMENTS(known_charsets); i++) { known_charsets[i].mib = parserutils_charset_mibenum_from_name( known_charsets[i].name, known_charsets[i].len); } } for (i = 0; i < N_ELEMENTS(known_charsets); i++) { if (known_charsets[i].mib == match) return true; } return false; } /** * Create an ISO-8859-n codec * * \param charset The charset to read from / write to * \param codec Pointer to location to receive codec * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error charset_8859_codec_create(const char *charset, parserutils_charset_codec **codec) { uint32_t i; charset_8859_codec *c; uint16_t match = parserutils_charset_mibenum_from_name( charset, strlen(charset)); uint32_t *table = NULL; for (i = 0; i < N_ELEMENTS(known_charsets); i++) { if (known_charsets[i].mib == match) { table = known_charsets[i].table; break; } } assert(table != NULL); c = malloc(sizeof(charset_8859_codec)); if (c == NULL) return PARSERUTILS_NOMEM; c->table = table; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; /* Finally, populate vtable */ c->base.handler.destroy = charset_8859_codec_destroy; c->base.handler.encode = charset_8859_codec_encode; c->base.handler.decode = charset_8859_codec_decode; c->base.handler.reset = charset_8859_codec_reset; *codec = (parserutils_charset_codec *) c; return PARSERUTILS_OK; } /** * Destroy an ISO-8859-n codec * * \param codec The codec to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_8859_codec_destroy (parserutils_charset_codec *codec) { UNUSED(codec); return PARSERUTILS_OK; } /** * Encode a chunk of UCS-4 (big endian) data into ISO-8859-n * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read. Any remaining output for the character will be buffered by the * codec for writing on the next call. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_8859_codec_encode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_8859_codec *c = (charset_8859_codec *) codec; uint32_t ucs4; uint32_t *towrite; size_t towritelen; parserutils_error error; /* Process any outstanding characters from the previous call */ if (c->write_len > 0) { uint32_t *pwrite = c->write_buf; while (c->write_len > 0) { error = charset_8859_from_ucs4(c, pwrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; assert(error == PARSERUTILS_NOMEM); for (len = 0; len < c->write_len; len++) { c->write_buf[len] = pwrite[len]; } return error; } pwrite++; c->write_len--; } } /* Now process the characters for this call */ while (*sourcelen > 0) { ucs4 = endian_big_to_host(*((uint32_t *) (void *) *source)); towrite = &ucs4; towritelen = 1; /* Output current characters */ while (towritelen > 0) { error = charset_8859_from_ucs4(c, towrite[0], dest, destlen); if (error != PARSERUTILS_OK) { uint32_t len; if (error != PARSERUTILS_NOMEM) { return error; } /* Insufficient output space */ assert(towritelen < WRITE_BUFSIZE); c->write_len = towritelen; /* Copy pending chars to save area, for * processing next call. */ for (len = 0; len < towritelen; len++) c->write_buf[len] = towrite[len]; /* Claim character we've just buffered, * so it's not reprocessed */ *source += 4; *sourcelen -= 4; return PARSERUTILS_NOMEM; } towrite++; towritelen--; } *source += 4; *sourcelen -= 4; } return PARSERUTILS_OK; } /** * Decode a chunk of ISO-8859-n data into UCS-4 (big endian) * * \param codec The codec to use * \param source Pointer to pointer to source data * \param sourcelen Pointer to length (in bytes) of source data * \param dest Pointer to pointer to output buffer * \param destlen Pointer to length (in bytes) of output buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * Note that, if failure occurs whilst attempting to write any output * buffered by the last call, then ::source and ::sourcelen will remain * unchanged (as nothing more has been read). * * If STRICT error handling is configured and an illegal sequence is split * over two calls, then _INVALID will be returned from the second call, * but ::source will point mid-way through the invalid sequence (i.e. it * will be unmodified over the second call). In addition, the internal * incomplete-sequence buffer will be emptied, such that subsequent calls * will progress, rather than re-evaluating the same invalid sequence. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. * * Call this with a source length of 0 to flush the output buffer. */ parserutils_error charset_8859_codec_decode(parserutils_charset_codec *codec, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { charset_8859_codec *c = (charset_8859_codec *) codec; parserutils_error error; if (c->read_len > 0) { /* Output left over from last decode */ uint32_t *pread = c->read_buf; while (c->read_len > 0 && *destlen >= c->read_len * 4) { *((uint32_t *) (void *) *dest) = endian_host_to_big(pread[0]); *dest += 4; *destlen -= 4; pread++; c->read_len--; } if (*destlen < c->read_len * 4) { /* Ran out of output buffer */ size_t i; /* Shuffle remaining output down */ for (i = 0; i < c->read_len; i++) c->read_buf[i] = pread[i]; return PARSERUTILS_NOMEM; } } /* Finally, the "normal" case; process all outstanding characters */ while (*sourcelen > 0) { error = charset_8859_codec_read_char(c, source, sourcelen, dest, destlen); if (error != PARSERUTILS_OK) { return error; } } return PARSERUTILS_OK; } /** * Clear an ISO-8859-n codec's encoding state * * \param codec The codec to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error charset_8859_codec_reset(parserutils_charset_codec *codec) { charset_8859_codec *c = (charset_8859_codec *) codec; c->read_buf[0] = 0; c->read_len = 0; c->write_buf[0] = 0; c->write_len = 0; return PARSERUTILS_OK; } /** * Read a character from the ISO-8859-n to UCS-4 (big endian) * * \param c The codec * \param source Pointer to pointer to source buffer (updated on exit) * \param sourcelen Pointer to length of source buffer (updated on exit) * \param dest Pointer to pointer to output buffer (updated on exit) * \param destlen Pointer to length of output buffer (updated on exit) * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, * PARSERUTILS_INVALID if a character cannot be represented and the * codec's error handling mode is set to STRICT, * * On exit, ::source will point immediately _after_ the last input character * read, if the result is _OK or _NOMEM. Any remaining output for the * character will be buffered by the codec for writing on the next call. * * In the case of the result being _INVALID, ::source will point _at_ the * last input character read; nothing will be written or buffered for the * failed character. It is up to the client to fix the cause of the failure * and retry the decoding process. * * ::sourcelen will be reduced appropriately on exit. * * ::dest will point immediately _after_ the last character written. * * ::destlen will be reduced appropriately on exit. */ parserutils_error charset_8859_codec_read_char(charset_8859_codec *c, const uint8_t **source, size_t *sourcelen, uint8_t **dest, size_t *destlen) { uint32_t ucs4; parserutils_error error; /* Convert a single character */ error = charset_8859_to_ucs4(c, *source, *sourcelen, &ucs4); if (error == PARSERUTILS_OK) { /* Read a character */ error = charset_8859_codec_output_decoded_char(c, ucs4, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } else if (error == PARSERUTILS_NEEDDATA) { /* Can only happen if sourcelen == 0 */ return error; } else if (error == PARSERUTILS_INVALID) { /* Illegal input sequence */ /* Strict errormode; simply flag invalid character */ if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) { return PARSERUTILS_INVALID; } /* output U+FFFD and continue processing. */ error = charset_8859_codec_output_decoded_char(c, 0xFFFD, dest, destlen); if (error == PARSERUTILS_OK || error == PARSERUTILS_NOMEM) { /* output succeeded; update source pointers */ *source += 1; *sourcelen -= 1; } return error; } return PARSERUTILS_OK; } /** * Output a UCS-4 character (big endian) * * \param c Codec to use * \param ucs4 UCS-4 character (host endian) * \param dest Pointer to pointer to output buffer * \param destlen Pointer to output buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if output buffer is too small, */ parserutils_error charset_8859_codec_output_decoded_char(charset_8859_codec *c, uint32_t ucs4, uint8_t **dest, size_t *destlen) { if (*destlen < 4) { /* Run out of output buffer */ c->read_len = 1; c->read_buf[0] = ucs4; return PARSERUTILS_NOMEM; } *((uint32_t *) (void *) *dest) = endian_host_to_big(ucs4); *dest += 4; *destlen -= 4; return PARSERUTILS_OK; } /** * Convert a UCS4 (host endian) character to ISO-8859-n * * \param c The codec instance * \param ucs4 The UCS4 character to convert * \param s Pointer to pointer to destination buffer * \param len Pointer to destination buffer length * \return PARSERUTILS_OK on success, * PARSERUTILS_NOMEM if there's insufficient space in the output buffer, * PARSERUTILS_INVALID if the character cannot be represented * * _INVALID will only be returned if the codec's conversion mode is STRICT. * Otherwise, '?' will be output. * * On successful conversion, *s and *len will be updated. */ parserutils_error charset_8859_from_ucs4(charset_8859_codec *c, uint32_t ucs4, uint8_t **s, size_t *len) { uint8_t out = 0; if (*len < 1) return PARSERUTILS_NOMEM; if (ucs4 < 0x80) { /* ASCII */ out = ucs4; } else { uint32_t i; for (i = 0; i < 96; i++) { if (ucs4 == c->table[i]) break; } if (i == 96) { if (c->base.errormode == PARSERUTILS_CHARSET_CODEC_ERROR_STRICT) return PARSERUTILS_INVALID; else out = '?'; } else { out = 0xA0 + i; } } *(*s) = out; (*s)++; (*len)--; return PARSERUTILS_OK; } /** * Convert an ISO-8859-n character to UCS4 (host endian) * * \param c The codec instance * \param s Pointer to source buffer * \param len Source buffer length * \param ucs4 Pointer to destination buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_NEEDDATA if there's insufficient input data * PARSERUTILS_INVALID if the character cannot be represented */ parserutils_error charset_8859_to_ucs4(charset_8859_codec *c, const uint8_t *s, size_t len, uint32_t *ucs4) { uint32_t out; if (len < 1) return PARSERUTILS_NEEDDATA; if (*s < 0x80) { out = *s; } else if (*s >= 0xA0) { if (c->table[*s - 0xA0] == 0xFFFF) return PARSERUTILS_INVALID; out = c->table[*s - 0xA0]; } else { return PARSERUTILS_INVALID; } *ucs4 = out; return PARSERUTILS_OK; } const parserutils_charset_handler charset_8859_codec_handler = { charset_8859_codec_handles_charset, charset_8859_codec_create }; netsurf-all-3.2/libparserutils/src/charset/codecs/Makefile0000644000175000017500000000020312377676760023010 0ustar vincevince# Sources DIR_SOURCES := codec_ascii.c codec_8859.c codec_ext8.c \ codec_utf8.c codec_utf16.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/src/charset/aliases.h0000644000175000017500000000132612377676760021711 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_charset_aliases_h_ #define parserutils_charset_aliases_h_ #include #include typedef struct parserutils_charset_aliases_canon { /* Do not change the ordering here without changing make-aliases.pl */ uint16_t mib_enum; uint16_t name_len; const char *name; } parserutils_charset_aliases_canon; /* Canonicalise an alias name */ parserutils_charset_aliases_canon *parserutils__charset_alias_canonicalise( const char *alias, size_t len); #endif netsurf-all-3.2/libparserutils/src/charset/Makefile0000644000175000017500000000052512377676760021557 0ustar vincevince# Sources DIR_SOURCES := aliases.c codec.c $(DIR)aliases.c: $(DIR)aliases.inc $(DIR)aliases.inc: build/make-aliases.pl build/Aliases $(VQ)$(ECHO) " ALIAS: $@" $(Q)$(PERL) build/make-aliases.pl ifeq ($(findstring clean,$(MAKECMDGOALS)),clean) CLEAN_ITEMS := $(CLEAN_ITEMS) $(DIR)aliases.inc endif include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/src/charset/aliases.c0000644000175000017500000000744012377676760021707 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include #include #include #include #include #include "charset/aliases.h" #include "utils/utils.h" /* Bring in the aliases tables */ #include "aliases.inc" typedef struct { size_t slen; const char *s; } lengthed_string; #define IS_PUNCT_OR_SPACE(x) \ (!(((x) >= 'A' && (x) <= 'Z') || \ ((x) >= 'a' && (x) <= 'z') || \ ((x) >= '0' && (x) <= '9'))) static int parserutils_charset_alias_match(const void *a, const void *b) { lengthed_string *s = (lengthed_string *)a; parserutils_charset_aliases_alias *alias = (parserutils_charset_aliases_alias*)b; size_t key_left = s->slen; size_t alias_left = alias->name_len; const char *s_alias = alias->name; const char *s_key = s->s; int cmpret; while ((key_left > 0) && (alias_left > 0)) { while ((key_left > 0) && IS_PUNCT_OR_SPACE(*s_key)) { key_left--; s_key++; } if (key_left == 0) break; cmpret = tolower(*s_key) - *s_alias; if (cmpret != 0) { return cmpret; } key_left--; s_key++; alias_left--; s_alias++; } while ((key_left > 0) && IS_PUNCT_OR_SPACE(*s_key)) { key_left--; s_key++; } return key_left - alias_left; } /** * Retrieve the canonical form of an alias name * * \param alias The alias name * \param len The length of the alias name * \return Pointer to canonical form or NULL if not found */ parserutils_charset_aliases_canon *parserutils__charset_alias_canonicalise( const char *alias, size_t len) { parserutils_charset_aliases_alias *c; lengthed_string s; s.slen = len; s.s = alias; c = (parserutils_charset_aliases_alias*)bsearch(&s, &charset_aliases[0], charset_aliases_count, sizeof(parserutils_charset_aliases_alias), parserutils_charset_alias_match); if (c == NULL) return NULL; return c->canon; } /** * Retrieve the MIB enum value assigned to an encoding name * * \param alias The alias to lookup * \param len The length of the alias string * \return The MIB enum value, or 0 if not found */ uint16_t parserutils_charset_mibenum_from_name(const char *alias, size_t len) { parserutils_charset_aliases_canon *c; if (alias == NULL) return 0; c = parserutils__charset_alias_canonicalise(alias, len); if (c == NULL) return 0; return c->mib_enum; } /** * Retrieve the canonical name of an encoding from the MIB enum * * \param mibenum The MIB enum value * \return Pointer to canonical name, or NULL if not found */ const char *parserutils_charset_mibenum_to_name(uint16_t mibenum) { int i; parserutils_charset_aliases_canon *c; for (i = 0; i < charset_aliases_canon_count; ++i) { c = &canonical_charset_names[i]; if (c->mib_enum == mibenum) return c->name; } return NULL; } /** * Detect if a parserutils_charset is Unicode * * \param mibenum The MIB enum to consider * \return true if a Unicode variant, false otherwise */ bool parserutils_charset_mibenum_is_unicode(uint16_t mibenum) { return MIBENUM_IS_UNICODE(mibenum); } netsurf-all-3.2/libparserutils/src/utils/0000755000175000017500000000000012377713347017615 5ustar vincevincenetsurf-all-3.2/libparserutils/src/utils/errors.c0000644000175000017500000000414312377676760021306 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include /** * Convert a parserutils error code to a string * * \param error The error code to convert * \return Pointer to string representation of error, or NULL if unknown. */ const char *parserutils_error_to_string(parserutils_error error) { const char *result = NULL; switch (error) { case PARSERUTILS_OK: result = "No error"; break; case PARSERUTILS_NOMEM: result = "Insufficient memory"; break; case PARSERUTILS_BADPARM: result = "Bad parameter"; break; case PARSERUTILS_INVALID: result = "Invalid input"; break; case PARSERUTILS_FILENOTFOUND: result = "File not found"; break; case PARSERUTILS_NEEDDATA: result = "Insufficient data"; break; case PARSERUTILS_BADENCODING: result = "Unsupported encoding"; break; case PARSERUTILS_EOF: result = "EOF"; break; } return result; } /** * Convert a string representation of an error name to a parserutils error code * * \param str String containing error name * \param len Length of string (bytes) * \return Error code, or PARSERUTILS_OK if unknown */ parserutils_error parserutils_error_from_string(const char *str, size_t len) { if (strncmp(str, "PARSERUTILS_OK", len) == 0) { return PARSERUTILS_OK; } else if (strncmp(str, "PARSERUTILS_NOMEM", len) == 0) { return PARSERUTILS_NOMEM; } else if (strncmp(str, "PARSERUTILS_BADPARM", len) == 0) { return PARSERUTILS_BADPARM; } else if (strncmp(str, "PARSERUTILS_INVALID", len) == 0) { return PARSERUTILS_INVALID; } else if (strncmp(str, "PARSERUTILS_FILENOTFOUND", len) == 0) { return PARSERUTILS_FILENOTFOUND; } else if (strncmp(str, "PARSERUTILS_NEEDDATA", len) == 0) { return PARSERUTILS_NEEDDATA; } else if (strncmp(str, "PARSERUTILS_BADENCODING", len) == 0) { return PARSERUTILS_BADENCODING; } else if (strncmp(str, "PARSERUTILS_EOF", len) == 0) { return PARSERUTILS_EOF; } return PARSERUTILS_OK; } netsurf-all-3.2/libparserutils/src/utils/vector.c0000644000175000017500000001340712377676760021277 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include /** * Vector object */ struct parserutils_vector { size_t item_size; /**< Size of an item in the vector */ size_t chunk_size; /**< Size of a vector chunk */ size_t items_allocated; /**< Number of slots allocated */ int32_t current_item; /**< Index of current item */ void *items; /**< Items in vector */ }; /** * Create a vector * * \param item_size Length, in bytes, of an item in the vector * \param chunk_size Number of vector slots in a chunk * \param vector Pointer to location to receive vector instance * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhaustion */ parserutils_error parserutils_vector_create(size_t item_size, size_t chunk_size, parserutils_vector **vector) { parserutils_vector *v; if (item_size == 0 || chunk_size == 0 || vector == NULL) return PARSERUTILS_BADPARM; v = malloc(sizeof(parserutils_vector)); if (v == NULL) return PARSERUTILS_NOMEM; v->items = malloc(item_size * chunk_size); if (v->items == NULL) { free(v); return PARSERUTILS_NOMEM; } v->item_size = item_size; v->chunk_size = chunk_size; v->items_allocated = chunk_size; v->current_item = -1; *vector = v; return PARSERUTILS_OK; } /** * Destroy a vector instance * * \param vector The vector to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_vector_destroy(parserutils_vector *vector) { if (vector == NULL) return PARSERUTILS_BADPARM; free(vector->items); free(vector); return PARSERUTILS_OK; } /** * Append an item to the vector * * \param vector The vector to append to * \param item The item to append * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_vector_append(parserutils_vector *vector, void *item) { int32_t slot; if (vector == NULL || item == NULL) return PARSERUTILS_BADPARM; /* Ensure we'll get a valid slot */ if (vector->current_item < -1 || vector->current_item == INT32_MAX) return PARSERUTILS_INVALID; slot = vector->current_item + 1; if ((size_t) slot >= vector->items_allocated) { void *temp = realloc(vector->items, (vector->items_allocated + vector->chunk_size) * vector->item_size); if (temp == NULL) return PARSERUTILS_NOMEM; vector->items = temp; vector->items_allocated += vector->chunk_size; } memcpy((uint8_t *) vector->items + (slot * vector->item_size), item, vector->item_size); vector->current_item = slot; return PARSERUTILS_OK; } /** * Clear a vector * * \param vector The vector to clear * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_vector_clear(parserutils_vector *vector) { if (vector == NULL) return PARSERUTILS_BADPARM; if (vector->current_item < 0) return PARSERUTILS_INVALID; vector->current_item = -1; return PARSERUTILS_OK; } /** * Remove the last item from a vector * * \param vector The vector to remove from * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_vector_remove_last(parserutils_vector *vector) { if (vector == NULL) return PARSERUTILS_BADPARM; if (vector->current_item < 0) return PARSERUTILS_INVALID; vector->current_item--; return PARSERUTILS_OK; } /** * Acquire the length (in items) of the vector. * * \param vector The vector to interrogate. * \param length Pointer to location to receive length information. * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_vector_get_length(parserutils_vector *vector, size_t *length) { if (vector == NULL) return PARSERUTILS_BADPARM; if (length == NULL) return PARSERUTILS_BADPARM; *length = vector->current_item + 1; return PARSERUTILS_OK; } /** * Iterate over a vector * * \param vector The vector to iterate over * \param ctx Pointer to an integer for the iterator to use as context. * \return Pointer to current item, or NULL if no more * * \note The value pointed to by \a ctx must be zero to begin the iteration. */ const void *parserutils_vector_iterate(const parserutils_vector *vector, int32_t *ctx) { void *item; if (vector == NULL || ctx == NULL || vector->current_item < 0) return NULL; if ((*ctx) > vector->current_item) return NULL; item = (uint8_t *) vector->items + ((*ctx) * vector->item_size); (*ctx)++; return item; } /** * Peek at an item in a vector * * \param vector The vector to iterate over * \param ctx Integer for the iterator to use as context. * \return Pointer to item, or NULL if no more */ const void *parserutils_vector_peek(const parserutils_vector *vector, int32_t ctx) { if (vector == NULL || vector->current_item < 0) return NULL; if (ctx > vector->current_item) return NULL; return (uint8_t *) vector->items + (ctx * vector->item_size); } #ifndef NDEBUG #include extern void parserutils_vector_dump(parserutils_vector *vector, const char *prefix, void (*printer)(void *item)); void parserutils_vector_dump(parserutils_vector *vector, const char *prefix, void (*printer)(void *item)) { int32_t i; if (vector == NULL || printer == NULL) return; for (i = 0; i <= vector->current_item; i++) { printf("%s %d: ", prefix != NULL ? prefix : "", i); printer((uint8_t *) vector->items + (i * vector->item_size)); printf("\n"); } } #endif netsurf-all-3.2/libparserutils/src/utils/endian.h0000644000175000017500000000151412377676760021234 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 John-Mark Bell */ #ifndef parserutils_endian_h_ #define parserutils_endian_h_ static inline bool endian_host_is_le(void) { static uint32_t magic = 0x10000002; return (((uint8_t *) &magic)[0] == 0x02); } static inline uint32_t endian_swap(uint32_t val) { return ((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24); } static inline uint32_t endian_host_to_big(uint32_t host) { if (endian_host_is_le()) return endian_swap(host); return host; } static inline uint32_t endian_big_to_host(uint32_t big) { if (endian_host_is_le()) return endian_swap(big); return big; } #endif netsurf-all-3.2/libparserutils/src/utils/stack.c0000644000175000017500000001031212377676760021072 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #include /** * Stack object */ struct parserutils_stack { size_t item_size; /**< Size of an item in the stack */ size_t chunk_size; /**< Size of a stack chunk */ size_t items_allocated; /**< Number of slots allocated */ int32_t current_item; /**< Index of current item */ void *items; /**< Items in stack */ }; /** * Create a stack * * \param item_size Length, in bytes, of an item in the stack * \param chunk_size Number of stack slots in a chunk * \param stack Pointer to location to receive stack instance * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters * PARSERUTILS_NOMEM on memory exhaustion */ parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size, parserutils_stack **stack) { parserutils_stack *s; if (item_size == 0 || chunk_size == 0 || stack == NULL) return PARSERUTILS_BADPARM; s = malloc(sizeof(parserutils_stack)); if (s == NULL) return PARSERUTILS_NOMEM; s->items = malloc(item_size * chunk_size); if (s->items == NULL) { free(s); return PARSERUTILS_NOMEM; } s->item_size = item_size; s->chunk_size = chunk_size; s->items_allocated = chunk_size; s->current_item = -1; *stack = s; return PARSERUTILS_OK; } /** * Destroy a stack instance * * \param stack The stack to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_stack_destroy(parserutils_stack *stack) { if (stack == NULL) return PARSERUTILS_BADPARM; free(stack->items); free(stack); return PARSERUTILS_OK; } /** * Push an item onto the stack * * \param stack The stack to push onto * \param item The item to push * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_stack_push(parserutils_stack *stack, const void *item) { int32_t slot; if (stack == NULL || item == NULL) return PARSERUTILS_BADPARM; /* Ensure we'll get a valid slot */ if (stack->current_item < -1 || stack->current_item == INT32_MAX) return PARSERUTILS_INVALID; slot = stack->current_item + 1; if ((size_t) slot >= stack->items_allocated) { void *temp = realloc(stack->items, (stack->items_allocated + stack->chunk_size) * stack->item_size); if (temp == NULL) return PARSERUTILS_NOMEM; stack->items = temp; stack->items_allocated += stack->chunk_size; } memcpy((uint8_t *) stack->items + (slot * stack->item_size), item, stack->item_size); stack->current_item = slot; return PARSERUTILS_OK; } /** * Pop an item off a stack * * \param stack The stack to pop from * \param item Pointer to location to receive popped item, or NULL * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item) { if (stack == NULL) return PARSERUTILS_BADPARM; if (stack->current_item < 0) return PARSERUTILS_INVALID; if (item != NULL) { memcpy(item, (uint8_t *) stack->items + (stack->current_item * stack->item_size), stack->item_size); } stack->current_item -= 1; return PARSERUTILS_OK; } /** * Retrieve a pointer to the current item on the stack * * \param stack The stack to inspect * \return Pointer to item on stack, or NULL if none */ void *parserutils_stack_get_current(parserutils_stack *stack) { if (stack == NULL || stack->current_item < 0) return NULL; return (uint8_t *) stack->items + (stack->current_item * stack->item_size); } #ifndef NDEBUG #include extern void parserutils_stack_dump(parserutils_stack *stack, const char *prefix, void (*printer)(void *item)); void parserutils_stack_dump(parserutils_stack *stack, const char *prefix, void (*printer)(void *item)) { int32_t i; if (stack == NULL || printer == NULL) return; for (i = 0; i <= stack->current_item; i++) { printf("%s %d: ", prefix != NULL ? prefix : "", i); printer((uint8_t *) stack->items + (i * stack->item_size)); printf("\n"); } } #endif netsurf-all-3.2/libparserutils/src/utils/buffer.c0000644000175000017500000001057512377676760021251 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 John-Mark Bell */ #include #include #define DEFAULT_SIZE (4096) /** * Create a memory buffer * * \param buffer Pointer to location to receive memory buffer * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion */ parserutils_error parserutils_buffer_create(parserutils_buffer **buffer) { parserutils_buffer *b; if (buffer == NULL) return PARSERUTILS_BADPARM; b = malloc(sizeof(parserutils_buffer)); if (b == NULL) return PARSERUTILS_NOMEM; b->data = malloc(DEFAULT_SIZE); if (b->data == NULL) { free(b); return PARSERUTILS_NOMEM; } b->length = 0; b->allocated = DEFAULT_SIZE; *buffer = b; return PARSERUTILS_OK; } /** * Destroy a memory buffer * * \param buffer The buffer to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_buffer_destroy(parserutils_buffer *buffer) { if (buffer == NULL) return PARSERUTILS_BADPARM; free(buffer->data); free(buffer); return PARSERUTILS_OK; } /** * Append data to a memory buffer * * \param buffer The buffer to append to * \param data The data to append * \param len The length, in bytes, of the data to append * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_buffer_append(parserutils_buffer *buffer, const uint8_t *data, size_t len) { while (len >= buffer->allocated - buffer->length) { parserutils_error error = parserutils_buffer_grow(buffer); if (error != PARSERUTILS_OK) return error; } memcpy(buffer->data + buffer->length, data, len); buffer->length += len; return PARSERUTILS_OK; } /** * Insert data into a memory buffer * * \param buffer The buffer to insert into * \param offset The offset into the buffer to insert at * \param data The data to insert * \param len The length, in bytes, of the data to insert * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_buffer_insert(parserutils_buffer *buffer, size_t offset, const uint8_t *data, size_t len) { if (offset > buffer->length) return PARSERUTILS_BADPARM; if (offset == buffer->length) return parserutils_buffer_append(buffer, data, len); while (len >= buffer->allocated - buffer->length) { parserutils_error error = parserutils_buffer_grow(buffer); if (error != PARSERUTILS_OK) return error; } memmove(buffer->data + offset + len, buffer->data + offset, buffer->length - offset); memcpy(buffer->data + offset, data, len); buffer->length += len; return PARSERUTILS_OK; } /** * Discard a section of a memory buffer * * \param buffer The buffer to discard data from * \param offset The offset into the buffer of the start of the section * \param len The number of bytes to discard * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_buffer_discard(parserutils_buffer *buffer, size_t offset, size_t len) { if (offset >= buffer->length || offset + len > buffer->length) return PARSERUTILS_BADPARM; memmove(buffer->data + offset, buffer->data + offset + len, buffer->length - (len + offset)); buffer->length -= len; return PARSERUTILS_OK; } /** * Extend the amount of space allocated for a memory buffer * * \param buffer The buffer to extend * \return PARSERUTILS_OK on success, appropriate error otherwise. */ parserutils_error parserutils_buffer_grow(parserutils_buffer *buffer) { uint8_t *temp = realloc(buffer->data, buffer->allocated * 2); if (temp == NULL) return PARSERUTILS_NOMEM; buffer->data = temp; buffer->allocated *= 2; return PARSERUTILS_OK; } parserutils_error parserutils_buffer_randomise(parserutils_buffer *buffer) { #ifndef NDEBUG uint8_t *temp; #endif if (buffer == NULL) return PARSERUTILS_BADPARM; #ifndef NDEBUG temp = malloc(buffer->allocated); if (temp == NULL) return PARSERUTILS_NOMEM; memcpy(temp, buffer->data, buffer->length); memset(buffer->data, 0xff, buffer->length); /* Leak the buffer's current data, so we don't reuse it */ /* buffer->alloc(buffer->data, 0, buffer->pw); */ buffer->data = temp; #endif return PARSERUTILS_OK; } netsurf-all-3.2/libparserutils/src/utils/utils.h0000644000175000017500000000127112377676760021136 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_utils_h_ #define parserutils_utils_h_ #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef SLEN /* Calculate length of a string constant */ #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ #endif #ifndef UNUSED #define UNUSED(x) ((x)=(x)) #endif #ifndef N_ELEMENTS #define N_ELEMENTS(s) (sizeof((s)) / sizeof((s)[0])) #endif #ifndef ALIGN #define ALIGN(val) (((val) + 3) & ~(3)) #endif #endif netsurf-all-3.2/libparserutils/src/utils/Makefile0000644000175000017500000000014012377676760021257 0ustar vincevince# Sources DIR_SOURCES := buffer.c errors.c stack.c vector.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/src/input/0000755000175000017500000000000012377713347017614 5ustar vincevincenetsurf-all-3.2/libparserutils/src/input/inputstream.c0000644000175000017500000004251512377676760022351 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include #include #include #include #include "input/filter.h" #include "utils/utils.h" /** * Private input stream definition */ typedef struct parserutils_inputstream_private { parserutils_inputstream public; /**< Public part. Must be first */ parserutils_buffer *raw; /**< Buffer containing raw data */ bool done_first_chunk; /**< Whether the first chunk has * been processed */ uint16_t mibenum; /**< MIB enum for charset, or 0 */ uint32_t encsrc; /**< Charset source */ parserutils_filter *input; /**< Charset conversion filter */ parserutils_charset_detect_func csdetect; /**< Charset detection func.*/ } parserutils_inputstream_private; static inline parserutils_error parserutils_inputstream_refill_buffer( parserutils_inputstream_private *stream); static inline parserutils_error parserutils_inputstream_strip_bom( uint16_t *mibenum, parserutils_buffer *buffer); /** * Create an input stream * * \param enc Document charset, or NULL to autodetect * \param encsrc Value for encoding source, if specified, or 0 * \param csdetect Charset detection function, or NULL * \param stream Pointer to location to receive stream instance * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhaustion, * PARSERUTILS_BADENCODING on unsupported encoding * * The value 0 is defined as being the lowest priority encoding source * (i.e. the default fallback encoding). Beyond this, no further * interpretation is made upon the encoding source. */ parserutils_error parserutils_inputstream_create(const char *enc, uint32_t encsrc, parserutils_charset_detect_func csdetect, parserutils_inputstream **stream) { parserutils_inputstream_private *s; parserutils_error error; if (stream == NULL) return PARSERUTILS_BADPARM; s = malloc(sizeof(parserutils_inputstream_private)); if (s == NULL) return PARSERUTILS_NOMEM; error = parserutils_buffer_create(&s->raw); if (error != PARSERUTILS_OK) { free(s); return error; } error = parserutils_buffer_create(&s->public.utf8); if (error != PARSERUTILS_OK) { parserutils_buffer_destroy(s->raw); free(s); return error; } s->public.cursor = 0; s->public.had_eof = false; s->done_first_chunk = false; error = parserutils__filter_create("UTF-8", &s->input); if (error != PARSERUTILS_OK) { parserutils_buffer_destroy(s->public.utf8); parserutils_buffer_destroy(s->raw); free(s); return error; } if (enc != NULL) { parserutils_filter_optparams params; s->mibenum = parserutils_charset_mibenum_from_name(enc, strlen(enc)); if (s->mibenum == 0) { parserutils__filter_destroy(s->input); parserutils_buffer_destroy(s->public.utf8); parserutils_buffer_destroy(s->raw); free(s); return PARSERUTILS_BADENCODING; } params.encoding.name = enc; error = parserutils__filter_setopt(s->input, PARSERUTILS_FILTER_SET_ENCODING, ¶ms); if (error != PARSERUTILS_OK) { parserutils__filter_destroy(s->input); parserutils_buffer_destroy(s->public.utf8); parserutils_buffer_destroy(s->raw); free(s); return error; } s->encsrc = encsrc; } else { s->mibenum = 0; s->encsrc = 0; } s->csdetect = csdetect; *stream = (parserutils_inputstream *) s; return PARSERUTILS_OK; } /** * Destroy an input stream * * \param stream Input stream to destroy * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_inputstream_destroy( parserutils_inputstream *stream) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; if (stream == NULL) return PARSERUTILS_BADPARM; parserutils__filter_destroy(s->input); parserutils_buffer_destroy(s->public.utf8); parserutils_buffer_destroy(s->raw); free(s); return PARSERUTILS_OK; } /** * Append data to an input stream * * \param stream Input stream to append data to * \param data Data to append (in document charset), or NULL to flag EOF * \param len Length, in bytes, of data * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_inputstream_append( parserutils_inputstream *stream, const uint8_t *data, size_t len) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; if (stream == NULL) return PARSERUTILS_BADPARM; if (data == NULL) { s->public.had_eof = true; return PARSERUTILS_OK; } return parserutils_buffer_append(s->raw, data, len); } /** * Insert data into stream at current location * * \param stream Input stream to insert into * \param data Data to insert (UTF-8 encoded) * \param len Length, in bytes, of data * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils_inputstream_insert( parserutils_inputstream *stream, const uint8_t *data, size_t len) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; if (stream == NULL || data == NULL) return PARSERUTILS_BADPARM; return parserutils_buffer_insert(s->public.utf8, s->public.cursor, data, len); } #define IS_ASCII(x) (((x) & 0x80) == 0) /** * Look at the character in the stream that starts at * offset bytes from the cursor (slow version) * * \param stream Stream to look in * \param offset Byte offset of start of character * \param ptr Pointer to location to receive pointer to character data * \param length Pointer to location to receive character length (in bytes) * \return PARSERUTILS_OK on success, * _NEEDDATA on reaching the end of available input, * _EOF on reaching the end of all input, * _BADENCODING if the input cannot be decoded, * _NOMEM on memory exhaustion, * _BADPARM if bad parameters are passed. * * Once the character pointed to by the result of this call has been advanced * past (i.e. parserutils_inputstream_advance has caused the stream cursor to * pass over the character), then no guarantee is made as to the validity of * the data pointed to. Thus, any attempt to dereference the pointer after * advancing past the data it points to is a bug. */ parserutils_error parserutils_inputstream_peek_slow( parserutils_inputstream *stream, size_t offset, const uint8_t **ptr, size_t *length) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; parserutils_error error = PARSERUTILS_OK; size_t len; if (stream == NULL || ptr == NULL || length == NULL) return PARSERUTILS_BADPARM; /* There's insufficient data in the buffer, so read some more */ if (s->raw->length == 0) { /* No more data to be had */ return s->public.had_eof ? PARSERUTILS_EOF : PARSERUTILS_NEEDDATA; } /* Refill utf8 buffer from raw buffer */ error = parserutils_inputstream_refill_buffer(s); if (error != PARSERUTILS_OK) return error; /* Refill may have succeeded, but not actually produced any new data */ if (s->public.cursor + offset == s->public.utf8->length) return PARSERUTILS_NEEDDATA; /* Now try the read */ if (IS_ASCII(s->public.utf8->data[s->public.cursor + offset])) { len = 1; } else { error = parserutils_charset_utf8_char_byte_length( s->public.utf8->data + s->public.cursor + offset, &len); if (error != PARSERUTILS_OK && error != PARSERUTILS_NEEDDATA) return error; if (error == PARSERUTILS_NEEDDATA) { return s->public.had_eof ? PARSERUTILS_EOF : PARSERUTILS_NEEDDATA; } } (*length) = len; (*ptr) = (s->public.utf8->data + s->public.cursor + offset); return PARSERUTILS_OK; } #undef IS_ASCII /** * Read the source charset of the input stream * * \param stream Input stream to query * \param source Pointer to location to receive charset source identifier * \return Pointer to charset name (constant; do not free) */ const char *parserutils_inputstream_read_charset( parserutils_inputstream *stream, uint32_t *source) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; if (stream == NULL || source == NULL) return NULL; *source = s->encsrc; if (s->encsrc == 0) return "UTF-8"; return parserutils_charset_mibenum_to_name(s->mibenum); } /** * Change the source charset of the input stream * * \param stream Input stream to modify * \param enc Charset name * \param source Charset source identifier * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on invalid parameters, * PARSERUTILS_INVALID if called after data has been read from stream, * PARSERUTILS_BADENCODING if the encoding is unsupported, * PARSERUTILS_NOMEM on memory exhaustion. */ parserutils_error parserutils_inputstream_change_charset( parserutils_inputstream *stream, const char *enc, uint32_t source) { parserutils_inputstream_private *s = (parserutils_inputstream_private *) stream; parserutils_filter_optparams params; uint16_t temp; parserutils_error error; if (stream == NULL || enc == NULL) return PARSERUTILS_BADPARM; if (s->done_first_chunk) return PARSERUTILS_INVALID; temp = parserutils_charset_mibenum_from_name(enc, strlen(enc)); if (temp == 0) return PARSERUTILS_BADENCODING; /* Ensure filter is using the correct encoding */ params.encoding.name = enc; error = parserutils__filter_setopt(s->input, PARSERUTILS_FILTER_SET_ENCODING, ¶ms); if (error != PARSERUTILS_OK) return error; /* Finally, replace the current settings */ s->mibenum = temp; s->encsrc = source; return PARSERUTILS_OK; } /****************************************************************************** ******************************************************************************/ /** * Refill the UTF-8 buffer from the raw buffer * * \param stream The inputstream to operate on * \return PARSERUTILS_OK on success */ parserutils_error parserutils_inputstream_refill_buffer( parserutils_inputstream_private *stream) { const uint8_t *raw; uint8_t *utf8; size_t raw_length, utf8_space; parserutils_error error; /* If this is the first chunk of data, we must detect the charset and * strip the BOM, if one exists */ if (stream->done_first_chunk == false) { parserutils_filter_optparams params; /* If there is a charset detection routine, give it an * opportunity to override any charset specified when the * inputstream was created */ if (stream->csdetect != NULL) { error = stream->csdetect(stream->raw->data, stream->raw->length, &stream->mibenum, &stream->encsrc); if (error != PARSERUTILS_OK) { if (error != PARSERUTILS_NEEDDATA || stream->public.had_eof == false) return error; /* We don't have enough data to detect the * input encoding, but we're not going to get * any more as we've been notified of EOF. * Therefore, leave the encoding alone * so that any charset specified when the * inputstream was created will be preserved. * If there was no charset specified, then * we'll default to UTF-8, below */ } } /* Default to UTF-8 if there is still no encoding information * We'll do this if there was no encoding specified up-front * and: * 1) there was no charset detection routine * or 2) there was insufficient data for the charset * detection routine to detect an encoding */ if (stream->mibenum == 0) { stream->mibenum = parserutils_charset_mibenum_from_name("UTF-8", SLEN("UTF-8")); stream->encsrc = 0; } assert(stream->mibenum != 0); /* Strip any BOM, and update encoding as appropriate */ error = parserutils_inputstream_strip_bom(&stream->mibenum, stream->raw); if (error != PARSERUTILS_OK) return error; /* Ensure filter is using the correct encoding */ params.encoding.name = parserutils_charset_mibenum_to_name(stream->mibenum); error = parserutils__filter_setopt(stream->input, PARSERUTILS_FILTER_SET_ENCODING, ¶ms); if (error != PARSERUTILS_OK) return error; stream->done_first_chunk = true; } /* Work out how to perform the buffer fill */ if (stream->public.cursor == stream->public.utf8->length) { /* Cursor's at the end, so simply reuse the entire buffer */ utf8 = stream->public.utf8->data; utf8_space = stream->public.utf8->allocated; } else { /* Cursor's not at the end, so shift data after cursor to the * bottom of the buffer. If the buffer's still over half full, * extend it. */ memmove(stream->public.utf8->data, stream->public.utf8->data + stream->public.cursor, stream->public.utf8->length - stream->public.cursor); stream->public.utf8->length -= stream->public.cursor; if (stream->public.utf8->length > stream->public.utf8->allocated / 2) { error = parserutils_buffer_grow(stream->public.utf8); if (error != PARSERUTILS_OK) return error; } utf8 = stream->public.utf8->data + stream->public.utf8->length; utf8_space = stream->public.utf8->allocated - stream->public.utf8->length; } raw = stream->raw->data; raw_length = stream->raw->length; /* Try to fill utf8 buffer from the raw data */ error = parserutils__filter_process_chunk(stream->input, &raw, &raw_length, &utf8, &utf8_space); /* _NOMEM implies that there's more input to read than available space * in the utf8 buffer. That's fine, so we'll ignore that error. */ if (error != PARSERUTILS_OK && error != PARSERUTILS_NOMEM) return error; /* Remove the raw data we've processed from the raw buffer */ error = parserutils_buffer_discard(stream->raw, 0, stream->raw->length - raw_length); if (error != PARSERUTILS_OK) return error; /* Fix up the utf8 buffer information */ stream->public.utf8->length = stream->public.utf8->allocated - utf8_space; /* Finally, fix up the cursor */ stream->public.cursor = 0; return PARSERUTILS_OK; } /** * Strip a BOM from a buffer in the given encoding * * \param mibenum Pointer to the character set of the buffer, updated on exit * \param buffer The buffer to process */ parserutils_error parserutils_inputstream_strip_bom(uint16_t *mibenum, parserutils_buffer *buffer) { static uint16_t utf8; static uint16_t utf16; static uint16_t utf16be; static uint16_t utf16le; static uint16_t utf32; static uint16_t utf32be; static uint16_t utf32le; if (utf8 == 0) { utf8 = parserutils_charset_mibenum_from_name("UTF-8", SLEN("UTF-8")); utf16 = parserutils_charset_mibenum_from_name("UTF-16", SLEN("UTF-16")); utf16be = parserutils_charset_mibenum_from_name("UTF-16BE", SLEN("UTF-16BE")); utf16le = parserutils_charset_mibenum_from_name("UTF-16LE", SLEN("UTF-16LE")); utf32 = parserutils_charset_mibenum_from_name("UTF-32", SLEN("UTF-32")); utf32be = parserutils_charset_mibenum_from_name("UTF-32BE", SLEN("UTF-32BE")); utf32le = parserutils_charset_mibenum_from_name("UTF-32LE", SLEN("UTF-32LE")); } #define UTF32_BOM_LEN (4) #define UTF16_BOM_LEN (2) #define UTF8_BOM_LEN (3) if (*mibenum == utf8) { if (buffer->length >= UTF8_BOM_LEN && buffer->data[0] == 0xEF && buffer->data[1] == 0xBB && buffer->data[2] == 0xBF) { return parserutils_buffer_discard( buffer, 0, UTF8_BOM_LEN); } } else if (*mibenum == utf16be) { if (buffer->length >= UTF16_BOM_LEN && buffer->data[0] == 0xFE && buffer->data[1] == 0xFF) { return parserutils_buffer_discard( buffer, 0, UTF16_BOM_LEN); } } else if (*mibenum == utf16le) { if (buffer->length >= UTF16_BOM_LEN && buffer->data[0] == 0xFF && buffer->data[1] == 0xFE) { return parserutils_buffer_discard( buffer, 0, UTF16_BOM_LEN); } } else if (*mibenum == utf16) { *mibenum = utf16be; if (buffer->length >= UTF16_BOM_LEN) { if (buffer->data[0] == 0xFE && buffer->data[1] == 0xFF) { return parserutils_buffer_discard( buffer, 0, UTF16_BOM_LEN); } else if (buffer->data[0] == 0xFF && buffer->data[1] == 0xFE) { *mibenum = utf16le; return parserutils_buffer_discard( buffer, 0, UTF16_BOM_LEN); } } } else if (*mibenum == utf32be) { if (buffer->length >= UTF32_BOM_LEN && buffer->data[0] == 0x00 && buffer->data[1] == 0x00 && buffer->data[2] == 0xFE && buffer->data[3] == 0xFF) { return parserutils_buffer_discard( buffer, 0, UTF32_BOM_LEN); } } else if (*mibenum == utf32le) { if (buffer->length >= UTF32_BOM_LEN && buffer->data[0] == 0xFF && buffer->data[1] == 0xFE && buffer->data[2] == 0x00 && buffer->data[3] == 0x00) { return parserutils_buffer_discard( buffer, 0, UTF32_BOM_LEN); } } else if (*mibenum == utf32) { *mibenum = utf32be; if (buffer->length >= UTF32_BOM_LEN) { if (buffer->data[0] == 0x00 && buffer->data[1] == 0x00 && buffer->data[2] == 0xFE && buffer->data[3] == 0xFF) { return parserutils_buffer_discard( buffer, 0, UTF32_BOM_LEN); } else if (buffer->data[0] == 0xFF && buffer->data[1] == 0xFE && buffer->data[2] == 0x00 && buffer->data[3] == 0x00) { *mibenum = utf32le; return parserutils_buffer_discard( buffer, 0, UTF32_BOM_LEN); } } } #undef UTF8_BOM_LEN #undef UTF16_BOM_LEN #undef UTF32_BOM_LEN return PARSERUTILS_OK; } netsurf-all-3.2/libparserutils/src/input/filter.c0000644000175000017500000002263112377676760021260 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include #include #ifndef WITHOUT_ICONV_FILTER #include #endif #include #include #include "input/filter.h" #include "utils/utils.h" /** Input filter */ struct parserutils_filter { #ifndef WITHOUT_ICONV_FILTER iconv_t cd; /**< Iconv conversion descriptor */ uint16_t int_enc; /**< The internal encoding */ #else parserutils_charset_codec *read_codec; /**< Read codec */ parserutils_charset_codec *write_codec; /**< Write codec */ uint32_t pivot_buf[64]; /**< Conversion pivot buffer */ bool leftover; /**< Data remains from last call */ uint8_t *pivot_left; /**< Remaining pivot to write */ size_t pivot_len; /**< Length of pivot remaining */ #endif struct { uint16_t encoding; /**< Input encoding */ } settings; /**< Filter settings */ }; static parserutils_error filter_set_defaults(parserutils_filter *input); static parserutils_error filter_set_encoding(parserutils_filter *input, const char *enc); /** * Create an input filter * * \param int_enc Desired encoding of document * \param filter Pointer to location to receive filter instance * \return PARSERUTILS_OK on success, * PARSERUTILS_BADPARM on bad parameters, * PARSERUTILS_NOMEM on memory exhausion, * PARSERUTILS_BADENCODING if the encoding is unsupported */ parserutils_error parserutils__filter_create(const char *int_enc, parserutils_filter **filter) { parserutils_filter *f; parserutils_error error; if (int_enc == NULL || filter == NULL) return PARSERUTILS_BADPARM; f = malloc(sizeof(parserutils_filter)); if (f == NULL) return PARSERUTILS_NOMEM; #ifndef WITHOUT_ICONV_FILTER f->cd = (iconv_t) -1; f->int_enc = parserutils_charset_mibenum_from_name( int_enc, strlen(int_enc)); if (f->int_enc == 0) { free(f); return PARSERUTILS_BADENCODING; } #else f->leftover = false; f->pivot_left = NULL; f->pivot_len = 0; #endif error = filter_set_defaults(f); if (error != PARSERUTILS_OK) { free(f); return error; } #ifdef WITHOUT_ICONV_FILTER error = parserutils_charset_codec_create(int_enc, &f->write_codec); if (error != PARSERUTILS_OK) { if (f->read_codec != NULL) { parserutils_charset_codec_destroy(f->read_codec); f->read_codec = NULL; } free(f); return error; } #endif *filter = f; return PARSERUTILS_OK; } /** * Destroy an input filter * * \param input Pointer to filter instance * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils__filter_destroy(parserutils_filter *input) { if (input == NULL) return PARSERUTILS_BADPARM; #ifndef WITHOUT_ICONV_FILTER if (input->cd != (iconv_t) -1) { iconv_close(input->cd); input->cd = (iconv_t) -1; } #else if (input->read_codec != NULL) { parserutils_charset_codec_destroy(input->read_codec); input->read_codec = NULL; } if (input->write_codec != NULL) { parserutils_charset_codec_destroy(input->write_codec); input->write_codec = NULL; } #endif free(input); return PARSERUTILS_OK; } /** * Configure an input filter * * \param input Pointer to filter instance * \param type Input option type to configure * \param params Option-specific parameters * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils__filter_setopt(parserutils_filter *input, parserutils_filter_opttype type, parserutils_filter_optparams *params) { parserutils_error error = PARSERUTILS_OK; if (input == NULL || params == NULL) return PARSERUTILS_BADPARM; switch (type) { case PARSERUTILS_FILTER_SET_ENCODING: error = filter_set_encoding(input, params->encoding.name); break; } return error; } /** * Process a chunk of data * * \param input Pointer to filter instance * \param data Pointer to pointer to input buffer * \param len Pointer to length of input buffer * \param output Pointer to pointer to output buffer * \param outlen Pointer to length of output buffer * \return PARSERUTILS_OK on success, appropriate error otherwise * * Call this with an input buffer length of 0 to flush any buffers. */ parserutils_error parserutils__filter_process_chunk(parserutils_filter *input, const uint8_t **data, size_t *len, uint8_t **output, size_t *outlen) { if (input == NULL || data == NULL || *data == NULL || len == NULL || output == NULL || *output == NULL || outlen == NULL) return PARSERUTILS_BADPARM; #ifndef WITHOUT_ICONV_FILTER if (iconv(input->cd, (void *) data, len, (char **) output, outlen) == (size_t) -1) { switch (errno) { case E2BIG: return PARSERUTILS_NOMEM; case EILSEQ: if (*outlen < 3) return PARSERUTILS_NOMEM; (*output)[0] = 0xef; (*output)[1] = 0xbf; (*output)[2] = 0xbd; *output += 3; *outlen -= 3; (*data)++; (*len)--; while (*len > 0) { size_t ret; ret = iconv(input->cd, (void *) data, len, (char **) output, outlen); if (ret != (size_t) -1 || errno != EILSEQ) break; if (*outlen < 3) return PARSERUTILS_NOMEM; (*output)[0] = 0xef; (*output)[1] = 0xbf; (*output)[2] = 0xbd; *output += 3; *outlen -= 3; (*data)++; (*len)--; } return errno == E2BIG ? PARSERUTILS_NOMEM : PARSERUTILS_OK; } } return PARSERUTILS_OK; #else if (input->leftover) { parserutils_error write_error; /* Some data left to be written from last call */ /* Attempt to flush the remaining data. */ write_error = parserutils_charset_codec_encode( input->write_codec, (const uint8_t **) &input->pivot_left, &input->pivot_len, output, outlen); if (write_error != PARSERUTILS_OK) return write_error; /* And clear leftover */ input->pivot_left = NULL; input->pivot_len = 0; input->leftover = false; } while (*len > 0) { parserutils_error read_error, write_error; size_t pivot_len = sizeof(input->pivot_buf); uint8_t *pivot = (uint8_t *) input->pivot_buf; read_error = parserutils_charset_codec_decode(input->read_codec, data, len, (uint8_t **) &pivot, &pivot_len); pivot = (uint8_t *) input->pivot_buf; pivot_len = sizeof(input->pivot_buf) - pivot_len; if (pivot_len > 0) { write_error = parserutils_charset_codec_encode( input->write_codec, (const uint8_t **) &pivot, &pivot_len, output, outlen); if (write_error != PARSERUTILS_OK) { input->leftover = true; input->pivot_left = pivot; input->pivot_len = pivot_len; return write_error; } } if (read_error != PARSERUTILS_OK && read_error != PARSERUTILS_NOMEM) return read_error; } return PARSERUTILS_OK; #endif } /** * Reset an input filter's state * * \param input The input filter to reset * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error parserutils__filter_reset(parserutils_filter *input) { parserutils_error error = PARSERUTILS_OK; if (input == NULL) return PARSERUTILS_BADPARM; #ifndef WITHOUT_ICONV_FILTER iconv(input->cd, NULL, 0, NULL, 0); #else /* Clear pivot buffer leftovers */ input->pivot_left = NULL; input->pivot_len = 0; input->leftover = false; /* Reset read codec */ error = parserutils_charset_codec_reset(input->read_codec); if (error != PARSERUTILS_OK) return error; /* Reset write codec */ error = parserutils_charset_codec_reset(input->write_codec); if (error != PARSERUTILS_OK) return error; #endif return error; } /** * Set an input filter's default settings * * \param input Input filter to configure * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error filter_set_defaults(parserutils_filter *input) { parserutils_error error; if (input == NULL) return PARSERUTILS_BADPARM; #ifdef WITHOUT_ICONV_FILTER input->read_codec = NULL; input->write_codec = NULL; #endif input->settings.encoding = 0; error = filter_set_encoding(input, "UTF-8"); if (error != PARSERUTILS_OK) return error; return PARSERUTILS_OK; } /** * Set an input filter's encoding * * \param input Input filter to configure * \param enc Encoding name * \return PARSERUTILS_OK on success, appropriate error otherwise */ parserutils_error filter_set_encoding(parserutils_filter *input, const char *enc) { parserutils_error error = PARSERUTILS_OK; uint16_t mibenum; if (input == NULL || enc == NULL) return PARSERUTILS_BADPARM; mibenum = parserutils_charset_mibenum_from_name(enc, strlen(enc)); if (mibenum == 0) return PARSERUTILS_BADENCODING; /* Exit early if we're already using this encoding */ if (input->settings.encoding == mibenum) return PARSERUTILS_OK; #ifndef WITHOUT_ICONV_FILTER if (input->cd != (iconv_t) -1) { iconv_close(input->cd); input->cd = (iconv_t) -1; } input->cd = iconv_open( parserutils_charset_mibenum_to_name(input->int_enc), parserutils_charset_mibenum_to_name(mibenum)); if (input->cd == (iconv_t) -1) { return (errno == EINVAL) ? PARSERUTILS_BADENCODING : PARSERUTILS_NOMEM; } #else if (input->read_codec != NULL) { parserutils_charset_codec_destroy(input->read_codec); input->read_codec = NULL; } error = parserutils_charset_codec_create(enc, &input->read_codec); if (error != PARSERUTILS_OK) return error; #endif input->settings.encoding = mibenum; return error; } netsurf-all-3.2/libparserutils/src/input/Makefile0000644000175000017500000000012412377676760021260 0ustar vincevince# Sources DIR_SOURCES := filter.c inputstream.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/src/input/filter.h0000644000175000017500000000276412377676760021272 0ustar vincevince/* * This file is part of LibParserUtils. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef parserutils_input_filter_h_ #define parserutils_input_filter_h_ #include #include #include typedef struct parserutils_filter parserutils_filter; /** * Input filter option types */ typedef enum parserutils_filter_opttype { PARSERUTILS_FILTER_SET_ENCODING = 0 } parserutils_filter_opttype; /** * Input filter option parameters */ typedef union parserutils_filter_optparams { /** Parameters for encoding setting */ struct { /** Encoding name */ const char *name; } encoding; } parserutils_filter_optparams; /* Create an input filter */ parserutils_error parserutils__filter_create(const char *int_enc, parserutils_filter **filter); /* Destroy an input filter */ parserutils_error parserutils__filter_destroy(parserutils_filter *input); /* Configure an input filter */ parserutils_error parserutils__filter_setopt(parserutils_filter *input, parserutils_filter_opttype type, parserutils_filter_optparams *params); /* Process a chunk of data */ parserutils_error parserutils__filter_process_chunk(parserutils_filter *input, const uint8_t **data, size_t *len, uint8_t **output, size_t *outlen); /* Reset an input filter's state */ parserutils_error parserutils__filter_reset(parserutils_filter *input); #endif netsurf-all-3.2/libparserutils/src/Makefile0000644000175000017500000000004412377676760020122 0ustar vincevince include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libparserutils/Makefile0000644000175000017500000000315212377676760017336 0ustar vincevince# Component settings COMPONENT := parserutils COMPONENT_VERSION := 0.2.0 # Default to a static library COMPONENT_TYPE ?= lib-static # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER := $(PERL) $(NSTESTTOOLS)/testrunner.pl # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs -pedantic # BeOS/Haiku standard library headers create warnings. ifneq ($(TARGET),beos) WARNFLAGS := $(WARNFLAGS) -Werror endif CFLAGS := -D_BSD_SOURCE -I$(CURDIR)/include/ \ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif include $(NSBUILD)/Makefile.top # Extra installation rules Is := include/parserutils I := /include/parserutils INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/errors.h;$(Is)/functypes.h;$(Is)/parserutils.h;$(Is)/types.h Is := include/parserutils/charset I := /include/parserutils/charset INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/codec.h;$(Is)/mibenum.h;$(Is)/utf16.h;$(Is)/utf8.h Is := include/parserutils/input I := /include/parserutils/input INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/inputstream.h Is := include/parserutils/utils I := /include/parserutils/utils INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/buffer.h;$(Is)/stack.h;$(Is)/vector.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) netsurf-all-3.2/libparserutils/libparserutils.pc.in0000644000175000017500000000037612377676760021700 0ustar vincevinceprefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/LIBDIR includedir=${prefix}/include Name: libparserutils Description: Utility library for facilitating parser development Version: VERSION Libs: -L${libdir} -lparserutils Cflags: -I${includedir} netsurf-all-3.2/libwapcaplet/0000755000175000017500000000000012377713350015263 5ustar vincevincenetsurf-all-3.2/libwapcaplet/include/0000755000175000017500000000000012377713350016706 5ustar vincevincenetsurf-all-3.2/libwapcaplet/include/libwapcaplet/0000755000175000017500000000000012377713350021355 5ustar vincevincenetsurf-all-3.2/libwapcaplet/include/libwapcaplet/libwapcaplet.h0000644000175000017500000001737512377676767024236 0ustar vincevince/* libwapcaplet.h * * String internment and management tools. * * Copyright 2009 The NetSurf Browser Project. * Daniel Silverstone */ #ifndef libwapcaplet_h_ #define libwapcaplet_h_ #ifdef __cplusplus extern "C" { #endif #include #include #include /** * The type of a reference counter used in libwapcaplet. */ typedef uint32_t lwc_refcounter; /** * The type of a hash value used in libwapcaplet. */ typedef uint32_t lwc_hash; /** * An interned string. * * NOTE: The contents of this struct are considered *PRIVATE* and may * change in future revisions. Do not rely on them whatsoever. * They're only here at all so that the ref, unref and matches etc can * use them. */ typedef struct lwc_string_s { struct lwc_string_s ** prevptr; struct lwc_string_s * next; size_t len; lwc_hash hash; lwc_refcounter refcnt; struct lwc_string_s * insensitive; } lwc_string; /** * String iteration function * * @param str A string which has been interned. * @param pw The private pointer for the allocator. */ typedef void (*lwc_iteration_callback_fn)(lwc_string *str, void *pw); /** * Result codes which libwapcaplet might return. */ typedef enum lwc_error_e { lwc_error_ok = 0, /**< No error. */ lwc_error_oom = 1, /**< Out of memory. */ lwc_error_range = 2 /**< Substring internment out of range. */ } lwc_error; /** * Intern a string. * * Take a copy of the string data referred to by \a s and \a slen and * intern it. The resulting ::lwc_string can be used for simple and * caseless comparisons by ::lwc_string_isequal and * ::lwc_string_caseless_isequal respectively. * * @param s Pointer to the start of the string to intern. * @param slen Length of the string in characters. (Not including any * terminators) * @param ret Pointer to ::lwc_string pointer to fill out. * @return Result of operation, if not OK then the value pointed * to by \a ret will not be valid. * * @note The memory pointed to by \a s is not referenced by the result. * @note If the string was already present, its reference count is * incremented rather than allocating more memory. * * @note The returned string is currently NULL-terminated but this * will not necessarily be the case in future. Try not to rely * on it. */ extern lwc_error lwc_intern_string(const char *s, size_t slen, lwc_string **ret); /** * Intern a substring. * * Intern a subsequence of the provided ::lwc_string. * * @param str String to acquire substring from. * @param ssoffset Substring offset into \a str. * @param sslen Substring length. * @param ret Pointer to pointer to ::lwc_string to fill out. * @return Result of operation, if not OK then the value * pointed to by \a ret will not be valid. */ extern lwc_error lwc_intern_substring(lwc_string *str, size_t ssoffset, size_t sslen, lwc_string **ret); /** * Increment the reference count on an lwc_string. * * This increases the reference count on the given string. You should * use this when copying a string pointer into a persistent data * structure. * * @verb * myobject->str = lwc_string_ref(myparent->str); * @endverb * * @param str The string to create another reference to. * @return The string pointer to use in your new data structure. * * @note Use this if copying the string and intending both sides to retain * ownership. */ #define lwc_string_ref(str) ({lwc_string *__lwc_s = (str); __lwc_s->refcnt++; __lwc_s;}) /** * Release a reference on an lwc_string. * * This decreases the reference count on the given ::lwc_string. * * @param str The string to unref. * * @note If the reference count reaches zero then the string will be * freed. (Ref count of 1 where string is its own insensitve match * will also result in the string being freed.) */ #define lwc_string_unref(str) { \ lwc_string *__lwc_s = (str); \ __lwc_s->refcnt--; \ if ((__lwc_s->refcnt == 0) || \ ((__lwc_s->refcnt == 1) && (__lwc_s->insensitive == __lwc_s))) \ lwc_string_destroy(__lwc_s); \ } /** * Destroy an unreffed lwc_string. * * This destroys an lwc_string whose reference count indicates that it should be. * * @param str The string to unref. */ extern void lwc_string_destroy(lwc_string *str); /** * Check if two interned strings are equal. * * @param str1 The first string in the comparison. * @param str2 The second string in the comparison. * @param ret A pointer to a boolean to be filled out with the result. * @return Result of operation, if not ok then value pointed to * by \a ret will not be valid. */ #define lwc_string_isequal(str1, str2, ret) \ ((*(ret) = ((str1) == (str2))), lwc_error_ok) /** * Check if two interned strings are case-insensitively equal. * * @param str1 The first string in the comparison. * @param str2 The second string in the comparison. * @param ret A pointer to a boolean to be filled out with the result. * @return Result of operation, if not ok then value pointed to * by \a ret will not be valid. */ #define lwc_string_caseless_isequal(_str1,_str2,_ret) ({ \ lwc_error __lwc_err = lwc_error_ok; \ lwc_string *__lwc_str1 = (_str1); \ lwc_string *__lwc_str2 = (_str2); \ bool *__lwc_ret = (_ret); \ \ if (__lwc_str1->insensitive == NULL) { \ __lwc_err = lwc__intern_caseless_string(__lwc_str1); \ } \ if (__lwc_err == lwc_error_ok && __lwc_str2->insensitive == NULL) { \ __lwc_err = lwc__intern_caseless_string(__lwc_str2); \ } \ if (__lwc_err == lwc_error_ok) \ *__lwc_ret = (__lwc_str1->insensitive == __lwc_str2->insensitive); \ __lwc_err; \ }) /** * Intern a caseless copy of the passed string. * * @param str The string to intern the caseless copy of. * * @return lwc_error_ok if successful, otherwise the * error code describing the issue., * * @note This is for "internal" use by the caseless comparison * macro and not for users. */ extern lwc_error lwc__intern_caseless_string(lwc_string *str); /** * Retrieve the data pointer for an interned string. * * @param str The string to retrieve the data pointer for. * @return The C string data pointer for \a str. * * @note The data we point at belongs to the string and will * die with the string. Keep a ref if you need it. * @note You may not rely on the NULL termination of the strings * in future. Any code relying on it currently should be * modified to use ::lwc_string_length if possible. */ #define lwc_string_data(str) ((const char *)((str)+1)) /** * Retrieve the data length for an interned string. * * @param str The string to retrieve the length of. * @return The length of \a str. */ #define lwc_string_length(str) ((str)->len) /** * Retrieve (or compute if unavailable) a hash value for the content of the string. * * @param str The string to get the hash for. * @return The 32 bit hash of \a str. * * @note This API should only be used as a convenient way to retrieve a hash * value for the string. This hash value should not be relied on to be * unique within an invocation of the program, nor should it be relied upon * to be stable between invocations of the program. Never use the hash * value as a way to directly identify the value of the string. */ #define lwc_string_hash_value(str) ((str)->hash) /** * Iterate the context and return every string in it. * * @param cb The callback to give the string to. * @param pw The private word for the callback. */ extern void lwc_iterate_strings(lwc_iteration_callback_fn cb, void *pw); #ifdef __cplusplus } #endif #endif /* libwapcaplet_h_ */ netsurf-all-3.2/libwapcaplet/test/0000755000175000017500000000000012377713350016242 5ustar vincevincenetsurf-all-3.2/libwapcaplet/test/tests.h0000644000175000017500000000063412377676767017604 0ustar vincevince/* test/tests.h * * Set of test suites for libwapcaplet * * Copyright 2009 The NetSurf Browser Project * Daniel Silverstone */ #ifndef lwc_tests_h_ #define lwc_tests_h_ #include #include #include "libwapcaplet/libwapcaplet.h" extern void lwc_basic_suite(SRunner *); extern void lwc_memory_suite(SRunner *); #endif /* lwc_tests_h_ */ netsurf-all-3.2/libwapcaplet/test/testmain.c0000644000175000017500000000167112377676767020263 0ustar vincevince/* test/testmain.c * * Core of the test suite for libwapcaplet * * Copyright 2009 The NetSurf Browser Project * Daniel Silverstone */ #include #include #include "tests.h" #ifndef UNUSED #define UNUSED(x) ((x) = (x)) #endif /* This means that assertion failures are silent in tests */ extern void __assert_fail(void); void __assert_fail(void) { abort(); } int main(int argc, char **argv) { int number_failed = 0; SRunner *sr; UNUSED(argc); UNUSED(argv); sr = srunner_create(suite_create("Test suite for libwapcaplet")); lwc_basic_suite(sr); // lwc_memory_suite(sr); srunner_set_fork_status(sr, CK_FORK); srunner_run_all(sr, CK_ENV); number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } netsurf-all-3.2/libwapcaplet/test/basictests.c0000644000175000017500000003135712377676767020607 0ustar vincevince/* test/basictests.c * * Basic tests for the test suite for libwapcaplet * * Copyright 2009 The NetSurf Browser Project * Daniel Silverstone */ #include #include #include #include "tests.h" #ifndef UNUSED #define UNUSED(x) (void)(x) #endif #ifndef NDEBUG /* All the basic assert() tests */ START_TEST (test_lwc_intern_string_aborts1) { lwc_intern_string(NULL, 0, NULL); } END_TEST START_TEST (test_lwc_intern_string_aborts2) { lwc_intern_string("A", 1, NULL); } END_TEST START_TEST (test_lwc_intern_substring_aborts1) { lwc_intern_substring(NULL, 0, 0, NULL); } END_TEST START_TEST (test_lwc_intern_substring_aborts2) { lwc_string *str; fail_unless(lwc_intern_string("Jam", 3, &str) == lwc_error_ok, "unable to intern 'Jam'"); lwc_intern_substring(str, 88, 77, NULL); } END_TEST START_TEST (test_lwc_string_ref_aborts) { lwc_string_ref(NULL); } END_TEST START_TEST (test_lwc_string_unref_aborts) { lwc_string_unref(NULL); } END_TEST START_TEST (test_lwc_string_data_aborts) { lwc_string_data(NULL); } END_TEST START_TEST (test_lwc_string_length_aborts) { lwc_string_length(NULL); } END_TEST START_TEST (test_lwc_string_hash_value_aborts) { lwc_string_hash_value(NULL); } END_TEST #endif /**** The next set of tests need a fixture set ****/ static void with_simple_context_setup(void) { /* Nothing to set up */ } static void with_simple_context_teardown(void) { /* Nothing to do to tear down */ } START_TEST (test_lwc_intern_string_ok) { lwc_string *str = NULL; fail_unless(lwc_intern_string("A", 1, &str) == lwc_error_ok, "Unable to intern a simple string"); fail_unless(str != NULL, "Returned OK but str was still NULL"); } END_TEST START_TEST (test_lwc_intern_string_twice_ok) { lwc_string *str1 = NULL, *str2 = NULL; fail_unless(lwc_intern_string("A", 1, &str1) == lwc_error_ok, "Unable to intern a simple string"); fail_unless(str1 != NULL, "Returned OK but str was still NULL"); fail_unless(lwc_intern_string("B", 1, &str2) == lwc_error_ok, "Unable to intern a simple string"); fail_unless(str2 != NULL, "Returned OK but str was still NULL"); } END_TEST START_TEST (test_lwc_intern_string_twice_same_ok) { lwc_string *str1 = NULL, *str2 = NULL; fail_unless(lwc_intern_string("A", 1, &str1) == lwc_error_ok, "Unable to intern a simple string"); fail_unless(str1 != NULL, "Returned OK but str was still NULL"); fail_unless(lwc_intern_string("A", 1, &str2) == lwc_error_ok, "Unable to intern a simple string"); fail_unless(str2 != NULL, "Returned OK but str was still NULL"); } END_TEST /**** The next set of tests need a fixture set with some strings ****/ static lwc_string *intern_one = NULL, *intern_two = NULL, *intern_three = NULL, *intern_YAY = NULL; static void with_filled_context_setup(void) { fail_unless(lwc_intern_string("one", 3, &intern_one) == lwc_error_ok, "Unable to intern 'one'"); fail_unless(lwc_intern_string("two", 3, &intern_two) == lwc_error_ok, "Unable to intern 'two'"); fail_unless(lwc_intern_string("three", 5, &intern_three) == lwc_error_ok, "Unable to intern 'three'"); fail_unless(lwc_intern_string("YAY", 3, &intern_YAY) == lwc_error_ok, "Unable to intern 'YAY'"); fail_unless(intern_one != intern_two, "'one' == 'two'"); fail_unless(intern_one != intern_three, "'one' == 'three'"); fail_unless(intern_two != intern_three, "'two' == 'three'"); } static void with_filled_context_teardown(void) { lwc_string_unref(intern_one); lwc_string_unref(intern_two); lwc_string_unref(intern_three); lwc_string_unref(intern_YAY); } START_TEST (test_lwc_interning_works) { lwc_string *new_one = NULL; fail_unless(lwc_intern_string("one", 3, &new_one) == lwc_error_ok, "Unable to re-intern 'one'"); fail_unless(new_one == intern_one, "Internalising of the string failed"); } END_TEST START_TEST (test_lwc_intern_substring) { lwc_string *new_hre = NULL, *sub_hre = NULL; fail_unless(lwc_intern_string("hre", 3, &new_hre) == lwc_error_ok, "Unable to intern 'hre'"); fail_unless(lwc_intern_substring(intern_three, 1, 3, &sub_hre) == lwc_error_ok, "Unable to re-intern 'hre' by substring"); fail_unless(new_hre == sub_hre, "'hre' != 'hre' -- wow!"); } END_TEST START_TEST (test_lwc_intern_substring_bad_offset) { lwc_string *str; fail_unless(lwc_intern_substring(intern_three, 100, 1, &str) == lwc_error_range, "Able to intern substring starting out of range"); } END_TEST START_TEST (test_lwc_intern_substring_bad_size) { lwc_string *str; fail_unless(lwc_intern_substring(intern_three, 1, 100, &str) == lwc_error_range, "Able to intern substring ending out of range"); } END_TEST START_TEST (test_lwc_string_ref_ok) { fail_unless(lwc_string_ref(intern_one) == intern_one, "Oddly, reffing a string didn't return it"); } END_TEST START_TEST (test_lwc_string_unref_ok) { lwc_string_unref(intern_one); } END_TEST START_TEST (test_lwc_string_ref_unref_ok) { lwc_string_ref(intern_one); lwc_string_unref(intern_one); } END_TEST START_TEST (test_lwc_string_isequal_ok) { bool result = true; fail_unless((lwc_string_isequal(intern_one, intern_two, &result)) == lwc_error_ok, "Failure comparing 'one' and 'two'"); fail_unless(result == false, "'one' == 'two' ?!"); } END_TEST START_TEST (test_lwc_string_caseless_isequal_ok1) { bool result = true; lwc_string *new_ONE; fail_unless(lwc_intern_string("ONE", 3, &new_ONE) == lwc_error_ok, "Failure interning 'ONE'"); fail_unless((lwc_string_isequal(intern_one, new_ONE, &result)) == lwc_error_ok); fail_unless(result == false, "'one' == 'ONE' ?!"); fail_unless((lwc_string_caseless_isequal(intern_one, new_ONE, &result)) == lwc_error_ok, "Failure comparing 'one' and 'ONE' caselessly"); fail_unless(result == true, "'one' !~= 'ONE' ?!"); } END_TEST START_TEST (test_lwc_string_caseless_isequal_ok2) { bool result = true; lwc_string *new_yay; fail_unless(lwc_intern_string("yay", 3, &new_yay) == lwc_error_ok, "Failure interning 'yay'"); fail_unless((lwc_string_isequal(intern_YAY, new_yay, &result)) == lwc_error_ok); fail_unless(result == false, "'yay' == 'YAY' ?!"); fail_unless((lwc_string_caseless_isequal(intern_YAY, new_yay, &result)) == lwc_error_ok, "Failure comparing 'yay' and 'YAY' caselessly"); fail_unless(result == true, "'yay' !~= 'YAY' ?!"); } END_TEST START_TEST (test_lwc_string_caseless_isequal_bad) { bool result = true; fail_unless(lwc_string_caseless_isequal(intern_YAY, intern_one, &result) == lwc_error_ok, "Failure comparing 'YAY' and 'one' caselessly"); fail_unless(result == false, "'YAY' ~= 'one' ?!"); } END_TEST START_TEST (test_lwc_extract_data_ok) { fail_unless(memcmp("one", lwc_string_data(intern_one), lwc_string_length(intern_one)) == 0, "Extracting data ptr etc failed"); } END_TEST START_TEST (test_lwc_string_hash_value_ok) { (void)lwc_string_hash_value(intern_one); } END_TEST START_TEST (test_lwc_string_is_nul_terminated) { lwc_string *new_ONE; fail_unless(lwc_intern_string("ONE", 3, &new_ONE) == lwc_error_ok, "Failure interning 'ONE'"); fail_unless(lwc_string_data(new_ONE)[lwc_string_length(new_ONE)] == '\0', "Interned string isn't NUL terminated"); } END_TEST START_TEST (test_lwc_substring_is_nul_terminated) { lwc_string *new_ONE; lwc_string *new_O; fail_unless(lwc_intern_string("ONE", 3, &new_ONE) == lwc_error_ok, "Failure interning 'ONE'"); fail_unless(lwc_intern_substring(new_ONE, 0, 1, &new_O) == lwc_error_ok, "Failure interning substring 'O'"); fail_unless(lwc_string_data(new_O)[lwc_string_length(new_O)] == '\0', "Interned substring isn't NUL terminated"); } END_TEST static void counting_cb(lwc_string *str, void *pw) { UNUSED(str); *((int *)pw) += 1; } START_TEST (test_lwc_string_iteration) { int counter = 0; lwc_iterate_strings(counting_cb, (void*)&counter); fail_unless(counter == 4, "Incorrect string count"); } END_TEST /**** And the suites are set up here ****/ void lwc_basic_suite(SRunner *sr) { Suite *s = suite_create("libwapcaplet: Basic tests"); TCase *tc_basic = tcase_create("Creation/Destruction"); #ifndef NDEBUG tcase_add_test_raise_signal(tc_basic, test_lwc_intern_string_aborts1, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_string_aborts2, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_substring_aborts1, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_intern_substring_aborts2, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_ref_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_unref_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_data_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_length_aborts, SIGABRT); tcase_add_test_raise_signal(tc_basic, test_lwc_string_hash_value_aborts, SIGABRT); #endif suite_add_tcase(s, tc_basic); tc_basic = tcase_create("Ops with a context"); tcase_add_checked_fixture(tc_basic, with_simple_context_setup, with_simple_context_teardown); tcase_add_test(tc_basic, test_lwc_intern_string_ok); tcase_add_test(tc_basic, test_lwc_intern_string_twice_ok); tcase_add_test(tc_basic, test_lwc_intern_string_twice_same_ok); suite_add_tcase(s, tc_basic); tc_basic = tcase_create("Ops with a filled context"); tcase_add_checked_fixture(tc_basic, with_filled_context_setup, with_filled_context_teardown); tcase_add_test(tc_basic, test_lwc_interning_works); tcase_add_test(tc_basic, test_lwc_intern_substring); tcase_add_test(tc_basic, test_lwc_string_ref_ok); tcase_add_test(tc_basic, test_lwc_string_ref_unref_ok); tcase_add_test(tc_basic, test_lwc_string_unref_ok); tcase_add_test(tc_basic, test_lwc_string_isequal_ok); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_ok1); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_ok2); tcase_add_test(tc_basic, test_lwc_string_caseless_isequal_bad); tcase_add_test(tc_basic, test_lwc_extract_data_ok); tcase_add_test(tc_basic, test_lwc_string_hash_value_ok); tcase_add_test(tc_basic, test_lwc_string_is_nul_terminated); tcase_add_test(tc_basic, test_lwc_substring_is_nul_terminated); tcase_add_test(tc_basic, test_lwc_intern_substring_bad_size); tcase_add_test(tc_basic, test_lwc_intern_substring_bad_offset); tcase_add_test(tc_basic, test_lwc_string_iteration); suite_add_tcase(s, tc_basic); srunner_add_suite(sr, s); } netsurf-all-3.2/libwapcaplet/test/Makefile0000644000175000017500000000013112377676767017721 0ustar vincevinceDIR_TEST_ITEMS := testrunner:testmain.c;basictests.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libwapcaplet/README0000644000175000017500000000401612377676767016170 0ustar vincevinceLibWapcaplet - a string internment library ========================================== Overview -------- LibWapcaplet provides a reference counted string internment system designed to store small strings and allow rapid comparison of them in terms of equality. It supports a caseless comparison where it will automatically intern a lowercased variant of the string and use that for comparison if needed. Rationale --------- Prior to LibWapcaplet, LibParserUtils contained a dictionary and hash implementation along with a red-black tree implementation internally. These three things were then used by client applications and libraries such as LibCSS. However, the code was deemed to be inefficient and the features in the wrong library. The behaviour required of the client libraries was therefore split out so that internment would still be able to be shared between different client libraries in the same application. (E.g. LibCSS and Hubbub) For those interested, The name 'Wapcaplet' is from the Monty Python sketch in which Mr Simpson (who is not French) attempts to sell 122,000 miles of string which was unfortunately cut up into 3 inch lengths, and Adrian Wapcaplet comes up with the idea of "Simpson's individual emperor stringettes - Just the right length!" Requirements ------------ To compile LibWapcaplet you need: * GNU Make 3.81 or better * A version of GCC capable of -MMD -MF (unless you change the build system) To compile the test suite you need: * Check v0.9.5 or better. Compilation ----------- To build LibWapcaplet in release mode, type 'make'. To build it in debug mode type 'make BUILD=debug'. To install, run 'make install'. If you wish to install LibWapcaplet into somewhere other than /usr/local/ then add PREFIX=/path/to/place to the installation make command. Verification ------------ To build and run the tests, run 'make test'. In release mode, fewer tests will be run as the assert() calls will be elided. API documentation ----------------- For API documentation see include/libwapcaplet/libwapcaplet.h netsurf-all-3.2/libwapcaplet/COPYING0000644000175000017500000000206412377676767016344 0ustar vincevinceCopyright 2009 The NetSurf Browser Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. netsurf-all-3.2/libwapcaplet/src/0000755000175000017500000000000012377713350016052 5ustar vincevincenetsurf-all-3.2/libwapcaplet/src/libwapcaplet.c0000644000175000017500000001376112377676767020721 0ustar vincevince/* libwapcaplet.c * * String internment and management tools. * * Copyright 2009 The NetSurf Browser Project. * Daniel Silverstone */ #include #include #include #include "libwapcaplet/libwapcaplet.h" #ifndef UNUSED #define UNUSED(x) ((x) = (x)) #endif static inline lwc_hash lwc__calculate_hash(const char *str, size_t len) { lwc_hash z = 0x811c9dc5; while (len > 0) { z *= 0x01000193; z ^= *str++; len--; } return z; } #define STR_OF(str) ((char *)(str + 1)) #define CSTR_OF(str) ((const char *)(str + 1)) #define NR_BUCKETS_DEFAULT (4091) typedef struct lwc_context_s { lwc_string ** buckets; lwc_hash bucketcount; } lwc_context; static lwc_context *ctx = NULL; #define LWC_ALLOC(s) malloc(s) #define LWC_FREE(p) free(p) typedef lwc_hash (*lwc_hasher)(const char *, size_t); typedef int (*lwc_strncmp)(const char *, const char *, size_t); typedef void (*lwc_memcpy)(char *, const char *, size_t); static lwc_error lwc__initialise(void) { if (ctx != NULL) return lwc_error_ok; ctx = LWC_ALLOC(sizeof(lwc_context)); if (ctx == NULL) return lwc_error_oom; memset(ctx, 0, sizeof(lwc_context)); ctx->bucketcount = NR_BUCKETS_DEFAULT; ctx->buckets = LWC_ALLOC(sizeof(lwc_string *) * ctx->bucketcount); if (ctx->buckets == NULL) { LWC_FREE(ctx); ctx = NULL; return lwc_error_oom; } memset(ctx->buckets, 0, sizeof(lwc_string *) * ctx->bucketcount); return lwc_error_ok; } static lwc_error lwc__intern(const char *s, size_t slen, lwc_string **ret, lwc_hasher hasher, lwc_strncmp compare, lwc_memcpy copy) { lwc_hash h; lwc_hash bucket; lwc_string *str; lwc_error eret; assert((s != NULL) || (slen == 0)); assert(ret); if (ctx == NULL) { eret = lwc__initialise(); if (eret != lwc_error_ok) return eret; if (ctx == NULL) return lwc_error_oom; } h = hasher(s, slen); bucket = h % ctx->bucketcount; str = ctx->buckets[bucket]; while (str != NULL) { if ((str->hash == h) && (str->len == slen)) { if (compare(CSTR_OF(str), s, slen) == 0) { str->refcnt++; *ret = str; return lwc_error_ok; } } str = str->next; } /* Add one for the additional NUL. */ *ret = str = LWC_ALLOC(sizeof(lwc_string) + slen + 1); if (str == NULL) return lwc_error_oom; str->prevptr = &(ctx->buckets[bucket]); str->next = ctx->buckets[bucket]; if (str->next != NULL) str->next->prevptr = &(str->next); ctx->buckets[bucket] = str; str->len = slen; str->hash = h; str->refcnt = 1; str->insensitive = NULL; copy(STR_OF(str), s, slen); /* Guarantee NUL termination */ STR_OF(str)[slen] = '\0'; return lwc_error_ok; } lwc_error lwc_intern_string(const char *s, size_t slen, lwc_string **ret) { return lwc__intern(s, slen, ret, lwc__calculate_hash, strncmp, (lwc_memcpy)memcpy); } lwc_error lwc_intern_substring(lwc_string *str, size_t ssoffset, size_t sslen, lwc_string **ret) { assert(str); assert(ret); if (ssoffset >= str->len) return lwc_error_range; if ((ssoffset + sslen) > str->len) return lwc_error_range; return lwc_intern_string(CSTR_OF(str) + ssoffset, sslen, ret); } void lwc_string_destroy(lwc_string *str) { assert(str); *(str->prevptr) = str->next; if (str->next != NULL) str->next->prevptr = str->prevptr; if (str->insensitive != NULL && str->refcnt == 0) lwc_string_unref(str->insensitive); #ifndef NDEBUG memset(str, 0xA5, sizeof(*str) + str->len); #endif LWC_FREE(str); } /**** Shonky caseless bits ****/ static inline char lwc__dolower(const char c) { if (c >= 'A' && c <= 'Z') return c + 'a' - 'A'; return c; } static inline lwc_hash lwc__calculate_lcase_hash(const char *str, size_t len) { lwc_hash z = 0x811c9dc5; while (len > 0) { z *= 0x01000193; z ^= lwc__dolower(*str++); len--; } return z; } static int lwc__lcase_strncmp(const char *s1, const char *s2, size_t n) { while (n--) { if (*s1++ != lwc__dolower(*s2++)) /** @todo Test this somehow? */ return 1; } return 0; } static void lwc__lcase_memcpy(char *target, const char *source, size_t n) { while (n--) { *target++ = lwc__dolower(*source++); } } lwc_error lwc__intern_caseless_string(lwc_string *str) { assert(str); assert(str->insensitive == NULL); return lwc__intern(CSTR_OF(str), str->len, &(str->insensitive), lwc__calculate_lcase_hash, lwc__lcase_strncmp, lwc__lcase_memcpy); } /**** Iteration ****/ void lwc_iterate_strings(lwc_iteration_callback_fn cb, void *pw) { lwc_hash n; lwc_string *str; if (ctx == NULL) return; for (n = 0; n < ctx->bucketcount; ++n) { for (str = ctx->buckets[n]; str != NULL; str = str->next) cb(str, pw); } } netsurf-all-3.2/libwapcaplet/src/Makefile0000644000175000017500000000010212377676767017527 0ustar vincevinceDIR_SOURCES := libwapcaplet.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libwapcaplet/libwapcaplet.pc.in0000644000175000017500000000035012377676767020705 0ustar vincevinceprefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/LIBDIR includedir=${prefix}/include Name: libwapcaplet Description: String internalisation dictionary Version: VERSION Libs: -L${libdir} -lwapcaplet Cflags: -I${includedir} netsurf-all-3.2/libwapcaplet/Makefile0000644000175000017500000000263712377676767016757 0ustar vincevince# Component settings COMPONENT := wapcaplet COMPONENT_VERSION := 0.2.1 # Default to a static library COMPONENT_TYPE ?= lib-static # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools # Reevaluate when used, as BUILDDIR won't be defined yet TESTRUNNER = $(BUILDDIR)/test_testrunner$(EXEEXT) # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs # BeOS/Haiku standard library headers issue warnings ifneq ($(TARGET),beos) WARNFLAGS := $(WARNFLAGS) -Werror endif CFLAGS := -D_BSD_SOURCE -I$(CURDIR)/include/ \ -I$(CURDIR)/src $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif include $(NSBUILD)/Makefile.top ifeq ($(WANT_TEST),yes) ifneq ($(PKGCONFIG),) TESTCFLAGS := $(TESTCFLAGS) $(shell $(PKGCONFIG) --cflags check) TESTLDFLAGS := $(TESTLDFLAGS) $(shell $(PKGCONFIG) --libs check) else TESTLDFLAGS := $(TESTLDFLAGS) -lcheck endif endif # Extra installation rules I := /include/libwapcaplet INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/libwapcaplet/libwapcaplet.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) netsurf-all-3.2/netsurf/0000755000175000017500000000000012377713350014302 5ustar vincevincenetsurf-all-3.2/netsurf/render/0000755000175000017500000000000012377713350015561 5ustar vincevincenetsurf-all-3.2/netsurf/render/table.c0000644000175000017500000006765412377677024017045 0ustar vincevince/* * Copyright 2005 James Bursa * Copyright 2005 Richard Wilson * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Table processing and layout (implementation). */ #include #include #include "css/css.h" #include "css/utils.h" #include "render/box.h" #include "render/table.h" #include "utils/log.h" #include "utils/talloc.h" /* Define to enable verbose table debug */ #undef TABLE_DEBUG /** * Container for border values during table border calculations */ struct border { enum css_border_style_e style; /**< border-style */ enum css_border_color_e color; /**< border-color type */ css_color c; /**< border-color value */ css_fixed width; /**< border-width length */ css_unit unit; /**< border-width units */ }; static void table_used_left_border_for_cell(struct box *cell); static void table_used_top_border_for_cell(struct box *cell); static void table_used_right_border_for_cell(struct box *cell); static void table_used_bottom_border_for_cell(struct box *cell); static bool table_border_is_more_eyecatching(const struct border *a, box_type a_src, const struct border *b, box_type b_src); static void table_cell_top_process_table(struct box *table, struct border *a, box_type *a_src); static bool table_cell_top_process_group(struct box *cell, struct box *group, struct border *a, box_type *a_src); static bool table_cell_top_process_row(struct box *cell, struct box *row, struct border *a, box_type *a_src); /** * Determine the column width types for a table. * * \param table box of type BOX_TABLE * \return true on success, false on memory exhaustion * * The table->col array is allocated and type and width are filled in for each * column. */ bool table_calculate_column_types(struct box *table) { unsigned int i, j; struct column *col; struct box *row_group, *row, *cell; if (table->col) /* table->col already constructed, for example frameset table */ return true; table->col = col = talloc_array(table, struct column, table->columns); if (!col) return false; for (i = 0; i != table->columns; i++) { col[i].type = COLUMN_WIDTH_UNKNOWN; col[i].width = 0; col[i].positioned = true; } /* 1st pass: cells with colspan 1 only */ for (row_group = table->children; row_group; row_group =row_group->next) for (row = row_group->children; row; row = row->next) for (cell = row->children; cell; cell = cell->next) { enum css_width_e type; css_fixed value = 0; css_unit unit = CSS_UNIT_PX; assert(cell->type == BOX_TABLE_CELL); assert(cell->style); if (cell->columns != 1) continue; i = cell->start_column; if (css_computed_position(cell->style) != CSS_POSITION_ABSOLUTE && css_computed_position(cell->style) != CSS_POSITION_FIXED) { col[i].positioned = false; } type = css_computed_width(cell->style, &value, &unit); /* fixed width takes priority over any other width type */ if (col[i].type != COLUMN_WIDTH_FIXED && type == CSS_WIDTH_SET && unit != CSS_UNIT_PCT) { col[i].type = COLUMN_WIDTH_FIXED; col[i].width = FIXTOINT(nscss_len2px(value, unit, cell->style)); if (col[i].width < 0) col[i].width = 0; continue; } if (col[i].type != COLUMN_WIDTH_UNKNOWN) continue; if (type == CSS_WIDTH_SET && unit == CSS_UNIT_PCT) { col[i].type = COLUMN_WIDTH_PERCENT; col[i].width = FIXTOINT(value); if (col[i].width < 0) col[i].width = 0; } else if (type == CSS_WIDTH_AUTO) { col[i].type = COLUMN_WIDTH_AUTO; } } /* 2nd pass: cells which span multiple columns */ for (row_group = table->children; row_group; row_group =row_group->next) for (row = row_group->children; row; row = row->next) for (cell = row->children; cell; cell = cell->next) { unsigned int fixed_columns = 0, percent_columns = 0, auto_columns = 0, unknown_columns = 0; int fixed_width = 0, percent_width = 0; enum css_width_e type; css_fixed value = 0; css_unit unit = CSS_UNIT_PX; if (cell->columns == 1) continue; i = cell->start_column; for (j = i; j < i + cell->columns; j++) { col[j].positioned = false; } /* count column types in spanned cells */ for (j = 0; j != cell->columns; j++) { if (col[i + j].type == COLUMN_WIDTH_FIXED) { fixed_width += col[i + j].width; fixed_columns++; } else if (col[i + j].type == COLUMN_WIDTH_PERCENT) { percent_width += col[i + j].width; percent_columns++; } else if (col[i + j].type == COLUMN_WIDTH_AUTO) { auto_columns++; } else { unknown_columns++; } } if (!unknown_columns) continue; type = css_computed_width(cell->style, &value, &unit); /* if cell is fixed width, and all spanned columns are fixed * or unknown width, split extra width among unknown columns */ if (type == CSS_WIDTH_SET && unit != CSS_UNIT_PCT && fixed_columns + unknown_columns == cell->columns) { int width = (FIXTOFLT(nscss_len2px(value, unit, cell->style)) - fixed_width) / unknown_columns; if (width < 0) width = 0; for (j = 0; j != cell->columns; j++) { if (col[i + j].type == COLUMN_WIDTH_UNKNOWN) { col[i + j].type = COLUMN_WIDTH_FIXED; col[i + j].width = width; } } } /* as above for percentage width */ if (type == CSS_WIDTH_SET && unit == CSS_UNIT_PCT && percent_columns + unknown_columns == cell->columns) { int width = (FIXTOFLT(value) - percent_width) / unknown_columns; if (width < 0) width = 0; for (j = 0; j != cell->columns; j++) { if (col[i + j].type == COLUMN_WIDTH_UNKNOWN) { col[i + j].type = COLUMN_WIDTH_PERCENT; col[i + j].width = width; } } } } /* use AUTO if no width type was specified */ for (i = 0; i != table->columns; i++) { if (col[i].type == COLUMN_WIDTH_UNKNOWN) col[i].type = COLUMN_WIDTH_AUTO; } #ifdef TABLE_DEBUG for (i = 0; i != table->columns; i++) LOG(("table %p, column %u: type %s, width %i", table, i, ((const char *[]) {"UNKNOWN", "FIXED", "AUTO", "PERCENT", "RELATIVE"})[col[i].type], col[i].width)); #endif return true; } /** * Calculate used values of border-{trbl}-{style,color,width} for table cells. * * \param cell Table cell to consider * * \post \a cell's border array is populated */ void table_used_border_for_cell(struct box *cell) { int side; assert(cell->type == BOX_TABLE_CELL); if (css_computed_border_collapse(cell->style) == CSS_BORDER_COLLAPSE_SEPARATE) { css_fixed width = 0; css_unit unit = CSS_UNIT_PX; /* Left border */ cell->border[LEFT].style = css_computed_border_left_style(cell->style); css_computed_border_left_color(cell->style, &cell->border[LEFT].c); css_computed_border_left_width(cell->style, &width, &unit); cell->border[LEFT].width = FIXTOINT(nscss_len2px(width, unit, cell->style)); /* Top border */ cell->border[TOP].style = css_computed_border_top_style(cell->style); css_computed_border_top_color(cell->style, &cell->border[TOP].c); css_computed_border_top_width(cell->style, &width, &unit); cell->border[TOP].width = FIXTOINT(nscss_len2px(width, unit, cell->style)); /* Right border */ cell->border[RIGHT].style = css_computed_border_right_style(cell->style); css_computed_border_right_color(cell->style, &cell->border[RIGHT].c); css_computed_border_right_width(cell->style, &width, &unit); cell->border[RIGHT].width = FIXTOINT(nscss_len2px(width, unit, cell->style)); /* Bottom border */ cell->border[BOTTOM].style = css_computed_border_bottom_style(cell->style); css_computed_border_bottom_color(cell->style, &cell->border[BOTTOM].c); css_computed_border_bottom_width(cell->style, &width, &unit); cell->border[BOTTOM].width = FIXTOINT(nscss_len2px(width, unit, cell->style)); } else { /* Left border */ table_used_left_border_for_cell(cell); /* Top border */ table_used_top_border_for_cell(cell); /* Right border */ table_used_right_border_for_cell(cell); /* Bottom border */ table_used_bottom_border_for_cell(cell); } /* Finally, ensure that any borders configured as * hidden or none have zero width. (c.f. layout_find_dimensions) */ for (side = 0; side != 4; side++) { if (cell->border[side].style == CSS_BORDER_STYLE_HIDDEN || cell->border[side].style == CSS_BORDER_STYLE_NONE) cell->border[side].width = 0; } } /****************************************************************************** * Helpers for used border calculations * ******************************************************************************/ /** * Calculate used values of border-left-{style,color,width} * * \param cell Table cell to consider */ void table_used_left_border_for_cell(struct box *cell) { struct border a, b; box_type a_src, b_src; /** \todo Need column and column_group, too */ /* Initialise to computed left border for cell */ a.style = css_computed_border_left_style(cell->style); a.color = css_computed_border_left_color(cell->style, &a.c); css_computed_border_left_width(cell->style, &a.width, &a.unit); a.width = nscss_len2px(a.width, a.unit, cell->style); a.unit = CSS_UNIT_PX; a_src = BOX_TABLE_CELL; if (cell->prev != NULL || cell->start_column != 0) { /* Cell to the left -- consider its right border */ struct box *prev = NULL; if (cell->prev == NULL) { struct box *row; /* Spanned from a previous row in current row group */ for (row = cell->parent; row != NULL; row = row->prev) { for (prev = row->children; prev != NULL; prev = prev->next) { if (prev->start_column + prev->columns == cell->start_column) break; } if (prev != NULL) break; } assert(prev != NULL); } else { prev = cell->prev; } b.style = css_computed_border_right_style(prev->style); b.color = css_computed_border_right_color(prev->style, &b.c); css_computed_border_right_width(prev->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, prev->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_CELL; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } } else { /* First cell in row, so consider rows and row group */ struct box *row = cell->parent; struct box *group = row->parent; struct box *table = group->parent; unsigned int rows = cell->rows; while (rows-- > 0 && row != NULL) { /* Spanned rows -- consider their left border */ b.style = css_computed_border_left_style(row->style); b.color = css_computed_border_left_color( row->style, &b.c); css_computed_border_left_width( row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } row = row->next; } /** \todo can cells span row groups? */ /* Row group -- consider its left border */ b.style = css_computed_border_left_style(group->style); b.color = css_computed_border_left_color(group->style, &b.c); css_computed_border_left_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } /* The table itself -- consider its left border */ b.style = css_computed_border_left_style(table->style); b.color = css_computed_border_left_color(table->style, &b.c); css_computed_border_left_width(table->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, table->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } } /* a now contains the used left border for the cell */ cell->border[LEFT].style = a.style; cell->border[LEFT].c = a.c; cell->border[LEFT].width = FIXTOINT(nscss_len2px(a.width, a.unit, cell->style)); } /** * Calculate used values of border-top-{style,color,width} * * \param cell Table cell to consider */ void table_used_top_border_for_cell(struct box *cell) { struct border a, b; box_type a_src, b_src; struct box *row = cell->parent; bool process_group = false; /* Initialise to computed top border for cell */ a.style = css_computed_border_top_style(cell->style); css_computed_border_top_color(cell->style, &a.c); css_computed_border_top_width(cell->style, &a.width, &a.unit); a.width = nscss_len2px(a.width, a.unit, cell->style); a.unit = CSS_UNIT_PX; a_src = BOX_TABLE_CELL; /* Top border of row */ b.style = css_computed_border_top_style(row->style); css_computed_border_top_color(row->style, &b.c); css_computed_border_top_width(row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } if (row->prev != NULL) { /* Consider row(s) above */ while (table_cell_top_process_row(cell, row->prev, &a, &a_src) == false) { if (row->prev->prev == NULL) { /* Consider row group */ process_group = true; break; } else { row = row->prev; } } } else { process_group = true; } if (process_group) { struct box *group = row->parent; /* Top border of row group */ b.style = css_computed_border_top_style(group->style); b.color = css_computed_border_top_color(group->style, &b.c); css_computed_border_top_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } if (group->prev == NULL) { /* Top border of table */ table_cell_top_process_table(group->parent, &a, &a_src); } else { /* Process previous group(s) */ while (table_cell_top_process_group(cell, group->prev, &a, &a_src) == false) { if (group->prev->prev == NULL) { /* Top border of table */ table_cell_top_process_table( group->parent, &a, &a_src); break; } else { group = group->prev; } } } } /* a now contains the used top border for the cell */ cell->border[TOP].style = a.style; cell->border[TOP].c = a.c; cell->border[TOP].width = FIXTOINT(nscss_len2px(a.width, a.unit, cell->style)); } /** * Calculate used values of border-right-{style,color,width} * * \param cell Table cell to consider */ void table_used_right_border_for_cell(struct box *cell) { struct border a, b; box_type a_src, b_src; /** \todo Need column and column_group, too */ /* Initialise to computed right border for cell */ a.style = css_computed_border_right_style(cell->style); css_computed_border_right_color(cell->style, &a.c); css_computed_border_right_width(cell->style, &a.width, &a.unit); a.width = nscss_len2px(a.width, a.unit, cell->style); a.unit = CSS_UNIT_PX; a_src = BOX_TABLE_CELL; if (cell->next != NULL || cell->start_column + cell->columns != cell->parent->parent->parent->columns) { /* Cell is not at right edge of table -- no right border */ a.style = CSS_BORDER_STYLE_NONE; a.width = 0; a.unit = CSS_UNIT_PX; } else { /* Last cell in row, so consider rows and row group */ struct box *row = cell->parent; struct box *group = row->parent; struct box *table = group->parent; unsigned int rows = cell->rows; while (rows-- > 0 && row != NULL) { /* Spanned rows -- consider their right border */ b.style = css_computed_border_right_style(row->style); b.color = css_computed_border_right_color( row->style, &b.c); css_computed_border_right_width( row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } row = row->next; } /** \todo can cells span row groups? */ /* Row group -- consider its right border */ b.style = css_computed_border_right_style(group->style); b.color = css_computed_border_right_color(group->style, &b.c); css_computed_border_right_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } /* The table itself -- consider its right border */ b.style = css_computed_border_right_style(table->style); b.color = css_computed_border_right_color(table->style, &b.c); css_computed_border_right_width(table->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, table->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } } /* a now contains the used right border for the cell */ cell->border[RIGHT].style = a.style; cell->border[RIGHT].c = a.c; cell->border[RIGHT].width = FIXTOINT(nscss_len2px(a.width, a.unit, cell->style)); } /** * Calculate used values of border-bottom-{style,color,width} * * \param cell Table cell to consider */ void table_used_bottom_border_for_cell(struct box *cell) { struct border a, b; box_type a_src, b_src; struct box *row = cell->parent; unsigned int rows = cell->rows; /* Initialise to computed bottom border for cell */ a.style = css_computed_border_bottom_style(cell->style); css_computed_border_bottom_color(cell->style, &a.c); css_computed_border_bottom_width(cell->style, &a.width, &a.unit); a.width = nscss_len2px(a.width, a.unit, cell->style); a.unit = CSS_UNIT_PX; a_src = BOX_TABLE_CELL; while (rows-- > 0 && row != NULL) row = row->next; /** \todo Can cells span row groups? */ if (row != NULL) { /* Cell is not at bottom edge of table -- no bottom border */ a.style = CSS_BORDER_STYLE_NONE; a.width = 0; a.unit = CSS_UNIT_PX; } else { /* Cell at bottom of table, so consider row and row group */ struct box *row = cell->parent; struct box *group = row->parent; struct box *table = group->parent; /* Bottom border of row */ b.style = css_computed_border_bottom_style(row->style); b.color = css_computed_border_bottom_color(row->style, &b.c); css_computed_border_bottom_width(row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } /* Row group -- consider its bottom border */ b.style = css_computed_border_bottom_style(group->style); b.color = css_computed_border_bottom_color(group->style, &b.c); css_computed_border_bottom_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; a_src = b_src; } /* The table itself -- consider its bottom border */ b.style = css_computed_border_bottom_style(table->style); b.color = css_computed_border_bottom_color(table->style, &b.c); css_computed_border_bottom_width(table->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, table->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE; if (table_border_is_more_eyecatching(&a, a_src, &b, b_src)) { a = b; } } /* a now contains the used bottom border for the cell */ cell->border[BOTTOM].style = a.style; cell->border[BOTTOM].c = a.c; cell->border[BOTTOM].width = FIXTOINT(nscss_len2px(a.width, a.unit, cell->style)); } /** * Determine if a border style is more eyecatching than another * * \param a Reference border style * \param a_src Source of \a a * \param b Candidate border style * \param b_src Source of \a b * \return True if \a b is more eyecatching than \a a */ bool table_border_is_more_eyecatching(const struct border *a, box_type a_src, const struct border *b, box_type b_src) { css_fixed awidth, bwidth; int impact = 0; /* See CSS 2.1 $17.6.2.1 */ /* 1 + 2 -- hidden beats everything, none beats nothing */ if (a->style == CSS_BORDER_STYLE_HIDDEN || b->style == CSS_BORDER_STYLE_NONE) return false; if (b->style == CSS_BORDER_STYLE_HIDDEN || a->style == CSS_BORDER_STYLE_NONE) return true; /* 3a -- wider borders beat narrow ones */ /* The widths must be absolute, which will be the case * if they've come from a computed style. */ assert(a->unit != CSS_UNIT_EM && a->unit != CSS_UNIT_EX); assert(b->unit != CSS_UNIT_EM && b->unit != CSS_UNIT_EX); awidth = nscss_len2px(a->width, a->unit, NULL); bwidth = nscss_len2px(b->width, b->unit, NULL); if (awidth < bwidth) return true; else if (bwidth < awidth) return false; /* 3b -- sort by style */ switch (a->style) { case CSS_BORDER_STYLE_DOUBLE: impact++; case CSS_BORDER_STYLE_SOLID: impact++; case CSS_BORDER_STYLE_DASHED: impact++; case CSS_BORDER_STYLE_DOTTED: impact++; case CSS_BORDER_STYLE_RIDGE: impact++; case CSS_BORDER_STYLE_OUTSET: impact++; case CSS_BORDER_STYLE_GROOVE: impact++; case CSS_BORDER_STYLE_INSET: impact++; default: break; } switch (b->style) { case CSS_BORDER_STYLE_DOUBLE: impact--; case CSS_BORDER_STYLE_SOLID: impact--; case CSS_BORDER_STYLE_DASHED: impact--; case CSS_BORDER_STYLE_DOTTED: impact--; case CSS_BORDER_STYLE_RIDGE: impact--; case CSS_BORDER_STYLE_OUTSET: impact--; case CSS_BORDER_STYLE_GROOVE: impact--; case CSS_BORDER_STYLE_INSET: impact--; default: break; } if (impact < 0) return true; else if (impact > 0) return false; /* 4a -- sort by origin */ impact = 0; switch (a_src) { case BOX_TABLE_CELL: impact++; case BOX_TABLE_ROW: impact++; case BOX_TABLE_ROW_GROUP: impact++; /** \todo COL/COL_GROUP */ case BOX_TABLE: impact++; default: break; } switch (b_src) { case BOX_TABLE_CELL: impact--; case BOX_TABLE_ROW: impact--; case BOX_TABLE_ROW_GROUP: impact--; /** \todo COL/COL_GROUP */ case BOX_TABLE: impact--; default: break; } if (impact < 0) return true; else if (impact > 0) return false; /* 4b -- furthest left (if direction: ltr) and towards top wins */ /** \todo Currently assumes b satisifies this */ return true; } /****************************************************************************** * Helpers for top border collapsing * ******************************************************************************/ /** * Process a table * * \param table Table to process * \param a Current border style for cell * \param a_src Source of \a a * * \post \a a will be updated with most eyecatching style * \post \a a_src will be updated also */ void table_cell_top_process_table(struct box *table, struct border *a, box_type *a_src) { struct border b; box_type b_src; /* Top border of table */ b.style = css_computed_border_top_style(table->style); b.color = css_computed_border_top_color(table->style, &b.c); css_computed_border_top_width(table->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, table->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } } /** * Process a group * * \param cell Cell being considered * \param group Group to process * \param a Current border style for cell * \param a_src Source of \a a * \return true if group has non-empty rows, false otherwise * * \post \a a will be updated with most eyecatching style * \post \a a_src will be updated also */ bool table_cell_top_process_group(struct box *cell, struct box *group, struct border *a, box_type *a_src) { struct border b; box_type b_src; /* Bottom border of group */ b.style = css_computed_border_bottom_style(group->style); b.color = css_computed_border_bottom_color(group->style, &b.c); css_computed_border_bottom_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } if (group->last != NULL) { /* Process rows in group, starting with last */ struct box *row = group->last; while (table_cell_top_process_row(cell, row, a, a_src) == false) { if (row->prev == NULL) { return false; } else { row = row->prev; } } } else { /* Group is empty, so consider its top border */ b.style = css_computed_border_top_style(group->style); b.color = css_computed_border_top_color(group->style, &b.c); css_computed_border_top_width(group->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, group->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW_GROUP; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } return false; } return true; } /** * Process a row * * \param cell Cell being considered * \param row Row to process * \param a Current border style for cell * \param a_src Source of \a a * \return true if row has cells, false otherwise * * \post \a a will be updated with most eyecatching style * \post \a a_src will be updated also */ bool table_cell_top_process_row(struct box *cell, struct box *row, struct border *a, box_type *a_src) { struct border b; box_type b_src; /* Bottom border of row */ b.style = css_computed_border_bottom_style(row->style); b.color = css_computed_border_bottom_color(row->style, &b.c); css_computed_border_bottom_width(row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } if (row->children == NULL) { /* Row is empty, so consider its top border */ b.style = css_computed_border_top_style(row->style); b.color = css_computed_border_top_color(row->style, &b.c); css_computed_border_top_width(row->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, row->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_ROW; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } return false; } else { /* Process cells that are directly above the cell being * considered. They may not be in this row, but in one of the * rows above it in the case where rowspan > 1. */ struct box *c; bool processed = false; while (processed == false) { for (c = row->children; c != NULL; c = c->next) { /* Ignore cells to the left */ if (c->start_column + c->columns - 1 < cell->start_column) continue; /* Ignore cells to the right */ if (c->start_column > cell->start_column + cell->columns - 1) continue; /* Flag that we've processed a cell */ processed = true; /* Consider bottom border */ b.style = css_computed_border_bottom_style( c->style); b.color = css_computed_border_bottom_color( c->style, &b.c); css_computed_border_bottom_width(c->style, &b.width, &b.unit); b.width = nscss_len2px(b.width, b.unit, c->style); b.unit = CSS_UNIT_PX; b_src = BOX_TABLE_CELL; if (table_border_is_more_eyecatching(a, *a_src, &b, b_src)) { *a = b; *a_src = b_src; } } if (processed == false) { /* There must be a preceding row */ assert(row->prev != NULL); row = row->prev; } } } return true; } netsurf-all-3.2/netsurf/render/search.c0000644000175000017500000003642012377677024017206 0ustar vincevince/* * Copyright 2004 John M Bell * Copyright 2005 Adrian Lees * Copyright 2009 Mark Benjamin * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Free text search (core) */ #include #include #include #include "utils/config.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" #include "content/content.h" #include "content/hlcache.h" #include "desktop/selection.h" #include "desktop/gui_factory.h" #include "render/box.h" #include "render/html.h" #include "render/html_internal.h" #include "render/search.h" #include "render/textplain.h" #ifndef NOF_ELEMENTS #define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array))) #endif struct list_entry { unsigned start_idx; /* start position of match */ unsigned end_idx; /* end of match */ struct box *start_box; /* used only for html contents */ struct box *end_box; struct selection *sel; struct list_entry *prev; struct list_entry *next; }; struct search_context { void *gui_p; struct content *c; struct list_entry *found; struct list_entry *current; /* first for select all */ char *string; bool prev_case_sens; bool newsearch; bool is_html; }; /* Exported function documented in search.h */ struct search_context * search_create_context(struct content *c, content_type type, void *gui_data) { struct search_context *context; struct list_entry *search_head; if (type != CONTENT_HTML && type != CONTENT_TEXTPLAIN) { return NULL; } context = malloc(sizeof(struct search_context)); if (context == NULL) { warn_user("NoMemory", 0); return NULL; } search_head = malloc(sizeof(struct list_entry)); if (search_head == NULL) { warn_user("NoMemory", 0); free(context); return NULL; } search_head->start_idx = 0; search_head->end_idx = 0; search_head->start_box = NULL; search_head->end_box = NULL; search_head->sel = NULL; search_head->prev = NULL; search_head->next = NULL; context->found = search_head; context->current = NULL; context->string = NULL; context->prev_case_sens = false; context->newsearch = true; context->c = c; context->is_html = (type == CONTENT_HTML) ? true : false; context->gui_p = gui_data; return context; } /** * Release the memory used by the list of matches, * deleting selection objects too */ static void free_matches(struct search_context *context) { struct list_entry *a; struct list_entry *b; a = context->found->next; /* empty the list before clearing and deleting the * selections because the the clearing updates the * screen immediately, causing nested accesses to the list */ context->found->prev = NULL; context->found->next = NULL; for (; a; a = b) { b = a->next; if (a->sel) { selection_clear(a->sel, true); selection_destroy(a->sel); } free(a); } } /** * Find the first occurrence of 'match' in 'string' and return its index * * \param string the string to be searched (unterminated) * \param s_len length of the string to be searched * \param pattern the pattern for which we are searching (unterminated) * \param p_len length of pattern * \param case_sens true iff case sensitive match required * \param m_len accepts length of match in bytes * \return pointer to first match, NULL if none */ static const char *find_pattern(const char *string, int s_len, const char *pattern, int p_len, bool case_sens, unsigned int *m_len) { struct { const char *ss, *s, *p; bool first; } context[16]; const char *ep = pattern + p_len; const char *es = string + s_len; const char *p = pattern - 1; /* a virtual '*' before the pattern */ const char *ss = string; const char *s = string; bool first = true; int top = 0; while (p < ep) { bool matches; if (p < pattern || *p == '*') { char ch; /* skip any further asterisks; one is the same as many */ do p++; while (p < ep && *p == '*'); /* if we're at the end of the pattern, yes, it matches */ if (p >= ep) break; /* anything matches a # so continue matching from here, and stack a context that will try to match the wildcard against the next character */ ch = *p; if (ch != '#') { /* scan forwards until we find a match for this char */ if (!case_sens) ch = toupper(ch); while (s < es) { if (case_sens) { if (*s == ch) break; } else if (toupper(*s) == ch) break; s++; } } if (s < es) { /* remember where we are in case the match fails; we may then resume */ if (top < (int)NOF_ELEMENTS(context)) { context[top].ss = ss; context[top].s = s + 1; context[top].p = p - 1; /* ptr to last asterisk */ context[top].first = first; top++; } if (first) { ss = s; /* remember first non-'*' char */ first = false; } matches = true; } else { matches = false; } } else if (s < es) { char ch = *p; if (ch == '#') matches = true; else { if (case_sens) matches = (*s == ch); else matches = (toupper(*s) == toupper(ch)); } if (matches && first) { ss = s; /* remember first non-'*' char */ first = false; } } else { matches = false; } if (matches) { p++; s++; } else { /* doesn't match, * resume with stacked context if we have one */ if (--top < 0) return NULL; /* no match, give up */ ss = context[top].ss; s = context[top].s; p = context[top].p; first = context[top].first; } } /* end of pattern reached */ *m_len = max(s - ss, 1); return ss; } /** * Add a new entry to the list of matches * * \param start_idx offset of match start within textual representation * \param end_idx offset of match end * \return pointer to added entry, NULL iff failed */ static struct list_entry *add_entry(unsigned start_idx, unsigned end_idx, struct search_context *context) { struct list_entry *entry; /* found string in box => add to list */ entry = calloc(1, sizeof(*entry)); if (!entry) { warn_user("NoMemory", 0); return NULL; } entry->start_idx = start_idx; entry->end_idx = end_idx; entry->sel = NULL; entry->next = 0; entry->prev = context->found->prev; if (context->found->prev == NULL) context->found->next = entry; else context->found->prev->next = entry; context->found->prev = entry; return entry; } /** * Finds all occurrences of a given string in the html box tree * * \param pattern the string pattern to search for * \param p_len pattern length * \param cur pointer to the current box * \param case_sens whether to perform a case sensitive search * \return true on success, false on memory allocation failure */ static bool find_occurrences_html(const char *pattern, int p_len, struct box *cur, bool case_sens, struct search_context *context) { struct box *a; /* ignore this box, if there's no visible text */ if (!cur->object && cur->text) { const char *text = cur->text; unsigned length = cur->length; while (length > 0) { struct list_entry *entry; unsigned match_length; unsigned match_offset; const char *new_text; const char *pos = find_pattern(text, length, pattern, p_len, case_sens, &match_length); if (!pos) break; /* found string in box => add to list */ match_offset = pos - cur->text; entry = add_entry(cur->byte_offset + match_offset, cur->byte_offset + match_offset + match_length, context); if (!entry) return false; entry->start_box = cur; entry->end_box = cur; new_text = pos + match_length; length -= (new_text - text); text = new_text; } } /* and recurse */ for (a = cur->children; a; a = a->next) { if (!find_occurrences_html(pattern, p_len, a, case_sens, context)) return false; } return true; } /** * Finds all occurrences of a given string in a textplain content * * \param pattern the string pattern to search for * \param p_len pattern length * \param c the content to be searched * \param case_sens wheteher to perform a case sensitive search * \return true on success, false on memory allocation failure */ static bool find_occurrences_text(const char *pattern, int p_len, struct content *c, bool case_sens, struct search_context *context) { int nlines = textplain_line_count(c); int line; for(line = 0; line < nlines; line++) { size_t offset, length; const char *text = textplain_get_line(c, line, &offset, &length); if (text) { while (length > 0) { struct list_entry *entry; unsigned match_length; size_t start_idx; const char *new_text; const char *pos = find_pattern(text, length, pattern, p_len, case_sens, &match_length); if (!pos) break; /* found string in line => add to list */ start_idx = offset + (pos - text); entry = add_entry(start_idx, start_idx + match_length, context); if (!entry) return false; new_text = pos + match_length; offset += (new_text - text); length -= (new_text - text); text = new_text; } } } return true; } /** * Search for a string in the box tree * * \param string the string to search for * \param string_len length of search string */ static void search_text(const char *string, int string_len, struct search_context *context, search_flags_t flags) { struct rect bounds; struct box *box = NULL; union content_msg_data msg_data; bool case_sensitive, forwards, showall; case_sensitive = ((flags & SEARCH_FLAG_CASE_SENSITIVE) != 0) ? true : false; forwards = ((flags & SEARCH_FLAG_FORWARDS) != 0) ? true : false; showall = ((flags & SEARCH_FLAG_SHOWALL) != 0) ? true : false; if (context->c == NULL) return; if (context->is_html == true) { html_content *html = (html_content *)context->c; box = html->layout; if (!box) return; } /* check if we need to start a new search or continue an old one */ if (context->newsearch) { bool res; if (context->string != NULL) free(context->string); context->current = NULL; free_matches(context); context->string = malloc(string_len + 1); if (context->string != NULL) { memcpy(context->string, string, string_len); context->string[string_len] = '\0'; } guit->search->hourglass(true, context->gui_p); if (context->is_html == true) { res = find_occurrences_html(string, string_len, box, case_sensitive, context); } else { res = find_occurrences_text(string, string_len, context->c, case_sensitive, context); } if (!res) { free_matches(context); guit->search->hourglass(false, context->gui_p); return; } guit->search->hourglass(false, context->gui_p); context->prev_case_sens = case_sensitive; /* new search, beginning at the top of the page */ context->current = context->found->next; context->newsearch = false; } else if (context->current != NULL) { /* continued search in the direction specified */ if (forwards) { if (context->current->next) context->current = context->current->next; } else { if (context->current->prev) context->current = context->current->prev; } } guit->search->status((context->current != NULL), context->gui_p); search_show_all(showall, context); guit->search->back_state((context->current != NULL) && (context->current->prev != NULL), context->gui_p); guit->search->forward_state((context->current != NULL) && (context->current->next != NULL), context->gui_p); if (context->current == NULL) return; if (context->is_html == true) { /* get box position and jump to it */ box_coords(context->current->start_box, &bounds.x0, &bounds.y0); /* \todo: move x0 in by correct idx */ box_coords(context->current->end_box, &bounds.x1, &bounds.y1); /* \todo: move x1 in by correct idx */ bounds.x1 += context->current->end_box->width; bounds.y1 += context->current->end_box->height; } else { textplain_coords_from_range(context->c, context->current->start_idx, context->current->end_idx, &bounds); } msg_data.scroll.area = true; msg_data.scroll.x0 = bounds.x0; msg_data.scroll.y0 = bounds.y0; msg_data.scroll.x1 = bounds.x1; msg_data.scroll.y1 = bounds.y1; content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data); } /* Exported function documented in search.h */ void search_step(struct search_context *context, search_flags_t flags, const char *string) { int string_len; int i = 0; if (context == NULL) { warn_user("SearchError", 0); return; } guit->search->add_recent(string, context->gui_p); string_len = strlen(string); for (i = 0; i < string_len; i++) if (string[i] != '#' && string[i] != '*') break; if (i >= string_len) { union content_msg_data msg_data; free_matches(context); guit->search->status(true, context->gui_p); guit->search->back_state(false, context->gui_p); guit->search->forward_state(false, context->gui_p); msg_data.scroll.area = false; msg_data.scroll.x0 = 0; msg_data.scroll.y0 = 0; content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data); return; } search_text(string, string_len, context, flags); } /* Exported function documented in search.h */ bool search_term_highlighted(struct content *c, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx, struct search_context *context) { if (c == context->c) { struct list_entry *a; for (a = context->found->next; a; a = a->next) if (a->sel && selection_defined(a->sel) && selection_highlighted(a->sel, start_offset, end_offset, start_idx, end_idx)) return true; } return false; } /* Exported function documented in search.h */ void search_show_all(bool all, struct search_context *context) { struct list_entry *a; for (a = context->found->next; a; a = a->next) { bool add = true; if (!all && a != context->current) { add = false; if (a->sel) { selection_clear(a->sel, true); selection_destroy(a->sel); a->sel = NULL; } } if (add && !a->sel) { if (context->is_html == true) { html_content *html = (html_content *)context->c; a->sel = selection_create(context->c, true); if (!a->sel) continue; selection_init(a->sel, html->layout); } else { a->sel = selection_create(context->c, false); if (!a->sel) continue; selection_init(a->sel, NULL); } selection_set_start(a->sel, a->start_idx); selection_set_end(a->sel, a->end_idx); } } } /* Exported function documented in search.h */ void search_destroy_context(struct search_context *context) { assert(context != NULL); if (context->string != NULL) { guit->search->add_recent(context->string, context->gui_p); free(context->string); } guit->search->forward_state(true, context->gui_p); guit->search->back_state(true, context->gui_p); free_matches(context); free(context); } netsurf-all-3.2/netsurf/render/form.h0000644000175000017500000001422012377677024016703 0ustar vincevince/* * Copyright 2003 Phil Mellor * Copyright 2003 James Bursa * Copyright 2009 Paul Blokus * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Form handling functions (interface). */ #ifndef _NETSURF_RENDER_FORM_H_ #define _NETSURF_RENDER_FORM_H_ #include #include "desktop/browser.h" #include "utils/config.h" struct box; struct form_control; struct form_option; struct form_select_menu; struct html_content; struct dom_string; struct content; struct nsurl; /** Form submit method. */ typedef enum { method_GET, /**< GET, always url encoded. */ method_POST_URLENC, /**< POST, url encoded. */ method_POST_MULTIPART /**< POST, multipart/form-data. */ } form_method; /** HTML form. */ struct form { void *node; /**< Corresponding DOM node */ char *action; /**< Absolute URL to submit to. */ char *target; /**< Target to submit to. */ form_method method; /**< Method and enctype. */ char *accept_charsets; /**< Charset to submit form in */ char *document_charset; /**< Charset of document containing form */ struct form_control *controls; /**< Linked list of controls. */ struct form_control *last_control; /**< Last control in list. */ struct form *prev; /**< Previous form in doc. */ }; /** Type of a struct form_control. */ typedef enum { GADGET_HIDDEN, GADGET_TEXTBOX, GADGET_RADIO, GADGET_CHECKBOX, GADGET_SELECT, GADGET_TEXTAREA, GADGET_IMAGE, GADGET_PASSWORD, GADGET_SUBMIT, GADGET_RESET, GADGET_FILE, GADGET_BUTTON } form_control_type; /** Data for textarea */ struct form_textarea_data { struct form_control *gadget; }; /** Form control. */ struct form_control { void *node; /**< Corresponding DOM node */ struct html_content *html; /**< HTML content containing control */ form_control_type type; /**< Type of control */ struct form *form; /**< Containing form */ char *name; /**< Control name */ char *value; /**< Current value of control */ char *initial_value; /**< Initial value of control */ bool disabled; /**< Whether control is disabled */ struct box *box; /**< Box for control */ unsigned int length; /**< Number of characters in control */ unsigned int maxlength; /**< Maximum characters permitted */ bool selected; /**< Whether control is selected */ union { struct { int mx, my; } image; struct { int num_items; struct form_option *items, *last_item; bool multiple; int num_selected; /** Currently selected item, if num_selected == 1. */ struct form_option *current; struct form_select_menu *menu; } select; struct { struct textarea *ta; struct dom_string *initial; struct form_textarea_data data; } text; /**< input type=text or textarea */ } data; struct form_control *prev; /**< Previous control in this form */ struct form_control *next; /**< Next control in this form. */ }; /** Option in a select. */ struct form_option { void *node; /**< Corresponding DOM node */ bool selected; bool initial_selected; char *value; char *text; /**< NUL terminated. */ struct form_option* next; }; struct image_input_coords { int x; int y; }; /** * Called by the select menu when it wants an area to be redrawn. The * coordinates are menu origin relative. * * \param client_data data which was passed to form_open_select_menu * \param x X coordinate of redraw rectangle * \param y Y coordinate of redraw rectangle * \param width width of redraw rectangle * \param height height of redraw rectangle */ typedef void(*select_menu_redraw_callback)(void *client_data, int x, int y, int width, int height); struct form *form_new(void *node, const char *action, const char *target, form_method method, const char *charset, const char *doc_charset); void form_free(struct form *form); struct form_control *form_new_control(void *node, form_control_type type); void form_add_control(struct form *form, struct form_control *control); void form_free_control(struct form_control *control); bool form_add_option(struct form_control *control, char *value, char *text, bool selected, void *node); bool form_successful_controls(struct form *form, struct form_control *submit_button, struct fetch_multipart_data **successful_controls); bool form_successful_controls_dom(struct form *form, struct form_control *submit_button, struct fetch_multipart_data **successful_controls); bool form_open_select_menu(void *client_data, struct form_control *control, select_menu_redraw_callback redraw_callback, struct content *c); void form_select_menu_callback(void *client_data, int x, int y, int width, int height); void form_free_select_menu(struct form_control *control); bool form_redraw_select_menu(struct form_control *control, int x, int y, float scale, const struct rect *clip, const struct redraw_context *ctx); bool form_clip_inside_select_menu(struct form_control *control, float scale, const struct rect *clip); const char *form_select_mouse_action(struct form_control *control, browser_mouse_state mouse, int x, int y); void form_select_mouse_drag_end(struct form_control *control, browser_mouse_state mouse, int x, int y); void form_select_get_dimensions(struct form_control *control, int *width, int *height); void form_select_process_selection(struct form_control *control, int item); void form_submit(struct nsurl *page_url, struct browser_window *target, struct form *form, struct form_control *submit_button); void form_radio_set(struct form_control *radio); void form_gadget_update_value(struct form_control *control, char *value); #endif netsurf-all-3.2/netsurf/render/font.h0000644000175000017500000000673712377677024016724 0ustar vincevince/* * Copyright 2003 Phil Mellor * Copyright 2005 James Bursa * Copyright 2004 John Tytgat * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Font handling (interface). * * These functions provide font related services. They all work on UTF-8 strings * with lengths given. * * Note that an interface to painting is not defined here. Painting is * redirected through platform-dependent plotters anyway, so there is no gain in * abstracting it here. */ #ifndef _NETSURF_RENDER_FONT_H_ #define _NETSURF_RENDER_FONT_H_ #include #include #include "css/css.h" #include "desktop/plot_style.h" struct font_functions { /** * Measure the width of a string. * * \param fstyle plot style for this text * \param string UTF-8 string to measure * \param length length of string, in bytes * \param width updated to width of string[0..length) * \return true on success, false on error and error reported */ bool (*font_width)(const plot_font_style_t *fstyle, const char *string, size_t length, int *width); /** * Find the position in a string where an x coordinate falls. * * \param fstyle style for this text * \param string UTF-8 string to measure * \param length length of string, in bytes * \param x x coordinate to search for * \param char_offset updated to offset in string of actual_x, [0..length] * \param actual_x updated to x coordinate of character closest to x * \return true on success, false on error and error reported */ bool (*font_position_in_string)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); /** * Find where to split a string to make it fit a width. * * \param fstyle style for this text * \param string UTF-8 string to measure * \param length length of string, in bytes * \param x width available * \param char_offset updated to offset in string of actual_x, [1..length] * \param actual_x updated to x coordinate of character closest to x * \return true on success, false on error and error reported * * On exit, char_offset indicates first character after split point. * * Note: char_offset of 0 should never be returned. * * Returns: * char_offset giving split point closest to x, where actual_x <= x * else * char_offset giving split point closest to x, where actual_x > x * * Returning char_offset == length means no split possible */ bool (*font_split)(const plot_font_style_t *fstyle, const char *string, size_t length, int x, size_t *char_offset, int *actual_x); }; extern const struct font_functions nsfont; void font_plot_style_from_css(const css_computed_style *css, plot_font_style_t *fstyle); #endif netsurf-all-3.2/netsurf/render/html_redraw.c0000644000175000017500000022065212377677024020253 0ustar vincevince/* * Copyright 2004-2008 James Bursa * Copyright 2004-2007 John M Bell * Copyright 2004-2007 Richard Wilson * Copyright 2005-2006 Adrian Lees * Copyright 2006 Rob Kendrick * Copyright 2008 Michael Drake * Copyright 2009 Paul Blokus * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Redraw of a CONTENT_HTML (implementation). */ #include #include #include #include #include #include #include "utils/config.h" #include "content/content_protected.h" #include "css/css.h" #include "css/utils.h" #include "desktop/plotters.h" #include "desktop/selection.h" #include "utils/nsoption.h" #include "desktop/print.h" #include "desktop/scrollbar.h" #include "desktop/textarea.h" #include "image/bitmap.h" #include "render/box.h" #include "render/font.h" #include "render/form.h" #include "render/html_internal.h" #include "render/layout.h" #include "render/search.h" #include "utils/log.h" #include "utils/messages.h" #include "utils/utils.h" bool html_redraw_debug = false; /** * Determine if a box has a background that needs drawing * * \param box Box to consider * \return True if box has a background, false otherwise. */ static bool html_redraw_box_has_background(struct box *box) { if (box->background != NULL) return true; if (box->style != NULL) { css_color colour; css_computed_background_color(box->style, &colour); if (nscss_color_is_transparent(colour) == false) return true; } return false; } /** * Find the background box for a box * * \param box Box to find background box for * \return Pointer to background box, or NULL if there is none */ static struct box *html_redraw_find_bg_box(struct box *box) { /* Thanks to backwards compatibility, CSS defines the following: * * + If the box is for the root element and it has a background, * use that (and then process the body box with no special case) * + If the box is for the root element and it has no background, * then use the background (if any) from the body element as if * it were specified on the root. Then, when the box for the body * element is processed, ignore the background. * + For any other box, just use its own styling. */ if (box->parent == NULL) { /* Root box */ if (html_redraw_box_has_background(box)) return box; /* No background on root box: consider body box, if any */ if (box->children != NULL) { if (html_redraw_box_has_background(box->children)) return box->children; } } else if (box->parent != NULL && box->parent->parent == NULL) { /* Body box: only render background if root has its own */ if (html_redraw_box_has_background(box) && html_redraw_box_has_background(box->parent)) return box; } else { /* Any other box */ if (html_redraw_box_has_background(box)) return box; } return NULL; } /** * Redraw a short text string, complete with highlighting * (for selection/search) * * \param utf8_text pointer to UTF-8 text string * \param utf8_len length of string, in bytes * \param offset byte offset within textual representation * \param space width of space that follows string (0 = no space) * \param fstyle text style to use (pass text size unscaled) * \param x x ordinate at which to plot text * \param y y ordinate at which to plot text * \param clip pointer to current clip rectangle * \param height height of text string * \param scale current display scale (1.0 = 100%) * \param excluded exclude this text string from the selection * \param ctx current redraw context * \return true iff successful and redraw should proceed */ bool text_redraw(const char *utf8_text, size_t utf8_len, size_t offset, int space, const plot_font_style_t *fstyle, int x, int y, const struct rect *clip, int height, float scale, bool excluded, struct content *c, const struct selection *sel, struct search_context *search, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; bool highlighted = false; plot_font_style_t plot_fstyle = *fstyle; /* Need scaled text size to pass to plotters */ plot_fstyle.size *= scale; /* is this box part of a selection? */ if (!excluded && ctx->interactive == true) { unsigned len = utf8_len + (space ? 1 : 0); unsigned start_idx; unsigned end_idx; /* first try the browser window's current selection */ if (selection_defined(sel) && selection_highlighted(sel, offset, offset + len, &start_idx, &end_idx)) { highlighted = true; } /* what about the current search operation, if any? */ if (!highlighted && (search != NULL) && search_term_highlighted(c, offset, offset + len, &start_idx, &end_idx, search)) { highlighted = true; } /* \todo make search terms visible within selected text */ if (highlighted) { struct rect r; unsigned endtxt_idx = end_idx; bool clip_changed = false; bool text_visible = true; int startx, endx; plot_style_t pstyle_fill_hback = *plot_style_fill_white; plot_font_style_t fstyle_hback = plot_fstyle; if (end_idx > utf8_len) { /* adjust for trailing space, not present in * utf8_text */ assert(end_idx == utf8_len + 1); endtxt_idx = utf8_len; } if (!nsfont.font_width(fstyle, utf8_text, start_idx, &startx)) startx = 0; if (!nsfont.font_width(fstyle, utf8_text, endtxt_idx, &endx)) endx = 0; /* is there a trailing space that should be highlighted * as well? */ if (end_idx > utf8_len) { endx += space; } if (scale != 1.0) { startx *= scale; endx *= scale; } /* draw any text preceding highlighted portion */ if (start_idx > 0 && !plot->text(x, y + (int)(height * 0.75 * scale), utf8_text, start_idx, &plot_fstyle)) return false; pstyle_fill_hback.fill_colour = fstyle->foreground; /* highlighted portion */ if (!plot->rectangle(x + startx, y, x + endx, y + height * scale, &pstyle_fill_hback)) return false; if (start_idx > 0) { int px0 = max(x + startx, clip->x0); int px1 = min(x + endx, clip->x1); if (px0 < px1) { r.x0 = px0; r.y0 = clip->y0; r.x1 = px1; r.y1 = clip->y1; if (!plot->clip(&r)) return false; clip_changed = true; } else { text_visible = false; } } fstyle_hback.background = pstyle_fill_hback.fill_colour; fstyle_hback.foreground = colour_to_bw_furthest( pstyle_fill_hback.fill_colour); if (text_visible && !plot->text(x, y + (int)(height * 0.75 * scale), utf8_text, endtxt_idx, &fstyle_hback)) return false; /* draw any text succeeding highlighted portion */ if (endtxt_idx < utf8_len) { int px0 = max(x + endx, clip->x0); if (px0 < clip->x1) { r.x0 = px0; r.y0 = clip->y0; r.x1 = clip->x1; r.y1 = clip->y1; if (!plot->clip(&r)) return false; clip_changed = true; if (!plot->text(x, y + (int) (height * 0.75 * scale), utf8_text, utf8_len, &plot_fstyle)) return false; } } if (clip_changed && !plot->clip(clip)) return false; } } if (!highlighted) { if (!plot->text(x, y + (int) (height * 0.75 * scale), utf8_text, utf8_len, &plot_fstyle)) return false; } return true; } static plot_style_t plot_style_bdr = { .stroke_type = PLOT_OP_TYPE_DASH, }; static plot_style_t plot_style_fillbdr = { .fill_type = PLOT_OP_TYPE_SOLID, }; static plot_style_t plot_style_fillbdr_dark = { .fill_type = PLOT_OP_TYPE_SOLID, }; static plot_style_t plot_style_fillbdr_light = { .fill_type = PLOT_OP_TYPE_SOLID, }; static plot_style_t plot_style_fillbdr_ddark = { .fill_type = PLOT_OP_TYPE_SOLID, }; static plot_style_t plot_style_fillbdr_dlight = { .fill_type = PLOT_OP_TYPE_SOLID, }; /** * Draw one border. * * \param side index of border side (TOP, RIGHT, BOTTOM, LEFT) * \param p array of precomputed border vertices * \param c colour for border * \param style border line style * \param thickness border thickness * \param rectangular whether border is rectangular * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_border_plot(const int side, const int *p, colour c, enum css_border_style_e style, int thickness, bool rectangular, const struct rect *clip, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; int z[8]; /* Vertices of border part */ unsigned int light = side; plot_style_t *plot_style_bdr_in; plot_style_t *plot_style_bdr_out; if (c == NS_TRANSPARENT) return true; plot_style_bdr.stroke_type = PLOT_OP_TYPE_DASH; plot_style_bdr.stroke_colour = c; plot_style_bdr.stroke_width = thickness; plot_style_fillbdr.fill_colour = c; plot_style_fillbdr_dark.fill_colour = darken_colour(c); plot_style_fillbdr_light.fill_colour = lighten_colour(c); plot_style_fillbdr_ddark.fill_colour = double_darken_colour(c); plot_style_fillbdr_dlight.fill_colour = double_lighten_colour(c); switch (style) { case CSS_BORDER_STYLE_DOTTED: plot_style_bdr.stroke_type = PLOT_OP_TYPE_DOT; /* fall through */ case CSS_BORDER_STYLE_DASHED: if (!plot->line((p[0] + p[2]) / 2, (p[1] + p[3]) / 2, (p[4] + p[6]) / 2, (p[5] + p[7]) / 2, &plot_style_bdr)) return false; break; case CSS_BORDER_STYLE_SOLID: /* fall through to default */ default: if (rectangular || thickness == 1) { int x0, y0, x1, y1; if (side == TOP || side == RIGHT) { x0 = p[2]; y0 = p[3]; x1 = p[6]; y1 = p[7]; x1 = ((side == TOP) && (p[4] - p[6] != 0)) ? x1 + p[4] - p[6] : x1; } else { x0 = p[6]; y0 = p[7]; x1 = p[2]; y1 = p[3]; y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ? y1 + p[1] - p[3] : y1; } /* find intersection of clip rectangle and border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, &plot_style_fillbdr)) return false; } } else { if (!plot->polygon(p, 4, &plot_style_fillbdr)) return false; } break; case CSS_BORDER_STYLE_DOUBLE: z[0] = p[0]; z[1] = p[1]; z[2] = (p[0] * 2 + p[2]) / 3; z[3] = (p[1] * 2 + p[3]) / 3; z[4] = (p[6] * 2 + p[4]) / 3; z[5] = (p[7] * 2 + p[5]) / 3; z[6] = p[6]; z[7] = p[7]; if (!plot->polygon(z, 4, &plot_style_fillbdr)) return false; z[0] = p[2]; z[1] = p[3]; z[2] = (p[2] * 2 + p[0]) / 3; z[3] = (p[3] * 2 + p[1]) / 3; z[4] = (p[4] * 2 + p[6]) / 3; z[5] = (p[5] * 2 + p[7]) / 3; z[6] = p[4]; z[7] = p[5]; if (!plot->polygon(z, 4, &plot_style_fillbdr)) return false; break; case CSS_BORDER_STYLE_GROOVE: light = 3 - light; /* fall through */ case CSS_BORDER_STYLE_RIDGE: /* choose correct colours for each part of the border line */ if (light <= 1) { plot_style_bdr_in = &plot_style_fillbdr_dark; plot_style_bdr_out = &plot_style_fillbdr_light; } else { plot_style_bdr_in = &plot_style_fillbdr_light; plot_style_bdr_out = &plot_style_fillbdr_dark; } /* Render border */ if ((rectangular || thickness == 2) && thickness != 1) { /* Border made up from two parts and can be plotted * with rectangles */ int x0, y0, x1, y1; /* First part */ if (side == TOP || side == RIGHT) { x0 = (p[0] + p[2]) / 2; y0 = (p[1] + p[3]) / 2; x1 = p[6]; y1 = p[7]; } else { x0 = p[6]; y0 = p[7]; x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2; } /* find intersection of clip rectangle and border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_in)) return false; } /* Second part */ if (side == TOP || side == RIGHT) { x0 = p[2]; y0 = p[3]; x1 = (p[6] + p[4]) / 2; y1 = (p[7] + p[5]) / 2; } else { x0 = (p[6] + p[4]) / 2; y0 = (p[7] + p[5]) / 2; x1 = p[2]; y1 = p[3]; } /* find intersection of clip rectangle and border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_out)) return false; } } else if (thickness == 1) { /* Border made up from one part which can be plotted * as a rectangle */ int x0, y0, x1, y1; if (side == TOP || side == RIGHT) { x0 = p[2]; y0 = p[3]; x1 = p[6]; y1 = p[7]; x1 = ((side == TOP) && (p[4] - p[6] != 0)) ? x1 + p[4] - p[6] : x1; /* find intersection of clip rectangle and * border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_in)) return false; } } else { x0 = p[6]; y0 = p[7]; x1 = p[2]; y1 = p[3]; y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ? y1 + p[1] - p[3] : y1; /* find intersection of clip rectangle and * border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_out)) return false; } } } else { /* Border made up from two parts and can't be plotted * with rectangles */ z[0] = p[0]; z[1] = p[1]; z[2] = (p[0] + p[2]) / 2; z[3] = (p[1] + p[3]) / 2; z[4] = (p[6] + p[4]) / 2; z[5] = (p[7] + p[5]) / 2; z[6] = p[6]; z[7] = p[7]; if (!plot->polygon(z, 4, plot_style_bdr_in)) return false; z[0] = p[2]; z[1] = p[3]; z[6] = p[4]; z[7] = p[5]; if (!plot->polygon(z, 4, plot_style_bdr_out)) return false; } break; case CSS_BORDER_STYLE_INSET: light = (light + 2) % 4; /* fall through */ case CSS_BORDER_STYLE_OUTSET: /* choose correct colours for each part of the border line */ switch (light) { case 0: plot_style_bdr_in = &plot_style_fillbdr_light; plot_style_bdr_out = &plot_style_fillbdr_dlight; break; case 1: plot_style_bdr_in = &plot_style_fillbdr_ddark; plot_style_bdr_out = &plot_style_fillbdr_dark; break; case 2: plot_style_bdr_in = &plot_style_fillbdr_dark; plot_style_bdr_out = &plot_style_fillbdr_ddark; break; case 3: plot_style_bdr_in = &plot_style_fillbdr_dlight; plot_style_bdr_out = &plot_style_fillbdr_light; break; default: plot_style_bdr_in = &plot_style_fillbdr; plot_style_bdr_out = &plot_style_fillbdr; break; } /* Render border */ if ((rectangular || thickness == 2) && thickness != 1) { /* Border made up from two parts and can be plotted * with rectangles */ int x0, y0, x1, y1; /* First part */ if (side == TOP || side == RIGHT) { x0 = (p[0] + p[2]) / 2; y0 = (p[1] + p[3]) / 2; x1 = p[6]; y1 = p[7]; } else { x0 = p[6]; y0 = p[7]; x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2; } /* find intersection of clip rectangle and border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_in)) return false; } /* Second part */ if (side == TOP || side == RIGHT) { x0 = p[2]; y0 = p[3]; x1 = (p[6] + p[4]) / 2; y1 = (p[7] + p[5]) / 2; } else { x0 = (p[6] + p[4]) / 2; y0 = (p[7] + p[5]) / 2; x1 = p[2]; y1 = p[3]; } /* find intersection of clip rectangle and border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_out)) return false; } } else if (thickness == 1) { /* Border made up from one part which can be plotted * as a rectangle */ int x0, y0, x1, y1; if (side == TOP || side == RIGHT) { x0 = p[2]; y0 = p[3]; x1 = p[6]; y1 = p[7]; x1 = ((side == TOP) && (p[4] - p[6] != 0)) ? x1 + p[4] - p[6] : x1; /* find intersection of clip rectangle and * border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_in)) return false; } } else { x0 = p[6]; y0 = p[7]; x1 = p[2]; y1 = p[3]; y1 = ((side == LEFT) && (p[1] - p[3] != 0)) ? y1 + p[1] - p[3] : y1; /* find intersection of clip rectangle and * border */ x0 = (clip->x0 > x0) ? clip->x0 : x0; y0 = (clip->y0 > y0) ? clip->y0 : y0; x1 = (clip->x1 < x1) ? clip->x1 : x1; y1 = (clip->y1 < y1) ? clip->y1 : y1; if ((x0 < x1) && (y0 < y1)) { /* valid clip rectangles only */ if (!plot->rectangle(x0, y0, x1, y1, plot_style_bdr_out)) return false; } } } else { /* Border made up from two parts and can't be plotted * with rectangles */ z[0] = p[0]; z[1] = p[1]; z[2] = (p[0] + p[2]) / 2; z[3] = (p[1] + p[3]) / 2; z[4] = (p[6] + p[4]) / 2; z[5] = (p[7] + p[5]) / 2; z[6] = p[6]; z[7] = p[7]; if (!plot->polygon(z, 4, plot_style_bdr_in)) return false; z[0] = p[2]; z[1] = p[3]; z[6] = p[4]; z[7] = p[5]; if (!plot->polygon(z, 4, plot_style_bdr_out)) return false; } break; } return true; } /** * Draw borders for a box. * * \param box box to draw * \param x_parent coordinate of left padding edge of parent of box * \param y_parent coordinate of top padding edge of parent of box * \param p_width width of padding box * \param p_height height of padding box * \param scale scale for redraw * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_borders(struct box *box, int x_parent, int y_parent, int p_width, int p_height, const struct rect *clip, float scale, const struct redraw_context *ctx) { unsigned int sides[] = { LEFT, RIGHT, TOP, BOTTOM }; int top = box->border[TOP].width; int right = box->border[RIGHT].width; int bottom = box->border[BOTTOM].width; int left = box->border[LEFT].width; int x, y; unsigned int i, side; int p[8]; /* Box border vertices */ int z[8]; /* Border vertices */ bool square_end_1 = false; bool square_end_2 = false; x = x_parent + box->x; y = y_parent + box->y; if (scale != 1.0) { top *= scale; right *= scale; bottom *= scale; left *= scale; x *= scale; y *= scale; } assert(box->style); /* Calculate border vertices * * A----------------------+ * | \ / | * | B--------------+ | * | | | | * | +--------------C | * | / \ | * +----------------------D */ p[0] = x - left; p[1] = y - top; /* A */ p[2] = x; p[3] = y; /* B */ p[4] = x + p_width; p[5] = y + p_height; /* C */ p[6] = x + p_width + right; p[7] = y + p_height + bottom; /* D */ for (i = 0; i != 4; i++) { colour col = 0; side = sides[i]; /* plot order */ if (box->border[side].width == 0 || nscss_color_is_transparent(box->border[side].c)) continue; switch (side) { case LEFT: square_end_1 = (top == 0); square_end_2 = (bottom == 0); z[0] = p[0]; z[1] = p[7]; z[2] = p[2]; z[3] = p[5]; z[4] = p[2]; z[5] = p[3]; z[6] = p[0]; z[7] = p[1]; if (nscss_color_is_transparent(box->border[TOP].c) == false && box->border[TOP].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang top corner fully, * if top border is opaque */ z[5] -= top; square_end_1 = true; } if (nscss_color_is_transparent(box->border[BOTTOM].c) == false && box->border[BOTTOM].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang bottom corner fully, * if bottom border is opaque */ z[3] += bottom; square_end_2 = true; } col = nscss_color_to_ns(box->border[side].c); if (!html_redraw_border_plot(side, z, col, box->border[side].style, box->border[side].width * scale, square_end_1 && square_end_2, clip, ctx)) return false; break; case RIGHT: square_end_1 = (top == 0); square_end_2 = (bottom == 0); z[0] = p[6]; z[1] = p[1]; z[2] = p[4]; z[3] = p[3]; z[4] = p[4]; z[5] = p[5]; z[6] = p[6]; z[7] = p[7]; if (nscss_color_is_transparent(box->border[TOP].c) == false && box->border[TOP].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang top corner fully, * if top border is opaque */ z[3] -= top; square_end_1 = true; } if (nscss_color_is_transparent(box->border[BOTTOM].c) == false && box->border[BOTTOM].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang bottom corner fully, * if bottom border is opaque */ z[5] += bottom; square_end_2 = true; } col = nscss_color_to_ns(box->border[side].c); if (!html_redraw_border_plot(side, z, col, box->border[side].style, box->border[side].width * scale, square_end_1 && square_end_2, clip, ctx)) return false; break; case TOP: if (clip->y0 > p[3]) /* clip rectangle is below border; nothing to * plot */ continue; square_end_1 = (left == 0); square_end_2 = (right == 0); z[0] = p[2]; z[1] = p[3]; z[2] = p[0]; z[3] = p[1]; z[4] = p[6]; z[5] = p[1]; z[6] = p[4]; z[7] = p[3]; if (box->border[TOP].style == CSS_BORDER_STYLE_SOLID && box->border[TOP].c == box->border[LEFT].c) { /* don't bother overlapping left corner if * it's the same colour anyway */ z[2] += left; square_end_1 = true; } if (box->border[TOP].style == CSS_BORDER_STYLE_SOLID && box->border[TOP].c == box->border[RIGHT].c) { /* don't bother overlapping right corner if * it's the same colour anyway */ z[4] -= right; square_end_2 = true; } col = nscss_color_to_ns(box->border[side].c); if (!html_redraw_border_plot(side, z, col, box->border[side].style, box->border[side].width * scale, square_end_1 && square_end_2, clip, ctx)) return false; break; case BOTTOM: if (clip->y1 < p[5]) /* clip rectangle is above border; nothing to * plot */ continue; square_end_1 = (left == 0); square_end_2 = (right == 0); z[0] = p[4]; z[1] = p[5]; z[2] = p[6]; z[3] = p[7]; z[4] = p[0]; z[5] = p[7]; z[6] = p[2]; z[7] = p[5]; if (box->border[BOTTOM].style == CSS_BORDER_STYLE_SOLID && box->border[BOTTOM].c == box->border[LEFT].c) { /* don't bother overlapping left corner if * it's the same colour anyway */ z[4] += left; square_end_1 = true; } if (box->border[BOTTOM].style == CSS_BORDER_STYLE_SOLID && box->border[BOTTOM].c == box->border[RIGHT].c) { /* don't bother overlapping right corner if * it's the same colour anyway */ z[2] -= right; square_end_2 = true; } col = nscss_color_to_ns(box->border[side].c); if (!html_redraw_border_plot(side, z, col, box->border[side].style, box->border[side].width * scale, square_end_1 && square_end_2, clip, ctx)) return false; break; default: assert(side == TOP || side == BOTTOM || side == LEFT || side == RIGHT); break; } } return true; } /** * Draw an inline's borders. * * \param box BOX_INLINE which created the border * \param b coordinates of border edge rectangle * \param scale scale for redraw * \param first true if this is the first rectangle associated with the inline * \param last true if this is the last rectangle associated with the inline * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_inline_borders(struct box *box, struct rect b, const struct rect *clip, float scale, bool first, bool last, const struct redraw_context *ctx) { int top = box->border[TOP].width; int right = box->border[RIGHT].width; int bottom = box->border[BOTTOM].width; int left = box->border[LEFT].width; colour col; int p[8]; /* Box border vertices */ int z[8]; /* Border vertices */ bool square_end_1; bool square_end_2; if (scale != 1.0) { top *= scale; right *= scale; bottom *= scale; left *= scale; } /* Calculate border vertices * * A----------------------+ * | \ / | * | B--------------+ | * | | | | * | +--------------C | * | / \ | * +----------------------D */ p[0] = b.x0; p[1] = b.y0; /* A */ p[2] = first ? b.x0 + left : b.x0; p[3] = b.y0 + top; /* B */ p[4] = last ? b.x1 - right : b.x1; p[5] = b.y1 - bottom; /* C */ p[6] = b.x1; p[7] = b.y1; /* D */ assert(box->style); /* Left */ square_end_1 = (top == 0); square_end_2 = (bottom == 0); if (left != 0 && first && nscss_color_is_transparent( box->border[LEFT].c) == false) { col = nscss_color_to_ns(box->border[LEFT].c); z[0] = p[0]; z[1] = p[7]; z[2] = p[2]; z[3] = p[5]; z[4] = p[2]; z[5] = p[3]; z[6] = p[0]; z[7] = p[1]; if (nscss_color_is_transparent(box->border[TOP].c) == false && box->border[TOP].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang top corner fully, * if top border is opaque */ z[5] -= top; square_end_1 = true; } if (nscss_color_is_transparent(box->border[BOTTOM].c) == false && box->border[BOTTOM].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang bottom corner fully, * if bottom border is opaque */ z[3] += bottom; square_end_2 = true; } if (!html_redraw_border_plot(LEFT, z, col, box->border[LEFT].style, left, square_end_1 && square_end_2, clip, ctx)) return false; } /* Right */ square_end_1 = (top == 0); square_end_2 = (bottom == 0); if (right != 0 && last && nscss_color_is_transparent( box->border[RIGHT].c) == false) { col = nscss_color_to_ns(box->border[RIGHT].c); z[0] = p[6]; z[1] = p[1]; z[2] = p[4]; z[3] = p[3]; z[4] = p[4]; z[5] = p[5]; z[6] = p[6]; z[7] = p[7]; if (nscss_color_is_transparent(box->border[TOP].c) == false && box->border[TOP].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang top corner fully, * if top border is opaque */ z[3] -= top; square_end_1 = true; } if (nscss_color_is_transparent(box->border[BOTTOM].c) == false && box->border[BOTTOM].style != CSS_BORDER_STYLE_DOUBLE) { /* make border overhang bottom corner fully, * if bottom border is opaque */ z[5] += bottom; square_end_2 = true; } if (!html_redraw_border_plot(RIGHT, z, col, box->border[RIGHT].style, right, square_end_1 && square_end_2, clip, ctx)) return false; } /* Top */ square_end_1 = (left == 0); square_end_2 = (right == 0); if (top != 0 && nscss_color_is_transparent( box->border[TOP].c) == false) { col = nscss_color_to_ns(box->border[TOP].c); z[0] = p[2]; z[1] = p[3]; z[2] = p[0]; z[3] = p[1]; z[4] = p[6]; z[5] = p[1]; z[6] = p[4]; z[7] = p[3]; if (first && box->border[TOP].style == CSS_BORDER_STYLE_SOLID && box->border[TOP].c == box->border[LEFT].c) { /* don't bother overlapping left corner if * it's the same colour anyway */ z[2] += left; square_end_1 = true; } if (last && box->border[TOP].style == CSS_BORDER_STYLE_SOLID && box->border[TOP].c == box->border[RIGHT].c) { /* don't bother overlapping right corner if * it's the same colour anyway */ z[4] -= right; square_end_2 = true; } if (!html_redraw_border_plot(TOP, z, col, box->border[TOP].style, top, square_end_1 && square_end_2, clip, ctx)) return false; } /* Bottom */ square_end_1 = (left == 0); square_end_2 = (right == 0); if (bottom != 0 && nscss_color_is_transparent( box->border[BOTTOM].c) == false) { col = nscss_color_to_ns(box->border[BOTTOM].c); z[0] = p[4]; z[1] = p[5]; z[2] = p[6]; z[3] = p[7]; z[4] = p[0]; z[5] = p[7]; z[6] = p[2]; z[7] = p[5]; if (first && box->border[BOTTOM].style == CSS_BORDER_STYLE_SOLID && box->border[BOTTOM].c == box->border[LEFT].c) { /* don't bother overlapping left corner if * it's the same colour anyway */ z[4] += left; square_end_1 = true; } if (last && box->border[BOTTOM].style == CSS_BORDER_STYLE_SOLID && box->border[BOTTOM].c == box->border[RIGHT].c) { /* don't bother overlapping right corner if * it's the same colour anyway */ z[2] -= right; square_end_2 = true; } if (!html_redraw_border_plot(BOTTOM, z, col, box->border[BOTTOM].style, bottom, square_end_1 && square_end_2, clip, ctx)) return false; } return true; } /** * Plot a checkbox. * * \param x left coordinate * \param y top coordinate * \param width dimensions of checkbox * \param height dimensions of checkbox * \param selected the checkbox is selected * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_checkbox(int x, int y, int width, int height, bool selected, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; double z = width * 0.15; if (z == 0) z = 1; if (!(plot->rectangle(x, y, x + width, y + height, plot_style_fill_wbasec) && plot->line(x, y, x + width, y, plot_style_stroke_darkwbasec) && plot->line(x, y, x, y + height, plot_style_stroke_darkwbasec) && plot->line(x + width, y, x + width, y + height, plot_style_stroke_lightwbasec) && plot->line(x, y + height, x + width, y + height, plot_style_stroke_lightwbasec))) return false; if (selected) { if (width < 12 || height < 12) { /* render a solid box instead of a tick */ if (!plot->rectangle(x + z + z, y + z + z, x + width - z, y + height - z, plot_style_fill_wblobc)) return false; } else { /* render a tick, as it'll fit comfortably */ if (!(plot->line(x + width - z, y + z, x + (z * 3), y + height - z, plot_style_stroke_wblobc) && plot->line(x + (z * 3), y + height - z, x + z + z, y + (height / 2), plot_style_stroke_wblobc))) return false; } } return true; } /** * Plot a radio icon. * * \param x left coordinate * \param y top coordinate * \param width dimensions of radio icon * \param height dimensions of radio icon * \param selected the radio icon is selected * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_radio(int x, int y, int width, int height, bool selected, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; /* plot background of radio button */ if (!plot->disc(x + width * 0.5, y + height * 0.5, width * 0.5 - 1, plot_style_fill_wbasec)) return false; /* plot dark arc */ if (!plot->arc(x + width * 0.5, y + height * 0.5, width * 0.5 - 1, 45, 225, plot_style_fill_darkwbasec)) return false; /* plot light arc */ if (!plot->arc(x + width * 0.5, y + height * 0.5, width * 0.5 - 1, 225, 45, plot_style_fill_lightwbasec)) return false; if (selected) { /* plot selection blob */ if (!plot->disc(x + width * 0.5, y + height * 0.5, width * 0.3 - 1, plot_style_fill_wblobc)) return false; } return true; } /** * Plot a file upload input. * * \param x left coordinate * \param y top coordinate * \param width dimensions of input * \param height dimensions of input * \param box box of input * \param scale scale for redraw * \param background_colour current background colour * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_file(int x, int y, int width, int height, struct box *box, float scale, colour background_colour, const struct redraw_context *ctx) { int text_width; const char *text; size_t length; plot_font_style_t fstyle; font_plot_style_from_css(box->style, &fstyle); fstyle.background = background_colour; if (box->gadget->value) text = box->gadget->value; else text = messages_get("Form_Drop"); length = strlen(text); if (!nsfont.font_width(&fstyle, text, length, &text_width)) return false; text_width *= scale; if (width < text_width + 8) x = x + width - text_width - 4; else x = x + 4; return ctx->plot->text(x, y + height * 0.75, text, length, &fstyle); } /** * Plot background images. * * \param x coordinate of box * \param y coordinate of box * \param box box to draw background image of * \param scale scale for redraw * \param clip current clip rectangle * \param background_colour current background colour * \param background box containing background details (usually ::box) * \param ctx current redraw context * \return true if successful, false otherwise * * The reason for the presence of ::background is the backwards compatibility * mess that is backgrounds on . The background will be drawn relative * to ::box, using the background information contained within ::background. */ static bool html_redraw_background(int x, int y, struct box *box, float scale, const struct rect *clip, colour *background_colour, struct box *background, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; bool repeat_x = false; bool repeat_y = false; bool plot_colour = true; bool plot_content; bool clip_to_children = false; struct box *clip_box = box; int ox = x, oy = y; int width, height; css_fixed hpos = 0, vpos = 0; css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX; struct box *parent; struct rect r = *clip; css_color bgcol; plot_style_t pstyle_fill_bg = { .fill_type = PLOT_OP_TYPE_SOLID, .fill_colour = *background_colour, }; if (ctx->background_images == false) return true; plot_content = (background->background != NULL); if (plot_content) { if (!box->parent) { /* Root element, special case: * background origin calc. is based on margin box */ x -= box->margin[LEFT] * scale; y -= box->margin[TOP] * scale; width = box->margin[LEFT] + box->padding[LEFT] + box->width + box->padding[RIGHT] + box->margin[RIGHT]; height = box->margin[TOP] + box->padding[TOP] + box->height + box->padding[BOTTOM] + box->margin[BOTTOM]; } else { width = box->padding[LEFT] + box->width + box->padding[RIGHT]; height = box->padding[TOP] + box->height + box->padding[BOTTOM]; } /* handle background-repeat */ switch (css_computed_background_repeat(background->style)) { case CSS_BACKGROUND_REPEAT_REPEAT: repeat_x = repeat_y = true; /* optimisation: only plot the colour if * bitmap is not opaque */ plot_colour = !content_get_opaque(background->background); break; case CSS_BACKGROUND_REPEAT_REPEAT_X: repeat_x = true; break; case CSS_BACKGROUND_REPEAT_REPEAT_Y: repeat_y = true; break; case CSS_BACKGROUND_REPEAT_NO_REPEAT: break; default: break; } /* handle background-position */ css_computed_background_position(background->style, &hpos, &hunit, &vpos, &vunit); if (hunit == CSS_UNIT_PCT) { x += (width - content_get_width(background->background)) * scale * FIXTOFLT(hpos) / 100.; } else { x += (int) (FIXTOFLT(nscss_len2px(hpos, hunit, background->style)) * scale); } if (vunit == CSS_UNIT_PCT) { y += (height - content_get_height(background->background)) * scale * FIXTOFLT(vpos) / 100.; } else { y += (int) (FIXTOFLT(nscss_len2px(vpos, vunit, background->style)) * scale); } } /* special case for table rows as their background needs * to be clipped to all the cells */ if (box->type == BOX_TABLE_ROW) { css_fixed h = 0, v = 0; css_unit hu = CSS_UNIT_PX, vu = CSS_UNIT_PX; for (parent = box->parent; ((parent) && (parent->type != BOX_TABLE)); parent = parent->parent); assert(parent && (parent->style)); css_computed_border_spacing(parent->style, &h, &hu, &v, &vu); clip_to_children = (h > 0) || (v > 0); if (clip_to_children) clip_box = box->children; } for (; clip_box; clip_box = clip_box->next) { /* clip to child boxes if needed */ if (clip_to_children) { assert(clip_box->type == BOX_TABLE_CELL); /* update clip.* to the child cell */ r.x0 = ox + (clip_box->x * scale); r.y0 = oy + (clip_box->y * scale); r.x1 = r.x0 + (clip_box->padding[LEFT] + clip_box->width + clip_box->padding[RIGHT]) * scale; r.y1 = r.y0 + (clip_box->padding[TOP] + clip_box->height + clip_box->padding[BOTTOM]) * scale; if (r.x0 < clip->x0) r.x0 = clip->x0; if (r.y0 < clip->y0) r.y0 = clip->y0; if (r.x1 > clip->x1) r.x1 = clip->x1; if (r.y1 > clip->y1) r.y1 = clip->y1; css_computed_background_color(clip_box->style, &bgcol); /* attributes override */ /* if the background content is opaque there * is no need to plot underneath it. */ if ((r.x0 >= r.x1) || (r.y0 >= r.y1) || (nscss_color_is_transparent(bgcol) == false) || ((clip_box->background != NULL) && content_get_opaque(clip_box->background))) continue; } /* plot the background colour */ css_computed_background_color(background->style, &bgcol); if (nscss_color_is_transparent(bgcol) == false) { *background_colour = nscss_color_to_ns(bgcol); pstyle_fill_bg.fill_colour = *background_colour; if (plot_colour) if (!plot->rectangle(r.x0, r.y0, r.x1, r.y1, &pstyle_fill_bg)) return false; } /* and plot the image */ if (plot_content) { width = content_get_width(background->background); height = content_get_height(background->background); /* ensure clip area only as large as required */ if (!repeat_x) { if (r.x0 < x) r.x0 = x; if (r.x1 > x + width * scale) r.x1 = x + width * scale; } if (!repeat_y) { if (r.y0 < y) r.y0 = y; if (r.y1 > y + height * scale) r.y1 = y + height * scale; } /* valid clipping rectangles only */ if ((r.x0 < r.x1) && (r.y0 < r.y1)) { struct content_redraw_data bg_data; if (!plot->clip(&r)) return false; bg_data.x = x; bg_data.y = y; bg_data.width = ceilf(width * scale); bg_data.height = ceilf(height * scale); bg_data.background_colour = *background_colour; bg_data.scale = scale; bg_data.repeat_x = repeat_x; bg_data.repeat_y = repeat_y; /* We just continue if redraw fails */ content_redraw(background->background, &bg_data, &r, ctx); } } /* only rows being clipped to child boxes loop */ if (!clip_to_children) return true; } return true; } /** * Plot an inline's background and/or background image. * * \param x coordinate of box * \param y coordinate of box * \param box BOX_INLINE which created the background * \param scale scale for redraw * \param clip coordinates of clip rectangle * \param b coordinates of border edge rectangle * \param first true if this is the first rectangle associated with the inline * \param last true if this is the last rectangle associated with the inline * \param background_colour updated to current background colour if plotted * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_inline_background(int x, int y, struct box *box, float scale, const struct rect *clip, struct rect b, bool first, bool last, colour *background_colour, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; struct rect r = *clip; bool repeat_x = false; bool repeat_y = false; bool plot_colour = true; bool plot_content; css_fixed hpos = 0, vpos = 0; css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX; css_color bgcol; plot_style_t pstyle_fill_bg = { .fill_type = PLOT_OP_TYPE_SOLID, .fill_colour = *background_colour, }; plot_content = (box->background != NULL); if (html_redraw_printing && nsoption_bool(remove_backgrounds)) return true; if (plot_content) { /* handle background-repeat */ switch (css_computed_background_repeat(box->style)) { case CSS_BACKGROUND_REPEAT_REPEAT: repeat_x = repeat_y = true; /* optimisation: only plot the colour if * bitmap is not opaque */ plot_colour = !content_get_opaque(box->background); break; case CSS_BACKGROUND_REPEAT_REPEAT_X: repeat_x = true; break; case CSS_BACKGROUND_REPEAT_REPEAT_Y: repeat_y = true; break; case CSS_BACKGROUND_REPEAT_NO_REPEAT: break; default: break; } /* handle background-position */ css_computed_background_position(box->style, &hpos, &hunit, &vpos, &vunit); if (hunit == CSS_UNIT_PCT) { x += (b.x1 - b.x0 - content_get_width(box->background) * scale) * FIXTOFLT(hpos) / 100.; if (!repeat_x && ((hpos < 2 && !first) || (hpos > 98 && !last))){ plot_content = false; } } else { x += (int) (FIXTOFLT(nscss_len2px(hpos, hunit, box->style)) * scale); } if (vunit == CSS_UNIT_PCT) { y += (b.y1 - b.y0 - content_get_height(box->background) * scale) * FIXTOFLT(vpos) / 100.; } else { y += (int) (FIXTOFLT(nscss_len2px(vpos, vunit, box->style)) * scale); } } /* plot the background colour */ css_computed_background_color(box->style, &bgcol); if (nscss_color_is_transparent(bgcol) == false) { *background_colour = nscss_color_to_ns(bgcol); pstyle_fill_bg.fill_colour = *background_colour; if (plot_colour) if (!plot->rectangle(r.x0, r.y0, r.x1, r.y1, &pstyle_fill_bg)) return false; } /* and plot the image */ if (plot_content) { int width = content_get_width(box->background); int height = content_get_height(box->background); if (!repeat_x) { if (r.x0 < x) r.x0 = x; if (r.x1 > x + width * scale) r.x1 = x + width * scale; } if (!repeat_y) { if (r.y0 < y) r.y0 = y; if (r.y1 > y + height * scale) r.y1 = y + height * scale; } /* valid clipping rectangles only */ if ((r.x0 < r.x1) && (r.y0 < r.y1)) { struct content_redraw_data bg_data; if (!plot->clip(&r)) return false; bg_data.x = x; bg_data.y = y; bg_data.width = ceilf(width * scale); bg_data.height = ceilf(height * scale); bg_data.background_colour = *background_colour; bg_data.scale = scale; bg_data.repeat_x = repeat_x; bg_data.repeat_y = repeat_y; /* We just continue if redraw fails */ content_redraw(box->background, &bg_data, &r, ctx); } } return true; } /** * Plot text decoration for an inline box. * * \param box box to plot decorations for, of type BOX_INLINE * \param x x coordinate of parent of box * \param y y coordinate of parent of box * \param scale scale for redraw * \param colour colour for decorations * \param ratio position of line as a ratio of line height * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_text_decoration_inline(struct box *box, int x, int y, float scale, colour colour, float ratio, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; struct box *c; plot_style_t plot_style_box = { .stroke_type = PLOT_OP_TYPE_SOLID, .stroke_colour = colour, }; for (c = box->next; c && c != box->inline_end; c = c->next) { if (c->type != BOX_TEXT) continue; if (!plot->line((x + c->x) * scale, (y + c->y + c->height * ratio) * scale, (x + c->x + c->width) * scale, (y + c->y + c->height * ratio) * scale, &plot_style_box)) return false; } return true; } /** * Plot text decoration for an non-inline box. * * \param box box to plot decorations for, of type other than BOX_INLINE * \param x x coordinate of box * \param y y coordinate of box * \param scale scale for redraw * \param colour colour for decorations * \param ratio position of line as a ratio of line height * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_text_decoration_block(struct box *box, int x, int y, float scale, colour colour, float ratio, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; struct box *c; plot_style_t plot_style_box = { .stroke_type = PLOT_OP_TYPE_SOLID, .stroke_colour = colour, }; /* draw through text descendants */ for (c = box->children; c; c = c->next) { if (c->type == BOX_TEXT) { if (!plot->line((x + c->x) * scale, (y + c->y + c->height * ratio) * scale, (x + c->x + c->width) * scale, (y + c->y + c->height * ratio) * scale, &plot_style_box)) return false; } else if (c->type == BOX_INLINE_CONTAINER || c->type == BOX_BLOCK) { if (!html_redraw_text_decoration_block(c, x + c->x, y + c->y, scale, colour, ratio, ctx)) return false; } } return true; } /** * Plot text decoration for a box. * * \param box box to plot decorations for * \param x_parent x coordinate of parent of box * \param y_parent y coordinate of parent of box * \param scale scale for redraw * \param background_colour current background colour * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_text_decoration(struct box *box, int x_parent, int y_parent, float scale, colour background_colour, const struct redraw_context *ctx) { static const enum css_text_decoration_e decoration[] = { CSS_TEXT_DECORATION_UNDERLINE, CSS_TEXT_DECORATION_OVERLINE, CSS_TEXT_DECORATION_LINE_THROUGH }; static const float line_ratio[] = { 0.9, 0.1, 0.5 }; colour fgcol; unsigned int i; css_color col; css_computed_color(box->style, &col); fgcol = nscss_color_to_ns(col); /* antialias colour for under/overline */ if (html_redraw_printing == false) fgcol = blend_colour(background_colour, fgcol); if (box->type == BOX_INLINE) { if (!box->inline_end) return true; for (i = 0; i != NOF_ELEMENTS(decoration); i++) if (css_computed_text_decoration(box->style) & decoration[i]) if (!html_redraw_text_decoration_inline(box, x_parent, y_parent, scale, fgcol, line_ratio[i], ctx)) return false; } else { for (i = 0; i != NOF_ELEMENTS(decoration); i++) if (css_computed_text_decoration(box->style) & decoration[i]) if (!html_redraw_text_decoration_block(box, x_parent + box->x, y_parent + box->y, scale, fgcol, line_ratio[i], ctx)) return false; } return true; } /** * Redraw the text content of a box, possibly partially highlighted * because the text has been selected, or matches a search operation. * * \param box box with text content * \param x x co-ord of box * \param y y co-ord of box * \param clip current clip rectangle * \param scale current scale setting (1.0 = 100%) * \param current_background_color * \param ctx current redraw context * \return true iff successful and redraw should proceed */ static bool html_redraw_text_box(const html_content *html, struct box *box, int x, int y, const struct rect *clip, float scale, colour current_background_color, const struct redraw_context *ctx) { bool excluded = (box->object != NULL); plot_font_style_t fstyle; font_plot_style_from_css(box->style, &fstyle); fstyle.background = current_background_color; if (!text_redraw(box->text, box->length, box->byte_offset, box->space, &fstyle, x, y, clip, box->height, scale, excluded, (struct content *)html, &html->sel, html->search, ctx)) return false; return true; } bool html_redraw_box(const html_content *html, struct box *box, int x_parent, int y_parent, const struct rect *clip, float scale, colour current_background_color, const struct redraw_context *ctx); /** * Draw the various children of a box. * * \param html html content * \param box box to draw children of * \param x_parent coordinate of parent box * \param y_parent coordinate of parent box * \param clip clip rectangle * \param scale scale for redraw * \param current_background_color background colour under this box * \param ctx current redraw context * \return true if successful, false otherwise */ static bool html_redraw_box_children(const html_content *html, struct box *box, int x_parent, int y_parent, const struct rect *clip, float scale, colour current_background_color, const struct redraw_context *ctx) { struct box *c; for (c = box->children; c; c = c->next) { if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT) if (!html_redraw_box(html, c, x_parent + box->x - scrollbar_get_offset(box->scroll_x), y_parent + box->y - scrollbar_get_offset(box->scroll_y), clip, scale, current_background_color, ctx)) return false; } for (c = box->float_children; c; c = c->next_float) if (!html_redraw_box(html, c, x_parent + box->x - scrollbar_get_offset(box->scroll_x), y_parent + box->y - scrollbar_get_offset(box->scroll_y), clip, scale, current_background_color, ctx)) return false; return true; } /** * Recursively draw a box. * * \param html html content * \param box box to draw * \param x_parent coordinate of parent box * \param y_parent coordinate of parent box * \param clip clip rectangle * \param scale scale for redraw * \param current_background_color background colour under this box * \param ctx current redraw context * \return true if successful, false otherwise * * x, y, clip_[xy][01] are in target coordinates. */ bool html_redraw_box(const html_content *html, struct box *box, int x_parent, int y_parent, const struct rect *clip, const float scale, colour current_background_color, const struct redraw_context *ctx) { const struct plotter_table *plot = ctx->plot; int x, y; int width, height; int padding_left, padding_top, padding_width, padding_height; int border_left, border_top, border_right, border_bottom; struct rect r; int x_scrolled, y_scrolled; struct box *bg_box = NULL; bool has_x_scroll, has_y_scroll; css_computed_clip_rect css_rect; enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE; enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE; if (html_redraw_printing && (box->flags & PRINTED)) return true; if (box->style != NULL) { overflow_x = css_computed_overflow_x(box->style); overflow_y = css_computed_overflow_y(box->style); } /* avoid trivial FP maths */ if (scale == 1.0) { x = x_parent + box->x; y = y_parent + box->y; width = box->width; height = box->height; padding_left = box->padding[LEFT]; padding_top = box->padding[TOP]; padding_width = padding_left + box->width + box->padding[RIGHT]; padding_height = padding_top + box->height + box->padding[BOTTOM]; border_left = box->border[LEFT].width; border_top = box->border[TOP].width; border_right = box->border[RIGHT].width; border_bottom = box->border[BOTTOM].width; } else { x = (x_parent + box->x) * scale; y = (y_parent + box->y) * scale; width = box->width * scale; height = box->height * scale; /* left and top padding values are normally zero, * so avoid trivial FP maths */ padding_left = box->padding[LEFT] ? box->padding[LEFT] * scale : 0; padding_top = box->padding[TOP] ? box->padding[TOP] * scale : 0; padding_width = (box->padding[LEFT] + box->width + box->padding[RIGHT]) * scale; padding_height = (box->padding[TOP] + box->height + box->padding[BOTTOM]) * scale; border_left = box->border[LEFT].width * scale; border_top = box->border[TOP].width * scale; border_right = box->border[RIGHT].width * scale; border_bottom = box->border[BOTTOM].width * scale; } /* calculate rectangle covering this box and descendants */ if (box->style && overflow_x != CSS_OVERFLOW_VISIBLE && box->parent != NULL) { /* box contents clipped to box size */ r.x0 = x - border_left; r.x1 = x + padding_width + border_right; } else { /* box contents can hang out of the box; use descendant box */ if (scale == 1.0) { r.x0 = x + box->descendant_x0; r.x1 = x + box->descendant_x1 + 1; } else { r.x0 = x + box->descendant_x0 * scale; r.x1 = x + box->descendant_x1 * scale + 1; } if (!box->parent) { /* root element */ int margin_left, margin_right; if (scale == 1.0) { margin_left = box->margin[LEFT]; margin_right = box->margin[RIGHT]; } else { margin_left = box->margin[LEFT] * scale; margin_right = box->margin[RIGHT] * scale; } r.x0 = x - border_left - margin_left < r.x0 ? x - border_left - margin_left : r.x0; r.x1 = x + padding_width + border_right + margin_right > r.x1 ? x + padding_width + border_right + margin_right : r.x1; } } /* calculate rectangle covering this box and descendants */ if (box->style && overflow_y != CSS_OVERFLOW_VISIBLE && box->parent != NULL) { /* box contents clipped to box size */ r.y0 = y - border_top; r.y1 = y + padding_height + border_bottom; } else { /* box contents can hang out of the box; use descendant box */ if (scale == 1.0) { r.y0 = y + box->descendant_y0; r.y1 = y + box->descendant_y1 + 1; } else { r.y0 = y + box->descendant_y0 * scale; r.y1 = y + box->descendant_y1 * scale + 1; } if (!box->parent) { /* root element */ int margin_top, margin_bottom; if (scale == 1.0) { margin_top = box->margin[TOP]; margin_bottom = box->margin[BOTTOM]; } else { margin_top = box->margin[TOP] * scale; margin_bottom = box->margin[BOTTOM] * scale; } r.y0 = y - border_top - margin_top < r.y0 ? y - border_top - margin_top : r.y0; r.y1 = y + padding_height + border_bottom + margin_bottom > r.y1 ? y + padding_height + border_bottom + margin_bottom : r.y1; } } /* return if the rectangle is completely outside the clip rectangle */ if (clip->y1 < r.y0 || r.y1 < clip->y0 || clip->x1 < r.x0 || r.x1 < clip->x0) return true; /*if the rectangle is under the page bottom but it can fit in a page, don't print it now*/ if (html_redraw_printing) { if (r.y1 > html_redraw_printing_border) { if (r.y1 - r.y0 <= html_redraw_printing_border && (box->type == BOX_TEXT || box->type == BOX_TABLE_CELL || box->object || box->gadget)) { /*remember the highest of all points from the not printed elements*/ if (r.y0 < html_redraw_printing_top_cropped) html_redraw_printing_top_cropped = r.y0; return true; } } else box->flags |= PRINTED; /*it won't be printed anymore*/ } /* if visibility is hidden render children only */ if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) { if ((plot->group_start) && (!plot->group_start("hidden box"))) return false; if (!html_redraw_box_children(html, box, x_parent, y_parent, &r, scale, current_background_color, ctx)) return false; return ((!plot->group_end) || (plot->group_end())); } if ((plot->group_start) && (!plot->group_start("vis box"))) return false; if (box->style != NULL && css_computed_position(box->style) == CSS_POSITION_ABSOLUTE && css_computed_clip(box->style, &css_rect) == CSS_CLIP_RECT) { /* We have an absolutly positioned box with a clip rect */ if (css_rect.left_auto == false) r.x0 = x - border_left + FIXTOINT(nscss_len2px( css_rect.left, css_rect.lunit, box->style)); if (css_rect.top_auto == false) r.y0 = y - border_top + FIXTOINT(nscss_len2px( css_rect.top, css_rect.tunit, box->style)); if (css_rect.right_auto == false) r.x1 = x - border_left + FIXTOINT(nscss_len2px( css_rect.right, css_rect.runit, box->style)); if (css_rect.bottom_auto == false) r.y1 = y - border_top + FIXTOINT(nscss_len2px( css_rect.bottom, css_rect.bunit, box->style)); /* find intersection of clip rectangle and box */ if (r.x0 < clip->x0) r.x0 = clip->x0; if (r.y0 < clip->y0) r.y0 = clip->y0; if (clip->x1 < r.x1) r.x1 = clip->x1; if (clip->y1 < r.y1) r.y1 = clip->y1; /* Nothing to do for invalid rectangles */ if (r.x0 >= r.x1 || r.y0 >= r.y1) /* not an error */ return ((!plot->group_end) || (plot->group_end())); /* clip to it */ if (!plot->clip(&r)) return false; } else if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK || box->type == BOX_TABLE_CELL || box->object) { /* find intersection of clip rectangle and box */ if (r.x0 < clip->x0) r.x0 = clip->x0; if (r.y0 < clip->y0) r.y0 = clip->y0; if (clip->x1 < r.x1) r.x1 = clip->x1; if (clip->y1 < r.y1) r.y1 = clip->y1; /* no point trying to draw 0-width/height boxes */ if (r.x0 == r.x1 || r.y0 == r.y1) /* not an error */ return ((!plot->group_end) || (plot->group_end())); /* clip to it */ if (!plot->clip(&r)) return false; } else { /* clip box is fine, clip to it */ r = *clip; if (!plot->clip(&r)) return false; } /* background colour and image for block level content and replaced * inlines */ bg_box = html_redraw_find_bg_box(box); /* bg_box == NULL implies that this box should not have * its background rendered. Otherwise filter out linebreaks, * optimize away non-differing inlines, only plot background * for BOX_TEXT it's in an inline */ if (bg_box && bg_box->type != BOX_BR && bg_box->type != BOX_TEXT && bg_box->type != BOX_INLINE_END && (bg_box->type != BOX_INLINE || bg_box->object || bg_box->flags & IFRAME || box->flags & REPLACE_DIM || (bg_box->gadget != NULL && (bg_box->gadget->type == GADGET_TEXTAREA || bg_box->gadget->type == GADGET_TEXTBOX || bg_box->gadget->type == GADGET_PASSWORD)))) { /* find intersection of clip box and border edge */ struct rect p; p.x0 = x - border_left < r.x0 ? r.x0 : x - border_left; p.y0 = y - border_top < r.y0 ? r.y0 : y - border_top; p.x1 = x + padding_width + border_right < r.x1 ? x + padding_width + border_right : r.x1; p.y1 = y + padding_height + border_bottom < r.y1 ? y + padding_height + border_bottom : r.y1; if (!box->parent) { /* Root element, special case: * background covers margins too */ int m_left, m_top, m_right, m_bottom; if (scale == 1.0) { m_left = box->margin[LEFT]; m_top = box->margin[TOP]; m_right = box->margin[RIGHT]; m_bottom = box->margin[BOTTOM]; } else { m_left = box->margin[LEFT] * scale; m_top = box->margin[TOP] * scale; m_right = box->margin[RIGHT] * scale; m_bottom = box->margin[BOTTOM] * scale; } p.x0 = p.x0 - m_left < r.x0 ? r.x0 : p.x0 - m_left; p.y0 = p.y0 - m_top < r.y0 ? r.y0 : p.y0 - m_top; p.x1 = p.x1 + m_right < r.x1 ? p.x1 + m_right : r.x1; p.y1 = p.y1 + m_bottom < r.y1 ? p.y1 + m_bottom : r.y1; } /* valid clipping rectangles only */ if ((p.x0 < p.x1) && (p.y0 < p.y1)) { /* plot background */ if (!html_redraw_background(x, y, box, scale, &p, ¤t_background_color, bg_box, ctx)) return false; /* restore previous graphics window */ if (!plot->clip(&r)) return false; } } /* borders for block level content and replaced inlines */ if (box->style && box->type != BOX_TEXT && box->type != BOX_INLINE_END && (box->type != BOX_INLINE || box->object || box->flags & IFRAME || box->flags & REPLACE_DIM || (box->gadget != NULL && (box->gadget->type == GADGET_TEXTAREA || box->gadget->type == GADGET_TEXTBOX || box->gadget->type == GADGET_PASSWORD))) && (border_top || border_right || border_bottom || border_left)) { if (!html_redraw_borders(box, x_parent, y_parent, padding_width, padding_height, &r, scale, ctx)) return false; } /* backgrounds and borders for non-replaced inlines */ if (box->style && box->type == BOX_INLINE && box->inline_end && (html_redraw_box_has_background(box) || border_top || border_right || border_bottom || border_left)) { /* inline backgrounds and borders span other boxes and may * wrap onto separate lines */ struct box *ib; struct rect b; /* border edge rectangle */ struct rect p; /* clipped rect */ bool first = true; int ib_x; int ib_y = y; int ib_p_width; int ib_b_left, ib_b_right; b.x0 = x - border_left; b.x1 = x + padding_width + border_right; b.y0 = y - border_top; b.y1 = y + padding_height + border_bottom; p.x0 = b.x0 < r.x0 ? r.x0 : b.x0; p.x1 = b.x1 < r.x1 ? b.x1 : r.x1; p.y0 = b.y0 < r.y0 ? r.y0 : b.y0; p.y1 = b.y1 < r.y1 ? b.y1 : r.y1; for (ib = box; ib; ib = ib->next) { /* to get extents of rectangle(s) associated with * inline, cycle though all boxes in inline, skipping * over floats */ if (ib->type == BOX_FLOAT_LEFT || ib->type == BOX_FLOAT_RIGHT) continue; if (scale == 1.0) { ib_x = x_parent + ib->x; ib_y = y_parent + ib->y; ib_p_width = ib->padding[LEFT] + ib->width + ib->padding[RIGHT]; ib_b_left = ib->border[LEFT].width; ib_b_right = ib->border[RIGHT].width; } else { ib_x = (x_parent + ib->x) * scale; ib_y = (y_parent + ib->y) * scale; ib_p_width = (ib->padding[LEFT] + ib->width + ib->padding[RIGHT]) * scale; ib_b_left = ib->border[LEFT].width * scale; ib_b_right = ib->border[RIGHT].width * scale; } if ((ib->flags & NEW_LINE) && ib != box) { /* inline element has wrapped, plot background * and borders */ if (!html_redraw_inline_background( x, y, box, scale, &p, b, first, false, ¤t_background_color, ctx)) return false; /* restore previous graphics window */ if (!plot->clip(&r)) return false; if (!html_redraw_inline_borders(box, b, &r, scale, first, false, ctx)) return false; /* reset coords */ b.x0 = ib_x - ib_b_left; b.y0 = ib_y - border_top - padding_top; b.y1 = ib_y + padding_height - padding_top + border_bottom; p.x0 = b.x0 < r.x0 ? r.x0 : b.x0; p.y0 = b.y0 < r.y0 ? r.y0 : b.y0; p.y1 = b.y1 < r.y1 ? b.y1 : r.y1; first = false; } /* increase width for current box */ b.x1 = ib_x + ib_p_width + ib_b_right; p.x1 = b.x1 < r.x1 ? b.x1 : r.x1; if (ib == box->inline_end) /* reached end of BOX_INLINE span */ break; } /* plot background and borders for last rectangle of * the inline */ if (!html_redraw_inline_background(x, ib_y, box, scale, &p, b, first, true, ¤t_background_color, ctx)) return false; /* restore previous graphics window */ if (!plot->clip(&r)) return false; if (!html_redraw_inline_borders(box, b, &r, scale, first, true, ctx)) return false; } /* Debug outlines */ if (html_redraw_debug) { int margin_left, margin_right; int margin_top, margin_bottom; if (scale == 1.0) { /* avoid trivial fp maths */ margin_left = box->margin[LEFT]; margin_top = box->margin[TOP]; margin_right = box->margin[RIGHT]; margin_bottom = box->margin[BOTTOM]; } else { margin_left = box->margin[LEFT] * scale; margin_top = box->margin[TOP] * scale; margin_right = box->margin[RIGHT] * scale; margin_bottom = box->margin[BOTTOM] * scale; } /* Content edge -- blue */ if (!plot->rectangle(x + padding_left, y + padding_top, x + padding_left + width, y + padding_top + height, plot_style_content_edge)) return false; /* Padding edge -- red */ if (!plot->rectangle(x, y, x + padding_width, y + padding_height, plot_style_padding_edge)) return false; /* Margin edge -- yellow */ if (!plot->rectangle( x - border_left - margin_left, y - border_top - margin_top, x + padding_width + border_right + margin_right, y + padding_height + border_bottom + margin_bottom, plot_style_margin_edge)) return false; } /* clip to the padding edge for objects, or boxes with overflow hidden * or scroll, unless it's the root element */ if (box->parent != NULL) { bool need_clip = false; if (box->object || box->flags & IFRAME || (overflow_x != CSS_OVERFLOW_VISIBLE && overflow_y != CSS_OVERFLOW_VISIBLE)) { r.x0 = x; r.y0 = y; r.x1 = x + padding_width; r.y1 = y + padding_height; if (r.x0 < clip->x0) r.x0 = clip->x0; if (r.y0 < clip->y0) r.y0 = clip->y0; if (clip->x1 < r.x1) r.x1 = clip->x1; if (clip->y1 < r.y1) r.y1 = clip->y1; if (r.x1 <= r.x0 || r.y1 <= r.y0) return (!plot->group_end || plot->group_end()); need_clip = true; } else if (overflow_x != CSS_OVERFLOW_VISIBLE) { r.x0 = x; r.y0 = clip->y0; r.x1 = x + padding_width; r.y1 = clip->y1; if (r.x0 < clip->x0) r.x0 = clip->x0; if (clip->x1 < r.x1) r.x1 = clip->x1; if (r.x1 <= r.x0) return (!plot->group_end || plot->group_end()); need_clip = true; } else if (overflow_y != CSS_OVERFLOW_VISIBLE) { r.x0 = clip->x0; r.y0 = y; r.x1 = clip->x1; r.y1 = y + padding_height; if (r.y0 < clip->y0) r.y0 = clip->y0; if (clip->y1 < r.y1) r.y1 = clip->y1; if (r.y1 <= r.y0) return (!plot->group_end || plot->group_end()); need_clip = true; } if (need_clip && (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK || box->type == BOX_TABLE_CELL || box->object)) { if (!plot->clip(&r)) return false; } } /* text decoration */ if (box->type != BOX_TEXT && box->style && css_computed_text_decoration(box->style) != CSS_TEXT_DECORATION_NONE) if (!html_redraw_text_decoration(box, x_parent, y_parent, scale, current_background_color, ctx)) return false; if (box->object && width != 0 && height != 0) { struct content_redraw_data obj_data; x_scrolled = x - scrollbar_get_offset(box->scroll_x) * scale; y_scrolled = y - scrollbar_get_offset(box->scroll_y) * scale; obj_data.x = x_scrolled + padding_left; obj_data.y = y_scrolled + padding_top; obj_data.width = width; obj_data.height = height; obj_data.background_colour = current_background_color; obj_data.scale = scale; obj_data.repeat_x = false; obj_data.repeat_y = false; if (content_get_type(box->object) == CONTENT_HTML) { obj_data.x /= scale; obj_data.y /= scale; } if (!content_redraw(box->object, &obj_data, &r, ctx)) { /* Show image fail */ /* Unicode (U+FFFC) 'OBJECT REPLACEMENT CHARACTER' */ const char *obj = "\xef\xbf\xbc"; int obj_width; int obj_x = x + padding_left; if (!plot->rectangle(x + padding_left, y + padding_top, x + padding_left + width - 1, y + padding_top + height - 1, plot_style_broken_object)) return false; if (!nsfont.font_width(plot_fstyle_broken_object, obj, sizeof(obj) - 1, &obj_width)) obj_x += 1; else obj_x += width / 2 - obj_width / 2; if (!plot->text(obj_x, y + padding_top + (int) (height * 0.75), obj, sizeof(obj) - 1, plot_fstyle_broken_object)) return false; } } else if (box->iframe) { /* Offset is passed to browser window redraw unscaled */ browser_window_redraw(box->iframe, (x + padding_left) / scale, (y + padding_top) / scale, &r, ctx); } else if (box->gadget && box->gadget->type == GADGET_CHECKBOX) { if (!html_redraw_checkbox(x + padding_left, y + padding_top, width, height, box->gadget->selected, ctx)) return false; } else if (box->gadget && box->gadget->type == GADGET_RADIO) { if (!html_redraw_radio(x + padding_left, y + padding_top, width, height, box->gadget->selected, ctx)) return false; } else if (box->gadget && box->gadget->type == GADGET_FILE) { if (!html_redraw_file(x + padding_left, y + padding_top, width, height, box, scale, current_background_color, ctx)) return false; } else if (box->gadget && (box->gadget->type == GADGET_TEXTAREA || box->gadget->type == GADGET_PASSWORD || box->gadget->type == GADGET_TEXTBOX)) { textarea_redraw(box->gadget->data.text.ta, x, y, current_background_color, scale, &r, ctx); } else if (box->text) { if (!html_redraw_text_box(html, box, x, y, &r, scale, current_background_color, ctx)) return false; } else { if (!html_redraw_box_children(html, box, x_parent, y_parent, &r, scale, current_background_color, ctx)) return false; } if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK || box->type == BOX_TABLE_CELL || box->type == BOX_INLINE) if (!plot->clip(clip)) return false; /* list marker */ if (box->list_marker) if (!html_redraw_box(html, box->list_marker, x_parent + box->x - scrollbar_get_offset(box->scroll_x), y_parent + box->y - scrollbar_get_offset(box->scroll_y), clip, scale, current_background_color, ctx)) return false; /* scrollbars */ if (((box->style && box->type != BOX_BR && box->type != BOX_TABLE && box->type != BOX_INLINE && (overflow_x == CSS_OVERFLOW_SCROLL || overflow_x == CSS_OVERFLOW_AUTO || overflow_y == CSS_OVERFLOW_SCROLL || overflow_y == CSS_OVERFLOW_AUTO)) || (box->object && content_get_type(box->object) == CONTENT_HTML)) && box->parent != NULL) { has_x_scroll = box_hscrollbar_present(box); has_y_scroll = box_vscrollbar_present(box); if (!box_handle_scrollbars((struct content *)html, box, has_x_scroll, has_y_scroll)) return false; if (box->scroll_x != NULL) scrollbar_redraw(box->scroll_x, x_parent + box->x, y_parent + box->y + box->padding[TOP] + box->height + box->padding[BOTTOM] - SCROLLBAR_WIDTH, clip, scale, ctx); if (box->scroll_y != NULL) scrollbar_redraw(box->scroll_y, x_parent + box->x + box->padding[LEFT] + box->width + box->padding[RIGHT] - SCROLLBAR_WIDTH, y_parent + box->y, clip, scale, ctx); } if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK || box->type == BOX_TABLE_CELL || box->type == BOX_INLINE) if (!plot->clip(clip)) return false; return ((!plot->group_end) || (plot->group_end())); } /** * Draw a CONTENT_HTML using the current set of plotters (plot). * * \param c content of type CONTENT_HTML * \param data redraw data for this content redraw * \param clip current clip region * \param ctx current redraw context * \return true if successful, false otherwise * * x, y, clip_[xy][01] are in target coordinates. */ bool html_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx) { html_content *html = (html_content *) c; struct box *box; bool result = true; bool select, select_only; plot_style_t pstyle_fill_bg = { .fill_type = PLOT_OP_TYPE_SOLID, .fill_colour = data->background_colour, }; box = html->layout; assert(box); /* The select menu needs special treating because, when opened, it * reaches beyond its layout box. */ select = false; select_only = false; if (ctx->interactive && html->visible_select_menu != NULL) { struct form_control *control = html->visible_select_menu; select = true; /* check if the redraw rectangle is completely inside of the select menu */ select_only = form_clip_inside_select_menu(control, data->scale, clip); } if (!select_only) { /* clear to background colour */ result = ctx->plot->clip(clip); if (html->background_colour != NS_TRANSPARENT) pstyle_fill_bg.fill_colour = html->background_colour; result &= ctx->plot->rectangle(clip->x0, clip->y0, clip->x1, clip->y1, &pstyle_fill_bg); result &= html_redraw_box(html, box, data->x, data->y, clip, data->scale, pstyle_fill_bg.fill_colour, ctx); } if (select) { int menu_x, menu_y; box = html->visible_select_menu->box; box_coords(box, &menu_x, &menu_y); menu_x -= box->border[LEFT].width; menu_y += box->height + box->border[BOTTOM].width + box->padding[BOTTOM] + box->padding[TOP]; result &= form_redraw_select_menu(html->visible_select_menu, data->x + menu_x, data->y + menu_y, data->scale, clip, ctx); } return result; } netsurf-all-3.2/netsurf/render/imagemap.h0000644000175000017500000000226612377677024017527 0ustar vincevince/* * Copyright 2004 John M Bell * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef _NETSURF_RENDER_IMAGEMAP_H_ #define _NETSURF_RENDER_IMAGEMAP_H_ #include #include "utils/nsurl.h" struct html_content; struct hlcache_handle; void imagemap_destroy(struct html_content *c); void imagemap_dump(struct html_content *c); nserror imagemap_extract(struct html_content *c); nsurl *imagemap_get(struct html_content *c, const char *key, unsigned long x, unsigned long y, unsigned long click_x, unsigned long click_y, const char **target); #endif netsurf-all-3.2/netsurf/render/layout.h0000644000175000017500000000265312377677024017264 0ustar vincevince/* * Copyright 2003 James Bursa * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * HTML layout (interface). * * The main interface to the layout code is layout_document(), which takes a * normalized box tree and assigns coordinates and dimensions to the boxes, and * also adds boxes to the tree (eg. when formatting lines of text). */ #ifndef _NETSURF_RENDER_LAYOUT_H_ #define _NETSURF_RENDER_LAYOUT_H_ struct box; struct html_content; bool layout_document(struct html_content *content, int width, int height); bool layout_inline_container(struct box *box, int width, struct box *cont, int cx, int cy, struct html_content *content); void layout_calculate_descendant_bboxes(struct box *box); void layout_minmax_table(struct box *table, const struct font_functions *font_func); #endif netsurf-all-3.2/netsurf/render/html_interaction.c0000644000175000017500000010556212377677024021310 0ustar vincevince/* * Copyright 2006 James Bursa * Copyright 2006 Richard Wilson * Copyright 2008 Michael Drake * Copyright 2009 Paul Blokus * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * User interaction with a CONTENT_HTML (implementation). */ #include #include #include #include "content/content.h" #include "content/hlcache.h" #include "desktop/browser.h" #include "desktop/gui_factory.h" #include "desktop/frames.h" #include "desktop/mouse.h" #include "utils/nsoption.h" #include "desktop/scrollbar.h" #include "desktop/selection.h" #include "desktop/textarea.h" #include "desktop/textinput.h" #include "render/box.h" #include "render/box_textarea.h" #include "render/font.h" #include "render/form.h" #include "render/html_internal.h" #include "render/imagemap.h" #include "render/search.h" #include "javascript/js.h" #include "utils/corestrings.h" #include "utils/messages.h" #include "utils/utils.h" #include "utils/log.h" /** * Get pointer shape for given box * * \param box box in question * \param imagemap whether an imagemap applies to the box */ static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap) { browser_pointer_shape pointer; css_computed_style *style; enum css_cursor_e cursor; lwc_string **cursor_uris; if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) style = box->children->style; else style = box->style; if (style == NULL) return BROWSER_POINTER_DEFAULT; cursor = css_computed_cursor(style, &cursor_uris); switch (cursor) { case CSS_CURSOR_AUTO: if (box->href || (box->gadget && (box->gadget->type == GADGET_IMAGE || box->gadget->type == GADGET_SUBMIT)) || imagemap) { /* link */ pointer = BROWSER_POINTER_POINT; } else if (box->gadget && (box->gadget->type == GADGET_TEXTBOX || box->gadget->type == GADGET_PASSWORD || box->gadget->type == GADGET_TEXTAREA)) { /* text input */ pointer = BROWSER_POINTER_CARET; } else { /* html content doesn't mind */ pointer = BROWSER_POINTER_AUTO; } break; case CSS_CURSOR_CROSSHAIR: pointer = BROWSER_POINTER_CROSS; break; case CSS_CURSOR_POINTER: pointer = BROWSER_POINTER_POINT; break; case CSS_CURSOR_MOVE: pointer = BROWSER_POINTER_MOVE; break; case CSS_CURSOR_E_RESIZE: pointer = BROWSER_POINTER_RIGHT; break; case CSS_CURSOR_W_RESIZE: pointer = BROWSER_POINTER_LEFT; break; case CSS_CURSOR_N_RESIZE: pointer = BROWSER_POINTER_UP; break; case CSS_CURSOR_S_RESIZE: pointer = BROWSER_POINTER_DOWN; break; case CSS_CURSOR_NE_RESIZE: pointer = BROWSER_POINTER_RU; break; case CSS_CURSOR_SW_RESIZE: pointer = BROWSER_POINTER_LD; break; case CSS_CURSOR_SE_RESIZE: pointer = BROWSER_POINTER_RD; break; case CSS_CURSOR_NW_RESIZE: pointer = BROWSER_POINTER_LU; break; case CSS_CURSOR_TEXT: pointer = BROWSER_POINTER_CARET; break; case CSS_CURSOR_WAIT: pointer = BROWSER_POINTER_WAIT; break; case CSS_CURSOR_PROGRESS: pointer = BROWSER_POINTER_PROGRESS; break; case CSS_CURSOR_HELP: pointer = BROWSER_POINTER_HELP; break; default: pointer = BROWSER_POINTER_DEFAULT; break; } return pointer; } /** * Start drag scrolling the contents of a box * * \param box the box to be scrolled * \param x x ordinate of initial mouse position * \param y y ordinate */ static void html_box_drag_start(struct box *box, int x, int y) { int box_x, box_y; int scroll_mouse_x, scroll_mouse_y; box_coords(box, &box_x, &box_y); if (box->scroll_x != NULL) { scroll_mouse_x = x - box_x ; scroll_mouse_y = y - (box_y + box->padding[TOP] + box->height + box->padding[BOTTOM] - SCROLLBAR_WIDTH); scrollbar_start_content_drag(box->scroll_x, scroll_mouse_x, scroll_mouse_y); } else if (box->scroll_y != NULL) { scroll_mouse_x = x - (box_x + box->padding[LEFT] + box->width + box->padding[RIGHT] - SCROLLBAR_WIDTH); scroll_mouse_y = y - box_y; scrollbar_start_content_drag(box->scroll_y, scroll_mouse_x, scroll_mouse_y); } } /** * End overflow scroll scrollbar drags * * \param h html content's high level cache entry * \param mouse state of mouse buttons and modifier keys * \param x coordinate of mouse * \param y coordinate of mouse */ static size_t html_selection_drag_end(struct html_content *html, browser_mouse_state mouse, int x, int y, int dir) { int pixel_offset; struct box *box; int dx, dy; size_t idx = 0; box = box_pick_text_box(html, x, y, dir, &dx, &dy); if (box) { plot_font_style_t fstyle; font_plot_style_from_css(box->style, &fstyle); nsfont.font_position_in_string(&fstyle, box->text, box->length, dx, &idx, &pixel_offset); idx += box->byte_offset; } return idx; } /** * Handle mouse tracking (including drags) in an HTML content window. * * \param c content of type html * \param bw browser window * \param mouse state of mouse buttons and modifier keys * \param x coordinate of mouse * \param y coordinate of mouse */ void html_mouse_track(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y) { html_mouse_action(c, bw, mouse, x, y); } /** Helper for file gadgets to store their filename unencoded on the * dom node associated with the gadget. * * \todo Get rid of this crap eventually */ static void html__image_coords_dom_user_data_handler(dom_node_operation operation, dom_string *key, void *_data, struct dom_node *src, struct dom_node *dst) { struct image_input_coords *oldcoords, *coords = _data, *newcoords; if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data, key) || coords == NULL) { return; } switch (operation) { case DOM_NODE_CLONED: newcoords = calloc(1, sizeof(*newcoords)); *newcoords = *coords; if (dom_node_set_user_data(dst, corestring_dom___ns_key_image_coords_node_data, newcoords, html__image_coords_dom_user_data_handler, &oldcoords) == DOM_NO_ERR) { free(oldcoords); } break; case DOM_NODE_RENAMED: case DOM_NODE_IMPORTED: case DOM_NODE_ADOPTED: break; case DOM_NODE_DELETED: free(coords); break; default: LOG(("User data operation not handled.")); assert(0); } } /** * Handle mouse clicks and movements in an HTML content window. * * \param c content of type html * \param bw browser window * \param mouse state of mouse buttons and modifier keys * \param x coordinate of mouse * \param y coordinate of mouse * * This function handles both hovering and clicking. It is important that the * code path is identical (except that hovering doesn't carry out the action), * so that the status bar reflects exactly what will happen. Having separate * code paths opens the possibility that an attacker will make the status bar * show some harmless action where clicking will be harmful. */ void html_mouse_action(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y) { html_content *html = (html_content *) c; enum { ACTION_NONE, ACTION_SUBMIT, ACTION_GO } action = ACTION_NONE; const char *title = 0; nsurl *url = 0; const char *target = 0; char status_buffer[200]; const char *status = 0; browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; bool imagemap = false; int box_x = 0, box_y = 0; int gadget_box_x = 0, gadget_box_y = 0; int html_object_pos_x = 0, html_object_pos_y = 0; int text_box_x = 0; struct box *url_box = 0; struct box *gadget_box = 0; struct box *text_box = 0; struct box *box; struct form_control *gadget = 0; hlcache_handle *object = NULL; struct box *html_object_box = NULL; struct browser_window *iframe = NULL; struct box *next_box; struct box *drag_candidate = NULL; struct scrollbar *scrollbar = NULL; plot_font_style_t fstyle; int scroll_mouse_x = 0, scroll_mouse_y = 0; int padding_left, padding_right, padding_top, padding_bottom; browser_drag_type drag_type = browser_window_get_drag_type(bw); union content_msg_data msg_data; struct dom_node *node = NULL; union html_drag_owner drag_owner; union html_selection_owner sel_owner; bool click = mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2 | BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2); if (drag_type != DRAGGING_NONE && !mouse && html->visible_select_menu != NULL) { /* drag end: select menu */ form_select_mouse_drag_end(html->visible_select_menu, mouse, x, y); } if (html->visible_select_menu != NULL) { box = html->visible_select_menu->box; box_coords(box, &box_x, &box_y); box_x -= box->border[LEFT].width; box_y += box->height + box->border[BOTTOM].width + box->padding[BOTTOM] + box->padding[TOP]; status = form_select_mouse_action(html->visible_select_menu, mouse, x - box_x, y - box_y); if (status != NULL) { msg_data.explicit_status_text = status; content_broadcast(c, CONTENT_MSG_STATUS, msg_data); } else { int width, height; form_select_get_dimensions(html->visible_select_menu, &width, &height); html->visible_select_menu = NULL; browser_window_redraw_rect(bw, box_x, box_y, width, height); } return; } if (html->drag_type == HTML_DRAG_SELECTION) { /* Selection drag */ struct box *box; int dir = -1; int dx, dy; if (!mouse) { /* End of selection drag */ int dir = -1; size_t idx; if (selection_dragging_start(&html->sel)) dir = 1; idx = html_selection_drag_end(html, mouse, x, y, dir); if (idx != 0) selection_track(&html->sel, mouse, idx); drag_owner.no_owner = true; html_set_drag_type(html, HTML_DRAG_NONE, drag_owner, NULL); return; } if (selection_dragging_start(&html->sel)) dir = 1; box = box_pick_text_box(html, x, y, dir, &dx, &dy); if (box != NULL) { int pixel_offset; size_t idx; plot_font_style_t fstyle; font_plot_style_from_css(box->style, &fstyle); nsfont.font_position_in_string(&fstyle, box->text, box->length, dx, &idx, &pixel_offset); selection_track(&html->sel, mouse, box->byte_offset + idx); } return; } if (html->drag_type == HTML_DRAG_SCROLLBAR) { struct scrollbar *scr = html->drag_owner.scrollbar; struct html_scrollbar_data *data = scrollbar_get_data(scr); if (!mouse) { /* drag end: scrollbar */ html_overflow_scroll_drag_end(scr, mouse, x, y); } box = data->box; box_coords(box, &box_x, &box_y); if (scrollbar_is_horizontal(scr)) { scroll_mouse_x = x - box_x ; scroll_mouse_y = y - (box_y + box->padding[TOP] + box->height + box->padding[BOTTOM] - SCROLLBAR_WIDTH); status = scrollbar_mouse_status_to_message( scrollbar_mouse_action(scr, mouse, scroll_mouse_x, scroll_mouse_y)); } else { scroll_mouse_x = x - (box_x + box->padding[LEFT] + box->width + box->padding[RIGHT] - SCROLLBAR_WIDTH); scroll_mouse_y = y - box_y; status = scrollbar_mouse_status_to_message( scrollbar_mouse_action(scr, mouse, scroll_mouse_x, scroll_mouse_y)); } msg_data.explicit_status_text = status; content_broadcast(c, CONTENT_MSG_STATUS, msg_data); return; } if (html->drag_type == HTML_DRAG_TEXTAREA_SELECTION || html->drag_type == HTML_DRAG_TEXTAREA_SCROLLBAR) { box = html->drag_owner.textarea; assert(box->gadget != NULL); assert(box->gadget->type == GADGET_TEXTAREA || box->gadget->type == GADGET_PASSWORD || box->gadget->type == GADGET_TEXTBOX); box_coords(box, &box_x, &box_y); textarea_mouse_action(box->gadget->data.text.ta, mouse, x - box_x, y - box_y); /* TODO: Set appropriate statusbar message */ return; } if (html->drag_type == HTML_DRAG_CONTENT_SELECTION || html->drag_type == HTML_DRAG_CONTENT_SCROLL) { box = html->drag_owner.content; assert(box->object != NULL); box_coords(box, &box_x, &box_y); content_mouse_track(box->object, bw, mouse, x - box_x, y - box_y); return; } if (html->drag_type == HTML_DRAG_CONTENT_SELECTION) { box = html->drag_owner.content; assert(box->object != NULL); box_coords(box, &box_x, &box_y); content_mouse_track(box->object, bw, mouse, x - box_x, y - box_y); return; } /* Content related drags handled by now */ assert(html->drag_type == HTML_DRAG_NONE); /* search the box tree for a link, imagemap, form control, or * box with scrollbars */ box = html->layout; /* Consider the margins of the html page now */ box_x = box->margin[LEFT]; box_y = box->margin[TOP]; /* descend through visible boxes setting more specific values for: * box - deepest box at point * html_object_box - html object * html_object_pos_x - html object * html_object_pos_y - html object * object - non html object * iframe - iframe * url - href or imagemap * target - href or imagemap or gadget * url_box - href or imagemap * imagemap - imagemap * gadget - gadget * gadget_box - gadget * gadget_box_x - gadget * gadget_box_y - gadget * title - title * pointer * * drag_candidate - first box with scroll * padding_left - box with scroll * padding_right * padding_top * padding_bottom * scrollbar - inside padding box stops decent * scroll_mouse_x - inside padding box stops decent * scroll_mouse_y - inside padding box stops decent * * text_box - text box * text_box_x - text_box */ while ((next_box = box_at_point(box, x, y, &box_x, &box_y)) != NULL) { box = next_box; if ((box->style != NULL) && (css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN)) { continue; } if (box->node != NULL) { node = box->node; } if (box->object) { if (content_get_type(box->object) == CONTENT_HTML) { html_object_box = box; html_object_pos_x = box_x; html_object_pos_y = box_y; } else { object = box->object; } } if (box->iframe) { iframe = box->iframe; } if (box->href) { url = box->href; target = box->target; url_box = box; } if (box->usemap) { url = imagemap_get(html, box->usemap, box_x, box_y, x, y, &target); if (url) { imagemap = true; url_box = box; } } if (box->gadget) { gadget = box->gadget; gadget_box = box; gadget_box_x = box_x; gadget_box_y = box_y; if (gadget->form) target = gadget->form->target; } if (box->title) { title = box->title; } pointer = get_pointer_shape(box, false); if ((box->scroll_x != NULL) || (box->scroll_y != NULL)) { if (drag_candidate == NULL) { drag_candidate = box; } padding_left = box_x + scrollbar_get_offset(box->scroll_x); padding_right = padding_left + box->padding[LEFT] + box->width + box->padding[RIGHT]; padding_top = box_y + scrollbar_get_offset(box->scroll_y); padding_bottom = padding_top + box->padding[TOP] + box->height + box->padding[BOTTOM]; if ((x > padding_left) && (x < padding_right) && (y > padding_top) && (y < padding_bottom)) { /* mouse inside padding box */ if ((box->scroll_y != NULL) && (x > (padding_right - SCROLLBAR_WIDTH))) { /* mouse above vertical box scroll */ scrollbar = box->scroll_y; scroll_mouse_x = x - (padding_right - SCROLLBAR_WIDTH); scroll_mouse_y = y - padding_top; break; } else if ((box->scroll_x != NULL) && (y > (padding_bottom - SCROLLBAR_WIDTH))) { /* mouse above horizontal box scroll */ scrollbar = box->scroll_x; scroll_mouse_x = x - padding_left; scroll_mouse_y = y - (padding_bottom - SCROLLBAR_WIDTH); break; } } } if (box->text && !box->object) { text_box = box; text_box_x = box_x; } } /* use of box_x, box_y, or content below this point is probably a * mistake; they will refer to the last box returned by box_at_point */ if (scrollbar) { status = scrollbar_mouse_status_to_message( scrollbar_mouse_action(scrollbar, mouse, scroll_mouse_x, scroll_mouse_y)); pointer = BROWSER_POINTER_DEFAULT; } else if (gadget) { textarea_mouse_status ta_status; switch (gadget->type) { case GADGET_SELECT: status = messages_get("FormSelect"); pointer = BROWSER_POINTER_MENU; if (mouse & BROWSER_MOUSE_CLICK_1 && nsoption_bool(core_select_menu)) { html->visible_select_menu = gadget; form_open_select_menu(c, gadget, form_select_menu_callback, c); pointer = BROWSER_POINTER_DEFAULT; } else if (mouse & BROWSER_MOUSE_CLICK_1) guit->browser->create_form_select_menu(bw, gadget); break; case GADGET_CHECKBOX: status = messages_get("FormCheckbox"); if (mouse & BROWSER_MOUSE_CLICK_1) { gadget->selected = !gadget->selected; dom_html_input_element_set_checked( (dom_html_input_element *)(gadget->node), gadget->selected); html__redraw_a_box(html, gadget_box); } break; case GADGET_RADIO: status = messages_get("FormRadio"); if (mouse & BROWSER_MOUSE_CLICK_1) form_radio_set(gadget); break; case GADGET_IMAGE: if (mouse & BROWSER_MOUSE_CLICK_1) { struct image_input_coords *coords, *oldcoords; /** \todo Find a way to not ignore errors */ coords = calloc(1, sizeof(*coords)); if (coords == NULL) { return; } coords->x = x - gadget_box_x; coords->y = y - gadget_box_y; if (dom_node_set_user_data( gadget->node, corestring_dom___ns_key_image_coords_node_data, coords, html__image_coords_dom_user_data_handler, &oldcoords) != DOM_NO_ERR) return; free(oldcoords); } /* drop through */ case GADGET_SUBMIT: if (gadget->form) { snprintf(status_buffer, sizeof status_buffer, messages_get("FormSubmit"), gadget->form->action); status = status_buffer; pointer = get_pointer_shape(gadget_box, false); if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) action = ACTION_SUBMIT; } else { status = messages_get("FormBadSubmit"); } break; case GADGET_TEXTBOX: case GADGET_PASSWORD: case GADGET_TEXTAREA: if (gadget->type == GADGET_TEXTAREA) status = messages_get("FormTextarea"); else status = messages_get("FormTextbox"); if (click && (html->selection_type != HTML_SELECTION_TEXTAREA || html->selection_owner.textarea != gadget_box)) { sel_owner.none = true; html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true); } ta_status = textarea_mouse_action(gadget->data.text.ta, mouse, x - gadget_box_x, y - gadget_box_y); if (ta_status & TEXTAREA_MOUSE_EDITOR) { pointer = get_pointer_shape(gadget_box, false); } else { pointer = BROWSER_POINTER_DEFAULT; status = scrollbar_mouse_status_to_message( ta_status >> 3); } break; case GADGET_HIDDEN: /* not possible: no box generated */ break; case GADGET_RESET: status = messages_get("FormReset"); break; case GADGET_FILE: status = messages_get("FormFile"); if (mouse & BROWSER_MOUSE_CLICK_1) { msg_data.gadget_click.gadget = gadget; content_broadcast(c, CONTENT_MSG_GADGETCLICK, msg_data); } break; case GADGET_BUTTON: /* This gadget cannot be activated */ status = messages_get("FormButton"); break; } } else if (object && (mouse & BROWSER_MOUSE_MOD_2)) { if (mouse & BROWSER_MOUSE_DRAG_2) { msg_data.dragsave.type = CONTENT_SAVE_NATIVE; msg_data.dragsave.content = object; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); } else if (mouse & BROWSER_MOUSE_DRAG_1) { msg_data.dragsave.type = CONTENT_SAVE_ORIG; msg_data.dragsave.content = object; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); } /* \todo should have a drag-saving object msg */ } else if (iframe) { int pos_x, pos_y; float scale = browser_window_get_scale(bw); browser_window_get_position(iframe, false, &pos_x, &pos_y); pos_x /= scale; pos_y /= scale; if (mouse & BROWSER_MOUSE_CLICK_1 || mouse & BROWSER_MOUSE_CLICK_2) { browser_window_mouse_click(iframe, mouse, x - pos_x, y - pos_y); } else { browser_window_mouse_track(iframe, mouse, x - pos_x, y - pos_y); } } else if (html_object_box) { if (click && (html->selection_type != HTML_SELECTION_CONTENT || html->selection_owner.content != html_object_box)) { sel_owner.none = true; html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true); } if (mouse & BROWSER_MOUSE_CLICK_1 || mouse & BROWSER_MOUSE_CLICK_2) { content_mouse_action(html_object_box->object, bw, mouse, x - html_object_pos_x, y - html_object_pos_y); } else { content_mouse_track(html_object_box->object, bw, mouse, x - html_object_pos_x, y - html_object_pos_y); } } else if (url) { if (title) { snprintf(status_buffer, sizeof status_buffer, "%s: %s", nsurl_access(url), title); status = status_buffer; } else status = nsurl_access(url); pointer = get_pointer_shape(url_box, imagemap); if (mouse & BROWSER_MOUSE_CLICK_1 && mouse & BROWSER_MOUSE_MOD_1) { /* force download of link */ browser_window_navigate(bw, url, content_get_url(c), BW_NAVIGATE_DOWNLOAD, NULL, NULL, NULL); } else if (mouse & BROWSER_MOUSE_CLICK_2 && mouse & BROWSER_MOUSE_MOD_1) { msg_data.savelink.url = nsurl_access(url); msg_data.savelink.title = title; content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data); } else if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) action = ACTION_GO; } else { bool done = false; /* frame resizing */ if (browser_window_frame_resize_start(bw, mouse, x, y, &pointer)) { if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) { status = messages_get("FrameDrag"); } done = true; } /* if clicking in the main page, remove the selection from any * text areas */ if (!done) { if (click && html->focus_type != HTML_FOCUS_SELF) { union html_focus_owner fo; fo.self = true; html_set_focus(html, HTML_FOCUS_SELF, fo, true, 0, 0, 0, NULL); } if (click && html->selection_type != HTML_SELECTION_SELF) { sel_owner.none = true; html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true); } if (text_box) { int pixel_offset; size_t idx; font_plot_style_from_css(text_box->style, &fstyle); nsfont.font_position_in_string(&fstyle, text_box->text, text_box->length, x - text_box_x, &idx, &pixel_offset); if (selection_click(&html->sel, mouse, text_box->byte_offset + idx)) { /* key presses must be directed at the * main browser window, paste text * operations ignored */ html_drag_type drag_type; union html_drag_owner drag_owner; if (selection_dragging(&html->sel)) { drag_type = HTML_DRAG_SELECTION; drag_owner.no_owner = true; html_set_drag_type(html, drag_type, drag_owner, NULL); status = messages_get( "Selecting"); } done = true; } } else if (mouse & BROWSER_MOUSE_PRESS_1) { union html_selection_owner sel_owner; sel_owner.none = true; selection_clear(&html->sel, true); } if (selection_defined(&html->sel)) { sel_owner.none = false; html_set_selection(html, HTML_SELECTION_SELF, sel_owner, true); } else if (click && html->selection_type != HTML_SELECTION_NONE) { sel_owner.none = true; html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true); } } if (!done) { if (title) status = title; if (mouse & BROWSER_MOUSE_DRAG_1) { if (mouse & BROWSER_MOUSE_MOD_2) { msg_data.dragsave.type = CONTENT_SAVE_COMPLETE; msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); } else { if (drag_candidate == NULL) { browser_window_page_drag_start( bw, x, y); } else { html_box_drag_start( drag_candidate, x, y); } pointer = BROWSER_POINTER_MOVE; } } else if (mouse & BROWSER_MOUSE_DRAG_2) { if (mouse & BROWSER_MOUSE_MOD_2) { msg_data.dragsave.type = CONTENT_SAVE_SOURCE; msg_data.dragsave.content = NULL; content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); } else { if (drag_candidate == NULL) { browser_window_page_drag_start( bw, x, y); } else { html_box_drag_start( drag_candidate, x, y); } pointer = BROWSER_POINTER_MOVE; } } } if (mouse && mouse < BROWSER_MOUSE_MOD_1) { /* ensure key presses still act on the browser window */ union html_focus_owner fo; fo.self = true; html_set_focus(html, HTML_FOCUS_SELF, fo, true, 0, 0, 0, NULL); } } if (!iframe && !html_object_box) { msg_data.explicit_status_text = status; content_broadcast(c, CONTENT_MSG_STATUS, msg_data); msg_data.pointer = pointer; content_broadcast(c, CONTENT_MSG_POINTER, msg_data); } /* fire dom click event */ if ((mouse & BROWSER_MOUSE_CLICK_1) || (mouse & BROWSER_MOUSE_CLICK_2)) { js_fire_event(html->jscontext, "click", html->document, node); } /* deferred actions that can cause this browser_window to be destroyed * and must therefore be done after set_status/pointer */ switch (action) { case ACTION_SUBMIT: form_submit(content_get_url(c), browser_window_find_target(bw, target, mouse), gadget->form, gadget); break; case ACTION_GO: browser_window_navigate(browser_window_find_target(bw, target, mouse), url, content_get_url(c), BW_NAVIGATE_HISTORY, NULL, NULL, NULL); break; case ACTION_NONE: break; } } /** * Handle keypresses. * * \param c content of type HTML * \param key The UCS4 character codepoint * \return true if key handled, false otherwise */ bool html_keypress(struct content *c, uint32_t key) { html_content *html = (html_content *) c; struct selection *sel = &html->sel; struct box *box; switch (html->focus_type) { case HTML_FOCUS_CONTENT: box = html->focus_owner.content; return content_keypress(box->object, key); case HTML_FOCUS_TEXTAREA: box = html->focus_owner.textarea; return box_textarea_keypress(html, box, key); default: /* Deal with it below */ break; } switch (key) { case KEY_COPY_SELECTION: selection_copy_to_clipboard(sel); return true; case KEY_CLEAR_SELECTION: selection_clear(sel, true); return true; case KEY_SELECT_ALL: selection_select_all(sel); return true; case KEY_ESCAPE: if (selection_defined(sel)) { selection_clear(sel, true); return true; } /* if there's no selection, leave Escape for the caller */ return false; } return false; } /** * Handle search. * * \param c content of type HTML * \param context front end private data * \param flags search flags * \param string search string */ void html_search(struct content *c, void *context, search_flags_t flags, const char *string) { html_content *html = (html_content *)c; assert(c != NULL); if (string != NULL && html->search_string != NULL && strcmp(string, html->search_string) == 0 && html->search != NULL) { /* Continue prev. search */ search_step(html->search, flags, string); } else if (string != NULL) { /* New search */ free(html->search_string); html->search_string = strdup(string); if (html->search_string == NULL) return; if (html->search != NULL) { search_destroy_context(html->search); html->search = NULL; } html->search = search_create_context(c, CONTENT_HTML, context); if (html->search == NULL) return; search_step(html->search, flags, string); } else { /* Clear search */ html_search_clear(c); free(html->search_string); html->search_string = NULL; } } /** * Terminate a search. * * \param c content of type HTML */ void html_search_clear(struct content *c) { html_content *html = (html_content *)c; assert(c != NULL); free(html->search_string); html->search_string = NULL; if (html->search != NULL) { search_destroy_context(html->search); } html->search = NULL; } /** * Callback for in-page scrollbars. */ void html_overflow_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data) { struct html_scrollbar_data *data = client_data; html_content *html = (html_content *)data->c; struct box *box = data->box; union content_msg_data msg_data; html_drag_type drag_type; union html_drag_owner drag_owner; switch(scrollbar_data->msg) { case SCROLLBAR_MSG_MOVED: html__redraw_a_box(html, box); break; case SCROLLBAR_MSG_SCROLL_START: { struct rect rect = { .x0 = scrollbar_data->x0, .y0 = scrollbar_data->y0, .x1 = scrollbar_data->x1, .y1 = scrollbar_data->y1 }; drag_type = HTML_DRAG_SCROLLBAR; drag_owner.scrollbar = scrollbar_data->scrollbar; html_set_drag_type(html, drag_type, drag_owner, &rect); } break; case SCROLLBAR_MSG_SCROLL_FINISHED: drag_type = HTML_DRAG_NONE; drag_owner.no_owner = true; html_set_drag_type(html, drag_type, drag_owner, NULL); msg_data.pointer = BROWSER_POINTER_AUTO; content_broadcast(data->c, CONTENT_MSG_POINTER, msg_data); break; } } /** * End overflow scroll scrollbar drags * * \param scroll scrollbar widget * \param mouse state of mouse buttons and modifier keys * \param x coordinate of mouse * \param y coordinate of mouse */ void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, browser_mouse_state mouse, int x, int y) { int scroll_mouse_x, scroll_mouse_y, box_x, box_y; struct html_scrollbar_data *data = scrollbar_get_data(scrollbar); struct box *box; box = data->box; box_coords(box, &box_x, &box_y); if (scrollbar_is_horizontal(scrollbar)) { scroll_mouse_x = x - box_x; scroll_mouse_y = y - (box_y + box->padding[TOP] + box->height + box->padding[BOTTOM] - SCROLLBAR_WIDTH); scrollbar_mouse_drag_end(scrollbar, mouse, scroll_mouse_x, scroll_mouse_y); } else { scroll_mouse_x = x - (box_x + box->padding[LEFT] + box->width + box->padding[RIGHT] - SCROLLBAR_WIDTH); scroll_mouse_y = y - box_y; scrollbar_mouse_drag_end(scrollbar, mouse, scroll_mouse_x, scroll_mouse_y); } } /* Documented in html_internal.h */ void html_set_drag_type(html_content *html, html_drag_type drag_type, union html_drag_owner drag_owner, const struct rect *rect) { union content_msg_data msg_data; assert(html != NULL); html->drag_type = drag_type; html->drag_owner = drag_owner; switch (drag_type) { case HTML_DRAG_NONE: assert(drag_owner.no_owner == true); msg_data.drag.type = CONTENT_DRAG_NONE; break; case HTML_DRAG_SCROLLBAR: case HTML_DRAG_TEXTAREA_SCROLLBAR: case HTML_DRAG_CONTENT_SCROLL: msg_data.drag.type = CONTENT_DRAG_SCROLL; break; case HTML_DRAG_SELECTION: assert(drag_owner.no_owner == true); /* Fall through */ case HTML_DRAG_TEXTAREA_SELECTION: case HTML_DRAG_CONTENT_SELECTION: msg_data.drag.type = CONTENT_DRAG_SELECTION; break; } msg_data.drag.rect = rect; /* Inform of the content's drag status change */ content_broadcast((struct content *)html, CONTENT_MSG_DRAG, msg_data); } /* Documented in html_internal.h */ void html_set_focus(html_content *html, html_focus_type focus_type, union html_focus_owner focus_owner, bool hide_caret, int x, int y, int height, const struct rect *clip) { union content_msg_data msg_data; int x_off = 0; int y_off = 0; struct rect cr; bool textarea_lost_focus = html->focus_type == HTML_FOCUS_TEXTAREA && focus_type != HTML_FOCUS_TEXTAREA; assert(html != NULL); switch (focus_type) { case HTML_FOCUS_SELF: assert(focus_owner.self == true); if (html->focus_type == HTML_FOCUS_SELF) /* Don't need to tell anyone anything */ return; break; case HTML_FOCUS_CONTENT: box_coords(focus_owner.content, &x_off, &y_off); break; case HTML_FOCUS_TEXTAREA: box_coords(focus_owner.textarea, &x_off, &y_off); break; } html->focus_type = focus_type; html->focus_owner = focus_owner; if (textarea_lost_focus) { msg_data.caret.type = CONTENT_CARET_REMOVE; } else if (focus_type != HTML_FOCUS_SELF && hide_caret) { msg_data.caret.type = CONTENT_CARET_HIDE; } else { if (clip != NULL) { cr = *clip; cr.x0 += x_off; cr.y0 += y_off; cr.x1 += x_off; cr.y1 += y_off; } msg_data.caret.type = CONTENT_CARET_SET_POS; msg_data.caret.pos.x = x + x_off; msg_data.caret.pos.y = y + y_off; msg_data.caret.pos.height = height; msg_data.caret.pos.clip = (clip == NULL) ? NULL : &cr; } /* Inform of the content's drag status change */ content_broadcast((struct content *)html, CONTENT_MSG_CARET, msg_data); } /* Documented in html_internal.h */ void html_set_selection(html_content *html, html_selection_type selection_type, union html_selection_owner selection_owner, bool read_only) { union content_msg_data msg_data; struct box *box; bool changed = false; bool same_type = html->selection_type == selection_type; assert(html != NULL); if ((selection_type == HTML_SELECTION_NONE && html->selection_type != HTML_SELECTION_NONE) || (selection_type != HTML_SELECTION_NONE && html->selection_type == HTML_SELECTION_NONE)) /* Existance of selection has changed, and we'll need to * inform our owner */ changed = true; /* Clear any existing selection */ if (html->selection_type != HTML_SELECTION_NONE) { switch (html->selection_type) { case HTML_SELECTION_SELF: if (same_type) break; selection_clear(&html->sel, true); break; case HTML_SELECTION_TEXTAREA: if (same_type && html->selection_owner.textarea == selection_owner.textarea) break; box = html->selection_owner.textarea; textarea_clear_selection(box->gadget->data.text.ta); break; case HTML_SELECTION_CONTENT: if (same_type && html->selection_owner.content == selection_owner.content) break; box = html->selection_owner.content; content_clear_selection(box->object); break; default: break; } } html->selection_type = selection_type; html->selection_owner = selection_owner; if (!changed) /* Don't need to report lack of change to owner */ return; /* Prepare msg */ switch (selection_type) { case HTML_SELECTION_NONE: assert(selection_owner.none == true); msg_data.selection.selection = false; break; case HTML_SELECTION_SELF: assert(selection_owner.none == false); /* fall through */ case HTML_SELECTION_TEXTAREA: case HTML_SELECTION_CONTENT: msg_data.selection.selection = true; break; default: break; } msg_data.selection.read_only = read_only; /* Inform of the content's selection status change */ content_broadcast((struct content *)html, CONTENT_MSG_SELECTION, msg_data); } netsurf-all-3.2/netsurf/render/html_script.c0000644000175000017500000003370112377677024020270 0ustar vincevince/* * Copyright 2012 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Content for text/html scripts (implementation). */ #include #include #include #include #include #include #include #include "utils/config.h" #include "utils/corestrings.h" #include "utils/log.h" #include "utils/messages.h" #include "javascript/js.h" #include "content/content_protected.h" #include "content/fetch.h" #include "content/hlcache.h" #include "render/html_internal.h" typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size) ; static script_handler_t *select_script_handler(content_type ctype) { if (ctype == CONTENT_JS) { return js_exec; } return NULL; } /* attempt defer and async script execution * * execute scripts using algorithm found in: * http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element * */ bool html_scripts_exec(html_content *c) { unsigned int i; struct html_script *s; script_handler_t *script_handler; if (c->jscontext == NULL) return false; for (i = 0, s = c->scripts; i != c->scripts_count; i++, s++) { if (s->already_started) { continue; } if ((s->type == HTML_SCRIPT_ASYNC) || (s->type == HTML_SCRIPT_DEFER)) { /* ensure script content is present */ if (s->data.handle == NULL) continue; /* ensure script content fetch status is not an error */ if (content_get_status(s->data.handle) == CONTENT_STATUS_ERROR) continue; /* ensure script handler for content type */ script_handler = select_script_handler( content_get_type(s->data.handle)); if (script_handler == NULL) continue; /* unsupported type */ if (content_get_status(s->data.handle) == CONTENT_STATUS_DONE) { /* external script is now available */ const char *data; unsigned long size; data = content_get_source_data( s->data.handle, &size ); script_handler(c->jscontext, data, size); s->already_started = true; } } } return true; } /* create new html script entry */ static struct html_script * html_process_new_script(html_content *c, dom_string *mimetype, enum html_script_type type) { struct html_script *nscript; /* add space for new script entry */ nscript = realloc(c->scripts, sizeof(struct html_script) * (c->scripts_count + 1)); if (nscript == NULL) { return NULL; } c->scripts = nscript; /* increment script entry count */ nscript = &c->scripts[c->scripts_count]; c->scripts_count++; nscript->already_started = false; nscript->parser_inserted = false; nscript->force_async = true; nscript->ready_exec = false; nscript->async = false; nscript->defer = false; nscript->type = type; nscript->mimetype = dom_string_ref(mimetype); /* reference mimetype */ return nscript; } /** * Callback for asyncronous scripts */ static nserror convert_script_async_cb(hlcache_handle *script, const hlcache_event *event, void *pw) { html_content *parent = pw; unsigned int i; struct html_script *s; /* Find script */ for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) { if (s->type == HTML_SCRIPT_ASYNC && s->data.handle == script) break; } assert(i != parent->scripts_count); switch (event->type) { case CONTENT_MSG_LOADING: break; case CONTENT_MSG_READY: break; case CONTENT_MSG_DONE: LOG(("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)))); parent->base.active--; LOG(("%d fetches active", parent->base.active)); break; case CONTENT_MSG_ERROR: LOG(("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error)); hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; LOG(("%d fetches active", parent->base.active)); content_add_error(&parent->base, "?", 0); break; default: break; } return NSERROR_OK; } /** * Callback for defer scripts */ static nserror convert_script_defer_cb(hlcache_handle *script, const hlcache_event *event, void *pw) { html_content *parent = pw; unsigned int i; struct html_script *s; /* Find script */ for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) { if (s->type == HTML_SCRIPT_DEFER && s->data.handle == script) break; } assert(i != parent->scripts_count); switch (event->type) { case CONTENT_MSG_DONE: LOG(("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)))); parent->base.active--; LOG(("%d fetches active", parent->base.active)); break; case CONTENT_MSG_ERROR: LOG(("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error)); hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; LOG(("%d fetches active", parent->base.active)); content_add_error(&parent->base, "?", 0); break; default: break; } /* if there are no active fetches remaining begin post parse * conversion */ if (html_can_begin_conversion(parent)) { html_begin_conversion(parent); } return NSERROR_OK; } /** * Callback for syncronous scripts */ static nserror convert_script_sync_cb(hlcache_handle *script, const hlcache_event *event, void *pw) { html_content *parent = pw; unsigned int i; struct html_script *s; script_handler_t *script_handler; dom_hubbub_error err; /* Find script */ for (i = 0, s = parent->scripts; i != parent->scripts_count; i++, s++) { if (s->type == HTML_SCRIPT_SYNC && s->data.handle == script) break; } assert(i != parent->scripts_count); switch (event->type) { case CONTENT_MSG_DONE: LOG(("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)))); parent->base.active--; LOG(("%d fetches active", parent->base.active)); s->already_started = true; /* attempt to execute script */ script_handler = select_script_handler(content_get_type(s->data.handle)); if (script_handler != NULL) { /* script has a handler */ const char *data; unsigned long size; data = content_get_source_data(s->data.handle, &size ); script_handler(parent->jscontext, data, size); } /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { LOG(("unpause returned 0x%x", err)); } break; case CONTENT_MSG_ERROR: LOG(("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error)); hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; LOG(("%d fetches active", parent->base.active)); content_add_error(&parent->base, "?", 0); s->already_started = true; /* continue parse */ err = dom_hubbub_parser_pause(parent->parser, false); if (err != DOM_HUBBUB_OK) { LOG(("unpause returned 0x%x", err)); } break; default: break; } /* if there are no active fetches remaining begin post parse * conversion */ if (html_can_begin_conversion(parent)) { html_begin_conversion(parent); } return NSERROR_OK; } /** * process a script with a src tag */ static dom_hubbub_error exec_src_script(html_content *c, dom_node *node, dom_string *mimetype, dom_string *src) { nserror ns_error; nsurl *joined; hlcache_child_context child; struct html_script *nscript; union content_msg_data msg_data; bool async; bool defer; enum html_script_type script_type; hlcache_handle_callback script_cb; dom_hubbub_error ret = DOM_HUBBUB_OK; dom_exception exc; /* returned by libdom functions */ /* src url */ ns_error = nsurl_join(c->base_url, dom_string_data(src), &joined); if (ns_error != NSERROR_OK) { msg_data.error = messages_get("NoMemory"); content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); return DOM_HUBBUB_NOMEM; } LOG(("script %i '%s'", c->scripts_count, nsurl_access(joined))); /* there are three ways to process the script tag at this point: * * Syncronously pause the parent parse and continue after * the script has downloaded and executed. (default) * Async Start the script downloading and execute it when it * becomes available. * Defered Start the script downloading and execute it when * the page has completed parsing, may be set along * with async where it is ignored. */ /* we interpret the presence of the async and defer attribute * as true and ignore its value, technically only the empty * value or the attribute name itself are valid. However * various browsers interpret this in various ways the most * compatible approach is to be liberal and accept any * value. Note setting the values to "false" still makes them true! */ exc = dom_element_has_attribute(node, corestring_dom_async, &async); if (exc != DOM_NO_ERR) { return DOM_HUBBUB_OK; /* dom error */ } if (async) { /* asyncronous script */ script_type = HTML_SCRIPT_ASYNC; script_cb = convert_script_async_cb; } else { exc = dom_element_has_attribute(node, corestring_dom_defer, &defer); if (exc != DOM_NO_ERR) { return DOM_HUBBUB_OK; /* dom error */ } if (defer) { /* defered script */ script_type = HTML_SCRIPT_DEFER; script_cb = convert_script_defer_cb; } else { /* syncronous script */ script_type = HTML_SCRIPT_SYNC; script_cb = convert_script_sync_cb; } } nscript = html_process_new_script(c, mimetype, script_type); if (nscript == NULL) { nsurl_unref(joined); msg_data.error = messages_get("NoMemory"); content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); return DOM_HUBBUB_NOMEM; } /* set up child fetch encoding and quirks */ child.charset = c->encoding; child.quirks = c->base.quirks; ns_error = hlcache_handle_retrieve(joined, 0, content_get_url(&c->base), NULL, script_cb, c, &child, CONTENT_SCRIPT, &nscript->data.handle); nsurl_unref(joined); if (ns_error != NSERROR_OK) { /* @todo Deal with fetch error better. currently assume * fetch never became active */ /* mark duff script fetch as already started */ nscript->already_started = true; LOG(("Fetch failed with error %d",ns_error)); } else { /* update base content active fetch count */ c->base.active++; LOG(("%d fetches active", c->base.active)); switch (script_type) { case HTML_SCRIPT_SYNC: ret = DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED; case HTML_SCRIPT_ASYNC: break; case HTML_SCRIPT_DEFER: break; default: assert(0); } } return ret; } static dom_hubbub_error exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype) { union content_msg_data msg_data; dom_string *script; dom_exception exc; /* returned by libdom functions */ struct lwc_string_s *lwcmimetype; script_handler_t *script_handler; struct html_script *nscript; /* does not appear to be a src so script is inline content */ exc = dom_node_get_text_content(node, &script); if ((exc != DOM_NO_ERR) || (script == NULL)) { return DOM_HUBBUB_OK; /* no contents, skip */ } nscript = html_process_new_script(c, mimetype, HTML_SCRIPT_INLINE); if (nscript == NULL) { dom_string_unref(script); msg_data.error = messages_get("NoMemory"); content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data); return DOM_HUBBUB_NOMEM; } nscript->data.string = script; nscript->already_started = true; /* ensure script handler for content type */ dom_string_intern(mimetype, &lwcmimetype); script_handler = select_script_handler(content_factory_type_from_mime_type(lwcmimetype)); lwc_string_unref(lwcmimetype); if (script_handler != NULL) { script_handler(c->jscontext, dom_string_data(script), dom_string_byte_length(script)); } return DOM_HUBBUB_OK; } /** * process script node parser callback * * */ dom_hubbub_error html_process_script(void *ctx, dom_node *node) { html_content *c = (html_content *)ctx; dom_exception exc; /* returned by libdom functions */ dom_string *src, *mimetype; dom_hubbub_error err = DOM_HUBBUB_OK; /* ensure javascript context is available */ if (c->jscontext == NULL) { union content_msg_data msg_data; msg_data.jscontext = &c->jscontext; content_broadcast(&c->base, CONTENT_MSG_GETCTX, msg_data); LOG(("javascript context %p ", c->jscontext)); if (c->jscontext == NULL) { /* no context and it could not be created, abort */ return DOM_HUBBUB_OK; } } LOG(("content %p parser %p node %p", c, c->parser, node)); exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype); if (exc != DOM_NO_ERR || mimetype == NULL) { mimetype = dom_string_ref(corestring_dom_text_javascript); } exc = dom_element_get_attribute(node, corestring_dom_src, &src); if (exc != DOM_NO_ERR || src == NULL) { err = exec_inline_script(c, node, mimetype); } else { err = exec_src_script(c, node, mimetype, src); dom_string_unref(src); } dom_string_unref(mimetype); return err; } void html_free_scripts(html_content *html) { unsigned int i; for (i = 0; i != html->scripts_count; i++) { if (html->scripts[i].mimetype != NULL) { dom_string_unref(html->scripts[i].mimetype); } if ((html->scripts[i].type == HTML_SCRIPT_INLINE) && (html->scripts[i].data.string != NULL)) { dom_string_unref(html->scripts[i].data.string); } else if ((html->scripts[i].type == HTML_SCRIPT_SYNC) && (html->scripts[i].data.handle != NULL)) { hlcache_handle_release(html->scripts[i].data.handle); } } free(html->scripts); } netsurf-all-3.2/netsurf/render/html_css_fetcher.c0000644000175000017500000001725212377677024021257 0ustar vincevince/* * Copyright 2008 Rob Kendrick * Copyright 2013 John-Mark Bell * * This file is part of NetSurf. * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #include #include #include #include #include #include "utils/config.h" #include "content/fetch.h" #include "content/fetchers.h" #include "render/html_internal.h" #include "utils/log.h" #include "utils/ring.h" #include "utils/nsurl.h" #include "utils/utils.h" typedef struct html_css_fetcher_item { uint32_t key; dom_string *data; nsurl *base_url; struct html_css_fetcher_item *r_next, *r_prev; } html_css_fetcher_item; typedef struct html_css_fetcher_context { struct fetch *parent_fetch; nsurl *url; html_css_fetcher_item *item; bool aborted; bool locked; struct html_css_fetcher_context *r_next, *r_prev; } html_css_fetcher_context; static uint32_t current_key = 0; static html_css_fetcher_item *items = NULL; static html_css_fetcher_context *ring = NULL; static bool html_css_fetcher_initialise(lwc_string *scheme) { LOG(("html_css_fetcher_initialise called for %s", lwc_string_data(scheme))); return true; } static void html_css_fetcher_finalise(lwc_string *scheme) { LOG(("html_css_fetcher_finalise called for %s", lwc_string_data(scheme))); } static bool html_css_fetcher_can_fetch(const nsurl *url) { return true; } static void *html_css_fetcher_setup(struct fetch *parent_fetch, nsurl *url, bool only_2xx, bool downgrade_tls, const char *post_urlenc, const struct fetch_multipart_data *post_multipart, const char **headers) { html_css_fetcher_context *ctx; lwc_string *path; uint32_t key; html_css_fetcher_item *item, *found = NULL; /* format of a x-ns-css URL is: * x-ns-url: * Where key is an unsigned 32bit integer */ path = nsurl_get_component(url, NSURL_PATH); /* The path must exist */ if (path == NULL) { return NULL; } key = strtoul(lwc_string_data(path), NULL, 10); lwc_string_unref(path); /* There must be at least one item */ if (items == NULL) { return NULL; } item = items; do { if (item->key == key) { found = item; break; } item = item->r_next; } while (item != items); /* We must have found the item */ if (found == NULL) { return NULL; } ctx = calloc(1, sizeof(*ctx)); if (ctx == NULL) return NULL; ctx->parent_fetch = parent_fetch; ctx->url = nsurl_ref(url); ctx->item = found; RING_INSERT(ring, ctx); return ctx; } static bool html_css_fetcher_start(void *ctx) { return true; } static void html_css_fetcher_free(void *ctx) { html_css_fetcher_context *c = ctx; nsurl_unref(c->url); if (c->item != NULL) { nsurl_unref(c->item->base_url); dom_string_unref(c->item->data); RING_REMOVE(items, c->item); free(c->item); } RING_REMOVE(ring, c); free(ctx); } static void html_css_fetcher_abort(void *ctx) { html_css_fetcher_context *c = ctx; /* To avoid the poll loop having to deal with the fetch context * disappearing from under it, we simply flag the abort here. * The poll loop itself will perform the appropriate cleanup. */ c->aborted = true; } static void html_css_fetcher_send_callback(const fetch_msg *msg, html_css_fetcher_context *c) { c->locked = true; fetch_send_callback(msg, c->parent_fetch); c->locked = false; } static void html_css_fetcher_poll(lwc_string *scheme) { fetch_msg msg; html_css_fetcher_context *c, *next; if (ring == NULL) return; /* Iterate over ring, processing each pending fetch */ c = ring; do { /* Ignore fetches that have been flagged as locked. * This allows safe re-entrant calls to this function. * Re-entrancy can occur if, as a result of a callback, * the interested party causes fetch_poll() to be called * again. */ if (c->locked == true) { next = c->r_next; continue; } /* Only process non-aborted fetches */ if (c->aborted) { /* Nothing to do */ assert(c->locked == false); } else if (c->item != NULL) { char header[4096]; fetch_set_http_code(c->parent_fetch, 200); /* Any callback can result in the fetch being aborted. * Therefore, we _must_ check for this after _every_ * call to html_css_fetcher_send_callback(). */ snprintf(header, sizeof header, "Content-Type: text/css; charset=utf-8"); msg.type = FETCH_HEADER; msg.data.header_or_data.buf = (const uint8_t *) header; msg.data.header_or_data.len = strlen(header); html_css_fetcher_send_callback(&msg, c); if (c->aborted == false) { snprintf(header, sizeof header, "Content-Length: %"SSIZET_FMT, dom_string_byte_length(c->item->data)); msg.type = FETCH_HEADER; msg.data.header_or_data.buf = (const uint8_t *) header; msg.data.header_or_data.len = strlen(header); html_css_fetcher_send_callback(&msg, c); } if (c->aborted == false) { snprintf(header, sizeof header, "X-NS-Base: %.*s", (int) nsurl_length(c->item->base_url), nsurl_access(c->item->base_url)); msg.type = FETCH_HEADER; msg.data.header_or_data.buf = (const uint8_t *) header; msg.data.header_or_data.len = strlen(header); html_css_fetcher_send_callback(&msg, c); } if (c->aborted == false) { msg.type = FETCH_DATA; msg.data.header_or_data.buf = (const uint8_t *) dom_string_data(c->item->data); msg.data.header_or_data.len = dom_string_byte_length(c->item->data); html_css_fetcher_send_callback(&msg, c); } if (c->aborted == false) { msg.type = FETCH_FINISHED; html_css_fetcher_send_callback(&msg, c); } } else { LOG(("Processing of %s failed!", nsurl_access(c->url))); /* Ensure that we're unlocked here. If we aren't, * then html_css_fetcher_process() is broken. */ assert(c->locked == false); } /* Compute next fetch item at the last possible moment as * processing this item may have added to the ring. */ next = c->r_next; fetch_remove_from_queues(c->parent_fetch); fetch_free(c->parent_fetch); /* Advance to next ring entry, exiting if we've reached * the start of the ring or the ring has become empty */ } while ( (c = next) != ring && ring != NULL); } void html_css_fetcher_register(void) { lwc_string *scheme; const struct fetcher_operation_table html_css_fetcher_ops = { .initialise = html_css_fetcher_initialise, .acceptable = html_css_fetcher_can_fetch, .setup = html_css_fetcher_setup, .start = html_css_fetcher_start, .abort = html_css_fetcher_abort, .free = html_css_fetcher_free, .poll = html_css_fetcher_poll, .finalise = html_css_fetcher_finalise }; if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"), &scheme) != lwc_error_ok) { die("Failed to initialise the fetch module " "(couldn't intern \"x-ns-css\")."); } fetcher_add(scheme, &html_css_fetcher_ops); } nserror html_css_fetcher_add_item(dom_string *data, nsurl *base_url, uint32_t *key) { html_css_fetcher_item *item = malloc(sizeof(*item)); if (item == NULL) { return NSERROR_NOMEM; } *key = item->key = current_key++; item->data = dom_string_ref(data); item->base_url = nsurl_ref(base_url); RING_INSERT(items, item); return NSERROR_OK; } netsurf-all-3.2/netsurf/render/search.h0000644000175000017500000000510612377677024017210 0ustar vincevince/* * Copyright 2009 Mark Benjamin * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef _NETSURF_RENDER_SEARCH_H_ #define _NETSURF_RENDER_SEARCH_H_ #include #include #include "desktop/search.h" struct search_context; /** * create a search_context * * \param c the content the search_context is connected to * \param type the content type of c * \param callbacks the callbacks to modify appearance according to results * \param p the pointer to send to the callbacks * \return true for success */ struct search_context * search_create_context(struct content *c, content_type type, void *context); /** * Ends the search process, invalidating all state * freeing the list of found boxes */ void search_destroy_context(struct search_context *context); /** * Begins/continues the search process * Note that this may be called many times for a single search. * * \param bw the browser_window to search in * \param flags the flags forward/back etc * \param string the string to match */ void search_step(struct search_context *context, search_flags_t flags, const char * string); /** * Specifies whether all matches or just the current match should * be highlighted in the search text. */ void search_show_all(bool all, struct search_context *context); /** * Determines whether any portion of the given text box should be * selected because it matches the current search string. * * \param bw browser window * \param start_offset byte offset within text of string to be checked * \param end_offset byte offset within text * \param start_idx byte offset within string of highlight start * \param end_idx byte offset of highlight end * \return true iff part of the box should be highlighted */ bool search_term_highlighted(struct content *c, unsigned start_offset, unsigned end_offset, unsigned *start_idx, unsigned *end_idx, struct search_context *context); #endif netsurf-all-3.2/netsurf/render/html_forms.c0000644000175000017500000003403512377677024020113 0ustar vincevince/* * Copyright 2011 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "render/form.h" #include "render/html_internal.h" #include "utils/corestrings.h" #include "utils/log.h" /** * process form element from dom */ static struct form * parse_form_element(const char *docenc, dom_node *node) { dom_string *ds_action = NULL; dom_string *ds_charset = NULL; dom_string *ds_target = NULL; dom_string *ds_method = NULL; dom_string *ds_enctype = NULL; char *action = NULL, *charset = NULL, *target = NULL; form_method method; dom_html_form_element *formele = (dom_html_form_element *)(node); struct form * ret = NULL; /* Retrieve the attributes from the node */ if (dom_html_form_element_get_action(formele, &ds_action) != DOM_NO_ERR) goto out; if (dom_html_form_element_get_accept_charset(formele, &ds_charset) != DOM_NO_ERR) goto out; if (dom_html_form_element_get_target(formele, &ds_target) != DOM_NO_ERR) goto out; if (dom_html_form_element_get_method(formele, &ds_method) != DOM_NO_ERR) goto out; if (dom_html_form_element_get_enctype(formele, &ds_enctype) != DOM_NO_ERR) goto out; /* Extract the plain attributes ready for use. We have to do this * because we cannot guarantee that the dom_strings are NULL terminated * and thus we copy them. */ if (ds_action != NULL) action = strndup(dom_string_data(ds_action), dom_string_byte_length(ds_action)); if (ds_charset != NULL) charset = strndup(dom_string_data(ds_charset), dom_string_byte_length(ds_charset)); if (ds_target != NULL) target = strndup(dom_string_data(ds_target), dom_string_byte_length(ds_target)); /* Determine the method */ method = method_GET; if (ds_method != NULL) { if (dom_string_caseless_lwc_isequal(ds_method, corestring_lwc_post)) { method = method_POST_URLENC; if (ds_enctype != NULL) { if (dom_string_caseless_lwc_isequal(ds_enctype, corestring_lwc_multipart_form_data)) { method = method_POST_MULTIPART; } } } } /* Construct the form object */ ret = form_new(node, action, target, method, charset, docenc); out: if (ds_action != NULL) dom_string_unref(ds_action); if (ds_charset != NULL) dom_string_unref(ds_charset); if (ds_target != NULL) dom_string_unref(ds_target); if (ds_method != NULL) dom_string_unref(ds_method); if (ds_enctype != NULL) dom_string_unref(ds_enctype); if (action != NULL) free(action); if (charset != NULL) free(charset); if (target != NULL) free(target); return ret; } /* documented in html_internal.h */ struct form *html_forms_get_forms(const char *docenc, dom_html_document *doc) { dom_html_collection *forms; struct form *ret = NULL, *newf; dom_node *node; unsigned long n; uint32_t nforms; if (doc == NULL) return NULL; /* Attempt to build a set of all the forms */ if (dom_html_document_get_forms(doc, &forms) != DOM_NO_ERR) return NULL; /* Count the number of forms so we can iterate */ if (dom_html_collection_get_length(forms, &nforms) != DOM_NO_ERR) goto out; /* Iterate the forms collection, making form structs for returning */ for (n = 0; n < nforms; ++n) { if (dom_html_collection_item(forms, n, &node) != DOM_NO_ERR) { goto out; } newf = parse_form_element(docenc, node); dom_node_unref(node); if (newf == NULL) { goto err; } newf->prev = ret; ret = newf; } /* All went well */ goto out; err: while (ret != NULL) { struct form *prev = ret->prev; /* Destroy ret */ free(ret); ret = prev; } out: /* Finished with the collection, return it */ dom_html_collection_unref(forms); return ret; } static struct form * find_form(struct form *forms, dom_html_form_element *form) { while (forms != NULL) { if (forms->node == form) break; forms = forms->prev; } return forms; } static struct form_control * parse_button_element(struct form *forms, dom_html_button_element *button) { struct form_control *control = NULL; dom_exception err; dom_html_form_element *form = NULL; dom_string *ds_type = NULL; dom_string *ds_value = NULL; dom_string *ds_name = NULL; err = dom_html_button_element_get_form(button, &form); if (err != DOM_NO_ERR) goto out; err = dom_html_button_element_get_type(button, &ds_type); if (err != DOM_NO_ERR) goto out; if (ds_type == NULL) { control = form_new_control(button, GADGET_SUBMIT); } else { if (dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_submit)) { control = form_new_control(button, GADGET_SUBMIT); } else if (dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_reset)) { control = form_new_control(button, GADGET_RESET); } else { control = form_new_control(button, GADGET_BUTTON); } } if (control == NULL) goto out; err = dom_html_button_element_get_value(button, &ds_value); if (err != DOM_NO_ERR) goto out; err = dom_html_button_element_get_name(button, &ds_name); if (err != DOM_NO_ERR) goto out; if (ds_value != NULL) { control->value = strndup( dom_string_data(ds_value), dom_string_byte_length(ds_value)); if (control->value == NULL) { form_free_control(control); control = NULL; goto out; } } if (ds_name != NULL) { control->name = strndup( dom_string_data(ds_name), dom_string_byte_length(ds_name)); if (control->name == NULL) { form_free_control(control); control = NULL; goto out; } } if (form != NULL && control != NULL) form_add_control(find_form(forms, form), control); out: if (form != NULL) dom_node_unref(form); if (ds_type != NULL) dom_string_unref(ds_type); if (ds_value != NULL) dom_string_unref(ds_value); if (ds_name != NULL) dom_string_unref(ds_name); return control; } static struct form_control * parse_input_element(struct form *forms, dom_html_input_element *input) { struct form_control *control = NULL; dom_html_form_element *form = NULL; dom_string *ds_type = NULL; dom_string *ds_name = NULL; dom_string *ds_value = NULL; char *name = NULL; if (dom_html_input_element_get_form(input, &form) != DOM_NO_ERR) goto out; if (dom_html_input_element_get_type(input, &ds_type) != DOM_NO_ERR) goto out; if (dom_html_input_element_get_name(input, &ds_name) != DOM_NO_ERR) goto out; if (ds_name != NULL) name = strndup(dom_string_data(ds_name), dom_string_byte_length(ds_name)); if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_password)) { control = form_new_control(input, GADGET_PASSWORD); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_file)) { control = form_new_control(input, GADGET_FILE); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_hidden)) { control = form_new_control(input, GADGET_HIDDEN); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_checkbox)) { control = form_new_control(input, GADGET_CHECKBOX); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_radio)) { control = form_new_control(input, GADGET_RADIO); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_submit)) { control = form_new_control(input, GADGET_SUBMIT); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_reset)) { control = form_new_control(input, GADGET_RESET); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_button)) { control = form_new_control(input, GADGET_BUTTON); } else if (ds_type != NULL && dom_string_caseless_lwc_isequal(ds_type, corestring_lwc_image)) { control = form_new_control(input, GADGET_IMAGE); } else { control = form_new_control(input, GADGET_TEXTBOX); } if (control == NULL) goto out; if (name != NULL) { /* Hand the name string over */ control->name = name; name = NULL; } if (control->type == GADGET_CHECKBOX || control->type == GADGET_RADIO) { bool selected; if (dom_html_input_element_get_checked( input, &selected) == DOM_NO_ERR) { control->selected = selected; } } if (control->type == GADGET_PASSWORD || control->type == GADGET_TEXTBOX) { int32_t maxlength; if (dom_html_input_element_get_max_length( input, &maxlength) != DOM_NO_ERR) { maxlength = -1; } if (maxlength >= 0) { /* Got valid maxlength */ control->maxlength = maxlength; } else { /* Input has no maxlength attr, or * dom_html_input_element_get_max_length failed. * * Set it to something insane. */ control->maxlength = UINT_MAX; } } if (control->type != GADGET_FILE && control->type != GADGET_IMAGE) { if (dom_html_input_element_get_value( input, &ds_value) == DOM_NO_ERR) { if (ds_value != NULL) { control->value = strndup( dom_string_data(ds_value), dom_string_byte_length(ds_value)); if (control->value == NULL) { form_free_control(control); control = NULL; goto out; } control->length = strlen(control->value); } } if (control->type == GADGET_TEXTBOX || control->type == GADGET_PASSWORD) { if (control->value == NULL) { control->value = strdup(""); if (control->value == NULL) { form_free_control(control); control = NULL; goto out; } control->length = 0; } control->initial_value = strdup(control->value); if (control->initial_value == NULL) { form_free_control(control); control = NULL; goto out; } } } if (form != NULL && control != NULL) form_add_control(find_form(forms, form), control); out: if (form != NULL) dom_node_unref(form); if (ds_type != NULL) dom_string_unref(ds_type); if (ds_name != NULL) dom_string_unref(ds_name); if (ds_value != NULL) dom_string_unref(ds_value); if (name != NULL) free(name); return control; } static struct form_control * parse_textarea_element(struct form *forms, dom_html_text_area_element *ta) { struct form_control *control = NULL; dom_html_form_element *form = NULL; dom_string *ds_name = NULL; char *name = NULL; if (dom_html_text_area_element_get_form(ta, &form) != DOM_NO_ERR) goto out; if (dom_html_text_area_element_get_name(ta, &ds_name) != DOM_NO_ERR) goto out; if (ds_name != NULL) name = strndup(dom_string_data(ds_name), dom_string_byte_length(ds_name)); control = form_new_control(ta, GADGET_TEXTAREA); if (control == NULL) goto out; if (name != NULL) { /* Hand the name string over */ control->name = name; name = NULL; } if (form != NULL && control != NULL) form_add_control(find_form(forms, form), control); out: if (form != NULL) dom_node_unref(form); if (ds_name != NULL) dom_string_unref(ds_name); if (name != NULL) free(name); return control; } static struct form_control * parse_select_element(struct form *forms, dom_html_select_element *select) { struct form_control *control = NULL; dom_html_form_element *form = NULL; dom_string *ds_name = NULL; char *name = NULL; if (dom_html_select_element_get_form(select, &form) != DOM_NO_ERR) goto out; if (dom_html_select_element_get_name(select, &ds_name) != DOM_NO_ERR) goto out; if (ds_name != NULL) name = strndup(dom_string_data(ds_name), dom_string_byte_length(ds_name)); control = form_new_control(select, GADGET_SELECT); if (control == NULL) goto out; if (name != NULL) { /* Hand the name string over */ control->name = name; name = NULL; } dom_html_select_element_get_multiple(select, &(control->data.select.multiple)); if (form != NULL && control != NULL) form_add_control(find_form(forms, form), control); out: if (form != NULL) dom_node_unref(form); if (ds_name != NULL) dom_string_unref(ds_name); if (name != NULL) free(name); return control; } static struct form_control * invent_fake_gadget(dom_node *node) { struct form_control *ctl = form_new_control(node, GADGET_HIDDEN); if (ctl != NULL) { ctl->value = strdup(""); ctl->initial_value = strdup(""); ctl->name = strdup("foo"); if (ctl->value == NULL || ctl->initial_value == NULL || ctl->name == NULL) { form_free_control(ctl); ctl = NULL; } } return ctl; } /* documented in html_internal.h */ struct form_control *html_forms_get_control_for_node(struct form *forms, dom_node *node) { struct form *f; struct form_control *ctl = NULL; dom_exception err; dom_string *ds_name = NULL; /* Step one, see if we already have a control */ for (f = forms; f != NULL; f = f->prev) { for (ctl = f->controls; ctl != NULL; ctl = ctl->next) { if (ctl->node == node) return ctl; } } /* Step two, extract the node's name so we can construct a gadget. */ err = dom_element_get_tag_name(node, &ds_name); if (err == DOM_NO_ERR && ds_name != NULL) { /* Step three, attempt to work out what gadget to make */ if (dom_string_caseless_lwc_isequal(ds_name, corestring_lwc_button)) { ctl = parse_button_element(forms, (dom_html_button_element *) node); } else if (dom_string_caseless_lwc_isequal(ds_name, corestring_lwc_input)) { ctl = parse_input_element(forms, (dom_html_input_element *) node); } else if (dom_string_caseless_lwc_isequal(ds_name, corestring_lwc_textarea)) { ctl = parse_textarea_element(forms, (dom_html_text_area_element *) node); } else if (dom_string_caseless_lwc_isequal(ds_name, corestring_lwc_select)) { ctl = parse_select_element(forms, (dom_html_select_element *) node); } } /* If all else fails, fake gadget time */ if (ctl == NULL) ctl = invent_fake_gadget(node); if (ds_name != NULL) dom_string_unref(ds_name); return ctl; } netsurf-all-3.2/netsurf/render/textplain.h0000644000175000017500000000331012377677024017746 0ustar vincevince/* * Copyright 2006 James Bursa * Copyright 2006 Adrian Lees * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Content for text/plain (interface). */ #ifndef _NETSURF_RENDER_TEXTPLAIN_H_ #define _NETSURF_RENDER_TEXTPLAIN_H_ #include #include "desktop/mouse.h" struct content; struct hlcache_handle; struct http_parameter; struct rect; nserror textplain_init(void); /* access to lines for text selection and searching */ unsigned long textplain_line_count(struct content *c); size_t textplain_size(struct content *c); size_t textplain_offset_from_coords(struct content *c, int x, int y, int dir); void textplain_coords_from_range(struct content *c, unsigned start, unsigned end, struct rect *r); char *textplain_get_line(struct content *c, unsigned lineno, size_t *poffset, size_t *plen); int textplain_find_line(struct content *c, unsigned offset); char *textplain_get_raw_data(struct content *c, unsigned start, unsigned end, size_t *plen); struct browser_window *textplain_get_browser_window(struct content *c); #endif netsurf-all-3.2/netsurf/render/box.h0000644000175000017500000002717012377677024016540 0ustar vincevince/* * Copyright 2005 James Bursa * Copyright 2003 Phil Mellor * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Box tree construction and manipulation (interface). * * This stage of rendering converts a tree of dom_nodes (produced by libdom) * to a tree of struct box. The box tree represents the structure of the * document as given by the CSS display and float properties. * * For example, consider the following HTML: * \code *

Example Heading

*

Example paragraph with emphasised text etc.

\endcode * * This would produce approximately the following box tree with default CSS * rules: * \code * BOX_BLOCK (corresponds to h1) * BOX_INLINE_CONTAINER * BOX_INLINE "Example Heading" * BOX_BLOCK (p) * BOX_INLINE_CONTAINER * BOX_INLINE "Example paragraph " * BOX_INLINE "with emphasised text" (em) * BOX_INLINE "etc." \endcode * * Note that the em has been collapsed into the INLINE_CONTAINER. * * If these CSS rules were applied: * \code * h1 { display: table-cell } * p { display: table-cell } * em { float: left; width: 5em } \endcode * * then the box tree would instead look like this: * \code * BOX_TABLE * BOX_TABLE_ROW_GROUP * BOX_TABLE_ROW * BOX_TABLE_CELL (h1) * BOX_INLINE_CONTAINER * BOX_INLINE "Example Heading" * BOX_TABLE_CELL (p) * BOX_INLINE_CONTAINER * BOX_INLINE "Example paragraph " * BOX_FLOAT_LEFT (em) * BOX_BLOCK * BOX_INLINE_CONTAINER * BOX_INLINE "with emphasised text" * BOX_INLINE "etc." \endcode * * Here implied boxes have been added and a float is present. * * A box tree is "normalized" if the following is satisfied: * \code * parent permitted child nodes * BLOCK, INLINE_BLOCK BLOCK, INLINE_CONTAINER, TABLE * INLINE_CONTAINER INLINE, INLINE_BLOCK, FLOAT_LEFT, FLOAT_RIGHT, BR, TEXT, * INLINE_END * INLINE none * TABLE at least 1 TABLE_ROW_GROUP * TABLE_ROW_GROUP at least 1 TABLE_ROW * TABLE_ROW at least 1 TABLE_CELL * TABLE_CELL BLOCK, INLINE_CONTAINER, TABLE (same as BLOCK) * FLOAT_(LEFT|RIGHT) exactly 1 BLOCK or TABLE * \endcode */ #ifndef _NETSURF_RENDER_BOX_H_ #define _NETSURF_RENDER_BOX_H_ #include #include #include #include "css/css.h" #include "utils/nsurl.h" #include "utils/types.h" struct content; struct box; struct browser_window; struct column; struct object_params; struct object_param; struct html_content; struct dom_node; #define UNKNOWN_WIDTH INT_MAX #define UNKNOWN_MAX_WIDTH INT_MAX typedef void (*box_construct_complete_cb)(struct html_content *c, bool success); /** Type of a struct box. */ typedef enum { BOX_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE, BOX_TABLE, BOX_TABLE_ROW, BOX_TABLE_CELL, BOX_TABLE_ROW_GROUP, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, BOX_INLINE_BLOCK, BOX_BR, BOX_TEXT, BOX_INLINE_END, BOX_NONE } box_type; /** Flags for a struct box. */ typedef enum { NEW_LINE = 1 << 0, /* first inline on a new line */ STYLE_OWNED = 1 << 1, /* style is owned by this box */ PRINTED = 1 << 2, /* box has already been printed */ PRE_STRIP = 1 << 3, /* PRE tag needing leading newline stripped */ CLONE = 1 << 4, /* continuation of previous box from wrapping */ MEASURED = 1 << 5, /* text box width has been measured */ HAS_HEIGHT = 1 << 6, /* box has height (perhaps due to children) */ MAKE_HEIGHT = 1 << 7, /* box causes its own height */ NEED_MIN = 1 << 8, /* minimum width is required for layout */ REPLACE_DIM = 1 << 9, /* replaced element has given dimensions */ IFRAME = 1 << 10, /* box contains an iframe */ CONVERT_CHILDREN = 1 << 11 /* wanted children converting */ } box_flags; /* Sides of a box */ enum box_side { TOP, RIGHT, BOTTOM, LEFT }; /** * Container for box border details */ struct box_border { enum css_border_style_e style; /**< border-style */ css_color c; /**< border-color value */ int width; /**< border-width (pixels) */ }; /** Node in box tree. All dimensions are in pixels. */ struct box { /** Type of box. */ box_type type; /** Box flags */ box_flags flags; /** Computed styles for elements and their pseudo elements. NULL on * non-element boxes. */ css_select_results *styles; /** Style for this box. 0 for INLINE_CONTAINER and FLOAT_*. Pointer into * a box's 'styles' select results, except for implied boxes, where it * is a pointer to an owned computed style. */ css_computed_style *style; /** Coordinate of left padding edge relative to parent box, or relative * to ancestor that contains this box in float_children for FLOAT_. */ int x; /** Coordinate of top padding edge, relative as for x. */ int y; int width; /**< Width of content box (excluding padding etc.). */ int height; /**< Height of content box (excluding padding etc.). */ /* These four variables determine the maximum extent of a box's * descendants. They are relative to the x,y coordinates of the box. * * Their use depends on the overflow CSS property: * * Overflow: Usage: * visible The content of the box is displayed within these * dimensions. * hidden These are ignored. Content is plotted within the box * dimensions. * scroll These are used to determine the extent of the * scrollable area. * auto As "scroll". */ int descendant_x0; /**< left edge of descendants */ int descendant_y0; /**< top edge of descendants */ int descendant_x1; /**< right edge of descendants */ int descendant_y1; /**< bottom edge of descendants */ int margin[4]; /**< Margin: TOP, RIGHT, BOTTOM, LEFT. */ int padding[4]; /**< Padding: TOP, RIGHT, BOTTOM, LEFT. */ struct box_border border[4]; /**< Border: TOP, RIGHT, BOTTOM, LEFT. */ struct scrollbar *scroll_x; /**< Horizontal scroll. */ struct scrollbar *scroll_y; /**< Vertical scroll. */ /** Width of box taking all line breaks (including margins etc). Must * be non-negative. */ int min_width; /** Width that would be taken with no line breaks. Must be * non-negative. */ int max_width; /**< Byte offset within a textual representation of this content. */ size_t byte_offset; char *text; /**< Text, or 0 if none. Unterminated. */ size_t length; /**< Length of text. */ /** Width of space after current text (depends on font and size). */ int space; nsurl *href; /**< Link, or 0. */ const char *target; /**< Link target, or 0. */ const char *title; /**< Title, or 0. */ unsigned int columns; /**< Number of columns for TABLE / TABLE_CELL. */ unsigned int rows; /**< Number of rows for TABLE only. */ unsigned int start_column; /**< Start column for TABLE_CELL only. */ struct box *next; /**< Next sibling box, or 0. */ struct box *prev; /**< Previous sibling box, or 0. */ struct box *children; /**< First child box, or 0. */ struct box *last; /**< Last child box, or 0. */ struct box *parent; /**< Parent box, or 0. */ /** INLINE_END box corresponding to this INLINE box, or INLINE box * corresponding to this INLINE_END box. */ struct box *inline_end; /** First float child box, or 0. Float boxes are in the tree twice, in * this list for the block box which defines the area for floats, and * also in the standard tree given by children, next, prev, etc. */ struct box *float_children; /** Next sibling float box. */ struct box *next_float; /** If box is a float, points to box's containing block */ struct box *float_container; /** Level below which subsequent floats must be cleared. * This is used only for boxes with float_children */ int clear_level; /** List marker box if this is a list-item, or 0. */ struct box *list_marker; struct column *col; /**< Array of table column data for TABLE only. */ /** Form control data, or 0 if not a form control. */ struct form_control* gadget; char *usemap; /** (Image)map to use with this object, or 0 if none */ lwc_string *id; /**< value of id attribute (or name for anchors) */ /** Background image for this box, or 0 if none */ struct hlcache_handle *background; /** Object in this box (usually an image), or 0 if none. */ struct hlcache_handle* object; /** Parameters for the object, or 0. */ struct object_params *object_params; /** Iframe's browser_window, or NULL if none */ struct browser_window *iframe; struct dom_node *node; /**< DOM node that generated this box or NULL */ }; /** Table column data. */ struct column { /** Type of column. */ enum { COLUMN_WIDTH_UNKNOWN, COLUMN_WIDTH_FIXED, COLUMN_WIDTH_AUTO, COLUMN_WIDTH_PERCENT, COLUMN_WIDTH_RELATIVE } type; /** Preferred width of column. Pixels for FIXED, percentage for PERCENT, * relative units for RELATIVE, unused for AUTO. */ int width; /** Minimum width of content. */ int min; /** Maximum width of content. */ int max; /** Whether all of column's cells are css positioned. */ bool positioned; }; /** Parameters for object element and similar elements. */ struct object_params { nsurl *data; char *type; char *codetype; nsurl *codebase; nsurl *classid; struct object_param *params; }; /** Linked list of object element parameters. */ struct object_param { char *name; char *value; char *type; char *valuetype; struct object_param *next; }; /** Frame target names (constant pointers to save duplicating the strings many * times). We convert _blank to _top for user-friendliness. */ extern const char *TARGET_SELF; extern const char *TARGET_PARENT; extern const char *TARGET_TOP; extern const char *TARGET_BLANK; struct box * box_create(css_select_results *styles, css_computed_style *style, bool style_owned, nsurl *href, const char *target, const char *title, lwc_string *id, void *context); void box_add_child(struct box *parent, struct box *child); void box_insert_sibling(struct box *box, struct box *new_box); void box_unlink_and_free(struct box *box); void box_free(struct box *box); void box_free_box(struct box *box); void box_bounds(struct box *box, struct rect *r); void box_coords(struct box *box, int *x, int *y); struct box *box_at_point(struct box *box, const int x, const int y, int *box_x, int *box_y); struct box *box_pick_text_box(struct html_content *html, int x, int y, int dir, int *dx, int *dy); struct box *box_find_by_id(struct box *box, lwc_string *id); bool box_visible(struct box *box); void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style); bool box_extract_link(const char *rel, nsurl *base, nsurl **result); bool box_handle_scrollbars(struct content *c, struct box *box, bool bottom, bool right); bool box_vscrollbar_present(const struct box *box); bool box_hscrollbar_present(const struct box *box); nserror dom_to_box(struct dom_node *n, struct html_content *c, box_construct_complete_cb cb); bool box_normalise_block(struct box *block, struct html_content *c); #endif netsurf-all-3.2/netsurf/render/box_textarea.c0000644000175000017500000001756412377677024020436 0ustar vincevince/* * Copyright 2013 Michael Drake * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Box tree treeview box replacement (implementation). */ #include #include "desktop/browser.h" #include "desktop/textarea.h" #include "desktop/textinput.h" #include "render/box_textarea.h" #include "render/font.h" #include "render/form.h" #include "utils/log.h" bool box_textarea_keypress(html_content *html, struct box *box, uint32_t key) { struct form_control *gadget = box->gadget; struct textarea *ta = gadget->data.text.ta; struct form* form = box->gadget->form; struct content *c = (struct content *) html; assert(ta != NULL); if (gadget->type != GADGET_TEXTAREA) { switch (key) { case KEY_NL: case KEY_CR: if (form) form_submit(content_get_url(c), html->bw, form, 0); return true; case KEY_TAB: { struct form_control *next_input; /* Find next text entry field that is actually * displayed (i.e. has an associated box) */ for (next_input = gadget->next; next_input && ((next_input->type != GADGET_TEXTBOX && next_input->type != GADGET_TEXTAREA && next_input->type != GADGET_PASSWORD) || !next_input->box); next_input = next_input->next) ; if (!next_input) return true; textarea_set_caret(ta, -1); textarea_set_caret(next_input->data.text.ta, 0); } return true; case KEY_SHIFT_TAB: { struct form_control *prev_input; /* Find previous text entry field that is actually * displayed (i.e. has an associated box) */ for (prev_input = gadget->prev; prev_input && ((prev_input->type != GADGET_TEXTBOX && prev_input->type != GADGET_TEXTAREA && prev_input->type != GADGET_PASSWORD) || !prev_input->box); prev_input = prev_input->prev) ; if (!prev_input) return true; textarea_set_caret(ta, -1); textarea_set_caret(prev_input->data.text.ta, 0); } return true; default: /* Pass to textarea widget */ break; } } return textarea_keypress(ta, key); } /** * Callback for html form textareas. */ static void box_textarea_callback(void *data, struct textarea_msg *msg) { struct form_textarea_data *d = data; struct form_control *gadget = d->gadget; struct html_content *html = d->gadget->html; struct box *box = gadget->box; switch (msg->type) { case TEXTAREA_MSG_DRAG_REPORT: if (msg->data.drag == TEXTAREA_DRAG_NONE) { /* Textarea drag finished */ html_drag_type drag_type = HTML_DRAG_NONE; union html_drag_owner drag_owner; drag_owner.no_owner = true; html_set_drag_type(html, drag_type, drag_owner, NULL); } else { /* Textarea drag started */ struct rect rect = { .x0 = INT_MIN, .y0 = INT_MIN, .x1 = INT_MAX, .y1 = INT_MAX }; html_drag_type drag_type; union html_drag_owner drag_owner; drag_owner.textarea = box; switch (msg->data.drag) { case TEXTAREA_DRAG_SCROLLBAR: drag_type = HTML_DRAG_TEXTAREA_SCROLLBAR; break; case TEXTAREA_DRAG_SELECTION: drag_type = HTML_DRAG_TEXTAREA_SELECTION; break; default: LOG(("Drag type not handled.")); assert(0); break; } html_set_drag_type(html, drag_type, drag_owner, &rect); } break; case TEXTAREA_MSG_REDRAW_REQUEST: { /* Request redraw of the required textarea rectangle */ int x, y; box_coords(box, &x, &y); content__request_redraw((struct content *)html, x + msg->data.redraw.x0, y + msg->data.redraw.y0, msg->data.redraw.x1 - msg->data.redraw.x0, msg->data.redraw.y1 - msg->data.redraw.y0); } break; case TEXTAREA_MSG_SELECTION_REPORT: if (msg->data.selection.have_selection) { /* Textarea now has a selection */ union html_selection_owner sel_owner; sel_owner.textarea = box; html_set_selection(html, HTML_SELECTION_TEXTAREA, sel_owner, msg->data.selection.read_only); } else { /* The textarea now has no selection */ union html_selection_owner sel_owner; sel_owner.none = true; html_set_selection(html, HTML_SELECTION_NONE, sel_owner, true); } break; case TEXTAREA_MSG_CARET_UPDATE: if (html->bw == NULL) break; if (msg->data.caret.type == TEXTAREA_CARET_HIDE) { union html_focus_owner focus_owner; focus_owner.textarea = box; html_set_focus(html, HTML_FOCUS_TEXTAREA, focus_owner, true, 0, 0, 0, NULL); } else { union html_focus_owner focus_owner; focus_owner.textarea = box; html_set_focus(html, HTML_FOCUS_TEXTAREA, focus_owner, false, msg->data.caret.pos.x, msg->data.caret.pos.y, msg->data.caret.pos.height, msg->data.caret.pos.clip); } break; case TEXTAREA_MSG_TEXT_MODIFIED: form_gadget_update_value(gadget, strndup(msg->data.modified.text, msg->data.modified.len)); break; } } /* Exported interface, documented in box_textarea.h */ bool box_textarea_create_textarea(html_content *html, struct box *box, struct dom_node *node) { dom_string *dom_text = NULL; dom_exception err; textarea_setup ta_setup; textarea_flags ta_flags; plot_font_style_t fstyle; bool read_only = false; struct form_control *gadget = box->gadget; const char *text; assert(gadget != NULL); assert(gadget->type == GADGET_TEXTAREA || gadget->type == GADGET_TEXTBOX || gadget->type == GADGET_PASSWORD); if (gadget->type == GADGET_TEXTAREA) { dom_html_text_area_element *textarea = (dom_html_text_area_element *) node; ta_flags = TEXTAREA_MULTILINE; err = dom_html_text_area_element_get_read_only( textarea, &read_only); if (err != DOM_NO_ERR) return false; /* Get the textarea's initial content */ err = dom_html_text_area_element_get_value(textarea, &dom_text); if (err != DOM_NO_ERR) return false; } else { dom_html_input_element *input = (dom_html_input_element *) node; err = dom_html_input_element_get_read_only( input, &read_only); if (err != DOM_NO_ERR) return false; if (gadget->type == GADGET_PASSWORD) ta_flags = TEXTAREA_PASSWORD; else ta_flags = TEXTAREA_DEFAULT; /* Get initial text */ err = dom_html_input_element_get_value(input, &dom_text); if (err != DOM_NO_ERR) return false; } if (dom_text != NULL) { text = dom_string_data(dom_text); } else { /* No initial text, or failed reading it; * use a blank string */ text = ""; } if (read_only) ta_flags |= TEXTAREA_READONLY; gadget->data.text.data.gadget = gadget; font_plot_style_from_css(gadget->box->style, &fstyle); /* Reset to correct values by layout */ ta_setup.width = 200; ta_setup.height = 20; ta_setup.pad_top = 4; ta_setup.pad_right = 4; ta_setup.pad_bottom = 4; ta_setup.pad_left = 4; /* Set remaining data */ ta_setup.border_width = 0; ta_setup.border_col = 0x000000; ta_setup.text = fstyle; ta_setup.text.background = NS_TRANSPARENT; /* Make selected text either black or white, as gives greatest contrast * with background colour. */ ta_setup.selected_bg = fstyle.foreground; ta_setup.selected_text = colour_to_bw_furthest(ta_setup.selected_bg); /* Hand reference to dom text over to gadget */ gadget->data.text.initial = dom_text; gadget->data.text.ta = textarea_create(ta_flags, &ta_setup, box_textarea_callback, &gadget->data.text.data); if (gadget->data.text.ta == NULL) { return false; } if (!textarea_set_text(gadget->data.text.ta, text)) return false; return true; } netsurf-all-3.2/netsurf/render/html_object.c0000644000175000017500000004211112377677024020225 0ustar vincevince/* * Copyright 2013 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Processing for html content object operations. */ #include #include #include #include #include #include #include "content/hlcache.h" #include "css/utils.h" #include "utils/nsoption.h" #include "desktop/scrollbar.h" #include "desktop/gui_factory.h" #include "utils/corestrings.h" #include "utils/config.h" #include "utils/log.h" #include "render/box.h" #include "render/html_internal.h" /* break reference loop */ static void html_object_refresh(void *p); /** * Retrieve objects used by HTML document * * \param h Content to retrieve objects from * \param n Pointer to location to receive number of objects * \return Pointer to list of objects */ struct content_html_object *html_get_objects(hlcache_handle *h, unsigned int *n) { html_content *c = (html_content *) hlcache_handle_get_content(h); assert(c != NULL); assert(n != NULL); *n = c->num_objects; return c->object_list; } /** * Handle object fetching or loading failure. * * \param box box containing object which failed to load * \param content document of type CONTENT_HTML * \param background the object was the background image for the box */ static void html_object_failed(struct box *box, html_content *content, bool background) { /* Nothing to do */ return; } /** * Update a box whose content has completed rendering. */ static void html_object_done(struct box *box, hlcache_handle *object, bool background) { struct box *b; if (background) { box->background = object; return; } box->object = object; if (!(box->flags & REPLACE_DIM)) { /* invalidate parent min, max widths */ for (b = box; b; b = b->parent) b->max_width = UNKNOWN_MAX_WIDTH; /* delete any clones of this box */ while (box->next && (box->next->flags & CLONE)) { /* box_free_box(box->next); */ box->next = box->next->next; } } } /** * Callback for hlcache_handle_retrieve() for objects. */ static nserror html_object_callback(hlcache_handle *object, const hlcache_event *event, void *pw) { struct content_html_object *o = pw; html_content *c = (html_content *) o->parent; int x, y; struct box *box; assert(c->base.status != CONTENT_STATUS_ERROR); box = o->box; if (box == NULL && event->type != CONTENT_MSG_ERROR) { return NSERROR_OK; } switch (event->type) { case CONTENT_MSG_LOADING: if (c->base.status != CONTENT_STATUS_LOADING && c->bw != NULL) content_open(object, c->bw, &c->base, box->object_params); break; case CONTENT_MSG_READY: if (content_can_reformat(object)) { /* TODO: avoid knowledge of box internals here */ content_reformat(object, false, box->max_width != UNKNOWN_MAX_WIDTH ? box->width : 0, box->max_width != UNKNOWN_MAX_WIDTH ? box->height : 0); /* Adjust parent content for new object size */ html_object_done(box, object, o->background); if (c->base.status == CONTENT_STATUS_READY || c->base.status == CONTENT_STATUS_DONE) content__reformat(&c->base, false, c->base.available_width, c->base.height); } break; case CONTENT_MSG_DONE: c->base.active--; LOG(("%d fetches active", c->base.active)); html_object_done(box, object, o->background); if (c->base.status != CONTENT_STATUS_LOADING && box->flags & REPLACE_DIM) { union content_msg_data data; if (!box_visible(box)) break; box_coords(box, &x, &y); data.redraw.x = x + box->padding[LEFT]; data.redraw.y = y + box->padding[TOP]; data.redraw.width = box->width; data.redraw.height = box->height; data.redraw.full_redraw = true; content_broadcast(&c->base, CONTENT_MSG_REDRAW, data); } break; case CONTENT_MSG_ERROR: hlcache_handle_release(object); o->content = NULL; if (box != NULL) { c->base.active--; LOG(("%d fetches active", c->base.active)); content_add_error(&c->base, "?", 0); html_object_failed(box, c, o->background); } break; case CONTENT_MSG_STATUS: if (event->data.explicit_status_text == NULL) { /* Object content's status text updated */ union content_msg_data data; data.explicit_status_text = content_get_status_message(object); html_set_status(c, data.explicit_status_text); content_broadcast(&c->base, CONTENT_MSG_STATUS, data); } else { /* Object content wants to set explicit message */ content_broadcast(&c->base, CONTENT_MSG_STATUS, event->data); } break; case CONTENT_MSG_REDRAW: if (c->base.status != CONTENT_STATUS_LOADING) { union content_msg_data data = event->data; if (!box_visible(box)) break; box_coords(box, &x, &y); if (object == box->background) { /* Redraw request is for background */ css_fixed hpos = 0, vpos = 0; css_unit hunit = CSS_UNIT_PX; css_unit vunit = CSS_UNIT_PX; int width = box->padding[LEFT] + box->width + box->padding[RIGHT]; int height = box->padding[TOP] + box->height + box->padding[BOTTOM]; int t, h, l, w; /* Need to know background-position */ css_computed_background_position(box->style, &hpos, &hunit, &vpos, &vunit); w = content_get_width(box->background); if (hunit == CSS_UNIT_PCT) { l = (width - w) * hpos / INTTOFIX(100); } else { l = FIXTOINT(nscss_len2px(hpos, hunit, box->style)); } h = content_get_height(box->background); if (vunit == CSS_UNIT_PCT) { t = (height - h) * vpos / INTTOFIX(100); } else { t = FIXTOINT(nscss_len2px(vpos, vunit, box->style)); } /* Redraw area depends on background-repeat */ switch (css_computed_background_repeat( box->style)) { case CSS_BACKGROUND_REPEAT_REPEAT: data.redraw.x = 0; data.redraw.y = 0; data.redraw.width = box->width; data.redraw.height = box->height; break; case CSS_BACKGROUND_REPEAT_REPEAT_X: data.redraw.x = 0; data.redraw.y += t; data.redraw.width = box->width; break; case CSS_BACKGROUND_REPEAT_REPEAT_Y: data.redraw.x += l; data.redraw.y = 0; data.redraw.height = box->height; break; case CSS_BACKGROUND_REPEAT_NO_REPEAT: data.redraw.x += l; data.redraw.y += t; break; default: break; } data.redraw.object_width = box->width; data.redraw.object_height = box->height; /* Add offset to box */ data.redraw.x += x; data.redraw.y += y; data.redraw.object_x += x; data.redraw.object_y += y; content_broadcast(&c->base, CONTENT_MSG_REDRAW, data); break; } else { /* Non-background case */ if (hlcache_handle_get_content(object) == event->data.redraw.object) { int w = content_get_width(object); int h = content_get_height(object); if (w != 0) { data.redraw.x = data.redraw.x * box->width / w; data.redraw.width = data.redraw.width * box->width / w; } if (h != 0) { data.redraw.y = data.redraw.y * box->height / h; data.redraw.height = data.redraw.height * box->height / h; } data.redraw.object_width = box->width; data.redraw.object_height = box->height; } data.redraw.x += x + box->padding[LEFT]; data.redraw.y += y + box->padding[TOP]; data.redraw.object_x += x + box->padding[LEFT]; data.redraw.object_y += y + box->padding[TOP]; } content_broadcast(&c->base, CONTENT_MSG_REDRAW, data); } break; case CONTENT_MSG_REFRESH: if (content_get_type(object) == CONTENT_HTML) { /* only for HTML objects */ guit->browser->schedule(event->data.delay * 1000, html_object_refresh, o); } break; case CONTENT_MSG_LINK: /* Don't care about favicons that aren't on top level content */ break; case CONTENT_MSG_GETCTX: *(event->data.jscontext) = NULL; break; case CONTENT_MSG_SCROLL: if (box->scroll_x != NULL) scrollbar_set(box->scroll_x, event->data.scroll.x0, false); if (box->scroll_y != NULL) scrollbar_set(box->scroll_y, event->data.scroll.y0, false); break; case CONTENT_MSG_DRAGSAVE: { union content_msg_data msg_data; if (event->data.dragsave.content == NULL) msg_data.dragsave.content = object; else msg_data.dragsave.content = event->data.dragsave.content; content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data); } break; case CONTENT_MSG_SAVELINK: case CONTENT_MSG_POINTER: case CONTENT_MSG_GADGETCLICK: /* These messages are for browser window layer. * we're not interested, so pass them on. */ content_broadcast(&c->base, event->type, event->data); break; case CONTENT_MSG_CARET: { union html_focus_owner focus_owner; focus_owner.content = box; switch (event->data.caret.type) { case CONTENT_CARET_REMOVE: case CONTENT_CARET_HIDE: html_set_focus(c, HTML_FOCUS_CONTENT, focus_owner, true, 0, 0, 0, NULL); break; case CONTENT_CARET_SET_POS: html_set_focus(c, HTML_FOCUS_CONTENT, focus_owner, false, event->data.caret.pos.x, event->data.caret.pos.y, event->data.caret.pos.height, event->data.caret.pos.clip); break; } } break; case CONTENT_MSG_DRAG: { html_drag_type drag_type = HTML_DRAG_NONE; union html_drag_owner drag_owner; drag_owner.content = box; switch (event->data.drag.type) { case CONTENT_DRAG_NONE: drag_type = HTML_DRAG_NONE; drag_owner.no_owner = true; break; case CONTENT_DRAG_SCROLL: drag_type = HTML_DRAG_CONTENT_SCROLL; break; case CONTENT_DRAG_SELECTION: drag_type = HTML_DRAG_CONTENT_SELECTION; break; } html_set_drag_type(c, drag_type, drag_owner, event->data.drag.rect); } break; case CONTENT_MSG_SELECTION: { html_selection_type sel_type; union html_selection_owner sel_owner; if (event->data.selection.selection) { sel_type = HTML_SELECTION_CONTENT; sel_owner.content = box; } else { sel_type = HTML_SELECTION_NONE; sel_owner.none = true; } html_set_selection(c, sel_type, sel_owner, event->data.selection.read_only); } break; default: break; } if (c->base.status == CONTENT_STATUS_READY && c->base.active == 0 && (event->type == CONTENT_MSG_LOADING || event->type == CONTENT_MSG_DONE || event->type == CONTENT_MSG_ERROR)) { /* all objects have arrived */ content__reformat(&c->base, false, c->base.available_width, c->base.height); html_set_status(c, ""); content_set_done(&c->base); } /* If 1) the configuration option to reflow pages while objects are * fetched is set * 2) an object is newly fetched & converted, * 3) the box's dimensions need to change due to being replaced * 4) the object's parent HTML is ready for reformat, * 5) the time since the previous reformat is more than the * configured minimum time between reformats * then reformat the page to display newly fetched objects */ else if (nsoption_bool(incremental_reflow) && event->type == CONTENT_MSG_DONE && box != NULL && !(box->flags & REPLACE_DIM) && (c->base.status == CONTENT_STATUS_READY || c->base.status == CONTENT_STATUS_DONE) && (wallclock() > c->base.reformat_time)) { content__reformat(&c->base, false, c->base.available_width, c->base.height); } return NSERROR_OK; } /** * Start a fetch for an object required by a page, replacing an existing object. * * \param object Object to replace * \param url URL of object to fetch (copied) * \return true on success, false on memory exhaustion */ static bool html_replace_object(struct content_html_object *object, nsurl *url) { html_content *c; hlcache_child_context child; html_content *page; nserror error; assert(object != NULL); assert(object->box != NULL); c = (html_content *) object->parent; child.charset = c->encoding; child.quirks = c->base.quirks; if (object->content != NULL) { /* remove existing object */ if (content_get_status(object->content) != CONTENT_STATUS_DONE) { c->base.active--; LOG(("%d fetches active", c->base.active)); } hlcache_handle_release(object->content); object->content = NULL; object->box->object = NULL; } /* initialise fetch */ error = hlcache_handle_retrieve(url, HLCACHE_RETRIEVE_SNIFF_TYPE, content_get_url(&c->base), NULL, html_object_callback, object, &child, object->permitted_types, &object->content); if (error != NSERROR_OK) return false; for (page = c; page != NULL; page = page->page) { page->base.active++; LOG(("%d fetches active", c->base.active)); page->base.status = CONTENT_STATUS_READY; } return true; } /** * schedule callback for object refresh */ static void html_object_refresh(void *p) { struct content_html_object *object = p; nsurl *refresh_url; assert(content_get_type(object->content) == CONTENT_HTML); refresh_url = content_get_refresh_url(object->content); /* Ignore if refresh URL has gone * (may happen if fetch errored) */ if (refresh_url == NULL) return; content_invalidate_reuse_data(object->content); if (!html_replace_object(object, refresh_url)) { /** \todo handle memory exhaustion */ } } nserror html_object_open_objects(html_content *html, struct browser_window *bw) { struct content_html_object *object, *next; for (object = html->object_list; object != NULL; object = next) { next = object->next; if (object->content == NULL || object->box == NULL) continue; if (content_get_type(object->content) == CONTENT_NONE) continue; content_open(object->content, bw, &html->base, object->box->object_params); } return NSERROR_OK; } nserror html_object_abort_objects(html_content *htmlc) { struct content_html_object *object; for (object = htmlc->object_list; object != NULL; object = object->next) { if (object->content == NULL) continue; switch (content_get_status(object->content)) { case CONTENT_STATUS_DONE: /* already loaded: do nothing */ break; case CONTENT_STATUS_READY: hlcache_handle_abort(object->content); /* Active count will be updated when * html_object_callback receives * CONTENT_MSG_DONE from this object */ break; default: hlcache_handle_abort(object->content); hlcache_handle_release(object->content); object->content = NULL; htmlc->base.active--; LOG(("%d fetches active", htmlc->base.active)); break; } } return NSERROR_OK; } nserror html_object_close_objects(html_content *html) { struct content_html_object *object, *next; for (object = html->object_list; object != NULL; object = next) { next = object->next; if (object->content == NULL || object->box == NULL) continue; if (content_get_type(object->content) == CONTENT_NONE) continue; if (content_get_type(object->content) == CONTENT_HTML) { guit->browser->schedule(-1, html_object_refresh, object); } content_close(object->content); } return NSERROR_OK; } nserror html_object_free_objects(html_content *html) { while (html->object_list != NULL) { struct content_html_object *victim = html->object_list; if (victim->content != NULL) { LOG(("object %p", victim->content)); if (content_get_type(victim->content) == CONTENT_HTML) { guit->browser->schedule(-1, html_object_refresh, victim); } hlcache_handle_release(victim->content); } html->object_list = victim->next; free(victim); } return NSERROR_OK; } /* exported interface documented in render/html_internal.h */ bool html_fetch_object(html_content *c, nsurl *url, struct box *box, content_type permitted_types, int available_width, int available_height, bool background) { struct content_html_object *object; hlcache_child_context child; nserror error; /* If we've already been aborted, don't bother attempting the fetch */ if (c->aborted) return true; child.charset = c->encoding; child.quirks = c->base.quirks; object = calloc(1, sizeof(struct content_html_object)); if (object == NULL) { return false; } object->parent = (struct content *) c; object->next = NULL; object->content = NULL; object->box = box; object->permitted_types = permitted_types; object->background = background; error = hlcache_handle_retrieve(url, HLCACHE_RETRIEVE_SNIFF_TYPE, content_get_url(&c->base), NULL, html_object_callback, object, &child, object->permitted_types, &object->content); if (error != NSERROR_OK) { free(object); return error != NSERROR_NOMEM; } /* add to content object list */ object->next = c->object_list; c->object_list = object; c->num_objects++; if (box != NULL) { c->base.active++; LOG(("%d fetches active", c->base.active)); } return true; } netsurf-all-3.2/netsurf/render/html.h0000644000175000017500000001344712377677024016716 0ustar vincevince/* * Copyright 2004 James Bursa * * This file is part of NetSurf, http://www.netsurf-browser.org/ * * NetSurf is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * NetSurf is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** \file * Content for text/html (interface). * * These functions should in general be called via the content interface. */ #ifndef _NETSURF_RENDER_HTML_H_ #define _NETSURF_RENDER_HTML_H_ #include #include #include #include "content/content_type.h" #include "css/css.h" #include "desktop/mouse.h" #include "desktop/plot_style.h" #include "desktop/frame_types.h" struct fetch_multipart_data; struct box; struct rect; struct browser_window; struct content; struct hlcache_handle; struct http_parameter; struct imagemap; struct object_params; struct plotters; struct textarea; struct scrollbar; struct scrollbar_msg_data; struct search_context; struct selection; struct nsurl; /** * Container for stylesheets used by an HTML document */ struct html_stylesheet { struct dom_node *node; /**< dom node associated with sheet */ struct hlcache_handle *sheet; bool modified; }; /** * Container for scripts used by an HTML document */ struct html_script { /** Type of script */ enum html_script_type { HTML_SCRIPT_INLINE, HTML_SCRIPT_SYNC, HTML_SCRIPT_DEFER, HTML_SCRIPT_ASYNC } type; union { struct hlcache_handle *handle; struct dom_string *string; } data; /**< Script data */ struct dom_string *mimetype; struct dom_string *encoding; bool already_started; bool parser_inserted; bool force_async; bool ready_exec; bool async; bool defer; }; /** An object (, , etc.) in a CONTENT_HTML document. */ struct content_html_object { struct content *parent; /**< Parent document */ struct content_html_object *next; /**< Next in chain */ struct hlcache_handle *content; /**< Content, or 0. */ struct box *box; /**< Node in box tree containing it. */ /** Bitmap of acceptable content types */ content_type permitted_types; bool background; /**< This object is a background image. */ }; struct html_scrollbar_data { struct content *c; struct box *box; }; /** Frame tree (, ) */ struct content_html_frames { int cols; /** number of columns in frameset */ int rows; /** number of rows in frameset */ struct frame_dimension width; /** frame width */ struct frame_dimension height; /** frame width */ int margin_width; /** frame margin width */ int margin_height; /** frame margin height */ char *name; /** frame name (for targetting) */ struct nsurl *url; /** frame url */ bool no_resize; /** frame is not resizable */ frame_scrolling scrolling; /** scrolling characteristics */ bool border; /** frame has a border */ colour border_colour; /** frame border colour */ struct content_html_frames *children; /** [cols * rows] children */ }; /** Inline frame list ( #errors Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE. Line: 1 Col: 20 Unexpected end tag (strong) in table context caused voodoo mode. Line: 1 Col: 20 End tag (strong) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 24 Unexpected end tag (b) in table context caused voodoo mode. Line: 1 Col: 24 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 29 Unexpected end tag (em) in table context caused voodoo mode. Line: 1 Col: 29 End tag (em) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 33 Unexpected end tag (i) in table context caused voodoo mode. Line: 1 Col: 33 End tag (i) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 37 Unexpected end tag (u) in table context caused voodoo mode. Line: 1 Col: 37 End tag (u) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 46 Unexpected end tag (strike) in table context caused voodoo mode. Line: 1 Col: 46 End tag (strike) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 50 Unexpected end tag (s) in table context caused voodoo mode. Line: 1 Col: 50 End tag (s) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 58 Unexpected end tag (blink) in table context caused voodoo mode. Line: 1 Col: 58 Unexpected end tag (blink). Ignored. Line: 1 Col: 63 Unexpected end tag (tt) in table context caused voodoo mode. Line: 1 Col: 63 End tag (tt) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 69 Unexpected end tag (pre) in table context caused voodoo mode. Line: 1 Col: 69 End tag (pre) seen too early. Expected other end tag. Line: 1 Col: 75 Unexpected end tag (big) in table context caused voodoo mode. Line: 1 Col: 75 End tag (big) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 83 Unexpected end tag (small) in table context caused voodoo mode. Line: 1 Col: 83 End tag (small) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 90 Unexpected end tag (font) in table context caused voodoo mode. Line: 1 Col: 90 End tag (font) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 99 Unexpected end tag (select) in table context caused voodoo mode. Line: 1 Col: 99 Unexpected end tag (select). Ignored. Line: 1 Col: 104 Unexpected end tag (h1) in table context caused voodoo mode. Line: 1 Col: 104 End tag (h1) seen too early. Expected other end tag. Line: 1 Col: 109 Unexpected end tag (h2) in table context caused voodoo mode. Line: 1 Col: 109 End tag (h2) seen too early. Expected other end tag. Line: 1 Col: 114 Unexpected end tag (h3) in table context caused voodoo mode. Line: 1 Col: 114 End tag (h3) seen too early. Expected other end tag. Line: 1 Col: 119 Unexpected end tag (h4) in table context caused voodoo mode. Line: 1 Col: 119 End tag (h4) seen too early. Expected other end tag. Line: 1 Col: 124 Unexpected end tag (h5) in table context caused voodoo mode. Line: 1 Col: 124 End tag (h5) seen too early. Expected other end tag. Line: 1 Col: 129 Unexpected end tag (h6) in table context caused voodoo mode. Line: 1 Col: 129 End tag (h6) seen too early. Expected other end tag. Line: 1 Col: 136 Unexpected end tag (body) in the table row phase. Ignored. Line: 1 Col: 141 Unexpected end tag (br) in table context caused voodoo mode. Line: 1 Col: 141 Unexpected end tag (br). Treated as br element. Line: 1 Col: 145 Unexpected end tag (a) in table context caused voodoo mode. Line: 1 Col: 145 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 151 Unexpected end tag (img) in table context caused voodoo mode. Line: 1 Col: 151 This element (img) has no end tag. Line: 1 Col: 159 Unexpected end tag (title) in table context caused voodoo mode. Line: 1 Col: 159 Unexpected end tag (title). Ignored. Line: 1 Col: 166 Unexpected end tag (span) in table context caused voodoo mode. Line: 1 Col: 166 Unexpected end tag (span). Ignored. Line: 1 Col: 174 Unexpected end tag (style) in table context caused voodoo mode. Line: 1 Col: 174 Unexpected end tag (style). Ignored. Line: 1 Col: 183 Unexpected end tag (script) in table context caused voodoo mode. Line: 1 Col: 183 Unexpected end tag (script). Ignored. Line: 1 Col: 196 Unexpected end tag (th). Ignored. Line: 1 Col: 201 Unexpected end tag (td). Ignored. Line: 1 Col: 206 Unexpected end tag (tr). Ignored. Line: 1 Col: 214 This element (frame) has no end tag. Line: 1 Col: 221 This element (area) has no end tag. Line: 1 Col: 228 Unexpected end tag (link). Ignored. Line: 1 Col: 236 This element (param) has no end tag. Line: 1 Col: 241 This element (hr) has no end tag. Line: 1 Col: 249 This element (input) has no end tag. Line: 1 Col: 255 Unexpected end tag (col). Ignored. Line: 1 Col: 262 Unexpected end tag (base). Ignored. Line: 1 Col: 269 Unexpected end tag (meta). Ignored. Line: 1 Col: 280 This element (basefont) has no end tag. Line: 1 Col: 290 This element (bgsound) has no end tag. Line: 1 Col: 298 This element (embed) has no end tag. Line: 1 Col: 307 This element (spacer) has no end tag. Line: 1 Col: 311 Unexpected end tag (p). Ignored. Line: 1 Col: 316 End tag (dd) seen too early. Expected other end tag. Line: 1 Col: 321 End tag (dt) seen too early. Expected other end tag. Line: 1 Col: 331 Unexpected end tag (caption). Ignored. Line: 1 Col: 342 Unexpected end tag (colgroup). Ignored. Line: 1 Col: 350 Unexpected end tag (tbody). Ignored. Line: 1 Col: 358 Unexpected end tag (tfoot). Ignored. Line: 1 Col: 366 Unexpected end tag (thead). Ignored. Line: 1 Col: 376 End tag (address) seen too early. Expected other end tag. Line: 1 Col: 389 End tag (blockquote) seen too early. Expected other end tag. Line: 1 Col: 398 End tag (center) seen too early. Expected other end tag. Line: 1 Col: 404 Unexpected end tag (dir). Ignored. Line: 1 Col: 410 End tag (div) seen too early. Expected other end tag. Line: 1 Col: 415 End tag (dl) seen too early. Expected other end tag. Line: 1 Col: 426 End tag (fieldset) seen too early. Expected other end tag. Line: 1 Col: 436 End tag (listing) seen too early. Expected other end tag. Line: 1 Col: 443 End tag (menu) seen too early. Expected other end tag. Line: 1 Col: 448 End tag (ol) seen too early. Expected other end tag. Line: 1 Col: 453 End tag (ul) seen too early. Expected other end tag. Line: 1 Col: 458 End tag (li) seen too early. Expected other end tag. Line: 1 Col: 465 End tag (nobr) violates step 1, paragraph 1 of the adoption agency algorithm. Line: 1 Col: 471 This element (wbr) has no end tag. Line: 1 Col: 487 End tag (button) seen too early. Expected other end tag. Line: 1 Col: 497 End tag (marquee) seen too early. Expected other end tag. Line: 1 Col: 506 End tag (object) seen too early. Expected other end tag. Line: 1 Col: 524 Unexpected end tag (). Ignored. Line: 1 Col: 524 Unexpected end tag (frameset). Ignored. Line: 1 Col: 531 Unexpected end tag (head). Ignored. Line: 1 Col: 540 Unexpected end tag (iframe). Ignored. Line: 1 Col: 548 This element (image) has no end tag. Line: 1 Col: 558 This element (isindex) has no end tag. Line: 1 Col: 568 Unexpected end tag (noembed). Ignored. Line: 1 Col: 579 Unexpected end tag (noframes). Ignored. Line: 1 Col: 590 Unexpected end tag (noscript). Ignored. Line: 1 Col: 601 Unexpected end tag (optgroup). Ignored. Line: 1 Col: 610 Unexpected end tag (option). Ignored. Line: 1 Col: 622 Unexpected end tag (plaintext). Ignored. Line: 1 Col: 633 Unexpected end tag (textarea). Ignored. #document | | | |
| | | |

#data #errors Line: 1 Col: 10 Unexpected start tag (frameset). Expected DOCTYPE. Line: 1 Col: 10 Expected closing tag. Unexpected end of file. #document | | | netsurf-all-3.2/libhubbub/test/data/tree-construction/tests4.dat0000644000175000017500000000156512377676754024100 0ustar vincevince#data direct div content #errors #document-fragment div #document | "direct div content" #data direct textarea content #errors #document-fragment textarea #document | "direct textarea content" #data textarea content with pseudo markup #errors #document-fragment textarea #document | "textarea content with pseudo markup" #data this is CDATA inside a #errors #document | | | | | | "X" | <meta> | name="z" | <link> | rel="foo" | <style> | " x { content:"</style" } " #data <!DOCTYPE html><select><optgroup></optgroup></select> #errors #document | <!DOCTYPE html> | <html> | <head> | <body> | <select> | <optgroup> #data #errors Line: 2 Col: 1 Unexpected End of file. Expected DOCTYPE. #document | <html> | <head> | <body> #data <!DOCTYPE html> <html> #errors #document | <!DOCTYPE html> | <html> | <head> | <body> #data <!DOCTYPE html><script> </script> <title>x #errors #document | | | | #errors Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE. Line: 1 Col: 21 Unexpected start tag (script) that can be in head. Moved. #document | | | #errors Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE. Line: 1 Col: 28 Unexpected start tag (style) that can be in head. Moved. #document | | | #errors Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE. #document | | | | | "x" | NIST DOM HTML Test - BR

Hello, World.

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/table1.xhtml0000644000175000017500000000057212377676746025712 0ustar vincevinceNIST DOM HTML Test - TABLE
XHTML can't abide empty table
netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/heading.html0000644000175000017500000000074312377676746025751 0ustar vincevince NIST DOM HTML Test - HEADING

Head Element 1

Head Element 2

Head Element 3

Head Element 4

Head Element 5
Head Element 6
netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/link.xml0000644000175000017500000000102712377676746025137 0ustar vincevince NIST DOM HTML Test - LINK


netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/label.xml0000644000175000017500000000114412377676746025261 0ustar vincevince NIST DOM HTML Test - LABEL

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/title.xml0000644000175000017500000000044612377676746025327 0ustar vincevince NIST DOM HTML Test - TITLE


netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/optgroup.xhtml0000644000175000017500000000116412377676746026417 0ustar vincevince NIST DOM HTML Test - OPTGROUP

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/element.xml0000644000175000017500000000705312377676746025640 0ustar vincevince NIST DOM HTML Test - Element

Test Lists


  1. EMP0001
    • Margaret Martin
      Accountant
      56,000
      Female
      1230 North Ave. Dallas, Texas 98551

Bold
DT element

Bidirectional algorithm overide
Italicized

Teletype
Subscript
SuperScript
Strike Through (S)
Strike Through (STRIKE)
Small
Big
Emphasis
Strong
10 Computer Code Fragment 20 Temp = 10 Temp = 20 *2 Temp Citation
Temp
NIST
Gaithersburg, MD 20899

Not

Underlined netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/mod.html0000644000175000017500000000105612377676746025127 0ustar vincevince NIST DOM HTML Test - MOD

The INS element is used to indicate that a section of a document had been inserted.
The DEL element is used to indicate that a section of a document had been removed.

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/input.xml0000644000175000017500000000327312377676746025346 0ustar vincevince NIST DOM HTML Test - INPUT
Under a FORM control
Hours available to work



netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/isindex.html0000644000175000017500000000060512377676746026012 0ustar vincevince NIST DOM HTML Test - ISINDEX
netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/form3.xml0000644000175000017500000000072712377676746025236 0ustar vincevince FORM3

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/object2.xml0000644000175000017500000000130312377676746025527 0ustar vincevince NIST DOM HTML Test - OBJECT

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/tablecol.xhtml0000644000175000017500000000122012377676746026316 0ustar vincevince NIST DOM HTML Test - TABLECOL
Id Name Position Salary
EMP0001 Martin Accountant 56,000
netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/form.xml0000644000175000017500000000112212377676746025141 0ustar vincevince NIST DOM HTML Test - FORM

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/style.xhtml0000644000175000017500000000054412377676746025701 0ustar vincevince NIST DOM HTML Test - BR

Hello, World.

netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/input.html0000644000175000017500000000330612377676746025507 0ustar vincevince NIST DOM HTML Test - INPUT
Under a FORM control
ReHire
NewHire
Hours available to work EarlyMornings
Afternoon
Evenings
Closing
netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/iframe.html0000644000175000017500000000065712377676746025621 0ustar vincevince NIST DOM HTML Test - IFRAME netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/meta.xhtml0000644000175000017500000000061112377676746025462 0ustar vincevince NIST DOM HTML Test - META


netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/directory.xml0000644000175000017500000000063112377676746026206 0ustar vincevince NIST DOM HTML Test - Directory
  • DIR item number 1.
  • DIR item number 2.
  • DIR item number 3.
  • netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/meta.html0000644000175000017500000000043312377676746025274 0ustar vincevince NIST DOM HTML Test - META


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/div.html0000644000175000017500000000053712377676746025135 0ustar vincevince NIST DOM HTML Test - DIV
    The DIV element is a generic block container. This text should be centered.
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/document.xml0000644000175000017500000000307012377676746026020 0ustar vincevince NIST DOM HTML Test - DOCUMENT

    Domain Domain

    DTS IMAGE LOGO

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/area2.xml0000644000175000017500000000062112377676746025173 0ustar vincevince NIST DOM HTML Test - Area

    Domain

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/area.html0000644000175000017500000000062512377676746025261 0ustar vincevince NIST DOM HTML Test - Area

    Domain

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/link.html0000644000175000017500000000075412377676746025311 0ustar vincevince NIST DOM HTML Test - LINK


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/hr.html0000644000175000017500000000046512377676746024764 0ustar vincevince NIST DOM HTML Test - HR
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/option.xml0000644000175000017500000000153212377676746025513 0ustar vincevince NIST DOM HTML Test - OPTION

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/style.html0000644000175000017500000000047712377676746025516 0ustar vincevince NIST DOM HTML Test - STYLE

    Hello, World.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/object2.xhtml0000644000175000017500000000126112377676746026066 0ustar vincevince NIST DOM HTML Test - OBJECT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/paragraph.xhtml0000644000175000017500000000050412377676746026502 0ustar vincevince NIST DOM HTML Test - PARAGRAPH

    TEXT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/link.xhtml0000644000175000017500000000102712377676746025473 0ustar vincevince NIST DOM HTML Test - LINK


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/applet2.xml0000644000175000017500000000073112377676746025552 0ustar vincevince NIST DOM HTML Test - Applet

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/html.xhtml0000644000175000017500000000045412377676746025505 0ustar vincevince NIST DOM HTML Test - Html

    Hello, World.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/document.xhtml0000644000175000017500000000307012377676746026354 0ustar vincevince NIST DOM HTML Test - DOCUMENT

    Domain Domain

    DTS IMAGE LOGO

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/head.xhtml0000644000175000017500000000052712377676746025443 0ustar vincevince NIST DOM HTML Test - HEAD

    Hello, World.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/label.xhtml0000644000175000017500000000114412377676746025615 0ustar vincevince NIST DOM HTML Test - LABEL

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/base.xhtml0000644000175000017500000000050112377676746025444 0ustar vincevince NIST DOM HTML Test - Base

    Some Text

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/collection.xml0000644000175000017500000000424212377676746026337 0ustar vincevince NIST DOM HTML Test - BR
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/link2.xhtml0000644000175000017500000000105012377676746025551 0ustar vincevince NIST DOM HTML Test - LINK


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/tablerow.xhtml0000644000175000017500000000343612377676746026363 0ustar vincevince NIST DOM HTML Test - TABLE
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/tablecell.xml0000644000175000017500000000166012377676746026134 0ustar vincevince NIST DOM HTML Test - TABLECELL
    Employee Id Employee Name Position Salary
    EMP0001 Margaret Martin Accountant 56,000
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/paragraph.html0000644000175000017500000000043412377676746026314 0ustar vincevince NIST DOM HTML Test - PARAGRAPH

    TEXT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/area2.xhtml0000644000175000017500000000062112377676746025527 0ustar vincevince NIST DOM HTML Test - Area

    Domain

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/base2.xml0000644000175000017500000000077312377676746025205 0ustar vincevince NIST DOM HTML Test - Base2 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/iframe.xml0000644000175000017500000000072712377676746025453 0ustar vincevince NIST DOM HTML Test - IFRAME netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/li.xhtml0000644000175000017500000000067112377676746025146 0ustar vincevince NIST DOM HTML Test - LI
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/ulist.html0000644000175000017500000000115312377676746025506 0ustar vincevince NIST DOM HTML Test - ULIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
        1230 North Ave. Dallas, Texas 98551
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
        Female
        1900 Dallas Road. Dallas, Texas 98554
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/area.xml0000644000175000017500000000070012377676746025107 0ustar vincevince NIST DOM HTML Test - Area

    Domain

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/frame.xml0000644000175000017500000000101212377676746025266 0ustar vincevince NIST DOM HTML Test - FRAME netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/script.xml0000644000175000017500000000061712377676746025512 0ustar vincevince NIST DOM HTML Test - SCRIPT netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/tablesection.xhtml0000644000175000017500000000356612377676746027224 0ustar vincevince NIST DOM HTML Test - TABLESECTION
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/olist.html0000644000175000017500000000076612377676746025511 0ustar vincevince NIST DOM HTML Test - OLIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/applet.xml0000644000175000017500000000074712377676746025477 0ustar vincevince NIST DOM HTML Test - Applet

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/anchor.xml0000644000175000017500000000102212377676746025447 0ustar vincevince NIST DOM HTML Test - Anchor

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/optgroup.html0000644000175000017500000000111312377676746026221 0ustar vincevince NIST DOM HTML Test - OPTGROUP

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/img.xhtml0000644000175000017500000000075612377676746025322 0ustar vincevince NIST DOM HTML Test - IMG

    DTS IMAGE LOGO

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/CVS/0000755000175000017500000000000012377713347024100 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/CVS/Template0000644000175000017500000000000012377676746025577 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/CVS/Entries0000644000175000017500000002102112377676746025443 0ustar vincevince/.cvsignore/1.1/Fri Apr 3 02:48:01 2009// /anchor.html/1.3/Fri Apr 3 02:48:01 2009// /anchor.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /anchor.xml/1.3/Fri Apr 3 02:48:01 2009// /anchor2.html/1.2/Fri Apr 3 02:48:01 2009// /anchor2.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /anchor2.xml/1.3/Fri Apr 3 02:48:01 2009// /applet.html/1.5/Fri Apr 3 02:48:01 2009// /applet.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /applet.xml/1.6/Fri Apr 3 02:48:01 2009// /applet2.html/1.3/Fri Apr 3 02:48:01 2009// /applet2.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /applet2.xml/1.3/Fri Apr 3 02:48:01 2009// /area.html/1.3/Fri Apr 3 02:48:01 2009// /area.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /area.xml/1.4/Fri Apr 3 02:48:01 2009// /area2.html/1.3/Fri Apr 3 02:48:01 2009// /area2.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /area2.xml/1.4/Fri Apr 3 02:48:01 2009// /base.html/1.4/Fri Apr 3 02:48:01 2009// /base.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /base.xml/1.4/Fri Apr 3 02:48:01 2009// /base2.html/1.4/Fri Apr 3 02:48:01 2009// /base2.xhtml/1.4/Fri Apr 3 02:48:01 2009/-kb/ /base2.xml/1.4/Fri Apr 3 02:48:01 2009// /basefont.html/1.3/Fri Apr 3 02:48:01 2009// /basefont.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /basefont.xml/1.3/Fri Apr 3 02:48:01 2009// /body.html/1.3/Fri Apr 3 02:48:01 2009// /body.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /body.xml/1.3/Fri Apr 3 02:48:01 2009// /br.html/1.3/Fri Apr 3 02:48:01 2009// /br.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /br.xml/1.3/Fri Apr 3 02:48:01 2009// /button.html/1.4/Fri Apr 3 02:48:01 2009// /button.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /button.xml/1.3/Fri Apr 3 02:48:01 2009// /collection.html/1.3/Fri Apr 3 02:48:01 2009// /collection.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /collection.xml/1.3/Fri Apr 3 02:48:01 2009// /directory.html/1.3/Fri Apr 3 02:48:01 2009// /directory.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /directory.xml/1.3/Fri Apr 3 02:48:01 2009// /div.html/1.3/Fri Apr 3 02:48:01 2009// /div.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /div.xml/1.3/Fri Apr 3 02:48:01 2009// /dl.html/1.3/Fri Apr 3 02:48:01 2009// /dl.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /dl.xml/1.3/Fri Apr 3 02:48:01 2009// /document.html/1.5/Fri Apr 3 02:48:01 2009// /document.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /document.xml/1.6/Fri Apr 3 02:48:01 2009// /element.html/1.3/Fri Apr 3 02:48:01 2009// /element.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /element.xml/1.3/Fri Apr 3 02:48:01 2009// /fieldset.html/1.4/Fri Apr 3 02:48:01 2009// /fieldset.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /fieldset.xml/1.3/Fri Apr 3 02:48:01 2009// /font.html/1.3/Fri Apr 3 02:48:01 2009// /font.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /font.xml/1.3/Fri Apr 3 02:48:01 2009// /form.html/1.3/Fri Apr 3 02:48:01 2009// /form.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /form.xml/1.3/Fri Apr 3 02:48:01 2009// /form2.html/1.2/Fri Apr 3 02:48:01 2009// /form2.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /form2.xml/1.3/Fri Apr 3 02:48:01 2009// /form3.html/1.1/Fri Apr 3 02:48:01 2009// /form3.xhtml/1.1/Fri Apr 3 02:48:01 2009/-kb/ /form3.xml/1.1/Fri Apr 3 02:48:01 2009// /frame.html/1.3/Fri Apr 3 02:48:01 2009// /frame.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /frame.xml/1.5/Fri Apr 3 02:48:01 2009// /frameset.html/1.2/Fri Apr 3 02:48:01 2009// /frameset.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /frameset.xml/1.3/Fri Apr 3 02:48:01 2009// /head.html/1.4/Fri Apr 3 02:48:01 2009// /head.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /head.xml/1.3/Fri Apr 3 02:48:01 2009// /heading.html/1.3/Fri Apr 3 02:48:01 2009// /heading.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /heading.xml/1.3/Fri Apr 3 02:48:01 2009// /hr.html/1.3/Fri Apr 3 02:48:01 2009// /hr.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /hr.xml/1.3/Fri Apr 3 02:48:01 2009// /html.html/1.4/Fri Apr 3 02:48:01 2009// /html.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /html.xml/1.3/Fri Apr 3 02:48:01 2009// /iframe.html/1.4/Fri Apr 3 02:48:01 2009// /iframe.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /iframe.xml/1.4/Fri Apr 3 02:48:01 2009// /img.html/1.3/Fri Apr 3 02:48:01 2009// /img.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /img.xml/1.3/Fri Apr 3 02:48:01 2009// /input.html/1.5/Fri Apr 3 02:48:01 2009// /input.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /input.xml/1.5/Fri Apr 3 02:48:01 2009// /isindex.html/1.4/Fri Apr 3 02:48:01 2009// /isindex.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /isindex.xml/1.4/Fri Apr 3 02:48:01 2009// /label.html/1.3/Fri Apr 3 02:48:01 2009// /label.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /label.xml/1.4/Fri Apr 3 02:48:01 2009// /legend.html/1.4/Fri Apr 3 02:48:01 2009// /legend.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /legend.xml/1.4/Fri Apr 3 02:48:01 2009// /li.html/1.3/Fri Apr 3 02:48:01 2009// /li.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /li.xml/1.3/Fri Apr 3 02:48:01 2009// /link.html/1.4/Fri Apr 3 02:48:01 2009// /link.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /link.xml/1.3/Fri Apr 3 02:48:01 2009// /link2.html/1.2/Fri Apr 3 02:48:01 2009// /link2.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /link2.xml/1.3/Fri Apr 3 02:48:01 2009// /map.html/1.3/Fri Apr 3 02:48:01 2009// /map.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /map.xml/1.3/Fri Apr 3 02:48:01 2009// /menu.html/1.3/Fri Apr 3 02:48:01 2009// /menu.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /menu.xml/1.3/Fri Apr 3 02:48:01 2009// /meta.html/1.2/Fri Apr 3 02:48:01 2009// /meta.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /meta.xml/1.3/Fri Apr 3 02:48:01 2009// /mod.html/1.2/Fri Apr 3 02:48:01 2009// /mod.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /mod.xml/1.3/Fri Apr 3 02:48:01 2009// /object.html/1.5/Fri Apr 3 02:48:01 2009// /object.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /object.xml/1.3/Fri Apr 3 02:48:01 2009// /object2.html/1.3/Fri Apr 3 02:48:01 2009// /object2.xhtml/1.3/Fri Apr 3 02:48:01 2009/-kb/ /object2.xml/1.2/Fri Apr 3 02:48:01 2009// /olist.html/1.3/Fri Apr 3 02:48:01 2009// /olist.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /olist.xml/1.3/Fri Apr 3 02:48:01 2009// /optgroup.html/1.2/Fri Apr 3 02:48:01 2009// /optgroup.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /optgroup.xml/1.3/Fri Apr 3 02:48:01 2009// /option.html/1.3/Fri Apr 3 02:48:01 2009// /option.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /option.xml/1.4/Fri Apr 3 02:48:01 2009// /paragraph.html/1.3/Fri Apr 3 02:48:01 2009// /paragraph.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /paragraph.xml/1.3/Fri Apr 3 02:48:01 2009// /param.html/1.2/Fri Apr 3 02:48:01 2009// /param.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /param.xml/1.4/Fri Apr 3 02:48:01 2009// /pre.html/1.3/Fri Apr 3 02:48:01 2009// /pre.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /pre.xml/1.3/Fri Apr 3 02:48:01 2009// /quote.html/1.2/Fri Apr 3 02:48:01 2009// /quote.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /quote.xml/1.3/Fri Apr 3 02:48:01 2009// /right.png/1.1/Fri Apr 3 02:48:01 2009/-kb/ /script.html/1.3/Fri Apr 3 02:48:01 2009// /script.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /script.xml/1.3/Fri Apr 3 02:48:01 2009// /select.html/1.4/Fri Apr 3 02:48:01 2009// /select.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /select.xml/1.4/Fri Apr 3 02:48:01 2009// /style.html/1.3/Fri Apr 3 02:48:01 2009// /style.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /style.xml/1.3/Fri Apr 3 02:48:01 2009// /table.html/1.3/Fri Apr 3 02:48:01 2009// /table.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /table.xml/1.3/Fri Apr 3 02:48:01 2009// /table1.html/1.4/Fri Apr 3 02:48:01 2009// /table1.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /table1.xml/1.3/Fri Apr 3 02:48:01 2009// /tablecaption.html/1.3/Fri Apr 3 02:48:01 2009// /tablecaption.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /tablecaption.xml/1.3/Fri Apr 3 02:48:01 2009// /tablecell.html/1.3/Fri Apr 3 02:48:01 2009// /tablecell.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /tablecell.xml/1.4/Fri Apr 3 02:48:01 2009// /tablecol.html/1.3/Fri Apr 3 02:48:01 2009// /tablecol.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /tablecol.xml/1.3/Fri Apr 3 02:48:01 2009// /tablerow.html/1.3/Fri Apr 3 02:48:01 2009// /tablerow.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /tablerow.xml/1.3/Fri Apr 3 02:48:01 2009// /tablesection.html/1.4/Fri Apr 3 02:48:01 2009// /tablesection.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /tablesection.xml/1.4/Fri Apr 3 02:48:01 2009// /textarea.html/1.4/Fri Apr 3 02:48:01 2009// /textarea.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /textarea.xml/1.4/Fri Apr 3 02:48:01 2009// /title.html/1.3/Fri Apr 3 02:48:01 2009// /title.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /title.xml/1.3/Fri Apr 3 02:48:01 2009// /ulist.html/1.3/Fri Apr 3 02:48:01 2009// /ulist.xhtml/1.2/Fri Apr 3 02:48:01 2009/-kb/ /ulist.xml/1.3/Fri Apr 3 02:48:01 2009// /w3c_main.png/1.1/Fri Apr 3 02:48:01 2009/-kb/ D netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/CVS/Root0000644000175000017500000000005612377676746024762 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/CVS/Repository0000644000175000017500000000005412377676746026214 0ustar vincevince2001/DOM-Test-Suite/tests/level1/html/files netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/table1.xml0000644000175000017500000000057212377676746025356 0ustar vincevince NIST DOM HTML Test - TABLE
    XHTML can't abide empty table
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/img.xml0000644000175000017500000000075612377676746024766 0ustar vincevince NIST DOM HTML Test - IMG

    DTS IMAGE LOGO

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/body.html0000644000175000017500000000057312377676746025310 0ustar vincevince NIST DOM HTML Test - Body

    Hello, World

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/hr.xml0000644000175000017500000000053412377676746024615 0ustar vincevince NIST DOM HTML Test - HR
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/map.xhtml0000644000175000017500000000101312377676746025306 0ustar vincevince NIST DOM HTML Test - MAP

    Domain1 Domain2 Domain3

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/body.xml0000644000175000017500000000073412377676746025143 0ustar vincevince NIST DOM HTML Test - Body

    Hello, World.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/script.xhtml0000644000175000017500000000061712377676746026046 0ustar vincevince NIST DOM HTML Test - SCRIPT netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/object.html0000644000175000017500000000123512377676746025615 0ustar vincevince NIST DOM HTML Test - OBJECT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/heading.xhtml0000644000175000017500000000101112377676746026126 0ustar vincevince NIST DOM HTML Test - HEADING

    Head Element 1

    Head Element 2

    Head Element 3

    Head Element 4

    Head Element 5
    Head Element 6
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/quote.html0000644000175000017500000000067012377676746025506 0ustar vincevince NIST DOM HTML Test - QUOTE

    The Q element is intended for short quotations

    The BLOCKQUOTE element is used for long quotations.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/br.xml0000644000175000017500000000047312377676746024611 0ustar vincevince NIST DOM HTML Test - BR


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/applet.html0000644000175000017500000000067612377676746025644 0ustar vincevince NIST DOM HTML Test - Applet

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/isindex.xml0000644000175000017500000000065612377676746025654 0ustar vincevince NIST DOM HTML Test - ISINDEX
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/fieldset.html0000644000175000017500000000077112377676746026152 0ustar vincevince NIST DOM HTML Test - FieldSet
    All data entered must be valid
    All data entered must be valid
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/table.xhtml0000644000175000017500000000364012377676746025630 0ustar vincevince NIST DOM HTML Test - TABLE
    Id Name Position Salary
    Table Caption
    Employee Id Employee Name Position Salary Gender Address
    next page ... next page ... next page ... next page ... next page ... next page ...
    EMP0001 Margaret Martin Accountant 56,000 Female 1230 North Ave. Dallas, Texas 98551
    EMP0002 Martha Raynolds Secretary 35,000 Female 1900 Dallas Road Dallas, Texas 98554
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/olist.xhtml0000644000175000017500000000103612377676746025670 0ustar vincevince NIST DOM HTML Test - OLIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/element.xhtml0000644000175000017500000000705312377676746026174 0ustar vincevince NIST DOM HTML Test - Element

    Test Lists


    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
        1230 North Ave. Dallas, Texas 98551

    Bold
    DT element

    Bidirectional algorithm overide
    Italicized

    Teletype
    Subscript
    SuperScript
    Strike Through (S)
    Strike Through (STRIKE)
    Small
    Big
    Emphasis
    Strong
    10 Computer Code Fragment 20 Temp = 10 Temp = 20 *2 Temp Citation
    Temp
    NIST
    Gaithersburg, MD 20899

    Not

    Underlined netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/html.xml0000644000175000017500000000045412377676746025151 0ustar vincevince NIST DOM HTML Test - Html

    Hello, World.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/base.html0000644000175000017500000000044412377676746025262 0ustar vincevince NIST DOM HTML Test - Base

    Some Text

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/li.html0000644000175000017500000000062112377676746024751 0ustar vincevince NIST DOM HTML Test - LI
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/base.xml0000644000175000017500000000050112377676746025110 0ustar vincevince NIST DOM HTML Test - Base

    Some Text

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/font.xhtml0000644000175000017500000000055612377676746025512 0ustar vincevince NIST DOM HTML Test - BaseFont Test Tables netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/document.html0000644000175000017500000000275112377676746026171 0ustar vincevince NIST DOM HTML Test - DOCUMENT

    Domain Domain

    DTS IMAGE LOGO

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/object.xml0000644000175000017500000000130512377676746025447 0ustar vincevince NIST DOM HTML Test - OBJECT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/object.xhtml0000644000175000017500000000130512377676746026003 0ustar vincevince NIST DOM HTML Test - OBJECT

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/quote.xhtml0000644000175000017500000000074112377676746025675 0ustar vincevince NIST DOM HTML Test - QUOTE

    The Q element is intended for short quotations

    The BLOCKQUOTE element is used for long quotations.

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/li.xml0000644000175000017500000000067112377676746024612 0ustar vincevince NIST DOM HTML Test - LI
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/anchor2.html0000644000175000017500000000055712377676746025711 0ustar vincevince NIST DOM HTML Test - Anchor

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/optgroup.xml0000644000175000017500000000116412377676746026063 0ustar vincevince NIST DOM HTML Test - OPTGROUP

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/base2.html0000644000175000017500000000077512377676746025353 0ustar vincevince NIST DOM HTML Test - Base2 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/applet.xhtml0000644000175000017500000000074712377676746026033 0ustar vincevince NIST DOM HTML Test - Applet

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/basefont.xhtml0000644000175000017500000000055212377676746026341 0ustar vincevince NIST DOM HTML Test - BaseFont

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/fieldset.xhtml0000644000175000017500000000104112377676746026331 0ustar vincevince NIST DOM HTML Test - FieldSet
    All data entered must be valid
    All data entered must be valid
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/anchor2.xml0000644000175000017500000000055712377676746025545 0ustar vincevince NIST DOM HTML Test - Anchor

    View Submit Button

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/font.xml0000644000175000017500000000055612377676746025156 0ustar vincevince NIST DOM HTML Test - BaseFont Test Tables netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/option.xhtml0000644000175000017500000000153212377676746026047 0ustar vincevince NIST DOM HTML Test - OPTION

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/dl.xhtml0000644000175000017500000000063512377676746025141 0ustar vincevince NIST DOM HTML Test - DL
    Accountant
    56,000
    Female
    1230 North Ave. Dallas, Texas 98551
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/basefont.xml0000644000175000017500000000055212377676746026005 0ustar vincevince NIST DOM HTML Test - BaseFont

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/applet2.xhtml0000644000175000017500000000073112377676746026106 0ustar vincevince NIST DOM HTML Test - Applet

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/textarea.xhtml0000644000175000017500000000166712377676746026365 0ustar vincevince NIST DOM HTML Test - TEXTAREA

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/link2.xml0000644000175000017500000000105012377676746025215 0ustar vincevince NIST DOM HTML Test - LINK


    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/ulist.xhtml0000644000175000017500000000122312377676746025674 0ustar vincevince NIST DOM HTML Test - ULIST
    1. EMP0001
      • Margaret Martin
        Accountant
        56,000
        Female
        1230 North Ave. Dallas, Texas 98551
    2. EMP0002
      • Martha Raynolds
        Secretary
        35,000
        Female
        1900 Dallas Road. Dallas, Texas 98554
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/tablecol.xml0000644000175000017500000000122012377676746025762 0ustar vincevince NIST DOM HTML Test - TABLECOL
    Id Name Position Salary
    EMP0001 Martin Accountant 56,000
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/files/basefont.html0000644000175000017500000000050112377676746026143 0ustar vincevince NIST DOM HTML Test - BaseFont

    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table21.xml0000644000175000017500000000325412377676746024336 0ustar vincevince table21 Netscape Horizontal alignment of data in cell. The value of attribute align of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAppletElement11.xml0000644000175000017500000000342412377676746026471 0ustar vincevince HTMLAppletElement11 NIST The object attribute specifies the serialized applet file. Retrieve the object attribute and examine its value. Rick Rivello Curt Arnold 2002-07-19 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBodyElement01.xml0000644000175000017500000000337712377676746026147 0ustar vincevince HTMLBodyElement01 NIST The aLink attribute specifies the color of active links. Retrieve the aLink attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table52.xml0000644000175000017500000000326512377676746024344 0ustar vincevince table52 Netscape Vertical alignment of cell data in column. The value of attribute valign of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement126.xml0000644000175000017500000000344612377676746025416 0ustar vincevince HTMLElement126 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the S element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBaseFontElement03.xml.kfail0000644000175000017500000000420112377676746030025 0ustar vincevince HTMLBaseFontElement03 NIST The size attribute specifies the base font's size. Retrieve the size attribute and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/basefont01.xml0000644000175000017500000000322012377676746025037 0ustar vincevince basefont01 Netscape The value of attribute color of the basefont element is read and checked against the expected value. Sivakiran Tummala 2002-02-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object12.xml0000644000175000017500000000321612377676746024513 0ustar vincevince object12 Netscape The value of attribute usemap of the object element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement08.xml0000644000175000017500000000344512377676746026774 0ustar vincevince HTMLTableRowElement08 NIST The ch attribute specifies the alignment character for cells in a column. Retrieve the char attribute of the second TR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table45.xml0000644000175000017500000000323012377676746024336 0ustar vincevince table45 Netscape Alignment character for cells in a column. The value of attribute ch of the tablerow element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement09.xml0000644000175000017500000000351212377676746026736 0ustar vincevince HTMLTableColElement09 NIST The vAlign attribute specifies the vertical alignment of cell data in column(COL). Retrieve the vAlign attribute from the COL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection06.xml0000644000175000017500000000434412377676746026033 0ustar vincevince HTMLCollection06 NIST An item(index) method retrieves an item specified by ordinal index (Test for index=0). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. The item located at ordinal index 0 is further retrieved and its "rowIndex" attribute is examined. Rick Rivello 2002-05-01 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAppletElement03.xml0000644000175000017500000000342512377676746026473 0ustar vincevince HTMLAppletElement03 NIST The archive attribute specifies a comma-seperated archive list. Retrieve the archive attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement80.xml0000644000175000017500000000341712377676746025333 0ustar vincevince HTMLElement80 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the ACRONYM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTextAreaElement11.xml0000644000175000017500000000365112377676746026763 0ustar vincevince HTMLTextAreaElement11 NIST The type attribute specifies the type of this form control. Retrieve the type attribute of the 1st TEXTAREA element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement15.xml0000644000175000017500000000352012377676746026344 0ustar vincevince HTMLInputElement15 NIST The tabIndex attribute is an index that represents the elements position in the tabbing order. Retrieve the tabIndex attribute of the 3rd INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement15.xml0000644000175000017500000000347112377676746026460 0ustar vincevince HTMLObjectElement15 NIST The useMap attribute specifies the used client-side image map. Retrieve the useMap attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement11.xml0000644000175000017500000000335312377676746026457 0ustar vincevince HTMLAnchorElement11 NIST The target attribute specifies the frame to render the source in. Retrieve the target attribute and examine it's value. Rick Rivello 2002-05-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBodyElement02.xml0000644000175000017500000000350212377676746026136 0ustar vincevince HTMLBodyElement02 NIST The background attribute specifies the URI fo the background texture tile image. Retrieve the background attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement07.xml0000644000175000017500000000352112377676746027076 0ustar vincevince HTMLTableCellElement07 NIST The axis attribute specifies the names group of related headers for table header cells(TH). Retrieve the align attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement78.xml0000644000175000017500000000340712377676746025341 0ustar vincevince HTMLElement78 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the VAR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement137.xml0000644000175000017500000000345712377676746025422 0ustar vincevince HTMLElement137 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the CITE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement06.xml0000644000175000017500000000352312377676746026767 0ustar vincevince HTMLTableRowElement06 NIST The align attribute specifies the horizontal alignment of data within cells of this row. Retrieve the align attribute of the second TR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement95.xml0000644000175000017500000000345112377676746025337 0ustar vincevince HTMLElement95 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the B element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement08.xml0000644000175000017500000000332512377676746026464 0ustar vincevince HTMLAnchorElement08 NIST The rev attribute contains the reverse link type Retrieve the rev attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement22.xml0000644000175000017500000000452712377676746027627 0ustar vincevince HTMLTableSectionElement22 NIST The deleteRow() method deletes a row from this section. Retrieve the first THEAD element and invoke the deleteRow() method with an index of 0. The nuber of rows in the THEAD section before the deletion of the row is one. After the row is deleted the number of rows in the THEAD section is zero. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/hasFeature01.xml.kfail0000644000175000017500000000244612377676746026423 0ustar vincevince hasFeature01 Curt Arnold hasFeature("hTmL", null) should return true. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table31.xml0000644000175000017500000000326012377676746024334 0ustar vincevince table31 Netscape Vertical alignment of data in cell. The value of attribute valign of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement12.xml0000644000175000017500000000346412377676746026736 0ustar vincevince HTMLTableColElement12 NIST The width attribute specifies the default column width(COLGORUP). Retrieve the width attribute from the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLButtonElement05.xml0000644000175000017500000000345012377676746026521 0ustar vincevince HTMLButtonElement05 NIST The name attribute is the form control or object name when submitted with a form. Retrieve the name attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLPreElement01.xml0000644000175000017500000000335712377676746025776 0ustar vincevince HTMLPreElement01 NIST The width attribute specifies the fixed width for content. Retrieve the width attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement39.xml0000644000175000017500000000340712377676746025336 0ustar vincevince HTMLElement39 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the S element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"S Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAreaElement05.xml�����������������������0000644�0001750�0001750�00000003334�12377676746�026117� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLAreaElement05"> <metadata> <title>HTMLAreaElement05 NIST The noHref attribute specifies that this area is inactive. Retrieve the noHref attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/anchor01.xml0000644000175000017500000000332312377676746024514 0ustar vincevince anchor01 Netscape A single character access key to give access to the form control. The value of attribute accessKey of the anchor element is read and checked against the expected value. Sivakiran Tummala 2002-02-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement06.xml0000644000175000017500000000346612377676746026421 0ustar vincevince HTMLIFrameElement06 NIST The marginHeight attribute specifies the frame margin height, in pixels. Retrieve the marginHeight attribute of the first IFRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement130.xml0000644000175000017500000000345112377676746025405 0ustar vincevince HTMLElement130 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the EM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement112.xml0000644000175000017500000000345512377676746025411 0ustar vincevince HTMLElement112 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the DT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object04.xml0000644000175000017500000000324712377676746024520 0ustar vincevince object04 Netscape Width of border around the object. The value of attribute border of the object element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement25.xml0000644000175000017500000000415412377676746026301 0ustar vincevince HTMLTableElement25 NIST The createCaption() method creates a new table caption object or returns an existing one. Create a new CAPTION element on the first TABLE element. Since one does not currently exist the CAPTION element is created. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement03.xml0000644000175000017500000000370112377676746026762 0ustar vincevince HTMLTableRowElement03 NIST The sectionRowIndex attribute specifies the index of this row, relative to the current section(THEAD, TFOOT, or TBODY),starting from 0. Retrieve the third TR(1st In TFOOT) element within the document and examine its sectionRowIndex value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement01.xml0000644000175000017500000000344212377676746026455 0ustar vincevince HTMLAnchorElement01 NIST The accessKey attribute is a single character access key to give access to the form control. Retrieve the accessKey attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement24.xml0000644000175000017500000000532512377676746026301 0ustar vincevince HTMLTableElement24 NIST The deleteTFoot() method deletes the footer from the table. The deleteTFoot() method will delete the TFOOT Element from the second TABLE element. First make sure that the TFOOT element exists and then count the number of rows. After the TFOOT element is deleted there should be one less row. Rick Rivello 2002-05-02 4 3 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement06.xml0000644000175000017500000000350412377676746026276 0ustar vincevince HTMLTableElement06 NIST The tFoot attribute returns the tables TFOOT or null if it does not exist. Retrieve the TFOOT element from within the first TABLE element. Since one does not exist it should be null. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTextAreaElement15.xml0000644000175000017500000000300612377676746026761 0ustar vincevince HTMLTextAreaElement15 Curt Arnold Calling HTMLTextAreaElement.select should select the text area. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement05.xml0000644000175000017500000000337312377676746026147 0ustar vincevince HTMLLinkElement05 NIST The media attribute specifies the targeted media. Retrieve the media attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement123.xml0000644000175000017500000000344612377676746025413 0ustar vincevince HTMLElement123 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the I element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table37.xml0000644000175000017500000000335712377676746024351 0ustar vincevince table37 Netscape Specifies the horizontal and vertical space between cell content and cell borders. The value of attribute cellpadding of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/dlist01.xml0000644000175000017500000000276612377676746024373 0ustar vincevince dlist01 Netscape Sivakiran Tummala 2002-02-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement08.xml0000644000175000017500000000351212377676746026735 0ustar vincevince HTMLTableColElement08 NIST The span attribute indicates the number of columns in a group or affected by a grouping(COLGROUP). Retrieve the span attribute of the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement03.xml0000644000175000017500000000352512377676746026455 0ustar vincevince HTMLObjectElement03 NIST The align attribute specifies the alignment of this object with respect to its surrounding text. Retrieve the align attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement17.xml0000644000175000017500000000355412377676746027105 0ustar vincevince HTMLTableCellElement17 NIST The headers attribute specifies a list of id attribute values for table header cells(TH). Retrieve the headers attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement11.xml0000644000175000017500000000336012377676746025322 0ustar vincevince HTMLElement11 NIST The id specifies the elements identifier. Retrieve the id attribute of the STRIKE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptGroupElement02.xml0000644000175000017500000000345212377676746027024 0ustar vincevince HTMLOptGroupElement02 NIST The label attribute specifies the label assigned to this option group. Retrieve the label attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOListElement01.xml0000644000175000017500000000341512377676746026275 0ustar vincevince HTMLOListElement01 NIST The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement23.xml0000644000175000017500000000452712377676746027630 0ustar vincevince HTMLTableSectionElement23 NIST The deleteRow() method deletes a row from this section. Retrieve the first TFOOT element and invoke the deleteRow() method with an index of 0. The nuber of rows in the TFOOT section before the deletion of the row is one. After the row is deleted the number of rows in the TFOOT section is zero. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/doc01.xml0000644000175000017500000000250712377676746024012 0ustar vincevince doc01 Netscape Retrieve the title attribute of HTMLDocument and examine it's value. Sivakiran Tummala 2002-02-08 <assertEquals actual="vtitle" expected='"NIST DOM HTML Test - Anchor"' id="titleLink" ignoreCase="false"/> </test> �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement26.xml����������������������0000644�0001750�0001750�00000004501�12377676746�026276� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xml" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLTableElement26"> <metadata> <title>HTMLTableElement26 NIST The createCaption() method creates a new table caption object or returns an existing one. Create a new CAPTION element on the first TABLE element. Since one currently exists the CAPTION element is not created and you can get the align attribute from the CAPTION element that exists. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/anchor06.xml0000644000175000017500000000327612377676746024530 0ustar vincevince anchor06 Netscape The shape of the active area. The coordinates are given by coords The value of attribute shape of the anchor element is read and checked against the expected value. Sivakiran Tummala 2002-02-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement116.xml0000644000175000017500000000346512377676746025416 0ustar vincevince HTMLElement116 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CENTER element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement02.xml0000644000175000017500000000357512377676746026416 0ustar vincevince HTMLIFrameElement02 NIST The frameBorder attribute specifies the request for frame borders. (frameBorder=1 A border is drawn) (FrameBorder=0 A border is not drawn) Retrieve the frameBorder attribute of the first IFRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/area03.xml0000644000175000017500000000303112377676746024150 0ustar vincevince area03 Netscape Sivakiran Tummala 2002-02-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement02.xml0000644000175000017500000000352412377676746026732 0ustar vincevince HTMLTableColElement02 NIST The align attribute specifies the horizontal alignment of cell data in column(COLGROUP). Retrieve the align attribute from the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement28.xml0000644000175000017500000000526612377676746026311 0ustar vincevince HTMLTableElement28 NIST The insertRow() method inserts a new empty table row. Retrieve the second TABLE element and invoke the insertRow() method with an index of 0. Currently the zero indexed row is in the THEAD section of the TABLE. The number of rows in the THEAD section before insertion of the new row is one. After the new row is inserted the number of rows in the THEAD section is two. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement10.xml0000644000175000017500000000334112377676746025320 0ustar vincevince HTMLElement10 NIST The id specifies the elements identifier. Retrieve the id attribute of the S element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement18.xml0000644000175000017500000000343512377676746026304 0ustar vincevince HTMLTableElement18 NIST The width attribute specifies the desired table width. Retrieve the width attribute of the first TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement15.xml0000644000175000017500000000346112377676746026300 0ustar vincevince HTMLTableElement15 NIST The frame attribute specifies which external table borders to render. Retrieve the frame attribute of the first TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement84.xml0000644000175000017500000000342112377676746025332 0ustar vincevince HTMLElement84 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the NOFRAMES element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement02.xml0000644000175000017500000000355312377676746026466 0ustar vincevince HTMLSelectElement02 NIST The selectedIndex attribute specifies the ordinal index of the selected option. Retrieve the selectedIndex attribute from the first SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement08.xml0000644000175000017500000000447712377676746026502 0ustar vincevince HTMLSelectElement08 NIST The options attribute returns a collection of OPTION elements contained by this element. Retrieve the options attribute from the first SELECT element and examine the items of the returned collection. Mary Brady 2002-02-22 "option" "option" "option" "option" "option" netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement97.xml0000644000175000017500000000345112377676746025341 0ustar vincevince HTMLElement97 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the S element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameElement06.xml0000644000175000017500000000343412377676746026303 0ustar vincevince HTMLFrameElement06 NIST The noResize attribute specifies if the user can resize the frame. When true, forbid user from resizing frame. Retrieve the noResize attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement02.xml0000644000175000017500000000334712377676746025327 0ustar vincevince HTMLElement02 NIST The id specifies the elements identifier. Retrieve the id attribute of the SUB element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement03.xml0000644000175000017500000000346612377676746027102 0ustar vincevince HTMLTableCellElement03 NIST The abbr attribute specifies the abbreviation for table header cells(TH). Retrieve the abbr attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement107.xml0000644000175000017500000000345712377676746025417 0ustar vincevince HTMLElement107 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the VAR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLScriptElement04.xml0000644000175000017500000000336412377676746026515 0ustar vincevince HTMLScriptElement04 NIST The src attribute specifies a URI designating an external script. Retrieve the src attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement22.xml0000644000175000017500000000342112377676746027072 0ustar vincevince HTMLTableCellElement22 NIST The noWrap attribute supresses word wrapping. Retrieve the noWrap attribute of the second TD Element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIsIndexElement03.xml.kfail0000644000175000017500000000341112377676746027671 0ustar vincevince HTMLIsIndexElement03 NIST The prompt attribute specifies the prompt message. Retrieve the prompt attribute of the 1st isindex element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement11.xml.kfail0000644000175000017500000000424112377676746027351 0ustar vincevince HTMLImageElement11 NIST The vspace attribute specifies the vertical space above and below this image. Retrieve the vspace attribute and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object13.xml.kfail0000644000175000017500000000415412377676746025603 0ustar vincevince object13 Netscape Vertical space above and below this image, applet, or object. The value of attribute vspace of the object element is read and checked against the expected value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadingElement04.xml0000644000175000017500000000342012377676746026601 0ustar vincevince HTMLHeadingElement04 NIST The align attribute specifies the horizontal text alignment(H4). Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection04.xml0000644000175000017500000000474512377676746026036 0ustar vincevince HTMLCollection04 NIST HTMLCollections are live, they are automatically updated when the underlying document is changed. Create a HTMLCollection object by invoking the rows attribute of the first TABLE element and examine its length, then add a new row and re-examine the length. Rick Rivello 2002-05-01 4 5 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement29.xml0000644000175000017500000000345212377676746027105 0ustar vincevince HTMLTableCellElement29 NIST The width attribute specifies the cells width. Retrieve the width attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table26.xml0000644000175000017500000000321012377676746024333 0ustar vincevince table26 Netscape The value of attribute height of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement77.xml0000644000175000017500000000340712377676746025340 0ustar vincevince HTMLElement77 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the KBD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table48.xml0000644000175000017500000000327612377676746024353 0ustar vincevince HTMLTableColElement align Netscape Horizontal alignment of cell data in column. The value of attribute align of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table17.xml0000644000175000017500000000344712377676746024347 0ustar vincevince table17 Netscape Offset of alignment character. The value of attribute chOff of the tablesection element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement01.xml0000644000175000017500000000365012377676746026147 0ustar vincevince HTMLFormElement01 NIST The elements attribute specifies a collection of all control element in the form. Retrieve the elements attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement33.xml0000644000175000017500000000342012377676746025323 0ustar vincevince HTMLElement33 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the SPAN element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"SPAN Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLabelElement02.xml����������������������0000644�0001750�0001750�00000003371�12377676746�026264� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLLabelElement02"> <metadata> <title>HTMLLabelElement02 NIST The form attribute returns null if control in not within the context of form. Retrieve the form attribute and examine its value. Mary Brady 2002-02-22
    netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table36.xml0000644000175000017500000000325712377676746024347 0ustar vincevince table36 Netscape Specifies which external table borders to render. The value of attribute frame of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement02.xml0000644000175000017500000000353412377676746027622 0ustar vincevince HTMLTableSectionElement02 NIST The align attribute specifies the horizontal alignment of data within cells. Retrieve the align attribute of the first TFOOT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement08.xml0000644000175000017500000000351412377676746026351 0ustar vincevince HTMLInputElement08 NIST The checked attribute represents the current state of the corresponding form control when type has the value Radio or Checkbox. Retrieve the accept attribute of the 3rd INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement08.xml0000644000175000017500000000425212377676746026301 0ustar vincevince HTMLTableElement08 NIST The tBodies attribute returns a collection of all the defined table bodies. Retrieve the tBodies attribute from the second TABLE element and examine the items of the returned collection. Mary Brady 2002-02-22 "tbody" netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table20.xml0000644000175000017500000000324012377676746024330 0ustar vincevince table20 Netscape Names group of related headers. The value of attribute axis of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement35.xml0000644000175000017500000000341212377676746025326 0ustar vincevince HTMLElement35 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the TT element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"TT Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement16.xml����������������������0000644�0001750�0001750�00000003426�12377676746�026352� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLInputElement16"> <metadata> <title>HTMLInputElement16 NIST The type attribute is the type of control created. Retrieve the type attribute of the 1st INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table18.xml0000644000175000017500000000325412377676746024344 0ustar vincevince table18 Netscape The index of this cell in the row. The value of attribute cellIndex of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement125.xml0000644000175000017500000000344612377676746025415 0ustar vincevince HTMLElement125 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the U element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement13.xml0000644000175000017500000000351312377676746026453 0ustar vincevince HTMLObjectElement13 NIST The tabIndex attribute specifies the elements position in the tabbing order. Retrieve the tabIndex attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement09.xml0000644000175000017500000000334512377676746026467 0ustar vincevince HTMLAnchorElement09 NIST The shape attribute contains the shape of the active area. Retrieve the shape attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBodyElement04.xml0000644000175000017500000000342712377676746026146 0ustar vincevince HTMLBodyElement04 NIST The link attribute specifies the color of links that are not active and unvisited. Retrieve the link attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/button03.xml0000644000175000017500000000355012377676746024561 0ustar vincevince button03 Netscape The value of attribute action of the form element which contains this button is read and checked against the expected value Sivakiran Tummala 2002-03-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBaseFontElement01.xml0000644000175000017500000000341712377676746026746 0ustar vincevince HTMLBaseFontElement01 NIST The color attribute specifies the base font's color. Retrieve the color attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHRElement04.xml0000644000175000017500000000335512377676746025562 0ustar vincevince HTMLHRElement04 NIST The width attribute specifies the width of the rule. Retrieve the width attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLabelElement01.xml0000644000175000017500000000352312377676746026262 0ustar vincevince HTMLLabelElement01 NIST The form attribute returns the FORM element containing this control. Retrieve the form attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement14.xml0000644000175000017500000000620312377676746026764 0ustar vincevince HTMLTableRowElement14 NIST The deleteCell() method deletes a cell from the current row. Retrieve the fourth TR element and examine the value of the cells length attribute which should be set to six. Check the value of the third(index 2) TD element. Invoke the deleteCell() method which will delete a cell from the current row. Check the value of the third cell(index 2) and also check the number of cells which should now be five. Rick Rivello 2002-05-06 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement03.xml0000644000175000017500000000347012377676746026270 0ustar vincevince HTMLImageElement03 NIST The alt attribute specifies an alternative text for user agenst not rendering the normal content of this element. Retrieve the alt attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLModElement01.xml0000644000175000017500000000345412377676746025765 0ustar vincevince HTMLModElement01 NIST The cite attribute specifies an URI designating a document that describes the reason for the change. Retrieve the cite attribute of the INS element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement14.xml0000644000175000017500000000352112377676746026344 0ustar vincevince HTMLInputElement14 NIST The src attribute specifies the location of the image to decorate the graphical submit button when the type has the value Image. Retrieve the src attribute of the 8th INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement13.xml0000644000175000017500000000277012377676746026463 0ustar vincevince HTMLAnchorElement13 Curt Arnold HTMLAnchorElement.blur should surrender input focus. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement114.xml0000644000175000017500000000347112377676746025411 0ustar vincevince HTMLElement114 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the NOSCRIPT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement19.xml0000644000175000017500000000340112377676746026455 0ustar vincevince HTMLObjectElement19 NIST The form attribute returns null if control in not within the context of form. Retrieve the form attribute and examine its value. Rick Rivello 2002-07-19 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLegendElement04.xml0000644000175000017500000000342112377676746026441 0ustar vincevince HTMLLegendElement04 NIST The align attribute specifies the text alignment relative to FIELDSET. Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table15.xml0000644000175000017500000000364412377676746024344 0ustar vincevince table15 Netscape The collection of rows in this table section. The value of attribute rows of the tablesection element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement05.xml0000644000175000017500000000345412377676746026415 0ustar vincevince HTMLIFrameElement05 NIST The marginWidth attribute specifies the frame margin width, in pixels. Retrieve the marginWidth attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLScriptElement02.xml0000644000175000017500000000346012377676746026510 0ustar vincevince HTMLScriptElement02 NIST The charset attribute specifies the character encoding of the linked resource. Retrieve the charset attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBRElement01.xml0000644000175000017500000000337312377676746025551 0ustar vincevince HTMLBRElement01 NIST The clear attribute specifies control flow of text around floats. Retrieve the clear attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement81.xml0000644000175000017500000000341112377676746025326 0ustar vincevince HTMLElement81 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the ABBR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement05.xml0000644000175000017500000000365412377676746026773 0ustar vincevince HTMLTableRowElement05 NIST The cells attribute specifies the collection of cells in this row. Retrieve the fourth TR element and examine the value of the cells length attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameElement03.xml0000644000175000017500000000346012377676746026277 0ustar vincevince HTMLFrameElement03 NIST The marginHeight attribute specifies the frame margin height, in pixels. Retrieve the marginHeight attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table51.xml0000644000175000017500000000326612377676746024344 0ustar vincevince table51 Netscape Indicates the number of columns in a group or affected by a grouping. The value of attribute span of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection09.xml0000644000175000017500000000400212377676746026025 0ustar vincevince HTMLCollection09 NIST The item(index) method returns null if the index is out of range. Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Invoke the item(index) method with an index of 5. This index is out of range and should return null. Rick Rivello 2002-05-01 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement67.xml0000644000175000017500000000340312377676746025333 0ustar vincevince HTMLElement67 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the U element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement03.xml0000644000175000017500000000343212377676746026456 0ustar vincevince HTMLAnchorElement03 NIST The coords attribute is a comma-seperated list of lengths, defining an active region geometry. Retrieve the coords attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement17.xml0000644000175000017500000000346712377676746026360 0ustar vincevince HTMLInputElement17 NIST The useMap attribute specifies the use of the client-side image map. Retrieve the useMap attribute of the 8th INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement05.xml0000644000175000017500000000347712377676746027633 0ustar vincevince HTMLTableSectionElement05 NIST The ch attribute specifies the alignment character for cells in a column. Retrieve the char attribute of the first TFOOT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement101.xml0000644000175000017500000000345512377676746025407 0ustar vincevince HTMLElement101 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the EM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement09.xml0000644000175000017500000000350312377676746026457 0ustar vincevince HTMLObjectElement09 NIST The declare attribute specifies this object should be declared only and no instance of it should be created. Retrieve the declare attribute of the second OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement103.xml0000644000175000017500000000345712377676746025413 0ustar vincevince HTMLElement103 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the DFN element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDivElement01.xml0000644000175000017500000000337412377676746025771 0ustar vincevince HTMLDivElement01 NIST The align attribute specifies the horizontal text alignment. Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table53.xml0000644000175000017500000000322612377676746024342 0ustar vincevince table53 Netscape Default column width. The value of attribute width of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement14.xml0000644000175000017500000000351412377676746026455 0ustar vincevince HTMLObjectElement14 NIST The type attribute specifies the content type for data downloaded via the data attribute. Retrieve the type attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement06.xml0000644000175000017500000000347512377676746026743 0ustar vincevince HTMLTableColElement06 NIST The charoff attribute specifies offset of alignment character(COLGROUP). Retrieve the charoff attribute from the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement14.xml0000644000175000017500000000277012377676746026464 0ustar vincevince HTMLAnchorElement14 Curt Arnold HTMLAnchorElement.focus should capture input focus. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement01.xml0000644000175000017500000000400412377676746026755 0ustar vincevince HTMLTableRowElement01 NIST The rowIndex attribute specifies the index of the row, relative to the entire table, starting from 0. This is in document tree order and not display order. The rowIndex does not take into account sections (THEAD, TFOOT, or TBODY) within the table. Retrieve the third TR element within the document and examine its rowIndex value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement11.xml0000644000175000017500000000351212377676746026461 0ustar vincevince HTMLSelectElement11 NIST The name attribute specifies the form control or object name when submitted with a form. Retrieve the name attribute from the first SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement05.xml0000644000175000017500000000340512377676746026460 0ustar vincevince HTMLAnchorElement05 NIST The hreflang attribute contains the language code of the linked resource. Retrieve the hreflang attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameSetElement02.xml0000644000175000017500000000344312377676746026753 0ustar vincevince HTMLFrameSetElement02 NIST The rows attribute specifies the number of rows of frames in the frameset. Retrieve the rows attribute of the second FRAMESET element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement02.xml0000644000175000017500000000351112377676746027070 0ustar vincevince HTMLTableCellElement02 NIST The cellIndex attribute specifies the index of this cell in the row(TD). Retrieve the cellIndex attribute of the first TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement14.xml0000644000175000017500000000275512377676746026474 0ustar vincevince HTMLSelectElement14 Curt Arnold focus should give the select element input focus. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement34.xml0000644000175000017500000000341512377676746025330 0ustar vincevince HTMLElement34 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the BDO element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"BDO Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement03.xml���������������������������0000644�0001750�0001750�00000003347�12377676746�025330� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement03"> <metadata> <title>HTMLElement03 NIST The id specifies the elements identifier. Retrieve the id attribute of the SUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement07.xml0000644000175000017500000000336412377676746026151 0ustar vincevince HTMLLinkElement07 NIST The rev attribute specifies the reverse link type. Retrieve the rev attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table19.xml0000644000175000017500000000330012377676746024335 0ustar vincevince table19 Netscape Abbreviation for header cells. The index of this cell in the row. The value of attribute abbr of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement13.xml0000644000175000017500000000370112377676746027620 0ustar vincevince HTMLTableSectionElement13 NIST The rows attribute specifies the collection of rows in this table section. Retrieve the first THEAD element and examine the value of the rows length attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement05.xml0000644000175000017500000000347212377676746026460 0ustar vincevince HTMLObjectElement05 NIST The border attribute specifies the widht of the border around the object. Retrieve the border attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement01.xml0000644000175000017500000000366612377676746026302 0ustar vincevince HTMLTableElement01 NIST The caption attribute returns the tables CAPTION. Retrieve the align attribute of the CAPTION element from the second TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement47.xml0000644000175000017500000000342012377676746025330 0ustar vincevince HTMLElement47 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the SAMP element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"SAMP Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement07.xml���������������������0000644�0001750�0001750�00000003430�12377676746�026411� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xml" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLIFrameElement07"> <metadata> <title>HTMLIFrameElement07 NIST The name attribute specifies the frame name(object of the target attribute). Retrieve the name attribute of the first IFRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLUListElement02.xml0000644000175000017500000000336112377676746026304 0ustar vincevince HTMLUListElement02 NIST The type attribute specifies the bullet style. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement03.xml0000644000175000017500000000336312377676746026144 0ustar vincevince HTMLLinkElement03 NIST The href attribute specifies the URI of the linked resource. Retrieve the href attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement16.xml0000644000175000017500000000334712377676746025334 0ustar vincevince HTMLElement16 NIST The id specifies the elements identifier. Retrieve the id attribute of the DFN element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table24.xml0000644000175000017500000000324012377676746024334 0ustar vincevince table24 Netscape offset of alignment character. The value of attribute chOff of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement07.xml0000644000175000017500000000351112377676746027622 0ustar vincevince HTMLTableSectionElement07 NIST The chOff attribute specifies the offset of alignment character. Retrieve the charoff attribute of the first THEAD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement03.xml0000644000175000017500000000352312377676746026515 0ustar vincevince HTMLOptionElement03 NIST The defaultSelected attribute contains the value of the selected attribute. Retrieve the defaultSelected attribute from the first OPTION element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement04.xml0000644000175000017500000000352612377676746026154 0ustar vincevince HTMLFormElement04 NIST The acceptCharset attribute specifies the list of character sets supported by the server. Retrieve the acceptCharset attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement24.xml0000644000175000017500000000452512377676746027627 0ustar vincevince HTMLTableSectionElement24 NIST The deleteRow() method deletes a row from this section. Retrieve the first TBODY element and invoke the deleteRow() method with an index of 0. The nuber of rows in the TBODY section before the deletion of the row is two. After the row is deleted the number of rows in the TBODY section is one. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table09.xml0000644000175000017500000000345712377676746024351 0ustar vincevince table09 Netscape Vertical alignment of data in cells. The value of attribute valign of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAreaElement04.xml0000644000175000017500000000335612377676746026122 0ustar vincevince HTMLAreaElement04 NIST The href attribute specifies the URI of the linked resource. Retrieve the href attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement115.xml0000644000175000017500000000346712377676746025417 0ustar vincevince HTMLElement115 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the ADDRESS element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLParamElement04.xml0000644000175000017500000000346112377676746026307 0ustar vincevince HTMLParamElement04 NIST The type attribute specifies the content type for the value attribute when valuetype has the value ref. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement30.xml0000644000175000017500000000344312377676746027075 0ustar vincevince HTMLTableCellElement30 NIST The width attribute specifies the cells width. Retrieve the width attribute from the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadElement01.xml0000644000175000017500000000340412377676746026102 0ustar vincevince HTMLHeadElement01 NIST The profile attribute specifies a URI designating a metadata profile. Retrieve the profile attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement22.xml0000644000175000017500000000427512377676746026302 0ustar vincevince HTMLTableElement22 NIST The createTFoot() method creates a table footer row or returns an existing one. Create a new TFOOT element on the first TABLE element. The first TABLE element should return null to make sure one doesn't exist. After creation of the TFOOT element the value is once again checked and should not be null. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement23.xml0000644000175000017500000000424312377676746026276 0ustar vincevince HTMLTableElement23 NIST The createTFoot() method creates a table footer row or returns an existing one. Try to create a new TFOOT element on the second TABLE element. Since a TFOOT element already exists in the TABLE element a new TFOOT element is not created and information from the already existing TFOOT element is returned. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement64.xml0000644000175000017500000000340512377676746025332 0ustar vincevince HTMLElement64 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the TT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement10.xml0000644000175000017500000000353112377676746026727 0ustar vincevince HTMLTableColElement10 NIST The vAlign attribute specifies the vertical alignment of cell data in column(COLGROUP). Retrieve the vAlign attribute from the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement92.xml0000644000175000017500000000345512377676746025340 0ustar vincevince HTMLElement92 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the BDO element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection10.xml0000644000175000017500000000445212377676746026026 0ustar vincevince HTMLCollection10 NIST The namedItem(name) method retrieves a node using a name. It first searches for a node with a matching id attribute. If it doesn't find one, it then searches for a Node with a matching name attribute, but only on those elements that are allowed a name attribute. Retrieve the first FORM element and create a HTMLCollection by invoking the elements attribute. The first SELECT element is further retrieved using the elements name attribute since the id attribute doesn't match. Rick Rivello 2002-05-01 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLMenuElement01.xml0000644000175000017500000000341312377676746026145 0ustar vincevince HTMLMenuElement01 NIST The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument21.xml.kfail0000644000175000017500000000467312377676746026605 0ustar vincevince HTMLDocument21 Curt Arnold Replaces the current document checks that writeln adds a new line. 2002-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement04.xml0000644000175000017500000000347312377676746026737 0ustar vincevince HTMLTableColElement04 NIST The char attribute specifies the alignment character for cells in a column(COLGROUP). Retrieve the char attribute from the COLGROUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement04.xml0000644000175000017500000000341512377676746026270 0ustar vincevince HTMLImageElement04 NIST The border attribute specifies the width of the border around the image. Retrieve the border attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection05.xml0000644000175000017500000000371112377676746026027 0ustar vincevince HTMLCollection05 NIST The length attribute specifies the length or size of the list. Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Retrieve the length attribute of the HTMLCollection object. Rick Rivello 2002-05-01 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement06.xml0000644000175000017500000000334412377676746025330 0ustar vincevince HTMLElement06 NIST The id specifies the elements identifier. Retrieve the id attribute of the TT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement27.xml0000644000175000017500000000350612377676746027103 0ustar vincevince HTMLTableCellElement27 NIST The vAlign attribute specifies the vertical alignment of data in cell. Retrieve the vAlign attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLModElement03.xml0000644000175000017500000000345412377676746025767 0ustar vincevince HTMLModElement03 NIST The cite attribute specifies an URI designating a document that describes the reason for the change. Retrieve the cite attribute of the DEL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement09.xml0000644000175000017500000000346412377676746026476 0ustar vincevince HTMLSelectElement09 NIST The disabled attribute indicates that this control is not available within this context. Retrieve the disabled attribute from the third SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDlistElement01.xml0000644000175000017500000000341212377676746026317 0ustar vincevince HTMLDListElement01 NIST The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement50.xml0000644000175000017500000000342012377676746025322 0ustar vincevince HTMLElement50 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the CITE element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"CITE Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement10.xml���������������0000644�0001750�0001750�00000003536�12377676746�027623� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLTableSectionElement10"> <metadata> <title>HTMLTableSectionElement10 NIST The vAlign attribute specifies the vertical alignment of cell data in column. Retrieve the vAlign attribute of the first THEAD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/button07.xml0000644000175000017500000000321712377676746024565 0ustar vincevince button07 Netscape The type of button The value of attribute type of the button element is read and checked against the expected value. Sivakiran Tummala 2002-03-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement25.xml0000644000175000017500000000347412377676746027105 0ustar vincevince HTMLTableCellElement25 NIST The scope attribute specifies the scope covered by header cells. Retrieve the scope attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table50.xml0000644000175000017500000000323712377676746024341 0ustar vincevince table50 Netscape Offset of alignment character. The value of attribute choff of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement01.xml0000644000175000017500000000351112377676746027067 0ustar vincevince HTMLTableCellElement01 NIST The cellIndex attribute specifies the index of this cell in the row(TH). Retrieve the cellIndex attribute of the first TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLQuoteElement02.xml0000644000175000017500000000346312377676746026344 0ustar vincevince HTMLQuoteElement02 NIST The cite attribute specifies a URI designating a source document or message. Retrieve the cite attribute from the BLOCKQUOTE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement08.xml0000644000175000017500000000337212377676746026151 0ustar vincevince HTMLLinkElement08 NIST The type attribute specifies the advisory content type. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement08.xml0000644000175000017500000000334112377676746025327 0ustar vincevince HTMLElement08 NIST The id specifies the elements identifier. Retrieve the id attribute of the B element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement02.xml0000644000175000017500000000346412377676746026520 0ustar vincevince HTMLOptionElement02 NIST The form attribute returns null if control in not within the context of a form. Retrieve the first OPTION attribute from the second select element and examine its form element. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement06.xml0000644000175000017500000000345612377676746026160 0ustar vincevince HTMLFormElement06 NIST The enctype attribute specifies the content of the submitted form. Retrieve the enctype attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement26.xml0000644000175000017500000000346312377676746027104 0ustar vincevince HTMLTableCellElement26 NIST The scope attribute specifies the scope covered by data cells. Retrieve the scope attribute from the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement09.xml0000644000175000017500000000334112377676746025330 0ustar vincevince HTMLElement09 NIST The id specifies the elements identifier. Retrieve the id attribute of the U element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement11.xml0000644000175000017500000000351512377676746027074 0ustar vincevince HTMLTableCellElement11 NIST The char attribute specifies the alignment character for cells in a column of table header cells(TH). Retrieve the char attribute from the second TH element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement128.xml0000644000175000017500000000345412377676746025417 0ustar vincevince HTMLElement128 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the BIG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameElement02.xml0000644000175000017500000000347512377676746026304 0ustar vincevince HTMLFrameElement02 NIST The longDesc attribute specifies a URI designating a long description of this image or frame. Retrieve the longDesc attribute of the first FRAME element and examine its value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAppletElement04.xml0000644000175000017500000000335312377676746026474 0ustar vincevince HTMLAppletElement04 NIST The code attribute specifies the applet class file. Retrieve the code attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAreaElement01.xml0000644000175000017500000000347512377676746026121 0ustar vincevince HTMLAreaElement01 NIST The accessKey attribute specifies a single character access key to give access to the control form. Retrieve the accessKey attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement65.xml0000644000175000017500000000340312377676746025331 0ustar vincevince HTMLElement65 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the I element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement58.xml0000644000175000017500000000342612377676746025340 0ustar vincevince HTMLElement58 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the CENTER element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"CENTER Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement17.xml���������������������������0000644�0001750�0001750�00000003352�12377676746�025331� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement17"> <metadata> <title>HTMLElement17 NIST The id specifies the elements identifier. Retrieve the id attribute of the CODE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument11.xml0000644000175000017500000000324012377676746025504 0ustar vincevince HTMLDocument11 NIST The anchors attribute returns a collection of all A elements with values for the name attribute. Retrieve the anchors attribute from the document and examine its value. Rick Rivello 2002-04-30 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameElement04.xml0000644000175000017500000000344612377676746026304 0ustar vincevince HTMLFrameElement04 NIST The marginWidth attribute specifies the frame margin width, in pixels. Retrieve the marginWidth attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement83.xml0000644000175000017500000000340512377676746025333 0ustar vincevince HTMLElement83 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the DT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table02.xml0000644000175000017500000000347012377676746024335 0ustar vincevince table02 Netscape Caption alignment with respect to the table. The value of attribute align of the tablecaption element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBodyElement03.xml0000644000175000017500000000342112377676746026137 0ustar vincevince HTMLBodyElement03 NIST The bgColor attribute specifies the document background color. Retrieve the bgColor attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement11.xml0000644000175000017500000000347212377676746026346 0ustar vincevince HTMLInputElement11 NIST The name attribute is the form control or object name when submitted with a form. Retrieve the name attribute of the 1st INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument10.xml0000644000175000017500000000317212377676746025507 0ustar vincevince HTMLDocument10 NIST The forms attribute returns a collection of all the forms in a document. Retrieve the forms attribute from the document and examine its value. Rick Rivello 2002-04-30 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLMetaElement03.xml0000644000175000017500000000337212377676746026135 0ustar vincevince HTMLMetaElement03 NIST The name attribute specifies the meta information name. Retrieve the name attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHtmlElement01.xml0000644000175000017500000000363312377676746026151 0ustar vincevince HTMLHtmlElement01 NIST The version attribute specifies version information about the document's DTD. Retrieve the version attribute and examine its value. Test is only applicable to HTML, version attribute is not supported in XHTML. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement28.xml0000644000175000017500000000350212377676746027100 0ustar vincevince HTMLTableCellElement28 NIST The vAlign attribute specifies the vertical alignment of data in cell. Retrieve the vAlign attribute from the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement40.xml0000644000175000017500000000342612377676746025327 0ustar vincevince HTMLElement40 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the STRIKE element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"STRIKE Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTextAreaElement13.xml�������������������0000644�0001750�0001750�00000003002�12377676746�026753� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLTextAreaElement13"> <metadata> <title>HTMLTextAreaElement13 Curt Arnold Calling HTMLTextAreaElement.blur should surrender input focus. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement73.xml0000644000175000017500000000341512377676746025333 0ustar vincevince HTMLElement73 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the STRONG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement03.xml0000644000175000017500000000366012377676746026276 0ustar vincevince HTMLTableElement03 NIST The tHead attribute returns the tables THEAD. Retrieve the align attribute of the THEAD element from the second TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTitleElement01.xml0000644000175000017500000000342212377676746026322 0ustar vincevince HTMLTitleElement01 NIST The text attribute is the specified title as a string. Retrieve the text attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement08.xml0000644000175000017500000000345112377676746026274 0ustar vincevince HTMLImageElement08 NIST The longDesc attribute contains an URI designating a long description of this image or frame. Retrieve the longDesc attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement45.xml0000644000175000017500000000341512377676746025332 0ustar vincevince HTMLElement45 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the DFN element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"DFN Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement15.xml���������������������������0000644�0001750�0001750�00000003360�12377676746�025326� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement15"> <metadata> <title>HTMLElement15 NIST The id specifies the elements identifier. Retrieve the id attribute of the STRONG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement08.xml0000644000175000017500000000335512377676746026160 0ustar vincevince HTMLFormElement08 NIST The target attribute specifies the frame to render the resource in. Retrieve the target attribute and examine it's value. Rick Rivello 2002-05-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement75.xml0000644000175000017500000000341112377676746025331 0ustar vincevince HTMLElement75 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the CODE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/button09.xml0000644000175000017500000000325412377676746024570 0ustar vincevince button09 Netscape The current form control value. The value of attribute value of the button element is read and checked against the expected value. Sivakiran Tummala 2002-03-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/button01.xml0000644000175000017500000000314112377676746024553 0ustar vincevince button01 Netscape Returns the FORM element containing this control. Returns null if this control is not within the context of a form. Sivakiran Tummala 2002-03-09 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLabelElement04.xml0000644000175000017500000000351312377676746026264 0ustar vincevince HTMLLabelElement04 NIST The htmlFor attribute links this label with another form control by id attribute. Retrieve the htmlFor attribute of the first LABEL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement16.xml0000644000175000017500000000462012377676746027624 0ustar vincevince HTMLTableSectionElement16 NIST The insertRow() method inserts a new empty table row. Retrieve the first THEAD element and invoke the insertRow() method with an index of 0. The nuber of rows in the THEAD section before insertion of the new row is one. After the new row is inserted the number of rows in the THEAD section is two. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTextAreaElement05.xml0000644000175000017500000000345112377676746026764 0ustar vincevince HTMLTextAreaElement05 NIST The cols attribute specifies the width of control(in characters). Retrieve the cols attribute of the 1st TEXTAREA element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement19.xml0000644000175000017500000000334712377676746025337 0ustar vincevince HTMLElement19 NIST The id specifies the elements identifier. Retrieve the id attribute of the KBD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement12.xml0000644000175000017500000000621412377676746026764 0ustar vincevince HTMLTableRowElement12 NIST The insertCell() method inserts an empty TD cell into this row. Retrieve the fourth TR element and examine the value of the cells length attribute which should be set to six. Check the value of the last TD element. Invoke the insertCell() which will append the empty cell to the end of the list. Check the value of the newly created cell and make sure it is null and also the numbers of cells should now be seven. Rick Rivello 2002-05-06 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement12.xml0000644000175000017500000000346312377676746026277 0ustar vincevince HTMLTableElement12 NIST The border attribute specifies the width of the border around the table. Retrieve the border attribute of the first TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement10.xml0000644000175000017500000000356612377676746026351 0ustar vincevince HTMLInputElement10 NIST The maxLength attribute is the maximum number of text characters for text fields, when type has the value of Text or Password. Retrieve the maxLenght attribute of the 1st INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement18.xml0000644000175000017500000000512212377676746026467 0ustar vincevince HTMLSelectElement18 Curt Arnold Add a new option at the end of an select using HTMLSelectElement.add. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument15.xml0000644000175000017500000000344212377676746025514 0ustar vincevince HTMLDocument15 NIST The getElementById method returns the Element whose id is given by elementId. If no such element exists, returns null. Retrieve the element whose id is "mapid". Check the value of the element. Rick Rivello 2002-07-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement70.xml0000644000175000017500000000340712377676746025331 0ustar vincevince HTMLElement70 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the BIG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLMetaElement04.xml0000644000175000017500000000340212377676746026130 0ustar vincevince HTMLMetaElement04 NIST The scheme attribute specifies a select form of content. Retrieve the scheme attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIsIndexElement01.xml.kfail0000644000175000017500000000420412377676746027670 0ustar vincevince HTMLIsIndexElement01 NIST The form attribute returns the FORM element containing this control. Retrieve the form attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/anchor04.xml.kfail0000644000175000017500000000323212377676746025603 0ustar vincevince anchor04 Netscape The URI of the linked resource. The value of attribute href of the anchor element is read and checked against the expected value. Sivakiran Tummala 2002-02-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement13.xml.kfail0000644000175000017500000000432512377676746027433 0ustar vincevince HTMLInputElement13 NIST The size attribute contains the size information. Its precise meaning is specific to each type of field. Retrieve the size attribute of the 1st INPUT element and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table28.xml0000644000175000017500000000324512377676746024345 0ustar vincevince table28 Netscape Number of rows spanned by cell. The value of attribute rowspan of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement144.xml0000644000175000017500000000347012377676746025413 0ustar vincevince HTMLElement144 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the ADDRESS element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAppletElement06.xml0000644000175000017500000000332312377676746026473 0ustar vincevince HTMLAppletElement06 NIST The height attribute overrides the height. Retrieve the height attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameElement07.xml0000644000175000017500000000345512377676746026307 0ustar vincevince HTMLFrameElement07 NIST The scrolling attribute specifies whether or not the frame should have scrollbars. Retrieve the scrolling attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFontElement03.xml0000644000175000017500000000335012377676746026151 0ustar vincevince HTMLFontElement03 NIST The size attribute specifies the font's size. Retrieve the size attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLInputElement07.xml0000644000175000017500000000351412377676746026350 0ustar vincevince HTMLInputElement07 NIST The alt attribute alternates text for user agents not rendering the normal content of this element. Retrieve the alt attribute of the 1st INPUT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLStyleElement03.xml0000644000175000017500000000342012377676746026341 0ustar vincevince HTMLStyleElement03 NIST The type attribute specifies the style sheet language(Internet media type). Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement52.xml0000644000175000017500000000342012377676746025324 0ustar vincevince HTMLElement52 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the ABBR element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"ABBR Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table38.xml���������������������������������0000644�0001750�0001750�00000003334�12377676746�024345� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="table38"> <metadata> <title>table38 Netscape Specifies the horizontal and vertical separation between cells. The value of attribute cellspacing of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement06.xml0000644000175000017500000000342312377676746027623 0ustar vincevince HTMLTableSectionElement06 NIST The ch attribute specifies the alignment character for cells in a column. Retrieve the char attribute of the first TBODY element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement04.xml0000644000175000017500000000350312377676746026273 0ustar vincevince HTMLTableElement04 NIST The tHead attribute returns the tables THEAD or null if it does not exist. Retrieve the THEAD element from within the first TABLE element. Since one does not exist it should be null. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement141.xml0000644000175000017500000000345112377676746025407 0ustar vincevince HTMLElement141 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the DT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement08.xml0000644000175000017500000000352612377676746026525 0ustar vincevince HTMLOptionElement08 NIST The selected attribute indicates the current state of the corresponding form control in an interactive user-agent. Retrieve the selected attribute from the first OPTION element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement131.xml0000644000175000017500000000346512377676746025413 0ustar vincevince HTMLElement131 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the STRONG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement12.xml0000644000175000017500000000342712377676746026467 0ustar vincevince HTMLSelectElement12 NIST The size attribute specifies the number of visible rows. Retrieve the size attribute from the first SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement87.xml0000644000175000017500000000341512377676746025340 0ustar vincevince HTMLElement87 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the CENTER element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLIElement01.xml0000644000175000017500000000334412377676746025550 0ustar vincevince HTMLLIElement01 NIST The type attribute is a list item bullet style. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/CVS/0000755000175000017500000000000012377713347022776 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/html/CVS/Template0000644000175000017500000000000012377676746024475 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/html/CVS/Entries0000644000175000017500000010232412377676746024347 0ustar vincevinceD/files//// /.cvsignore/1.1/Fri Apr 3 02:48:02 2009// /HTMLAnchorElement01.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLAnchorElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAnchorElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement04.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement06.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAnchorElement11.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLAnchorElement12.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLAnchorElement13.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLAnchorElement14.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLAppletElement01.xml/1.5/Fri Apr 3 02:48:03 2009// /HTMLAppletElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAppletElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAppletElement04.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLAppletElement05.xml/1.6/Fri Apr 3 02:48:01 2009// /HTMLAppletElement06.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLAppletElement07.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLAppletElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAppletElement09.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLAppletElement10.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAppletElement11.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLAreaElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAreaElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLAreaElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAreaElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAreaElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAreaElement06.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLAreaElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLAreaElement08.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLBRElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLBaseElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLBaseElement02.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLBaseFontElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLBaseFontElement02.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLBaseFontElement03.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLBodyElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLBodyElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLBodyElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLBodyElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLBodyElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLBodyElement06.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLButtonElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLButtonElement02.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLButtonElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLButtonElement04.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLButtonElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLButtonElement06.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLButtonElement07.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLButtonElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLCollection01.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLCollection02.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLCollection03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLCollection04.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLCollection05.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLCollection06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLCollection07.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLCollection08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLCollection09.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLCollection10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLCollection11.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLCollection12.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLDirectoryElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLDivElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLDlistElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLDocument01.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLDocument02.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLDocument03.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument04.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLDocument05.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLDocument07.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLDocument08.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLDocument09.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument10.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument11.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLDocument12.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLDocument13.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument14.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument15.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLDocument16.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLDocument17.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLDocument18.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLDocument19.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLDocument20.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLDocument21.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement09.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement100.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement101.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement102.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement103.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement104.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement105.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement106.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement107.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement108.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement109.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement11.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement110.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement111.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement112.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement113.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement114.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement115.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement116.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement117.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement118.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement119.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement12.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement120.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement121.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement122.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement123.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement124.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement125.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement126.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement127.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement128.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement129.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement13.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement130.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement131.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement132.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement133.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement134.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement135.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement136.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement137.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement138.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement139.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement14.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement140.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement141.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement142.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement143.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement144.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement145.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement15.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement16.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement17.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement18.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement19.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement20.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement21.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement22.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement23.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement24.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement25.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement26.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement27.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement28.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement29.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement30.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement31.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement32.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement33.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement34.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement35.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement36.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement37.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement38.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement39.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement40.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement41.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement42.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement43.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement44.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement45.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement46.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement47.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement48.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement49.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement50.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement51.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement52.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement53.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement54.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement55.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement56.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement57.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement58.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement59.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement60.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement61.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement62.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement63.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement64.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement65.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement66.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement67.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement68.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement69.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement70.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement71.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement72.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement73.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement74.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement75.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement76.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement77.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement78.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement79.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement80.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement81.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement82.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement83.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement84.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement85.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement86.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement87.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement88.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement89.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement90.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement91.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement92.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement93.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement94.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLElement95.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement96.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLElement97.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement98.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLElement99.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFieldSetElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLFieldSetElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFontElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFontElement02.xml/1.5/Fri Apr 3 02:48:02 2009// /HTMLFontElement03.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLFormElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLFormElement02.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLFormElement03.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLFormElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFormElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFormElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLFormElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLFormElement08.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLFormElement09.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLFormElement10.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLFrameElement01.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLFrameElement02.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLFrameElement03.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLFrameElement04.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLFrameElement05.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLFrameElement06.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLFrameElement07.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLFrameElement08.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLFrameSetElement01.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLFrameSetElement02.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLHRElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLHRElement02.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLHRElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLHRElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLHeadElement01.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLHeadingElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLHeadingElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLHeadingElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLHeadingElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLHeadingElement05.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLHeadingElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLHtmlElement01.xml/1.5/Fri Apr 3 02:48:02 2009// /HTMLIFrameElement01.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLIFrameElement02.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLIFrameElement03.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLIFrameElement04.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLIFrameElement05.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLIFrameElement06.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLIFrameElement07.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLIFrameElement08.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLIFrameElement09.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLIFrameElement10.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLImageElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLImageElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement03.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLImageElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement05.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLImageElement06.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLImageElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement09.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLImageElement11.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLImageElement12.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLImageElement14.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLInputElement01.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLInputElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement03.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLInputElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLInputElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement06.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLInputElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLInputElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement10.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement11.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLInputElement12.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement13.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLInputElement14.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLInputElement15.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLInputElement16.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement17.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLInputElement18.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLInputElement19.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLInputElement20.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLInputElement21.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLInputElement22.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLIsIndexElement01.xml/1.6/Fri Apr 3 02:48:02 2009// /HTMLIsIndexElement02.xml/1.5/Fri Apr 3 02:48:01 2009// /HTMLIsIndexElement03.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLLIElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLIElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLabelElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLLabelElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLabelElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLabelElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLegendElement01.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLLegendElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLegendElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLegendElement04.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLLinkElement01.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLLinkElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLinkElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLinkElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLinkElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLinkElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLinkElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLLinkElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLLinkElement09.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLMapElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLMapElement02.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLMenuElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLMetaElement01.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLMetaElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLMetaElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLMetaElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLModElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLModElement02.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLModElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLModElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOListElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLOListElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLOListElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement01.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLObjectElement02.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLObjectElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement05.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLObjectElement06.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLObjectElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement10.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement11.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLObjectElement12.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement13.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement14.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement15.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement16.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLObjectElement17.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLObjectElement18.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLObjectElement19.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLOptGroupElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptGroupElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLOptionElement01.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLOptionElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement07.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLOptionElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLOptionElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLParagraphElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLParamElement01.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLParamElement02.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLParamElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLParamElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLPreElement01.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLQuoteElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLQuoteElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLScriptElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLScriptElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLScriptElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLScriptElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLScriptElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLScriptElement06.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLScriptElement07.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLSelectElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLSelectElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLSelectElement03.xml/1.5/Fri Apr 3 02:48:01 2009// /HTMLSelectElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLSelectElement05.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLSelectElement06.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLSelectElement07.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLSelectElement08.xml/1.6/Fri Apr 3 02:48:03 2009// /HTMLSelectElement09.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLSelectElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLSelectElement11.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLSelectElement12.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLSelectElement13.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLSelectElement14.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLSelectElement15.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLSelectElement16.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLSelectElement17.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLSelectElement18.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLSelectElement19.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLStyleElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLStyleElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLStyleElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCaptionElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement06.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableCellElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement09.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement10.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement11.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement12.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement13.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement14.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement15.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement16.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement17.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement18.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement19.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement20.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement21.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableCellElement22.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement23.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement24.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement25.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableCellElement26.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement27.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableCellElement28.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement29.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableCellElement30.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableColElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement02.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableColElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableColElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement06.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableColElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableColElement10.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableColElement11.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableColElement12.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement03.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement04.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableElement05.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement06.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableElement07.xml/1.5/Fri Apr 3 02:48:03 2009// /HTMLTableElement08.xml/1.5/Fri Apr 3 02:48:01 2009// /HTMLTableElement09.xml/1.5/Fri Apr 3 02:48:01 2009// /HTMLTableElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement11.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement12.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement13.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement14.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement15.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement16.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement17.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement18.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableElement19.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLTableElement20.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLTableElement21.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLTableElement22.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLTableElement23.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLTableElement24.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLTableElement25.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLTableElement26.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLTableElement27.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTableElement28.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLTableElement29.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableElement30.xml/1.2/Fri Apr 3 02:48:01 2009// /HTMLTableElement31.xml/1.7/Fri Apr 3 02:48:02 2009// /HTMLTableElement32.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLTableElement33.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement06.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement07.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement09.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement10.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement11.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableRowElement12.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableRowElement13.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLTableRowElement14.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement02.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement03.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement04.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement06.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement07.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement08.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement09.xml/1.4/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement10.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement11.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement12.xml/1.4/Fri Apr 3 02:48:03 2009// /HTMLTableSectionElement13.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement14.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTableSectionElement15.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement16.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement17.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement18.xml/1.2/Fri Apr 3 02:48:03 2009// /HTMLTableSectionElement19.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement20.xml/1.1/Fri Apr 3 02:48:02 2009// /HTMLTableSectionElement21.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement22.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLTableSectionElement23.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTableSectionElement24.xml/1.2/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement01.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTextAreaElement02.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement03.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement04.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement05.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement06.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement07.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement08.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLTextAreaElement09.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement10.xml/1.3/Fri Apr 3 02:48:03 2009// /HTMLTextAreaElement11.xml/1.4/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement12.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement13.xml/1.1/Fri Apr 3 02:48:03 2009// /HTMLTextAreaElement14.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTextAreaElement15.xml/1.1/Fri Apr 3 02:48:01 2009// /HTMLTitleElement01.xml/1.3/Fri Apr 3 02:48:01 2009// /HTMLUListElement01.xml/1.3/Fri Apr 3 02:48:02 2009// /HTMLUListElement02.xml/1.3/Fri Apr 3 02:48:01 2009// /alltests.xml/1.10/Fri Apr 3 02:48:01 2009// /anchor01.xml/1.1/Fri Apr 3 02:48:01 2009// /anchor02.xml/1.1/Fri Apr 3 02:48:02 2009// /anchor03.xml/1.1/Fri Apr 3 02:48:02 2009// /anchor04.xml/1.1/Fri Apr 3 02:48:02 2009// /anchor05.xml/1.1/Fri Apr 3 02:48:01 2009// /anchor06.xml/1.1/Fri Apr 3 02:48:03 2009// /area01.xml/1.1/Fri Apr 3 02:48:02 2009// /area02.xml/1.1/Fri Apr 3 02:48:02 2009// /area03.xml/1.1/Fri Apr 3 02:48:02 2009// /area04.xml/1.1/Fri Apr 3 02:48:01 2009// /basefont01.xml/1.1/Fri Apr 3 02:48:02 2009// /body01.xml/1.1/Fri Apr 3 02:48:01 2009// /button01.xml/1.1/Fri Apr 3 02:48:01 2009// /button02.xml/1.1/Fri Apr 3 02:48:01 2009// /button03.xml/1.1/Fri Apr 3 02:48:02 2009// /button04.xml/1.1/Fri Apr 3 02:48:03 2009// /button05.xml/1.1/Fri Apr 3 02:48:01 2009// /button06.xml/1.1/Fri Apr 3 02:48:01 2009// /button07.xml/1.1/Fri Apr 3 02:48:02 2009// /button08.xml/1.1/Fri Apr 3 02:48:02 2009// /button09.xml/1.1/Fri Apr 3 02:48:02 2009// /dlist01.xml/1.1/Fri Apr 3 02:48:01 2009// /doc01.xml/1.1/Fri Apr 3 02:48:01 2009// /hasFeature01.xml/1.1/Fri Apr 3 02:48:03 2009// /index.htm/1.1/Fri Apr 3 02:48:01 2009// /metadata.xml/1.1/Fri Apr 3 02:48:01 2009// /object01.xml/1.2/Fri Apr 3 02:48:02 2009// /object02.xml/1.2/Fri Apr 3 02:48:02 2009// /object03.xml/1.2/Fri Apr 3 02:48:02 2009// /object04.xml/1.2/Fri Apr 3 02:48:01 2009// /object05.xml/1.2/Fri Apr 3 02:48:01 2009// /object06.xml/1.2/Fri Apr 3 02:48:02 2009// /object07.xml/1.2/Fri Apr 3 02:48:02 2009// /object08.xml/1.4/Fri Apr 3 02:48:02 2009// /object09.xml/1.2/Fri Apr 3 02:48:02 2009// /object10.xml/1.2/Fri Apr 3 02:48:02 2009// /object11.xml/1.2/Fri Apr 3 02:48:02 2009// /object12.xml/1.2/Fri Apr 3 02:48:03 2009// /object13.xml/1.4/Fri Apr 3 02:48:02 2009// /object14.xml/1.2/Fri Apr 3 02:48:01 2009// /object15.xml/1.2/Fri Apr 3 02:48:02 2009// /table01.xml/1.2/Fri Apr 3 02:48:02 2009// /table02.xml/1.2/Fri Apr 3 02:48:02 2009// /table03.xml/1.2/Fri Apr 3 02:48:03 2009// /table04.xml/1.2/Fri Apr 3 02:48:03 2009// /table06.xml/1.2/Fri Apr 3 02:48:01 2009// /table07.xml/1.2/Fri Apr 3 02:48:03 2009// /table08.xml/1.2/Fri Apr 3 02:48:03 2009// /table09.xml/1.2/Fri Apr 3 02:48:01 2009// /table10.xml/1.2/Fri Apr 3 02:48:02 2009// /table12.xml/1.2/Fri Apr 3 02:48:02 2009// /table15.xml/1.2/Fri Apr 3 02:48:02 2009// /table17.xml/1.2/Fri Apr 3 02:48:02 2009// /table18.xml/1.2/Fri Apr 3 02:48:02 2009// /table19.xml/1.2/Fri Apr 3 02:48:01 2009// /table20.xml/1.2/Fri Apr 3 02:48:02 2009// /table21.xml/1.2/Fri Apr 3 02:48:01 2009// /table22.xml/1.2/Fri Apr 3 02:48:02 2009// /table23.xml/1.2/Fri Apr 3 02:48:01 2009// /table24.xml/1.2/Fri Apr 3 02:48:02 2009// /table25.xml/1.2/Fri Apr 3 02:48:02 2009// /table26.xml/1.2/Fri Apr 3 02:48:01 2009// /table27.xml/1.2/Fri Apr 3 02:48:02 2009// /table28.xml/1.2/Fri Apr 3 02:48:01 2009// /table29.xml/1.2/Fri Apr 3 02:48:02 2009// /table30.xml/1.2/Fri Apr 3 02:48:02 2009// /table31.xml/1.2/Fri Apr 3 02:48:03 2009// /table32.xml/1.2/Fri Apr 3 02:48:03 2009// /table33.xml/1.2/Fri Apr 3 02:48:01 2009// /table34.xml/1.2/Fri Apr 3 02:48:02 2009// /table35.xml/1.2/Fri Apr 3 02:48:02 2009// /table36.xml/1.2/Fri Apr 3 02:48:02 2009// /table37.xml/1.2/Fri Apr 3 02:48:01 2009// /table38.xml/1.2/Fri Apr 3 02:48:02 2009// /table39.xml/1.2/Fri Apr 3 02:48:02 2009// /table40.xml/1.2/Fri Apr 3 02:48:02 2009// /table41.xml/1.2/Fri Apr 3 02:48:01 2009// /table42.xml/1.2/Fri Apr 3 02:48:02 2009// /table43.xml/1.2/Fri Apr 3 02:48:01 2009// /table44.xml/1.2/Fri Apr 3 02:48:02 2009// /table45.xml/1.2/Fri Apr 3 02:48:03 2009// /table46.xml/1.2/Fri Apr 3 02:48:03 2009// /table47.xml/1.2/Fri Apr 3 02:48:03 2009// /table48.xml/1.2/Fri Apr 3 02:48:01 2009// /table49.xml/1.2/Fri Apr 3 02:48:01 2009// /table50.xml/1.2/Fri Apr 3 02:48:02 2009// /table51.xml/1.2/Fri Apr 3 02:48:01 2009// /table52.xml/1.2/Fri Apr 3 02:48:02 2009// /table53.xml/1.2/Fri Apr 3 02:48:01 2009// netsurf-all-3.2/libdom/test/testcases/tests/level1/html/CVS/Root0000644000175000017500000000005612377676746023660 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/level1/html/CVS/Repository0000644000175000017500000000004612377676746025113 0ustar vincevince2001/DOM-Test-Suite/tests/level1/html netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOListElement02.xml0000644000175000017500000000337512377676746026303 0ustar vincevince HTMLOListElement02 NIST The start attribute specifies the starting sequence number. Retrieve the start attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement72.xml0000644000175000017500000000340512377676746025331 0ustar vincevince HTMLElement72 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the EM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement108.xml0000644000175000017500000000346112377676746025413 0ustar vincevince HTMLElement108 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CITE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDirectoryElement01.xml0000644000175000017500000000343612377676746027212 0ustar vincevince HTMLDirectoryElement01 NIST The compact attribute specifies a boolean value on whether to display the list more compactly. Retrieve the compact attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement68.xml0000644000175000017500000000340312377676746025334 0ustar vincevince HTMLElement68 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the S element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement18.xml0000644000175000017500000000350712377676746026463 0ustar vincevince HTMLObjectElement18 NIST The name attribute specifies form control or object name when submitted with a form. Retrieve the name attribute of the second OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement61.xml0000644000175000017500000000340712377676746025331 0ustar vincevince HTMLElement61 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SUP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadingElement02.xml0000644000175000017500000000341512377676746026603 0ustar vincevince HTMLHeadingElement02 NIST The align attribute specifies the horizontal text alignment(H2). Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement122.xml0000644000175000017500000000345112377676746025406 0ustar vincevince HTMLElement122 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the TT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table27.xml0000644000175000017500000000317112377676746024342 0ustar vincevince table27 Netscape Suppress word wrapping. The value of attribute nowrap of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table32.xml0000644000175000017500000000321412377676746024334 0ustar vincevince table32 Netscape cell width. The value of attribute width of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHRElement02.xml0000644000175000017500000000336112377676746025555 0ustar vincevince HTMLHRElement02 NIST The noShade attribute specifies that the rule should be drawn as a solid color. Retrieve the noShade attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement104.xml0000644000175000017500000000346112377676746025407 0ustar vincevince HTMLElement104 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the CODE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table25.xml0000644000175000017500000000325012377676746024336 0ustar vincevince table25 Netscape Number of columns spanned by cell. The value of attribute colspan of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table34.xml0000644000175000017500000000325012377676746024336 0ustar vincevince table34 Netscape The width of the border around the table. The value of attribute border of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement06.xml0000644000175000017500000000357312377676746026474 0ustar vincevince HTMLSelectElement06 NIST The form attribute returns the FORM element containing this control. Retrieve the form attribute from the first SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement02.xml0000644000175000017500000000370212377676746026762 0ustar vincevince HTMLTableRowElement02 NIST The sectionRowIndex attribute specifies the index of this row, relative to the current section(THEAD, TFOOT, or TBODY),starting from 0. Retrieve the second TR(1st In THEAD) element within the document and examine its sectionRowIndex value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument19.xml.kfail0000644000175000017500000000404312377676746026603 0ustar vincevince HTMLDocument19 Curt Arnold Replaces the current document with a valid HTML document using HTMLDocument.open, write and close. 2002-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLScriptElement01.xml0000644000175000017500000000341312377676746026505 0ustar vincevince HTMLScriptElement01 NIST The text attribute specifies the script content of the element. Retrieve the text attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement120.xml0000644000175000017500000000345712377676746025412 0ustar vincevince HTMLElement120 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SPAN element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement24.xml0000644000175000017500000000334412377676746025330 0ustar vincevince HTMLElement24 NIST The id specifies the elements identifier. Retrieve the id attribute of the DD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table29.xml0000644000175000017500000000324212377676746024343 0ustar vincevince table29 Netscape Scope covered by header cells. The value of attribute scope of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFrameSetElement01.xml0000644000175000017500000000344312377676746026752 0ustar vincevince HTMLFrameSetElement01 NIST The cols attribute specifies the number of columns of frames in the frameset. Retrieve the cols attribute of the first FRAMESET element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table03.xml0000644000175000017500000000344012377676746024333 0ustar vincevince table03 Netscape Alignment character for cells in a column. The value of attribute ch of the tablesection element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument09.xml0000644000175000017500000000325412377676746025520 0ustar vincevince HTMLDocument09 NIST The links attribute returns a collection of all AREA and A elements in a document with a value for the href attribute. Retrieve the links attribute from the document and examine its value. Rick Rivello 2002-04-30 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTextAreaElement09.xml0000644000175000017500000000343512377676746026772 0ustar vincevince HTMLTextAreaElement09 NIST The rows attribute specifies the number of text rowns. Retrieve the rows attribute of the 1st TEXTAREA element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement121.xml0000644000175000017500000000345412377676746025410 0ustar vincevince HTMLElement121 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the BDO element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLegendElement03.xml0000644000175000017500000000350112377676746026437 0ustar vincevince HTMLLegendElement03 NIST The accessKey attribute is a single character access key to give access to the form control. Retrieve the accessKey attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement02.xml0000644000175000017500000000347412377676746026154 0ustar vincevince HTMLFormElement02 NIST The length attribute specifies the number of form controls in the form. Retrieve the length attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement100.xml0000644000175000017500000000346312377676746025405 0ustar vincevince HTMLElement100 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SMALL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement15.xml0000644000175000017500000000273512377676746026473 0ustar vincevince HTMLSelectElement15 Curt Arnold blur should surrender input focus. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement10.xml0000644000175000017500000000353012377676746026760 0ustar vincevince HTMLTableRowElement10 NIST The vAlign attribute specifies the vertical alignment of data within cells of this row. Retrieve the vAlign attribute of the second TR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement07.xml0000644000175000017500000000353312377676746026460 0ustar vincevince HTMLObjectElement07 NIST The codeType attribute specifies the data downloaded via the classid attribute. Retrieve the codeType attribute of the second OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement32.xml0000644000175000017500000000443612377676746026302 0ustar vincevince HTMLTableElement32 NIST The deleteRow() method deletes a table row. Retrieve the second TABLE element and invoke the deleteRow() method with an index of 0(first row). Currently there are four rows in the table. After the deleteRow() method is called there should be three rows in the table. Rick Rivello 2002-05-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table01.xml0000644000175000017500000000322112377676746024326 0ustar vincevince table01 Netscape Returns the table's CAPTION, or void if none exists. The value of attribute caption of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAnchorElement12.xml0000644000175000017500000000334212377676746026456 0ustar vincevince HTMLAnchorElement12 NIST The type attribute contains the advisory content model. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement10.xml0000644000175000017500000000350712377676746026453 0ustar vincevince HTMLObjectElement10 NIST The height attribute overrides the value of the actual height of the object. Retrieve the height attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table33.xml0000644000175000017500000000330612377676746024337 0ustar vincevince table33 Netscape Specifies the table's position with respect to the rest of the document. The value of attribute align of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement46.xml0000644000175000017500000000342012377676746025327 0ustar vincevince HTMLElement46 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the CODE element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"CODE Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object08.xml.kfail��������������������������0000644�0001750�0001750�00000004170�12377676746�025605� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="object08"> <metadata> <title>object08 Netscape Horizontal space to the left and right of this image, applet, or object. The value of attribute hspace of the object element is read and checked against the expected value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement08.xml0000644000175000017500000000346212377676746026417 0ustar vincevince HTMLIFrameElement08 NIST The scrolling attribute specifies whether or not the frame should have scrollbars. Retrieve the scrolling attribute of the first FRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement57.xml0000644000175000017500000000343112377676746025333 0ustar vincevince HTMLElement57 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the ADDRESS element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"ADDRESS Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement106.xml��������������������������0000644�0001750�0001750�00000003457�12377676746�025416� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement106"> <metadata> <title>HTMLElement106 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the KBD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement62.xml0000644000175000017500000000341112377676746025325 0ustar vincevince HTMLElement62 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the SPAN element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLQuoteElement01.xml0000644000175000017500000000342212377676746026336 0ustar vincevince HTMLQuoteElement01 NIST The cite attribute specifies a URI designating a source document or message. Retrieve the cite attribute from the Q element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object01.xml0000644000175000017500000000331712377676746024513 0ustar vincevince object01 Netscape Returns the FORM element containing this control. Returns null if this control is not within the context of a form. The value of attribute form of the object element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement22.xml0000644000175000017500000000336312377676746025327 0ustar vincevince HTMLElement22 NIST The id specifies the elements identifier. Retrieve the id attribute of the ACRONYM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement113.xml0000644000175000017500000000347112377676746025410 0ustar vincevince HTMLElement113 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the NOFRAMES element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLStyleElement01.xml0000644000175000017500000000336312377676746026345 0ustar vincevince HTMLStyleElement01 NIST The disabled attribute enables/disables the stylesheet. Retrieve the disabled attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement02.xml0000644000175000017500000000344112377676746026451 0ustar vincevince HTMLObjectElement02 NIST The code attribute specifies an Applet class file. Retrieve the code attribute of the second OBJECT element and examine its value. Should be "" since CODE is not a valid attribute for OBJECT. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement23.xml0000644000175000017500000000335212377676746025326 0ustar vincevince HTMLElement23 NIST The id specifies the elements identifier. Retrieve the id attribute of the ABBR element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement88.xml0000644000175000017500000000345712377676746025347 0ustar vincevince HTMLElement88 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the HEAD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement53.xml0000644000175000017500000000341212377676746025326 0ustar vincevince HTMLElement53 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the DD element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"DD Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement28.xml���������������������������0000644�0001750�0001750�00000003363�12377676746�025335� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement28"> <metadata> <title>HTMLElement28 NIST The id specifies the elements identifier. Retrieve the id attribute of the ADDRESS element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement134.xml0000644000175000017500000000345712377676746025417 0ustar vincevince HTMLElement134 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SAMP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/object14.xml0000644000175000017500000000320012377676746024506 0ustar vincevince object14 Netscape The value of attribute width of the object element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement08.xml0000644000175000017500000000344112377676746026457 0ustar vincevince HTMLObjectElement08 NIST The data attribute specifies the URI of the location of the objects data. Retrieve the data attribute of the first OBJECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement06.xml0000644000175000017500000000346412377676746026524 0ustar vincevince HTMLOptionElement06 NIST The disabled attribute indicates that this control is not available within this context. Retrieve the disabled attribute from the last OPTION element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadingElement03.xml0000644000175000017500000000341612377676746026605 0ustar vincevince HTMLHeadingElement03 NIST The align attribute specifies the horizontal text alignment(H3). Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement38.xml0000644000175000017500000000340712377676746025335 0ustar vincevince HTMLElement38 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the U element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"U Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement138.xml��������������������������0000644�0001750�0001750�00000003470�12377676746�025416� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement138"> <metadata> <title>HTMLElement138 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the ACRONYM element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement11.xml0000644000175000017500000000353612377676746027624 0ustar vincevince HTMLTableSectionElement11 NIST The vAlign attribute specifies the vertical alignment of cell data in column. Retrieve the vAlign attribute of the first TFOOT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLParamElement03.xml0000644000175000017500000000352012377676746026302 0ustar vincevince HTMLParamElement03 NIST The valueType attribute specifies information about the meaning of the value specified by the value attribute. Retrieve the valueType attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table46.xml0000644000175000017500000000323512377676746024344 0ustar vincevince table46 Netscape Offset of alignment character. The value of attribute choff of the tablerow element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/anchor02.xml0000644000175000017500000000327312377676746024521 0ustar vincevince anchor02 Netscape The character encoding of the linked resource. The value of attribute charset of the anchor element is read and checked against the expected value. Sivakiran Tummala 2002-02-02 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLBodyElement05.xml0000644000175000017500000000336612377676746026151 0ustar vincevince HTMLBodyElement05 NIST The text attribute specifies the document text color. Retrieve the text attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLIElement02.xml0000644000175000017500000000335512377676746025553 0ustar vincevince HTMLLIElement02 NIST The value attribute is a reset sequence number when used in OL. Retrieve the value attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLIFrameElement01.xml0000644000175000017500000000346012377676746026406 0ustar vincevince HTMLIFrameElement01 NIST The align attribute aligns this object(vertically or horizontally with respect to its surrounding text. Retrieve the align attribute of the first IFRAME element and examine it's value. Rick Rivello 2002-05-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement04.xml0000644000175000017500000000347112377676746026520 0ustar vincevince HTMLOptionElement04 NIST The text attribute contains the text contained within the option element. Retrieve the text attribute from the second OPTION element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement143.xml0000644000175000017500000000347312377676746025415 0ustar vincevince HTMLElement143 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the NOSCRIPT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLButtonElement07.xml0000644000175000017500000000337112377676746026525 0ustar vincevince HTMLButtonElement07 NIST The type attribute specifies the type of button. Retrieve the type attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement03.xml0000644000175000017500000000345412377676746026735 0ustar vincevince HTMLTableColElement03 NIST The char attribute specifies the alignment character for cells in a column(COL). Retrieve the char attribute from the COL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement51.xml0000644000175000017500000000343112377676746025325 0ustar vincevince HTMLElement51 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the ACRONYM element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"ACRONYM Element"' id="titleLink" ignoreCase="false"/> </test> ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement91.xml���������������������������0000644�0001750�0001750�00000003457�12377676746�025341� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xsl" type="text/xml"?> <!-- Copyright (c) 2001 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLElement91"> <metadata> <title>HTMLElement91 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the SPAN element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement129.xml0000644000175000017500000000346212377676746025417 0ustar vincevince HTMLElement129 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the SMALL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableColElement11.xml0000644000175000017500000000344512377676746026734 0ustar vincevince HTMLTableColElement11 NIST The width attribute specifies the default column width(COL). Retrieve the width attribute from the COL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableSectionElement09.xml0000644000175000017500000000343612377676746027632 0ustar vincevince HTMLTableSectionElement09 NIST The chOff attribute specifies the offset of alignment character. Retrieve the charoff attribute of the first TBODY element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement06.xml0000644000175000017500000000336212377676746026146 0ustar vincevince HTMLLinkElement06 NIST The rel attribute specifies the forward link type. Retrieve the rel attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table49.xml0000644000175000017500000000323012377676746024342 0ustar vincevince table49 Netscape Alignment character for cells in a column. The value of attribute ch of the tablecol element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement98.xml0000644000175000017500000000346312377676746025345 0ustar vincevince HTMLElement98 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the STRIKE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLLinkElement01.xml0000644000175000017500000000326312377676746026141 0ustar vincevince HTMLLinkElement01 NIST The disabled attribute enables/disables the link. Retrieve the disabled attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement18.xml0000644000175000017500000000335212377676746025332 0ustar vincevince HTMLElement18 NIST The id specifies the elements identifier. Retrieve the id attribute of the SAMP element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLAppletElement07.xml.kfail0000644000175000017500000000437512377676746027571 0ustar vincevince HTMLAppletElement07 NIST The hspace attribute specifies the horizontal space to the left and right of this image, applet, or object. Retrieve the hspace attribute and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement96.xml0000644000175000017500000000345112377676746025340 0ustar vincevince HTMLElement96 NIST The dir attribute specifies the base direction of directionally neutral text and the directionality of tables. Retrieve the dir attribute of the U element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement12.xml0000644000175000017500000000334712377676746025330 0ustar vincevince HTMLElement12 NIST The id specifies the elements identifier. Retrieve the id attribute of the BIG element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement117.xml0000644000175000017500000000345712377676746025420 0ustar vincevince HTMLElement117 NIST The className attribute specifies the class attribute of the element. Retrieve the class attribute of the HEAD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement08.xml0000644000175000017500000000351612377676746027103 0ustar vincevince HTMLTableCellElement08 NIST The axis attribute specifies the names group of related headers for table data cells(TD). Retrieve the axis attribute from the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement09.xml0000644000175000017500000000275312377676746026162 0ustar vincevince HTMLFormElement09 Curt Arnold HTMLFormElement.reset restores the forms default values. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadingElement06.xml0000644000175000017500000000341512377676746026607 0ustar vincevince HTMLHeadingElement06 NIST The align attribute specifies the horizontal text alignment(H6). Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement09.xml0000644000175000017500000000335612377676746026301 0ustar vincevince HTMLImageElement09 NIST The src attribute contains an URI designating the source of this image. Retrieve the src attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement16.xml0000644000175000017500000000352412377676746027101 0ustar vincevince HTMLTableCellElement16 NIST The colSpan attribute specifies the number of columns spanned by a table data(TD) cell. Retrieve the colSpan attribute of the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement63.xml0000644000175000017500000000340712377676746025333 0ustar vincevince HTMLElement63 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the BDO element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableElement05.xml0000644000175000017500000000366112377676746026301 0ustar vincevince HTMLTableElement05 NIST The tFoot attribute returns the tables TFOOT. Retrieve the align attribute of the TFOOT element from the second TABLE element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement66.xml0000644000175000017500000000340312377676746025332 0ustar vincevince HTMLElement66 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the B element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableRowElement13.xml0000644000175000017500000000620312377676746026763 0ustar vincevince HTMLTableRowElement13 NIST The deleteCell() method deletes a cell from the current row. Retrieve the fourth TR element and examine the value of the cells length attribute which should be set to six. Check the value of the first TD element. Invoke the deleteCell() method which will delete a cell from the current row. Check the value of the cell at the zero index and also check the number of cells which should now be five. Rick Rivello 2002-05-06 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument13.xml.kfail0000644000175000017500000000312212377676746026572 0ustar vincevince HTMLDocument13 NIST The getElementsByName method returns the (possibly empty) collection of elements whose name value is given by the elementName. Retrieve all the elements whose name attribute is "mapid". Check the length of the nodelist. It should be 1. Rick Rivello 2002-07-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLOptionElement09.xml0000644000175000017500000000345612377676746026530 0ustar vincevince HTMLOptionElement09 NIST The value attribute contains the current form control value. Retrieve the value attribute from the first OPTION element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLTableCellElement20.xml0000644000175000017500000000347112377676746027075 0ustar vincevince HTMLTableCellElement20 NIST The height attribute specifies the cell height. Retrieve the height attribute from the second TD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement55.xml0000644000175000017500000000343412377676746025334 0ustar vincevince HTMLElement55 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the NOFRAMES element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"NOFRAMES Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFormElement10.xml�����������������������0000644�0001750�0001750�00000002734�12377676746�026151� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet href="test-to-html.xml" type="text/xml"?> <!-- Copyright (c) 2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="HTMLFormElement10"> <metadata> <title>HTMLFormElement10 Curt Arnold HTMLFormElement.submit submits the form. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/area04.xml0000644000175000017500000000304612377676746024157 0ustar vincevince area04 Netscape Sivakiran Tummala 2002-02-08 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement82.xml0000644000175000017500000000340512377676746025332 0ustar vincevince HTMLElement82 NIST The lang attribute specifies the language code defined in RFC 1766. Retrieve the lang attribute of the DD element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLParamElement01.xml0000644000175000017500000000333012377676746026277 0ustar vincevince HTMLParamElement01 NIST The name attribute specifies the name of the run-time parameter. Retrieve the name attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLUListElement01.xml0000644000175000017500000000337412377676746026307 0ustar vincevince HTMLUListElement01 NIST The compact attribute specifies whether to reduce spacing between list items. Retrieve the compact attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement13.xml0000644000175000017500000000354112377676746026465 0ustar vincevince HTMLSelectElement13 NIST The tabIndex attribute specifies an index that represents the elements position in the tabbing order. Retrieve the tabIndex attribute from the first SELECT element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLCollection08.xml0000644000175000017500000000422612377676746026034 0ustar vincevince HTMLCollection08 NIST Nodes in a HTMLCollection object are numbered in tree order. (Depth-first traversal order). Retrieve the first TABLE element and create a HTMLCollection by invoking the "rows" attribute. Access the item in the third ordinal index. The resulting rowIndex attribute is examined and should be two. Rick Rivello 2002-05-01 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table39.xml0000644000175000017500000000333212377676746024344 0ustar vincevince table39 Netscape Supplementary description about the purpose or structure of a table. The value of attribute summary of the table element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLSelectElement16.xml0000644000175000017500000000356412377676746026475 0ustar vincevince HTMLSelectElement16 Curt Arnold Removes an option using HTMLSelectElement.remove. 2004-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument16.xml0000644000175000017500000000340612377676746025515 0ustar vincevince HTMLDocument16 NIST The getElementById method returns the Element whose id is given by elementId. If no such element exists, returns null. Retrieve the element whose id is "noid". The value returned should be null since there are not any elements with an id of "noid". Rick Rivello 2002-07-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLFontElement02.xml0000644000175000017500000000346412377676746026156 0ustar vincevince HTMLFontElement02 NIST The face attribute specifies the font's face identifier. Retrieve the face attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLHeadingElement05.xml0000644000175000017500000000341712377676746026610 0ustar vincevince HTMLHeadingElement05 NIST The align attribute specifies the horizontal text alignment(H5). Retrieve the align attribute and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLObjectElement16.xml.kfail0000644000175000017500000000433312377676746027544 0ustar vincevince HTMLObjectElement16 NIST The vspace attribute specifies the vertical space above or below this image, applet or object. Retrieve the vspace attribute of the first OBJECT element and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLDocument17.xml.kfail0000644000175000017500000000310312377676746026575 0ustar vincevince HTMLDocument17 Curt Arnold Clears the current document using HTMLDocument.open immediately followed by close. 2002-03-18 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLImageElement12.xml.kfail0000644000175000017500000000422212377676746027351 0ustar vincevince HTMLImageElement12 NIST The width attribute overrides the natural "width" of the image. Retrieve the width attribute and examine its value. This test is incompatible with L2 HTML implementations due to a change in the type of the attribute. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement54.xml0000644000175000017500000000341212377676746025327 0ustar vincevince HTMLElement54 NIST The title attribute specifies the elements advisory title. Retrieve the title attribute of the DT element and examine its value. Mary Brady 2002-02-22 <assertEquals actual="vtitle" expected='"DT Element"' id="titleLink" ignoreCase="false"/> </test> ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table30.xml���������������������������������0000644�0001750�0001750�00000003302�12377676746�024330� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (c) 2001-2004 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This program is distributed under the W3C's Software Intellectual Property License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more details. --> <!DOCTYPE test SYSTEM "dom1.dtd"> <test xmlns="http://www.w3.org/2001/DOM-Test-Suite/Level-1" name="table30"> <metadata> <title>table30 Netscape List of id attribute values for header cells. The value of attribute headers of the tablecell element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/table43.xml0000644000175000017500000000324712377676746024344 0ustar vincevince table43 Netscape Background color for rows. The value of attribute bgcolor of the tablerow element is read and checked against the expected value. Sivakiran Tummala 2002-02-15 netsurf-all-3.2/libdom/test/testcases/tests/level1/html/HTMLElement13.xml0000644000175000017500000000335512377676746025330 0ustar vincevince HTMLElement13 NIST The id specifies the elements identifier. Retrieve the id attribute of the SMALL element and examine its value. Mary Brady 2002-02-22 netsurf-all-3.2/libdom/test/testcases/tests/level1/CVS/0000755000175000017500000000000012377713347022032 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/CVS/Template0000644000175000017500000000000012377676746023531 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/level1/CVS/Entries0000644000175000017500000000002612377676746023377 0ustar vincevinceD/core//// D/html//// netsurf-all-3.2/libdom/test/testcases/tests/level1/CVS/Root0000644000175000017500000000005612377676746022714 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/level1/CVS/Repository0000644000175000017500000000004112377676746024142 0ustar vincevince2001/DOM-Test-Suite/tests/level1 netsurf-all-3.2/libdom/test/testcases/tests/validation/0000755000175000017500000000000012377713347022341 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/files/0000755000175000017500000000000012377713347023443 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/files/CVS/0000755000175000017500000000000012377713347024076 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/files/CVS/Template0000644000175000017500000000000012377676746025575 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/files/CVS/Entries0000644000175000017500000000000212377676746025435 0ustar vincevinceD netsurf-all-3.2/libdom/test/testcases/tests/validation/files/CVS/Root0000644000175000017500000000005612377676746024760 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/validation/files/CVS/Repository0000644000175000017500000000005312377676746026211 0ustar vincevince2001/DOM-Test-Suite/tests/validation/files netsurf-all-3.2/libdom/test/testcases/tests/validation/CVS/0000755000175000017500000000000012377713347022774 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/CVS/Template0000644000175000017500000000000012377676746024473 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/validation/CVS/Entries0000644000175000017500000000001412377676746024336 0ustar vincevinceD/files//// netsurf-all-3.2/libdom/test/testcases/tests/validation/CVS/Root0000644000175000017500000000005612377676746023656 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/validation/CVS/Repository0000644000175000017500000000004512377676746025110 0ustar vincevince2001/DOM-Test-Suite/tests/validation netsurf-all-3.2/libdom/test/testcases/tests/CVS/0000755000175000017500000000000012377713347020642 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/CVS/Template0000644000175000017500000000000012377676746022341 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/CVS/Entries0000644000175000017500000000011512377676746022206 0ustar vincevinceD/level1//// D/level2//// D/level3//// D/submittedtests//// D/validation//// netsurf-all-3.2/libdom/test/testcases/tests/CVS/Root0000644000175000017500000000005612377676746021524 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/CVS/Repository0000644000175000017500000000003212377676746022752 0ustar vincevince2001/DOM-Test-Suite/tests netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/0000755000175000017500000000000012377713347023272 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/0000755000175000017500000000000012377713347025561 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/CVS/0000755000175000017500000000000012377713347026214 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/CVS/Template0000644000175000017500000000000012377676746027713 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/CVS/Entries0000644000175000017500000000000212377676746027553 0ustar vincevinceD netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/CVS/Root0000644000175000017500000000005612377676746027076 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/netscapeHTML/CVS/Repository0000644000175000017500000000006612377676746030333 0ustar vincevince2001/DOM-Test-Suite/tests/submittedtests/netscapeHTML netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/CVS/0000755000175000017500000000000012377713347023725 5ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/CVS/Template0000644000175000017500000000000012377676746025424 0ustar vincevincenetsurf-all-3.2/libdom/test/testcases/tests/submittedtests/CVS/Entries0000644000175000017500000000002312377676746025267 0ustar vincevinceD/netscapeHTML//// netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/CVS/Root0000644000175000017500000000005612377676746024607 0ustar vincevince:pserver:anonymous@dev.w3.org:/sources/public netsurf-all-3.2/libdom/test/testcases/tests/submittedtests/CVS/Repository0000644000175000017500000000005112377676746026036 0ustar vincevince2001/DOM-Test-Suite/tests/submittedtests netsurf-all-3.2/libdom/test/dom3-core-interface.xml0000644000175000017500000067344512377676746021355 0ustar vincevince

    DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impossible to perform (either for logical reasons, because data is lost, or because the implementation has become unstable). In general, DOM methods return specific error values in ordinary processing situations, such as out-of-bound errors when usingNodeList.

    Implementations should raise other exceptions under other circumstances. For example, implementations should raise an implementation-dependent exception if anullargument is passed whennullwas not expected.

    Some languages and object systems do not support the concept of exceptions. For such systems, error conditions may be indicated using native error reporting mechanisms. For some bindings, for example, methods may return error codes similar to those listed in the corresponding method descriptions.

    unsigned short

    An integer indicating the type of error generated.

    Other numeric codes are reserved for W3C for possible future use.

    If index or size is negative, or greater than the allowed value.

    If the specified range of text does not fit into aDOMString.

    If anyNodeis inserted somewhere it doesn't belong.

    If aNodeis used in a different document than the one that created it (that doesn't support it).

    If an invalid or illegal character is specified, such as in an XML name.

    If data is specified for aNodewhich does not support data.

    If an attempt is made to modify an object where modifications are not allowed.

    If an attempt is made to reference aNodein a context where it does not exist.

    If the implementation does not support the requested type of object or operation.

    If an attempt is made to add an attribute that is already in use elsewhere.

    If an attempt is made to use an object that is not, or is no longer, usable.

    If an invalid or illegal string is specified.

    If an attempt is made to modify the type of the underlying object.

    If an attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

    If a parameter or an operation is not supported by the underlying object.

    If a call to a method such asinsertBeforeorremoveChildwould make theNodeinvalid with respect to"partial validity", this exception would be raised and the operation would not be done. This code is used in. Refer to this specification for further information.

    If the type of an object is incompatible with the expected type of the parameter associated to the object.

    TheDOMStringListinterface provides the abstraction of an ordered collection ofDOMStringvalues, without defining or constraining how this collection is implemented. The items in theDOMStringListare accessible via an integral index, starting from 0.

    Returns theindexth item in the collection. Ifindexis greater than or equal to the number ofDOMStrings in the list, this returnsnull.

    Index into the collection.

    TheDOMStringat theindexth position in theDOMStringList, ornullif that is not a valid index.

    The number ofDOMStrings in the list. The range of valid child node indices is 0 tolength-1inclusive.

    Test if a string is part of thisDOMStringList.

    The string to look for.

    trueif the string has been found,falseotherwise.

    TheNameListinterface provides the abstraction of an ordered collection of parallel pairs of name and namespace values (which could be null values), without defining or constraining how this collection is implemented. The items in theNameListare accessible via an integral index, starting from 0.

    Returns theindexth name item in the collection.

    Index into the collection.

    The name at theindexth position in theNameList, ornullif there is no name for the specified index or if the index is out of range.

    Returns theindexth namespaceURI item in the collection.

    Index into the collection.

    The namespace URI at theindexth position in theNameList, ornullif there is no name for the specified index or if the index is out of range.

    The number of pairs (name and namespaceURI) in the list. The range of valid child node indices is 0 tolength-1inclusive.

    Test if a name is part of thisNameList.

    The name to look for.

    trueif the name has been found,falseotherwise.

    Test if the pair namespaceURI/name is part of thisNameList.

    The namespace URI to look for.

    The name to look for.

    trueif the pair namespaceURI/name has been found,falseotherwise.

    TheDOMImplementationListinterface provides the abstraction of an ordered collection of DOM implementations, without defining or constraining how this collection is implemented. The items in theDOMImplementationListare accessible via an integral index, starting from 0.

    Returns theindexth item in the collection. Ifindexis greater than or equal to the number ofDOMImplementations in the list, this returnsnull.

    Index into the collection.

    TheDOMImplementationat theindexth position in theDOMImplementationList, ornullif that is not a valid index.

    The number ofDOMImplementations in the list. The range of valid child node indices is 0 tolength-1inclusive.

    This interface permits a DOM implementer to supply one or more implementations, based upon requested features and versions, as specified in. Each implementedDOMImplementationSourceobject is listed in the binding-specific list of available sources so that itsDOMImplementationobjects are made available.

    A method to request the first DOM implementation that supports the specified features.

    A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number.

    This method returns the first item of the list returned bygetDOMImplementationList.

    As an example, the string"XML 3.0 Traversal +Events 2.0"will request a DOM implementation that supports the module "XML" for its 3.0 version, a module that support of the "Traversal" module for any version, and the module "Events" for its 2.0 version. The module "Events" must be accessible using the methodNode.getFeature()andDOMImplementation.getFeature().

    The first DOM implementation that support the desired features, ornullif this source has none.

    A method to request a list of DOM implementations that support the specified features and versions, as specified in.

    A string that specifies which features and versions are required. This is a space separated list in which each feature is specified by its name optionally followed by a space and a version number. This is something like: "XML 3.0 Traversal +Events 2.0"

    A list of DOM implementations that support the desired features.

    TheDOMImplementationinterface provides a number of methods for performing operations that are independent of any particular instance of the document object model.

    Test if the DOM implementation implements a specific feature and version, as specified in.

    The name of the feature to test.

    This is the version number of the feature to test.

    trueif the feature is implemented in the specified version,falseotherwise.

    Creates an emptyDocumentTypenode. Entity declarations and notations are not made available. Entity reference expansions and default attribute additions do not occur..

    Thequalified nameof the document type to be created.

    The external subset public identifier.

    The external subset system identifier.

    A newDocumentTypenode withNode.ownerDocumentset tonull.

    INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to.

    NAMESPACE_ERR: Raised if thequalifiedNameis malformed.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

    Creates a DOM Document object of the specified type with its document element.

    Note that based on theDocumentTypegiven to create the document, the implementation may instantiate specializedDocumentobjects that support additional features than the "Core", such as "HTML". On the other hand, setting theDocumentTypeafter the document was created makes this very unlikely to happen. Alternatively, specializedDocumentcreation methods, such ascreateHTMLDocument, can be used to obtain specific types ofDocumentobjects.

    Thenamespace URIof the document element to create ornull.

    Thequalified nameof the document element to be created ornull.

    The type of document to be created ornull.

    Whendoctypeis notnull, itsNode.ownerDocumentattribute is set to the document being created.

    A newDocumentobject with its document element. If theNamespaceURI,qualifiedName, anddoctypearenull, the returnedDocumentis empty with no document element.

    INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to.

    NAMESPACE_ERR: Raised if thequalifiedNameis malformed, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNameisnulland thenamespaceURIis different fromnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", or if the DOM implementation does not support the"XML"feature but a non-null namespace URI was provided, since namespaces were defined by XML.

    WRONG_DOCUMENT_ERR: Raised ifdoctypehas already been used with a different document or was created from a different implementation.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

    This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in. This method also allow the implementation to provide specialized objects which do not support theDOMImplementationinterface.

    The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.

    This is the version number of the feature to test.

    Returns an object which implements the specialized APIs of the specified feature and version, if any, ornullif there is no object which implements interfaces associated with that feature. If theDOMObjectreturned by this method implements theDOMImplementationinterface, it must delegate to the primary coreDOMImplementationand not return results inconsistent with the primary coreDOMImplementationsuch ashasFeature,getFeature, etc.

    DocumentFragmentis a "lightweight" or "minimal"Documentobject. It is very common to want to be able to extract a portion of a document's tree or to create a new fragment of a document. Imagine implementing a user command like cut or rearranging a document by moving fragments around. It is desirable to have an object which can hold such fragments and it is quite natural to use a Node for this purpose. While it is true that aDocumentobject could fulfill this role, aDocumentobject can potentially be a heavyweight object, depending on the underlying implementation. What is really needed for this is a very lightweight object.DocumentFragmentis such an object.

    Furthermore, various operations -- such as inserting nodes as children of anotherNode-- may takeDocumentFragmentobjects as arguments; this results in all the child nodes of theDocumentFragmentbeing moved to the child list of this node.

    The children of aDocumentFragmentnode are zero or more nodes representing the tops of any sub-trees defining the structure of the document.DocumentFragmentnodes do not need to bewell-formed XML documents(although they do need to follow the rules imposed upon well-formed XML parsed entities, which can have multiple top nodes). For example, aDocumentFragmentmight have only one child and that child node could be aTextnode. Such a structure model represents neither an HTML document nor a well-formed XML document.

    When aDocumentFragmentis inserted into aDocument(or indeed any otherNodethat may take children) the children of theDocumentFragmentand not theDocumentFragmentitself are inserted into theNode. This makes theDocumentFragmentvery useful when the user wishes to create nodes that aresiblings; theDocumentFragmentacts as the parent of these nodes so that the user can use the standard methods from theNodeinterface, such asNode.insertBeforeandNode.appendChild.

    TheDocumentinterface represents the entire HTML or XML document. Conceptually, it is therootof the document tree, and provides the primary access to the document's data.

    Since elements, text nodes, comments, processing instructions, etc. cannot exist outside the context of aDocument, theDocumentinterface also contains the factory methods needed to create these objects. TheNodeobjects created have aownerDocumentattribute which associates them with theDocumentwithin whose context they were created.

    The Document Type Declaration (seeDocumentType) associated with this document. For XML documents without a document type declaration this returnsnull. For HTML documents, aDocumentTypeobject may be returned, independently of the presence or absence of document type declaration in the HTML document.

    This provides direct access to theDocumentTypenode, child node of thisDocument. This node can be set at document creation time and later changed through the use of child nodes manipulation methods, such asNode.insertBefore, orNode.replaceChild. Note, however, that while some implementations may instantiate different types ofDocumentobjects supporting additional features than the "Core", such as "HTML", based on theDocumentTypespecified at creation time, changing it afterwards is very unlikely to result in a change of the features supported.

    TheDOMImplementationobject that handles this document. A DOM application may use objects from multiple implementations.

    This is aconvenienceattribute that allows direct access to the child node that is thedocument elementof the document.

    Creates an element of the type specified. Note that the instance returned implements theElementinterface, so attributes can be specified directly on the returned object.

    In addition, if there are known attributes with default values,Attrnodes representing them are automatically created and attached to the element.

    To create an element with aqualified nameandnamespace URI, use thecreateElementNSmethod.

    The name of the element type to instantiate. For XML, this is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use. In that case, the name is mapped to the canonical form of that markup by the DOM implementation.

    A newElementobject with thenodeNameattribute set totagName, andlocalName,prefix, andnamespaceURIset tonull.

    INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    Creates an emptyDocumentFragmentobject.

    A newDocumentFragment.

    Creates aTextnode given the specified string.

    The data for the node.

    The newTextobject.

    Creates aCommentnode given the specified string.

    The data for the node.

    The newCommentobject.

    Creates aCDATASectionnode whose value is the specified string.

    The data for theCDATASectioncontents.

    The newCDATASectionobject.

    NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

    Creates aProcessingInstructionnode given the specified name and data strings.

    The target part of the processing instruction.

    UnlikeDocument.createElementNSorDocument.createAttributeNS, no namespace well-formed checking is done on the target name. Applications should invokeDocument.normalizeDocument()with the parameter "namespaces" set totruein order to ensure that the target name is namespace well-formed.

    The data for the node.

    The newProcessingInstructionobject.

    INVALID_CHARACTER_ERR: Raised if the specified target is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

    Creates anAttrof the given name. Note that theAttrinstance can then be set on anElementusing thesetAttributeNodemethod.

    To create an attribute with aqualified nameandnamespace URI, use thecreateAttributeNSmethod.

    The name of the attribute.

    A newAttrobject with thenodeNameattribute set toname, andlocalName,prefix, andnamespaceURIset tonull. The value of the attribute is the empty string.

    INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    Creates anEntityReferenceobject. In addition, if the referenced entity is known, the child list of theEntityReferencenode is made the same as that of the correspondingEntitynode.

    If any descendant of theEntitynode has an unboundnamespace prefix, the corresponding descendant of the createdEntityReferencenode is also unbound; (itsnamespaceURIisnull). The DOM Level 2 and 3 do not support any mechanism to resolve namespace prefixes in this case.

    The name of the entity to reference.

    UnlikeDocument.createElementNSorDocument.createAttributeNS, no namespace well-formed checking is done on the entity name. Applications should invokeDocument.normalizeDocument()with the parameter "namespaces" set totruein order to ensure that the entity name is namespace well-formed.

    The newEntityReferenceobject.

    INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

    Returns aNodeListof all theElementsindocument orderwith a given tag name and are contained in the document.

    The name of the tag to match on. The special value "*" matches all tags. For XML, thetagnameparameter is case-sensitive, otherwise it depends on the case-sensitivity of the markup language in use.

    A newNodeListobject containing all the matchedElements.

    Imports a node from another document to this document, without altering or removing the source node from the original document; this method creates a new copy of the source node. The returned node has no parent; (parentNodeisnull).

    For all nodes, importing a node creates a node object owned by the importing document, with attribute values identical to the source node'snodeNameandnodeType, plus the attributes related to namespaces (prefix,localName, andnamespaceURI). As in thecloneNodeoperation, the source node is not altered. User data associated to the imported node is not carried over. However, if anyUserDataHandlershas been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.

    Additional information is copied as appropriate to thenodeType, attempting to mirror the behavior expected if a fragment of XML or HTML source was copied from one document to another, recognizing that the two documents may have different DTDs in the XML case. The following list describes the specifics for each type of node.

    TheownerElementattribute is set tonulland thespecifiedflag is set totrueon the generatedAttr. Thedescendantsof the sourceAttrare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

    Note that thedeepparameter has no effect onAttrnodes; they always carry their children with them when imported.

    If thedeepoption was set totrue, thedescendantsof the sourceDocumentFragmentare recursively imported and the resulting nodes reassembled under the importedDocumentFragmentto form the corresponding subtree. Otherwise, this simply generates an emptyDocumentFragment.

    Documentnodes cannot be imported.

    DocumentTypenodes cannot be imported.

    Specifiedattribute nodes of the source element are imported, and the generatedAttrnodes are attached to the generatedElement. Default attributes arenotcopied, though if the document being imported into defines default attributes for this element name, those are assigned. If theimportNodedeepparameter was set totrue, thedescendantsof the source element are recursively imported and the resulting nodes reassembled to form the corresponding subtree.

    Entitynodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

    On import, thepublicId,systemId, andnotationNameattributes are copied. If adeepimport is requested, thedescendantsof the the sourceEntityare recursively imported and the resulting nodes reassembled to form the corresponding subtree.

    Only theEntityReferenceitself is copied, even if adeepimport is requested, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.

    Notationnodes can be imported, however in the current release of the DOM theDocumentTypeis readonly. Ability to add these imported nodes to aDocumentTypewill be considered for addition to a future release of the DOM.

    On import, thepublicIdandsystemIdattributes are copied.

    Note that thedeepparameter has no effect on this type of nodes since they cannot have any children.

    The imported node copies itstargetanddatavalues from those of the source node.

    Note that thedeepparameter has no effect on this type of nodes since they cannot have any children.

    These three types of nodes inheriting fromCharacterDatacopy theirdataandlengthattributes from those of the source node.

    Note that thedeepparameter has no effect on these types of nodes since they cannot have any children.

    The node to import.

    Iftrue, recursively import the subtree under the specified node; iffalse, import only the node itself, as explained above. This has no effect on nodes that cannot have any children, and onAttr, andEntityReferencenodes.

    The imported node that belongs to thisDocument.

    NOT_SUPPORTED_ERR: Raised if the type of node being imported is not supported.

    INVALID_CHARACTER_ERR: Raised if one of the imported names is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute. This may happen when importing an XML 1.1element into an XML 1.0 document, for instance.

    Creates an element of the givenqualified nameandnamespace URI.

    Per, applications must use the valuenullas the namespaceURI parameter for methods if they wish to have no namespace.

    Thenamespace URIof the element to create.

    Thequalified nameof the element type to instantiate.

    A newElementobject with the following attributes:

    AttributeValue
    Node.nodeNamequalifiedName
    Node.namespaceURInamespaceURI
    Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
    Node.localNamelocal name, extracted fromqualifiedName
    Element.tagNamequalifiedName

    INVALID_CHARACTER_ERR: Raised if the specifiedqualifiedNameis not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", or if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

    NOT_SUPPORTED_ERR: Always thrown if the current document does not support the"XML"feature, since namespaces were defined by XML.

    Creates an attribute of the givenqualified nameandnamespace URI.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to create.

    Thequalified nameof the attribute to instantiate.

    A newAttrobject with the following attributes:

    AttributeValue
    Node.nodeNamequalifiedName
    Node.namespaceURInamespaceURI
    Node.prefixprefix, extracted fromqualifiedName, ornullif there is no prefix
    Node.localNamelocal name, extracted fromqualifiedName
    Attr.namequalifiedName
    Node.nodeValuethe empty string

    INVALID_CHARACTER_ERR: Raised if the specifiedqualifiedNameis not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

    NOT_SUPPORTED_ERR: Always thrown if the current document does not support the"XML"feature, since namespaces were defined by XML.

    Returns aNodeListof all theElementswith a givenlocal nameandnamespace URIindocument order.

    Thenamespace URIof the elements to match on. The special value"*"matches all namespaces.

    Thelocal nameof the elements to match on. The special value "*" matches all local names.

    A newNodeListobject containing all the matchedElements.

    Returns theElementthat has an ID attribute with the given value. If no such element exists, this returnsnull. If more than one element has an ID attribute with that value, what is returned is undefined.

    The DOM implementation is expected to use the attributeAttr.isIdto determine if an attribute is of type ID.

    Attributes with the name "ID" or "id" are not of type ID unless so defined.

    The uniqueidvalue for an element.

    The matching element ornullif there is none.

    An attribute specifying the encoding used for this document at the time of the parsing. This isnullwhen it is not known, such as when theDocumentwas created in memory.

    An attribute specifying, as part of theXML declaration, the encoding of this document. This isnullwhen unspecified or when it is not known, such as when theDocumentwas created in memory.

    An attribute specifying, as part of theXML declaration, whether this document is standalone. This isfalsewhen unspecified.

    No verification is done on the value when setting this attribute. Applications should useDocument.normalizeDocument()with the "validate" parameter to verify if the value matches thevalidity constraint for standalone document declarationas defined in.

    NOT_SUPPORTED_ERR: Raised if this document does not support the "XML" feature.

    An attribute specifying, as part of theXML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is"1.0". If this document does not support the "XML" feature, the value is alwaysnull. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invokeDocument.normalizeDocument()in order to check for invalid characters in theNodes that are already part of thisDocument.

    DOM applications may use theDOMImplementation.hasFeature(feature, version)method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification.Documentobjects supporting a version of the "XMLVersion" feature must not raise aNOT_SUPPORTED_ERRexception for the same version number when usingDocument.xmlVersion.

    NOT_SUPPORTED_ERR: Raised if the version is set to a value that is not supported by thisDocumentor if this document does not support the "XML" feature.

    An attribute specifying whether error checking is enforced or not. When set tofalse, the implementation is free to not test every possible error case normally defined on DOM operations, and not raise anyDOMExceptionon DOM operations or report errors while usingDocument.normalizeDocument(). In case of error, the behavior is undefined. This attribute istrueby default.

    The location of the document ornullif undefined or if theDocumentwas created usingDOMImplementation.createDocument. No lexical checking is performed when setting this attribute; this could result in anullvalue returned when usingNode.baseURI.

    Beware that when theDocumentsupports the feature "HTML", the href attribute of the HTML BASE element takes precedence over this attribute when computingNode.baseURI.

    Attempts to adopt a node from another document to this document. If supported, it changes theownerDocumentof the source node, its children, as well as the attached attribute nodes if there are any. If the source node has a parent it is first removed from the child list of its parent. This effectively allows moving a subtree from one document to another (unlikeimportNode()which create a copy of the source node instead of moving it). When it fails, applications should useDocument.importNode()instead. Note that if the adopted node is already part of this document (i.e. the source and target document are the same), this method still has the effect of removing the source node from the child list of its parent, if any. The following list describes the specifics for each type of node.

    TheownerElementattribute is set tonulland thespecifiedflag is set totrueon the adoptedAttr. The descendants of the sourceAttrare recursively adopted.

    The descendants of the source node are recursively adopted.

    Documentnodes cannot be adopted.

    DocumentTypenodes cannot be adopted.

    Specifiedattribute nodes of the source element are adopted. Default attributes are discarded, though if the document being adopted into defines default attributes for this element name, those are assigned. The descendants of the source element are recursively adopted.

    Entitynodes cannot be adopted.

    Only theEntityReferencenode itself is adopted, the descendants are discarded, since the source and destination documents might have defined the entity differently. If the document being imported into provides a definition for this entity name, its value is assigned.

    Notationnodes cannot be adopted.

    These nodes can all be adopted. No specifics.

    Since it does not create new nodes unlike theDocument.importNode()method, this method does not raise anINVALID_CHARACTER_ERRexception, and applications should use theDocument.normalizeDocument()method to check if an imported name is not an XML name according to the XML version in use.

    The node to move into this document.

    The adopted node, ornullif this operation fails, such as when the source node comes from a different implementation.

    NOT_SUPPORTED_ERR: Raised if the source node is of typeDOCUMENT,DOCUMENT_TYPE.

    NO_MODIFICATION_ALLOWED_ERR: Raised when the source node is readonly.

    The configuration used whenDocument.normalizeDocument()is invoked.

    This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. As a consequence, this method updates the replacement tree ofEntityReferencenodes and normalizesTextnodes, as defined in the methodNode.normalize().

    Otherwise, the actual result depends on the features being set on theDocument.domConfigobject and governing what operations actually take place. Noticeably this method could also make the documentnamespace well-formedaccording to the algorithm described in, check the character normalization, remove theCDATASectionnodes, etc. SeeDOMConfigurationfor details.

    // Keep in the document the information defined // in the XML Information Set (Java example) DOMConfiguration docConfig = myDocument.getDomConfig(); docConfig.setParameter("infoset", Boolean.TRUE); myDocument.normalizeDocument();

    Mutation events, when supported, are generated to reflect the changes occurring on the document.

    If errors occur during the invocation of this method, such as an attempt to update aread-only nodeor aNode.nodeNamecontains an invalid character according to the XML version in use, errors or warnings (DOMError.SEVERITY_ERRORorDOMError.SEVERITY_WARNING) will be reported using theDOMErrorHandlerobject associated with the "error-handler" parameter. Note this method might also report fatal errors (DOMError.SEVERITY_FATAL_ERROR) if an implementation cannot recover from an error.

    Rename an existing node of typeELEMENT_NODEorATTRIBUTE_NODE.

    When possible this simply changes the name of the given node, otherwise this creates a new node with the specified name and replaces the existing node with the new node as described below.

    If simply changing the name of the given node is not possible, the following operations are performed: a new node is created, any registered event listener is registered on the new node, any user data attached to the old node is removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node, if the renamed node is anElementits attributes are moved to the new node, the new node is inserted at the position the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old node is attached to the new node.

    When the node being renamed is anElementonly the specified attributes are moved, default attributes originated from the DTD are updated according to the new element name. In addition, the implementation may update default attributes from other schemas. Applications should useDocument.normalizeDocument()to guarantee these attributes are up-to-date.

    When the node being renamed is anAttrthat is attached to anElement, the node is first removed from theElementattributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it is put back.

    In addition,

    a user data eventNODE_RENAMEDis fired,

    when the implementation supports the feature "MutationNameEvents", each mutation operation involved in this method fires the appropriate event, and in the end the event {http://www.w3.org/2001/xml-events,DOMElementNameChanged} or {http://www.w3.org/2001/xml-events,DOMAttributeNameChanged} is fired.

    The node to rename.

    The newnamespace URI.

    The newqualified name.

    The renamed node. This is either the specified node or the new node that was created to replace the specified node.

    NOT_SUPPORTED_ERR: Raised when the type of the specified node is neitherELEMENT_NODEnorATTRIBUTE_NODE, or if the implementation does not support the renaming of thedocument element.

    INVALID_CHARACTER_ERR: Raised if the new qualified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    WRONG_DOCUMENT_ERR: Raised when the specified node was created from a different document than this document.

    NAMESPACE_ERR: Raised if thequalifiedNameis a malformedqualified name, if thequalifiedNamehas a prefix and thenamespaceURIisnull, or if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace". Also raised, when the node being renamed is an attribute, if thequalifiedName, or its prefix, is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/".

    TheNodeinterface is the primary datatype for the entire Document Object Model. It represents a single node in the document tree. While all objects implementing theNodeinterface expose methods for dealing with children, not all objects implementing theNodeinterface may have children. For example,Textnodes may not have children, and adding children to such nodes results in aDOMExceptionbeing raised.

    The attributesnodeName,nodeValueandattributesare included as a mechanism to get at node information without casting down to the specific derived interface. In cases where there is no obvious mapping of these attributes for a specificnodeType(e.g.,nodeValuefor anElementorattributesfor aComment), this returnsnull. Note that the specialized interfaces may contain additional and more convenient mechanisms to get and set the relevant information.

    An integer indicating which type of node this is.

    Numeric codes up to 200 are reserved to W3C for possible future use.

    The node is anElement.

    The node is anAttr.

    The node is aTextnode.

    The node is aCDATASection.

    The node is anEntityReference.

    The node is anEntity.

    The node is aProcessingInstruction.

    The node is aComment.

    The node is aDocument.

    The node is aDocumentType.

    The node is aDocumentFragment.

    The node is aNotation.

    The values ofnodeName,nodeValue, andattributesvary according to the node type as follows:
    InterfacenodeNamenodeValueattributes
    Attrsame asAttr.namesame asAttr.valuenull
    CDATASection"#cdata-section"same asCharacterData.data, the content of the CDATA Sectionnull
    Comment"#comment"same asCharacterData.data, the content of the commentnull
    Document"#document"nullnull
    DocumentFragment"#document-fragment"nullnull
    DocumentTypesame asDocumentType.namenullnull
    Elementsame asElement.tagNamenullNamedNodeMap
    Entityentity namenullnull
    EntityReferencename of entity referencednullnull
    Notationnotation namenullnull
    ProcessingInstructionsame asProcessingInstruction.targetsame asProcessingInstruction.datanull
    Text"#text"same asCharacterData.data, the content of the text nodenull

    The name of this node, depending on its type; see the table above.

    The value of this node, depending on its type; see the table above. When it is defined to benull, setting it has no effect, including if the node isread-only.

    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly and if it is not defined to benull.

    DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

    A code representing the type of the underlying object, as defined above.

    Theparentof this node. All nodes, exceptAttr,Document,DocumentFragment,Entity, andNotationmay have a parent. However, if a node has just been created and not yet added to the tree, or if it has been removed from the tree, this isnull.

    ANodeListthat contains all children of this node. If there are no children, this is aNodeListcontaining no nodes.

    The first child of this node. If there is no such node, this returnsnull.

    The last child of this node. If there is no such node, this returnsnull.

    The node immediately preceding this node. If there is no such node, this returnsnull.

    The node immediately following this node. If there is no such node, this returnsnull.

    ANamedNodeMapcontaining the attributes of this node (if it is anElement) ornullotherwise.

    TheDocumentobject associated with this node. This is also theDocumentobject used to create new nodes. When this node is aDocumentor aDocumentTypewhich is not used with anyDocumentyet, this isnull.

    Inserts the nodenewChildbefore the existing child noderefChild. IfrefChildisnull, insertnewChildat the end of the list of children.

    IfnewChildis aDocumentFragmentobject, all of its children are inserted, in the same order, beforerefChild. If thenewChildis already in the tree, it is first removed.

    Inserting a node before itself is implementation dependent.

    The node to insert.

    The reference node, i.e., the node before which the new node must be inserted.

    The node being inserted.

    HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to insert is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the DOM application attempts to insert a secondDocumentTypeorElementnode.

    WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the parent of the node being inserted is readonly.

    NOT_FOUND_ERR: Raised ifrefChildis not a child of this node.

    NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the insertion of aDocumentTypeorElementnode.

    Replaces the child nodeoldChildwithnewChildin the list of children, and returns theoldChildnode.

    IfnewChildis aDocumentFragmentobject,oldChildis replaced by all of theDocumentFragmentchildren, which are inserted in the same order. If thenewChildis already in the tree, it is first removed.

    Replacing a node with itself is implementation dependent.

    The new node to put in the child list.

    The node being replaced in the list.

    The node replaced.

    HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to put in is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the result of the replacement operation would add a secondDocumentTypeorElementon theDocumentnode.

    WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of the new node is readonly.

    NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

    NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the replacement of theDocumentTypechild orElementchild.

    Removes the child node indicated byoldChildfrom the list of children, and returns it.

    The node being removed.

    The node removed.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_FOUND_ERR: Raised ifoldChildis not a child of this node.

    NOT_SUPPORTED_ERR: if this node is of typeDocument, this exception might be raised if the DOM implementation doesn't support the removal of theDocumentTypechild or theElementchild.

    Adds the nodenewChildto the end of the list of children of this node. If thenewChildis already in the tree, it is first removed.

    The node to add.

    If it is aDocumentFragmentobject, the entire contents of the document fragment are moved into the child list of this node

    The node added.

    HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not allow children of the type of thenewChildnode, or if the node to append is one of this node'sancestorsor this node itself, or if this node is of typeDocumentand the DOM application attempts to append a secondDocumentTypeorElementnode.

    WRONG_DOCUMENT_ERR: Raised ifnewChildwas created from a different document than the one that created this node.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or if the previous parent of the node being inserted is readonly.

    NOT_SUPPORTED_ERR: if thenewChildnode is a child of theDocumentnode, this exception might be raised if the DOM implementation doesn't support the removal of theDocumentTypechild orElementchild.

    Returns whether this node has any children.

    Returnstrueif this node has any children,falseotherwise.

    Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent (parentNodeisnull) and no user data. User data associated to the imported node is not carried over. However, if anyUserDataHandlershas been specified along with the associated data these handlers will be called with the appropriate parameters before this method returns.

    Cloning anElementcopies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any children it contains unless it is a deep clone. This includes text contained in an theElementsince the text is contained in a childTextnode. Cloning anAttrdirectly, as opposed to be cloned as part of anElementcloning operation, returns a specified attribute (specifiedistrue). Cloning anAttralways clones its children, since they represent its value, no matter whether this is a deep clone or not. Cloning anEntityReferenceautomatically constructs its subtree if a correspondingEntityis available, no matter whether this is a deep clone or not. Cloning any other type of node simply returns a copy of this node.

    Note that cloning an immutable subtree results in a mutable copy, but the children of anEntityReferenceclone arereadonly. In addition, clones of unspecifiedAttrnodes are specified. And, cloningDocument,DocumentType,Entity, andNotationnodes is implementation dependent.

    Iftrue, recursively clone the subtree under the specified node; iffalse, clone only the node itself (and its attributes, if it is anElement).

    The duplicate node.

    Puts allTextnodes in the full depth of the sub-tree underneath thisNode, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separatesTextnodes, i.e., there are neither adjacentTextnodes nor emptyTextnodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointerlookups) that depend on a particular document tree structure are to be used. If the parameter "normalize-characters" of theDOMConfigurationobject attached to theNode.ownerDocumentistrue, this method will also fully normalize the characters of theTextnodes.

    In cases where the document containsCDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate betweenTextnodes andCDATASectionnodes.

    Tests whether the DOM implementation implements a specific feature and that feature is supported by this node, as specified in.

    The name of the feature to test.

    This is the version number of the feature to test.

    Returnstrueif the specified feature is supported on this node,falseotherwise.

    Thenamespace URIof this node, ornullif it is unspecified (see).

    This is not a computed value that is the result of a namespace lookup based on an examination of the namespace declarations in scope. It is merely the namespace URI given at creation time.

    For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such asDocument.createElement(), this is alwaysnull.

    Per theNamespaces in XMLSpecificationan attribute does not inherit its namespace from the element it is attached to. If an attribute is not explicitly given a namespace, it simply has no namespace.

    Thenamespace prefixof this node, ornullif it is unspecified. When it is defined to benull, setting it has no effect, including if the node isread-only.

    Note that setting this attribute, when permitted, changes thenodeNameattribute, which holds thequalified name, as well as thetagNameandnameattributes of theElementandAttrinterfaces, when applicable.

    Setting the prefix tonullmakes it unspecified, setting it to an empty string is implementation dependent.

    Note also that changing the prefix of an attribute that is known to have a default value, does not make a new attribute with the default value and the original prefix appear, since thenamespaceURIandlocalNamedo not change.

    For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such ascreateElementfrom theDocumentinterface, this is alwaysnull.

    INVALID_CHARACTER_ERR: Raised if the specified prefix contains an illegal character according to the XML version in use specified in theDocument.xmlVersionattribute.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NAMESPACE_ERR: Raised if the specifiedprefixis malformed per the Namespaces in XML specification, if thenamespaceURIof this node isnull, if the specified prefix is "xml" and thenamespaceURIof this node is different from "http://www.w3.org/XML/1998/namespace", if this node is an attribute and the specified prefix is "xmlns" and thenamespaceURIof this node is different from "http://www.w3.org/2000/xmlns/", or if this node is an attribute and thequalifiedNameof this node is "xmlns".

    Returns the local part of thequalified nameof this node.

    For nodes of any type other thanELEMENT_NODEandATTRIBUTE_NODEand nodes created with a DOM Level 1 method, such asDocument.createElement(), this is alwaysnull.

    Returns whether this node (if it is an element) has any attributes.

    Returnstrueif this node has any attributes,falseotherwise.

    The absolute base URI of this node ornullif the implementation wasn't able to obtain an absolute URI. This value is computed as described in. However, when theDocumentsupports the feature "HTML", the base URI is computed using first the value of the href attribute of the HTML BASE element if any, and the value of thedocumentURIattribute from theDocumentinterface otherwise.

    A bitmask indicating the relative document position of a node with respect to another node.

    If the two nodes being compared are the same node, then no flags are set on the return.

    Otherwise, the order of two nodes is determined by looking for common containers -- containers which contain both. A node directly contains any child nodes. A node also directly contains any other nodes attached to it such as attributes contained in an element or entities and notations contained in a document type. Nodes contained in contained nodes are also contained, but less-directly as the number of intervening containers increases.

    If there is no common container node, then the order is based upon order between the root container of each node that is in no container. In this case, the result is disconnected and implementation-specific. This result is stable as long as these outer-most containing nodes remain in memory and are not inserted into some other containing node. This would be the case when the nodes belong to different documents or fragments, and cloning the document or inserting a fragment might change the order.

    If one of the nodes being compared contains the other node, then the container precedes the contained node, and reversely the contained node follows the container. For example, when comparing an element against its own attribute or child, the element node precedes its attribute node and its child node, which both follow it.

    If neither of the previous cases apply, then there exists a most-direct container common to both nodes being compared. In this case, the order is determined based upon the two determining nodes directly contained in this most-direct common container that either are or contain the corresponding nodes being compared.

    If these two determining nodes are both child nodes, then the natural DOM order of these determining nodes within the containing node is returned as the order of the corresponding nodes. This would be the case, for example, when comparing two child elements of the same element.

    If one of the two determining nodes is a child node and the other is not, then the corresponding node of the child node follows the corresponding node of the non-child node. This would be the case, for example, when comparing an attribute of an element with a child element of the same element.

    If neither of the two determining node is a child node and one determining node has a greater value ofnodeTypethan the other, then the corresponding node precedes the other. This would be the case, for example, when comparing an entity of a document type against a notation of the same document type.

    If neither of the two determining node is a child node andnodeTypeis the same for both determining nodes, then an implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of the same nodeType are inserted into or removed from the direct container. This would be the case, for example, when comparing two attributes of the same element, and inserting or removing additional attributes might change the order between existing attributes.

    The two nodes are disconnected. Order between disconnected nodes is always implementation-specific.

    The second node precedes the reference node.

    The node follows the reference node.

    The node contains the reference node. A node which contains is always preceding, too.

    The node is contained by the reference node. A node which is contained is always following, too.

    The determination of preceding versus following is implementation-specific.

    Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to thedocument order.

    The node to compare against the reference node.

    Returns how the node is positioned relatively to the reference node.

    NOT_SUPPORTED_ERR: when the compared nodes are from different DOM implementations that do not coordinate to return consistent implementation-specific results.

    This attribute returns the text content of this node and its descendants. When it is defined to benull, setting it has no effect. On setting, any possible children this node may have are removed and, if it the new string is not empty ornull, replaced by a singleTextnode containing the string this attribute is set to.

    On getting, no serialization is performed, the returned string does not contain any markup. No whitespace normalization is performed and the returned string does not contain the white spaces in element content (see the attributeText.isElementContentWhitespace). Similarly, on setting, no parsing is performed either, the input string is taken as pure textual content.

    The string returned is made of the text content of this node depending on its type, as defined below:

    Node typeContent
    ELEMENT_NODE, ATTRIBUTE_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, DOCUMENT_FRAGMENT_NODEconcatenation of thetextContentattribute value of every child node, excluding COMMENT_NODE and PROCESSING_INSTRUCTION_NODE nodes. This is the empty string if the node has no children.
    TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, PROCESSING_INSTRUCTION_NODEnodeValue
    DOCUMENT_NODE, DOCUMENT_TYPE_NODE, NOTATION_NODEnull

    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

    DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

    Returns whether this node is the same node as the given one.

    This method provides a way to determine whether twoNodereferences returned by the implementation reference the same object. When twoNodereferences are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.

    The node to test against.

    Returnstrueif the nodes are the same,falseotherwise.

    Look up the prefix associated to the given namespace URI, starting from this node. The default namespace declarations are ignored by this method.

    Seefor details on the algorithm used by this method.

    The namespace URI to look for.

    Returns an associated namespace prefix if found ornullif none is found. If more than one prefix are associated to the namespace prefix, the returned namespace prefix is implementation dependent.

    This method checks if the specifiednamespaceURIis the default namespace or not.

    The namespace URI to look for.

    Returnstrueif the specifiednamespaceURIis the default namespace,falseotherwise.

    Look up the namespace URI associated to the given prefix, starting from this node.

    Seefor details on the algorithm used by this method.

    The prefix to look for. If this parameter isnull, the method will return the default namespace URI if any.

    Returns the associated namespace URI ornullif none is found.

    Tests whether two nodes are equal.

    This method tests for equality of nodes, not sameness (i.e., whether the two nodes are references to the same object) which can be tested withNode.isSameNode(). All nodes that are the same will also be equal, though the reverse may not be true.

    Two nodes are equal if and only if the following conditions are satisfied:

    The two nodes are of the same type.

    The following string attributes are equal:nodeName,localName,namespaceURI,prefix,nodeValue. This is: they are bothnull, or they have the same length and are character for character identical.

    TheattributesNamedNodeMapsare equal. This is: they are bothnull, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.

    ThechildNodesNodeListsare equal. This is: they are bothnull, or they have the same length and contain equal nodes at the same index. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.

    For twoDocumentTypenodes to be equal, the following conditions must also be satisfied:

    The following string attributes are equal:publicId,systemId,internalSubset.

    TheentitiesNamedNodeMapsare equal.

    ThenotationsNamedNodeMapsare equal.

    On the other hand, the following do not affect equality: theownerDocument,baseURI, andparentNodeattributes, thespecifiedattribute forAttrnodes, theschemaTypeInfoattribute forAttrandElementnodes, theText.isElementContentWhitespaceattribute forTextnodes, as well as any user data or event listeners registered on the nodes.

    As a general rule, anything not mentioned in the description above is not significant in consideration of equality checking. Note that future versions of this specification may take into account more attributes and implementations conform to this specification are expected to be updated accordingly.

    The node to compare equality with.

    Returnstrueif the nodes are equal,falseotherwise.

    This method returns a specialized object which implements the specialized APIs of the specified feature and version, as specified in. The specialized object may also be obtained by using binding-specific casting methods but is not necessarily expected to, as discussed in. This method also allow the implementation to provide specialized objects which do not support theNodeinterface.

    The name of the feature requested. Note that any plus sign "+" prepended to the name of the feature will be ignored since it is not significant in the context of this method.

    This is the version number of the feature to test.

    Returns an object which implements the specialized APIs of the specified feature and version, if any, ornullif there is no object which implements interfaces associated with that feature. If theDOMObjectreturned by this method implements theNodeinterface, it must delegate to the primary coreNodeand not return results inconsistent with the primary coreNodesuch as attributes, childNodes, etc.

    Associate an object to a key on this node. The object can later be retrieved from this node by callinggetUserDatawith the same key.

    The key to associate the object to.

    The object to associate to the given key, ornullto remove any existing association to that key.

    The handler to associate to that key, ornull.

    Returns theDOMUserDatapreviously associated to the given key on this node, ornullif there was none.

    Retrieves the object associated to a key on a this node. The object must first have been set to this node by callingsetUserDatawith the same key.

    The key the object is associated to.

    Returns theDOMUserDataassociated to the given key on this node, ornullif there was none.

    TheNodeListinterface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented.NodeListobjects in the DOM arelive.

    The items in theNodeListare accessible via an integral index, starting from 0.

    Returns theindexth item in the collection. Ifindexis greater than or equal to the number of nodes in the list, this returnsnull.

    Index into the collection.

    The node at theindexth position in theNodeList, ornullif that is not a valid index.

    The number of nodes in the list. The range of valid child node indices is 0 tolength-1inclusive.

    Objects implementing theNamedNodeMapinterface are used to represent collections of nodes that can be accessed by name. Note thatNamedNodeMapdoes not inherit fromNodeList;NamedNodeMapsare not maintained in any particular order. Objects contained in an object implementingNamedNodeMapmay also be accessed by an ordinal index, but this is simply to allow convenient enumeration of the contents of aNamedNodeMap, and does not imply that the DOM specifies an order to these Nodes.

    NamedNodeMapobjects in the DOM arelive.

    Retrieves a node specified by name.

    ThenodeNameof a node to retrieve.

    ANode(of any type) with the specifiednodeName, ornullif it does not identify any node in this map.

    Adds a node using itsnodeNameattribute. If a node with that name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.

    As thenodeNameattribute is used to derive the name which the node must be stored under, multiple nodes of certain types (those that have a "special" string value) cannot be stored as the names would clash. This is seen as preferable to allowing nodes to be aliased.

    A node to store in this map. The node will later be accessible using the value of itsnodeNameattribute.

    If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

    WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

    INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

    HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.

    Removes a node specified by name. When this map contains the attributes attached to an element, if the removed attribute is known to have a default value, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

    ThenodeNameof the node to remove.

    The node removed from this map if a node with such a name exists.

    NOT_FOUND_ERR: Raised if there is no node namednamein this map.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

    Returns theindexth item in the map. Ifindexis greater than or equal to the number of nodes in this map, this returnsnull.

    Index into this map.

    The node at theindexth position in the map, ornullif that is not a valid index.

    The number of nodes in this map. The range of valid child node indices is0tolength-1inclusive.

    Retrieves a node specified by local name and namespace URI.

    Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

    Thenamespace URIof the node to retrieve.

    Thelocal nameof the node to retrieve.

    ANode(of any type) with the specified local name and namespace URI, ornullif they do not identify any node in this map.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

    Adds a node using itsnamespaceURIandlocalName. If a node with that namespace URI and that local name is already present in this map, it is replaced by the new one. Replacing a node by itself has no effect.

    Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

    A node to store in this map. The node will later be accessible using the value of itsnamespaceURIandlocalNameattributes.

    If the newNodereplaces an existing node the replacedNodeis returned, otherwisenullis returned.

    WRONG_DOCUMENT_ERR: Raised ifargwas created from a different document than the one that created this map.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

    INUSE_ATTRIBUTE_ERR: Raised ifargis anAttrthat is already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

    HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node doesn't belong in this NamedNodeMap. Examples would include trying to insert something other than an Attr node into an Element's map of attributes, or a non-Entity node into the DocumentType's map of Entities.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

    Removes a node specified by local name and namespace URI. A removed attribute may be known to have a default value when this map contains the attributes attached to an element, as returned by the attributes attribute of theNodeinterface. If so, an attribute immediately appears containing the default value as well as the corresponding namespace URI, local name, and prefix when applicable.

    Per, applications must use the value null as the namespaceURI parameter for methods if they wish to have no namespace.

    Thenamespace URIof the node to remove.

    Thelocal nameof the node to remove.

    The node removed from this map if a node with such a local name and namespace URI exists.

    NOT_FOUND_ERR: Raised if there is no node with the specifiednamespaceURIandlocalNamein this map.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature "XML" and the language exposed through the Document does not support XML Namespaces (such as).

    TheCharacterDatainterface extends Node with a set of attributes and methods for accessing character data in the DOM. For clarity this set is defined here rather than on each object that uses these attributes and methods. No DOM objects correspond directly toCharacterData, thoughTextand others do inherit the interface from it. Alloffsetsin this interface start from0.

    As explained in theDOMStringinterface, text strings in the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In the following, the term16-bit unitsis used whenever necessary to indicate that indexing on CharacterData is done in 16-bit units.

    The character data of the node that implements this interface. The DOM implementation may not put arbitrary limits on the amount of data that may be stored in aCharacterDatanode. However, implementation limits may mean that the entirety of a node's data may not fit into a singleDOMString. In such cases, the user may callsubstringDatato retrieve the data in appropriately sized pieces.

    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

    DOMSTRING_SIZE_ERR: Raised when it would return more characters than fit in aDOMStringvariable on the implementation platform.

    The number of16-bit unitsthat are available throughdataand thesubstringDatamethod below. This may have the value zero, i.e.,CharacterDatanodes may be empty.

    Extracts a range of data from the node.

    Start offset of substring to extract.

    The number of 16-bit units to extract.

    The specified substring. If the sum ofoffsetandcountexceeds thelength, then all 16-bit units to the end of the data are returned.

    INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

    DOMSTRING_SIZE_ERR: Raised if the specified range of text does not fit into aDOMString.

    Append the string to the end of the character data of the node. Upon success,dataprovides access to the concatenation ofdataand theDOMStringspecified.

    TheDOMStringto append.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Insert a string at the specified16-bit unitoffset.

    The character offset at which to insert.

    TheDOMStringto insert.

    INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Remove a range of16-bit unitsfrom the node. Upon success,dataandlengthreflect the change.

    The offset from which to start removing.

    The number of 16-bit units to delete. If the sum ofoffsetandcountexceedslengththen all 16-bit units fromoffsetto the end of the data are deleted.

    INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Replace the characters starting at the specified16-bit unitoffset with the specified string.

    The offset from which to start replacing.

    The number of 16-bit units to replace. If the sum ofoffsetandcountexceedslength, then all 16-bit units to the end of the data are replaced; (i.e., the effect is the same as aremovemethod call with the same range, followed by anappendmethod invocation).

    TheDOMStringwith which the range must be replaced.

    INDEX_SIZE_ERR: Raised if the specifiedoffsetis negative or greater than the number of 16-bit units indata, or if the specifiedcountis negative.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    TheAttrinterface represents an attribute in anElementobject. Typically the allowable values for the attribute are defined in a schema associated with the document.

    Attrobjects inherit theNodeinterface, but since they are not actually child nodes of the element they describe, the DOM does not consider them part of the document tree. Thus, theNodeattributesparentNode,previousSibling, andnextSiblinghave anullvalue forAttrobjects. The DOM takes the view that attributes are properties of elements rather than having a separate identity from the elements they are associated with; this should make it more efficient to implement such features as default attributes associated with all elements of a given type. Furthermore,Attrnodes may not be immediate children of aDocumentFragment. However, they can be associated withElementnodes contained within aDocumentFragment. In short, users and implementors of the DOM need to be aware thatAttrnodes have some things in common with other objects inheriting theNodeinterface, but they also are quite distinct.

    The attribute's effective value is determined as follows: if this attribute has been explicitly assigned any value, that value is the attribute's effective value; otherwise, if there is a declaration for this attribute, and that declaration includes a default value, then that default value is the attribute's effective value; otherwise, the attribute does not exist on this element in the structure model until it has been explicitly added. Note that theNode.nodeValueattribute on theAttrinstance can also be used to retrieve the string version of the attribute's value(s).

    If the attribute was not explicitly given a value in the instance document but has a default value provided by the schema associated with the document, an attribute node will be created withspecifiedset tofalse. Removing attribute nodes for which a default value is defined in the schema generates a new attribute node with the default value andspecifiedset tofalse. If validation occurred while invokingDocument.normalizeDocument(), attribute nodes withspecifiedequals tofalseare recomputed according to the default attribute values provided by the schema. If no default value is associate with this attribute in the schema, the attribute node is discarded.

    In XML, where the value of an attribute can contain entity references, the child nodes of theAttrnode may be eitherTextorEntityReferencenodes (when these are in use; see the description ofEntityReferencefor discussion).

    The DOM Core represents all attribute values as simple strings, even if the DTD or schema associated with the document declares them of some specific type such astokenized.

    The way attribute value normalization is performed by the DOM implementation depends on how much the implementation knows about the schema in use. Typically, thevalueandnodeValueattributes of anAttrnode initially returns the normalized value given by the parser. It is also the case afterDocument.normalizeDocument()is called (assuming the right options have been set). But this may not be the case after mutation, independently of whether the mutation is performed by setting the string value directly or by changing theAttrchild nodes. In particular, this is true whencharacter referencesare involved, given that they are not represented in the DOM and they impact attribute value normalization. On the other hand, if the implementation knows about the schema in use when the attribute value is changed, and it is of a different type than CDATA, it may normalize it again at that time. This is especially true of specialized DOM implementations, such as SVG DOM implementations, which store attribute values in an internal form different from a string.

    The following table gives some examples of the relations between the attribute value in the original document (parsed attribute), the value as exposed in the DOM, and the serialization of the value:

    ExamplesParsed attribute valueInitialAttr.valueSerialized attribute value
    Character reference"x&#178;=5""x族=5""x&#178;=5"
    Built-in character entity"y&lt;6""y<6""y&lt;6"
    Literal newline between"x=5&#10;y=6""x=5 y=6""x=5&#10;y=6"
    Normalized newline between"x=5 y=6""x=5 y=6""x=5 y=6"
    Entityewith literal newline<!ENTITY e '...&#10;...'> [...]> "x=5&e;y=6"Dependent on Implementation and Load OptionsDependent on Implementation and Load/Save Options

    Returns the name of this attribute. IfNode.localNameis different fromnull, this attribute is aqualified name.

    Trueif this attribute was explicitly given a value in the instance document,falseotherwise. If the application changed the value of this attribute node (even if it ends up having the same value as the default value) then it is set totrue. The implementation may handle attributes with default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

    On retrieval, the value of the attribute is returned as a string. Character and general entity references are replaced with their values. See also the methodgetAttributeon theElementinterface.

    On setting, this creates aTextnode with the unparsed contents of the string, i.e. any characters that an XML processor would recognize as markup are instead treated as literal text. See also the methodElement.setAttribute().

    Some specialized implementations, such as someimplementations, may do normalization automatically, even after mutation; in such case, the value on retrieval may differ from the value on setting.

    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

    TheElementnode this attribute is attached to ornullif this attribute is not in use.

    The type information associated with this attribute. While the type information contained in this attribute is guarantee to be correct after loading the document or invokingDocument.normalizeDocument(),schemaTypeInfomay not be reliable if the node was moved.

    Returns whether this attribute is known to be of type ID (i.e. to contain an identifier for its owner element) or not. When it is and its value is unique, theownerElementof this attribute can be retrieved using the methodDocument.getElementById. The implementation could use several ways to determine if an attribute node is known to contain an identifier:

    If validation occurred using an XML Schemawhile loading the document or while invokingDocument.normalizeDocument(), the post-schema-validation infoset contributions (PSVI contributions) values are used to determine if this attribute is aschema-determined ID attributeusing theschema-determined IDdefinition in.

    If validation occurred using a DTD while loading the document or while invokingDocument.normalizeDocument(), the infoset[type definition]value is used to determine if this attribute is aDTD-determined ID attributeusing theDTD-determined IDdefinition in.

    from the use of the methodsElement.setIdAttribute(),Element.setIdAttributeNS(), orElement.setIdAttributeNode(), i.e. it is anuser-determined ID attribute;

    XPointer framework (see section 3.2 in) consider the DOMuser-determined ID attributeas being part of the XPointerexternally-determined IDdefinition.

    using mechanisms that are outside the scope of this specification, it is then anexternally-determined ID attribute. This includes using schema languages different from XML schema and DTD.

    If validation occurred while invokingDocument.normalizeDocument(), alluser-determined ID attributesare reset and all attribute nodes ID information are then reevaluated in accordance to the schema used. As a consequence, if theAttr.schemaTypeInfoattribute contains an ID type,isIdwill always return true.

    TheElementinterface represents anelementin an HTML or XML document. Elements may have attributes associated with them; since theElementinterface inherits fromNode, the genericNodeinterface attributeattributesmay be used to retrieve the set of all attributes for an element. There are methods on theElementinterface to retrieve either anAttrobject by name or an attribute value by name. In XML, where an attribute value may contain entity references, anAttrobject should be retrieved to examine the possibly fairly complex sub-tree representing the attribute value. On the other hand, in HTML, where all attributes have simple string values, methods to directly access an attribute value can safely be used as aconvenience.

    In DOM Level 2, the methodnormalizeis inherited from theNodeinterface where it was moved.

    The name of the element. IfNode.localNameis different fromnull, this attribute is aqualified name. For example, in:<elementExample id="demo"> ... </elementExample> ,tagNamehas the value"elementExample". Note that this is case-preserving in XML, as are all of the operations of the DOM. The HTML DOM returns thetagNameof an HTML element in the canonical uppercase form, regardless of the case in the source HTML document.

    Retrieves an attribute value by name.

    The name of the attribute to retrieve.

    TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

    Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeto assign it as the value of an attribute.

    To set an attribute with a qualified name and namespace URI, use thesetAttributeNSmethod.

    The name of the attribute to create or alter.

    Value to set in string form.

    INVALID_CHARACTER_ERR: Raised if the specified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Removes an attribute by name. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

    If no attribute with this name is found, this method has no effect.

    To remove an attribute by local name and namespace URI, use theremoveAttributeNSmethod.

    The name of the attribute to remove.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Retrieves an attribute node by name.

    To retrieve an attribute node by qualified name and namespace URI, use thegetAttributeNodeNSmethod.

    The name (nodeName) of the attribute to retrieve.

    TheAttrnode with the specified name (nodeName) ornullif there is no such attribute.

    Adds a new attribute node. If an attribute with that name (nodeName) is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.

    To add a new attribute node with a qualified name and namespace URI, use thesetAttributeNodeNSmethod.

    TheAttrnode to add to the attribute list.

    If thenewAttrattribute replaces an existing attribute, the replacedAttrnode is returned, otherwisenullis returned.

    WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

    Removes the specified attribute node. If a default value for the removedAttrnode is defined in the DTD, a new node immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

    TheAttrnode to remove from the attribute list.

    TheAttrnode that was removed.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_FOUND_ERR: Raised ifoldAttris not an attribute of the element.

    Returns aNodeListof alldescendantElementswith a given tag name, indocument order.

    The name of the tag to match on. The special value "*" matches all tags.

    A list of matchingElementnodes.

    Retrieves an attribute value by local name and namespace URI.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to retrieve.

    Thelocal nameof the attribute to retrieve.

    TheAttrvalue as a string, or the empty string if that attribute does not have a specified or default value.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Adds a new attribute. If an attribute with the same local name and namespace URI is already present on the element, its prefix is changed to be the prefix part of thequalifiedName, and its value is changed to be thevalueparameter. This value is a simple string; it is not parsed as it is being set. So any markup (such as syntax to be recognized as an entity reference) is treated as literal text, and needs to be appropriately escaped by the implementation when it is written out. In order to assign an attribute value that contains entity references, the user must create anAttrnode plus anyTextandEntityReferencenodes, build the appropriate subtree, and usesetAttributeNodeNSorsetAttributeNodeto assign it as the value of an attribute.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to create or alter.

    Thequalified nameof the attribute to create or alter.

    The value to set in string form.

    INVALID_CHARACTER_ERR: Raised if the specified qualified name is not an XML name according to the XML version in use specified in theDocument.xmlVersionattribute.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NAMESPACE_ERR: Raised if thequalifiedNameis malformed per the Namespaces in XML specification, if thequalifiedNamehas a prefix and thenamespaceURIisnull, if thequalifiedNamehas a prefix that is "xml" and thenamespaceURIis different from "http://www.w3.org/XML/1998/namespace", if thequalifiedNameor its prefix is "xmlns" and thenamespaceURIis different from "http://www.w3.org/2000/xmlns/", or if thenamespaceURIis "http://www.w3.org/2000/xmlns/" and neither thequalifiedNamenor its prefix is "xmlns".

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Removes an attribute by local name and namespace URI. If a default value for the removed attribute is defined in the DTD, a new attribute immediately appears with the default value as well as the corresponding namespace URI, local name, and prefix when applicable. The implementation may handle default values from other schemas similarly but applications should useDocument.normalizeDocument()to guarantee this information is up-to-date.

    If no attribute with this local name and namespace URI is found, this method has no effect.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to remove.

    Thelocal nameof the attribute to remove.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Retrieves anAttrnode by local name and namespace URI.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to retrieve.

    Thelocal nameof the attribute to retrieve.

    TheAttrnode with the specified attribute local name and namespace URI ornullif there is no such attribute.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Adds a new attribute. If an attribute with that local name and that namespace URI is already present in the element, it is replaced by the new one. Replacing an attribute node by itself has no effect.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    TheAttrnode to add to the attribute list.

    If thenewAttrattribute replaces an existing attribute with the samelocal nameandnamespace URI, the replacedAttrnode is returned, otherwisenullis returned.

    WRONG_DOCUMENT_ERR: Raised ifnewAttrwas created from a different document than the one that created the element.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    INUSE_ATTRIBUTE_ERR: Raised ifnewAttris already an attribute of anotherElementobject. The DOM user must explicitly cloneAttrnodes to re-use them in other elements.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Returns aNodeListof all thedescendantElementswith a given local name and namespace URI indocument order.

    Thenamespace URIof the elements to match on. The special value "*" matches all namespaces.

    Thelocal nameof the elements to match on. The special value "*" matches all local names.

    A newNodeListobject containing all the matchedElements.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    Returnstruewhen an attribute with a given name is specified on this element or has a default value,falseotherwise.

    The name of the attribute to look for.

    trueif an attribute with the given name is specified on this element or has a default value,falseotherwise.

    Returnstruewhen an attribute with a given local name and namespace URI is specified on this element or has a default value,falseotherwise.

    Per, applications must use the valuenullas thenamespaceURIparameter for methods if they wish to have no namespace.

    Thenamespace URIof the attribute to look for.

    Thelocal nameof the attribute to look for.

    trueif an attribute with the given local name and namespace URI is specified or has a default value on this element,falseotherwise.

    NOT_SUPPORTED_ERR: May be raised if the implementation does not support the feature"XML"and the language exposed through the Document does not support XML Namespaces (such as).

    The type information associated with this element.

    If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

    To specify an attribute by local name and namespace URI, use thesetIdAttributeNSmethod.

    The name of the attribute.

    Whether the attribute is a of type ID.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

    If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

    Thenamespace URIof the attribute.

    Thelocal nameof the attribute.

    Whether the attribute is a of type ID.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

    If the parameterisIdistrue, this method declares the specified attribute to be auser-determined ID attribute. This affects the value ofAttr.isIdand the behavior ofDocument.getElementById, but does not change any schema that may be in use, in particular this does not affect theAttr.schemaTypeInfoof the specifiedAttrnode. Use the valuefalsefor the parameterisIdto undeclare an attribute for being auser-determined ID attribute.

    The attribute node.

    Whether the attribute is a of type ID.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    NOT_FOUND_ERR: Raised if the specified node is not an attribute of this element.

    TheTextinterface inherits fromCharacterDataand represents the textual content (termedcharacter datain XML) of anElementorAttr. If there is no markup inside an element's content, the text is contained in a single object implementing theTextinterface that is the only child of the element. If there is markup, it is parsed into theinformation items(elements, comments, etc.) andTextnodes that form the list of children of the element.

    When a document is first made available via the DOM, there is only oneTextnode for each block of text. Users may create adjacentTextnodes that represent the contents of a given element without any intervening markup, but should be aware that there is no way to represent the separations between these nodes in XML or HTML, so they will not (in general) persist between DOM editing sessions. TheNode.normalize()method merges any such adjacentTextobjects into a single node for each block of text.

    No lexical check is done on the content of aTextnode and, depending on its position in the document, some characters must be escaped during serialization using character references; e.g. the characters "<&" if the textual content is part of an element or of an attribute, the character sequence "]]>" when part of an element, the quotation mark character " or the apostrophe character ' when part of an attribute.

    Breaks this node into two nodes at the specifiedoffset, keeping both in the tree assiblings. After being split, this node will contain all the content up to theoffsetpoint. A new node of the same type, which contains all the content at and after theoffsetpoint, is returned. If the original node had a parent node, the new node is inserted as the nextsiblingof the original node. When theoffsetis equal to the length of this node, the new node has no data.

    The16-bit unitoffset at which to split, starting from0.

    The new node, of the same type as this node.

    INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than the number of 16-bit units indata.

    NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.

    Returns whether this text node containselement content whitespace, often abusively called "ignorable whitespace". The text node is determined to contain whitespace in element content during the load of the document or if validation occurs while usingDocument.normalizeDocument().

    Returns all text ofTextnodeslogically-adjacent text nodesto this node, concatenated in document order.

    For instance, in the example belowwholeTexton theTextnode that contains "bar" returns "barfoo", while on theTextnode that contains "foo" it returns "barfoo".

    Replaces the text of the current node and alllogically-adjacent text nodeswith the specified text. Alllogically-adjacent text nodesare removed including the current node unless it was the recipient of the replacement text.

    This method returns the node which received the replacement text. The returned node is:

    null, when the replacement text is the empty string;

    the current node, except when the current node isread-only;

    a newTextnode of the same type (TextorCDATASection) as the current node inserted at the location of the replacement.

    For instance, in the above example callingreplaceWholeTexton theTextnode that contains "bar" with "yo" in argument results in the following:

    Where the nodes to be removed are read-only descendants of anEntityReference, theEntityReferencemust be removed instead of the read-only nodes. If anyEntityReferenceto be removed has descendants that are notEntityReference,Text, orCDATASectionnodes, thereplaceWholeTextmethod must fail before performing any modification of the document, raising aDOMExceptionwith the codeNO_MODIFICATION_ALLOWED_ERR.

    For instance, in the example below callingreplaceWholeTexton theTextnode that contains "bar" fails, because theEntityReferencenode "ent" contains anElementnode which cannot be removed.

    The content of the replacingTextnode.

    TheTextnode created with the specified content.

    NO_MODIFICATION_ALLOWED_ERR: Raised if one of theTextnodes being replaced is readonly.

    This interface inherits fromCharacterDataand represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.

    No lexical check is done on the content of a comment and it is therefore possible to have the character sequence"--"(double-hyphen) in the content, which is illegal in a comment per section 2.5 of. The presence of this character sequence must generate a fatal error during serialization.

    TheTypeInfointerface represents a type referenced fromElementorAttrnodes, specified in theschemasassociated with the document. The type is a pair of anamespace URIand name properties, and depends on the document's schema.

    If the document's schema is an XML DTD, the values are computed as follows:

    If this type is referenced from anAttrnode,typeNamespaceis"http://www.w3.org/TR/REC-xml"andtypeNamerepresents the[attribute type]property in the. If there is no declaration for the attribute,typeNamespaceandtypeNamearenull.

    If this type is referenced from anElementnode,typeNamespaceandtypeNamearenull.

    If the document's schema is an XML Schema, the values are computed as follows using the post-schema-validation infoset contributions (also called PSVI contributions):

    If the[validity]property exists AND is"invalid"or"notKnown": the {target namespace} and {name} properties of the declared type if available, otherwisenull.

    At the time of writing, the XML Schema specification does not require exposing the declared type. Thus, DOM implementations might choose not to provide type information if validity is not valid.

    If the[validity]property exists and is"valid":

    If[member type definition]exists:

    If {name} is not absent, then expose {name} and {target namespace} properties of the[member type definition]property;

    Otherwise, expose the namespace and local name of the correspondinganonymous type name.

    If the[type definition]property exists:

    If {name} is not absent, then expose {name} and {target namespace} properties of the[type definition]property;

    Otherwise, expose the namespace and local name of the correspondinganonymous type name.

    If the[member type definition anonymous]exists:

    If it is false, then expose[member type definition name]and[member type definition namespace]properties;

    Otherwise, expose the namespace and local name of the correspondinganonymous type name.

    If the[type definition anonymous]exists:

    If it is false, then expose[type definition name]and[type definition namespace]properties;

    Otherwise, expose the namespace and local name of the correspondinganonymous type name.

    Other schema languages are outside the scope of the W3C and therefore should define how to represent their type systems usingTypeInfo.

    The name of a type declared for the associated element or attribute, ornullif unknown.

    The namespace of the type declared for the associated element or attribute ornullif the element does not have declaration or if no namespace information is available.

    These are the available values for thederivationMethodparameter used by the methodTypeInfo.isDerivedFrom(). It is a set of possible types of derivation, and the values represent bit positions. If a bit in thederivationMethodparameter is set to1, the corresponding type of derivation will be taken into account when evaluating the derivation between the reference type definition and the other type definition. When using theisDerivedFrommethod, combining all of them in thederivationMethodparameter is equivalent to invoking the method for each of them separately and combining the results with the OR boolean function. This specification only defines the type of derivation for XML Schema.

    In addition to the types of derivation listed below, please note that:

    any type derives fromxsd:anyType.

    any simple type derives fromxsd:anySimpleTypebyrestriction.

    any complex type does not derive fromxsd:anySimpleTypebyrestriction.

    If the document's schema is an XML Schema, this constant represents the derivation byrestrictionif complex types are involved, or arestrictionif simple types are involved.

    The reference type definition is derived byrestrictionfrom the other type definition if the other type definition is the same as the reference type definition, or if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and all thederivation methodsinvolved arerestriction.

    If the document's schema is an XML Schema, this constant represents the derivation byextension.

    The reference type definition is derived byextensionfrom the other type definition if the other type definition can be reached recursively following the {base type definition} property from the reference type definition, and at least one of thederivation methodsinvolved is anextension.

    If the document's schema is an XML Schema, this constant represents theunionif simple types are involved.

    The reference type definition is derived byunionfrom the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 byDERIVATION_RESTRICTIONorDERIVATION_EXTENSION, T2 is derived from the other type definition byDERIVATION_RESTRICTION, T1 has {variety}union, and one of the {member type definitions} is T2. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition.

    If the document's schema is an XML Schema, this constant represents thelist.

    The reference type definition is derived bylistfrom the other type definition if there exists two type definitions T1 and T2 such as the reference type definition is derived from T1 byDERIVATION_RESTRICTIONorDERIVATION_EXTENSION, T2 is derived from the other type definition byDERIVATION_RESTRICTION, T1 has {variety}list, and T2 is the {item type definition}. Note that T1 could be the same as the reference type definition, and T2 could be the same as the other type definition.

    This method returns if there is a derivation between the reference type definition, i.e. theTypeInfoon which the method is being called, and the other type definition, i.e. the one passed as parameters.

    the namespace of the other type definition.

    the name of the other type definition.

    the type of derivation and conditions applied between two types, as described in the list of constants provided in this interface.

    If the document's schema is a DTD or no schema is associated with the document, this method will always returnfalse.

    If the document's schema is an XML Schema, the method willtrueif the reference type definition is derived from the other type definition according to the derivation parameter. If the value of the parameter is0(no bit is set to1for thederivationMethodparameter), the method will returntrueif the other type definition can be reached by recursing any combination of {base type definition}, {item type definition}, or {member type definitions} from the reference type definition.

    When associating an object to a key on a node usingNode.setUserData()the application can provide a handler that gets called when the node the object is associated to is being cloned, imported, or renamed. This can be used by the application to implement various behaviors regarding the data it associates to the DOM nodes. This interface defines that handler.

    An integer indicating the type of operation being performed on a node.

    The node is cloned, usingNode.cloneNode().

    The node is imported, usingDocument.importNode().

    The node is deleted.

    This may not be supported or may not be reliable in certain environments, such as Java, where the implementation has no real control over when objects are actually deleted.

    The node is renamed, usingDocument.renameNode().

    The node is adopted, usingDocument.adoptNode().

    This method is called whenever the node for which this handler is registered is imported or cloned.

    DOM applications must not raise exceptions in aUserDataHandler. The effect of throwing exceptions from the handler is DOM implementation dependent.

    Specifies the type of operation that is being performed on the node.

    Specifies the key for which this handler is being called.

    Specifies the data for which this handler is being called.

    Specifies the node being cloned, adopted, imported, or renamed. This isnullwhen the node is being deleted.

    Specifies the node newly created if any, ornull.

    DOMErroris an interface that describes an error.

    An integer indicating the severity of the error.

    The severity of the error described by theDOMErroris warning. ASEVERITY_WARNINGwill not cause the processing to stop, unlessDOMErrorHandler.handleError()returnsfalse.

    The severity of the error described by theDOMErroris error. ASEVERITY_ERRORmay not cause the processing to stop if the error can be recovered, unlessDOMErrorHandler.handleError()returnsfalse.

    The severity of the error described by theDOMErroris fatal error. ASEVERITY_FATAL_ERRORwill cause the normal processing to stop. The return value ofDOMErrorHandler.handleError()is ignored unless the implementation chooses to continue, in which case the behavior becomes undefined.

    The severity of the error, eitherSEVERITY_WARNING,SEVERITY_ERROR, orSEVERITY_FATAL_ERROR.

    An implementation specific string describing the error that occurred.

    ADOMStringindicating which related data is expected inrelatedData. Users should refer to the specification of the error in order to find itsDOMStringtype andrelatedDatadefinitions if any.

    As an example,Document.normalizeDocument()does generate warnings when the "split-cdata-sections" parameter is in use. Therefore, the method generates aSEVERITY_WARNINGwithtype"cdata-sections-splitted"and the firstCDATASectionnode in document order resulting from the split is returned by therelatedDataattribute.

    The related platform dependent exception if any.

    The relatedDOMError.typedependent data if any.

    The location of the error.

    DOMErrorHandleris a callback interface that the DOM implementation can call when reporting errors that happens while processing XML data, or when doing some other processing (e.g. validating a document). ADOMErrorHandlerobject can be attached to aDocumentusing the "error-handler" on theDOMConfigurationinterface. If more than one error needs to be reported during an operation, the sequence and numbers of the errors passed to the error handler are implementation dependent.

    The application that is using the DOM implementation is expected to implement this interface.

    This method is called on the error handler when an error occurs.

    If an exception is thrown from this method, it is considered to be equivalent of returningtrue.

    The error object that describes the error. This object may be reused by the DOM implementation across multiple calls to thehandleErrormethod.

    If thehandleErrormethod returnsfalse, the DOM implementation should stop the current processing when possible. If the method returnstrue, the processing may continue depending onDOMError.severity.

    DOMLocatoris an interface that describes a location (e.g. where an error occurred).

    The line number this locator is pointing to, or-1if there is no column number available.

    The column number this locator is pointing to, or-1if there is no column number available.

    The byte offset into the input source this locator is pointing to or-1if there is no byte offset available.

    The UTF-16, as defined inand Amendment 1 of, offset into the input source this locator is pointing to or-1if there is no UTF-16 offset available.

    The node this locator is pointing to, ornullif no node is available.

    The URI this locator is pointing to, ornullif no URI is available.

    TheDOMConfigurationinterface represents the configuration of a document and maintains a table of recognized parameters. Using the configuration, it is possible to changeDocument.normalizeDocument()behavior, such as replacing theCDATASectionnodes withTextnodes or specifying the type of theschemathat must be used when the validation of theDocumentis requested.DOMConfigurationobjects are also used inin theDOMParserandDOMSerializerinterfaces.

    The parameter names used by theDOMConfigurationobject are defined throughout the DOM Level 3 specifications. Names are case-insensitive. To avoid possible conflicts, as a convention, names referring to parameters defined outside the DOM specification should be made unique. Because parameters are exposed as properties in the, names are recommended to follow the section5.16 Identifiersofwith the addition of the character '-' (HYPHEN-MINUS) but it is not enforced by the DOM implementation. DOM Level 3 Core Implementations are required to recognize all parameters defined in this specification. Some parameter values may also be required to be supported by the implementation. Refer to the definition of the parameter to know if a value must be supported or not.

    Parameters are similar to features and properties used in SAX2.

    The following list of parameters defined in the DOM:

    [optional]

    Canonicalize the document according to the rules specified in, such as removing theDocumentTypenode (if any) from the tree, or removing superfluous namespace declarations from each element. Note that this is limited to what can be represented in the DOM; in particular, there is no way to specify the order of the attributes in the DOM. In addition,

    Setting this parameter totruewill also set the state of the parameters listed below. Later changes to the state of one of those parameters will revert "canonical-form" back tofalse.

    Parameters set tofalse: "entities", "normalize-characters", "cdata-sections".

    Parameters set totrue: "namespaces", "namespace-declarations", "well-formed", "element-content-whitespace".

    Other parameters are not changed unless explicitly specified in the description of the parameters.

    [required] (default)

    Do not canonicalize the document.

    [required] (default)

    KeepCDATASectionnodes in the document.

    [required]

    TransformCDATASectionnodes in the document intoTextnodes. The newTextnode is then combined with any adjacentTextnode.

    [optional]

    Check if the characters in the document arefully normalized, as defined in appendix B of. When a sequence of characters is encountered that fails normalization checking, an error with theDOMError.typeequals to "check-character-normalization-failure" is issued.

    [required] (default)

    Do not check if characters are normalized.

    [required] (default)

    KeepCommentnodes in the document.

    [required]

    DiscardCommentnodes in the document.

    [optional]

    Expose schema normalized values in the tree, such asXML Schema normalized valuesin the case of XML Schema. Since this parameter requires to haveschemainformation, the "validate" parameter will also be set totrue. Having this parameter activated when "validate" isfalsehas no effect and no schema-normalization will happen.

    Since the document contains the result of the XML 1.0 processing, this parameter does not apply to attribute value normalization as defined in section 3.3.3 ofand is only meant forschemalanguages other than Document Type Definition (DTD).

    [required] (default)

    Do not perform schema normalization on the tree.

    [required] (default)

    Keep all whitespaces in the document.

    [optional]

    Discard allTextnodes that contain whitespaces in element content, as described in[element content whitespace]. The implementation is expected to use the attributeText.isElementContentWhitespaceto determine if aTextnode should be discarded or not.

    [required] (default)

    KeepEntityReferencenodes in the document.

    [required]

    Remove allEntityReferencenodes from the document, putting the entity expansions directly in their place.Textnodes are normalized, as defined inNode.normalize. Onlyunexpanded entity referencesare kept in the document.

    This parameter does not affectEntitynodes.

    [required]

    Contains aDOMErrorHandlerobject. If an error is encountered in the document, the implementation will call back theDOMErrorHandlerregistered using this parameter. The implementation may provide a defaultDOMErrorHandlerobject.

    When called,DOMError.relatedDatawill contain the closest node to where the error occurred. If the implementation is unable to determine the node where the error occurs,DOMError.relatedDatawill contain theDocumentnode. Mutations to the document from within an error handler will result in implementation dependent behavior.

    [required]

    Keep in the document the information defined in the XML Information Set.

    This forces the following parameters tofalse: "validate-if-schema", "entities", "datatype-normalization", "cdata-sections".

    This forces the following parameters totrue: "namespace-declarations", "well-formed", "element-content-whitespace", "comments", "namespaces".

    Other parameters are not changed unless explicitly specified in the description of the parameters.

    Note that querying this parameter withgetParameterreturnstrueonly if the individual parameters specified above are appropriately set.

    Settinginfosettofalsehas no effect.

    [required] (default)

    Perform the namespace processing as defined in.

    [optional]

    Do not perform the namespace processing.

    This parameter has no effect if the parameter "namespaces" is set tofalse.

    [required] (default)

    Include namespace declaration attributes, specified or defaulted from theschema, in the document. See also the sections "Declaring Namespaces" inand.

    [required]

    Discard all namespace declaration attributes. The namespace prefixes (Node.prefix) are retained even if this parameter is set tofalse.

    [optional]

    Fully normalizedthe characters in the document as defined in appendix B of.

    [required] (default)

    Do not perform character normalization.

    [optional]

    Represent aDOMStringobject containing a list of URIs, separated by whitespaces (characters matching thenonterminal production Sdefined in section 2.3), that represents theschemasagainst which validation should occur, i.e. the current schema. The types of schemas referenced in this list must match the type specified withschema-type, otherwise the behavior of an implementation is undefined.

    The schemas specified using this property take precedence to the schema information specified in the document itself. For namespace aware schema, if a schema specified using this property and a schema specified in the document instance (i.e. using theschemaLocationattribute) in a schema document (i.e. using schemaimportmechanisms) share the sametargetNamespace, the schema specified by the user using this property will be used. If two schemas specified using this property share the sametargetNamespaceor have no namespace, the behavior is implementation dependent.

    If no location has been provided, this parameter isnull.

    The"schema-location"parameter is ignored unless the "schema-type" parameter value is set. It is strongly recommended thatDocument.documentURIwill be set so that an implementation can successfully resolve any external entities referenced.

    [optional]

    Represent aDOMStringobject containing an absolute URI and representing the type of theschemalanguage used to validate a document against. Note that no lexical checking is done on the absolute URI.

    If this parameter is not set, a default value may be provided by the implementation, based on the schema languages supported and on the schema language used at load time. If no value is provided, this parameter isnull.

    For XML Schema, applications must use the value"http://www.w3.org/2001/XMLSchema". For XML DTD, applications must use the value"http://www.w3.org/TR/REC-xml". Other schema languages are outside the scope of the W3C and therefore should recommend an absolute URI in order to use this method.

    [required] (default)

    Split CDATA sections containing the CDATA section termination marker ']]>'. When a CDATA section is split a warning is issued with aDOMError.typeequals to"cdata-sections-splitted"andDOMError.relatedDataequals to the firstCDATASectionnode in document order resulting from the split.

    [required]

    Signal an error if aCDATASectioncontains an unrepresentable character.

    [optional]

    Require the validation against aschema(i.e. XML schema, DTD, any other type or representation of schema) of the document as it is being normalized as defined by. If validation errors are found, or no schema was found, the error handler is notified. Schema-normalized values will not be exposed according to the schema in used unless the parameter "datatype-normalization" istrue.

    This parameter will reevaluate:

    Attribute nodes withAttr.specifiedequals tofalse, as specified in the description of theAttrinterface;

    The value of the attributeText.isElementContentWhitespacefor allTextnodes;

    The value of the attributeAttr.isIdfor allAttrnodes;

    The attributesElement.schemaTypeInfoandAttr.schemaTypeInfo.

    "validate-if-schema" and "validate" are mutually exclusive, setting one of them totruewill set the other one tofalse. Applications should also consider setting the parameter "well-formed" totrue, which is the default for that option, when validating the document.

    [required] (default)

    Do not accomplish schema processing, including the internal subset processing. Default attribute values information are kept. Note that validation might still happen if "validate-if-schema" istrue.

    [optional]

    Enable validation only if a declaration for the document element can be found in aschema(independently of where it is found, i.e. XML schema, DTD, or any other type or representation of schema). If validation is enabled, this parameter has the same behavior as the parameter "validate" set totrue.

    "validate-if-schema" and "validate" are mutually exclusive, setting one of them totruewill set the other one tofalse.

    [required] (default)

    No schema processing should be performed if the document has a schema, including internal subset processing. Default attribute values information are kept. Note that validation must still happen if "validate" istrue.

    [required] (default)

    Check if all nodes are XMLwell formedaccording to the XML version in use inDocument.xmlVersion:

    check if the attributeNode.nodeNamecontains invalid characters according to its node type and generate aDOMErrorof type"wf-invalid-character-in-node-name", with aDOMError.SEVERITY_ERRORseverity, if necessary;

    check if the text content insideAttr,Element,Comment,Text,CDATASectionnodes for invalid characters and generate aDOMErrorof type"wf-invalid-character", with aDOMError.SEVERITY_ERRORseverity, if necessary;

    check if the data insideProcessingInstructionnodes for invalid characters and generate aDOMErrorof type"wf-invalid-character", with aDOMError.SEVERITY_ERRORseverity, if necessary;

    [optional]

    Do not check for XML well-formedness.

    The resolution of the system identifiers associated with entities is done usingDocument.documentURI. However, when the feature "LS" defined inis supported by the DOM implementation, the parameter "resource-resolver" can also be used onDOMConfigurationobjects attached toDocumentnodes. If this parameter is set,Document.normalizeDocument()will invoke the resource resolver instead of usingDocument.documentURI.

    Set the value of a parameter.

    The name of the parameter to set.

    The new value ornullif the user wishes to unset the parameter. While the type of the value parameter is defined asDOMUserData, the object type must match the type defined by the definition of the parameter. For example, if the parameter is"error-handler", the value must be of typeDOMErrorHandler.

    NOT_FOUND_ERR: Raised when the parameter name is not recognized.

    NOT_SUPPORTED_ERR: Raised when the parameter name is recognized but the requested value cannot be set.

    TYPE_MISMATCH_ERR: Raised if the value type for this parameter name is incompatible with the expected value type.

    Return the value of a parameter if known.

    The name of the parameter.

    The current object associated with the specified parameter ornullif no object has been associated or if the parameter is not supported.

    NOT_FOUND_ERR: Raised when the parameter name is not recognized.

    Check if setting a parameter to a specific value is supported.

    The name of the parameter to check.

    An object. ifnull, the returned value istrue.

    trueif the parameter could be successfully set to the specified value, orfalseif the parameter is not recognized or the requested value is not supported. This does not change the current value of the parameter itself.

    The list of the parameters supported by thisDOMConfigurationobject and for which at least one value can be set by the application. Note that this list can also contain parameter names defined outside this specification.

    CDATA sections are used to escape blocks of text containing characters that would otherwise be regarded as markup. The only delimiter that is recognized in a CDATA section is the "]]>" string that ends the CDATA section. CDATA sections cannot be nested. Their primary purpose is for including material such as XML fragments, without needing to escape all the delimiters.

    TheCharacterData.dataattribute holds the text that is contained by the CDATA section. Note that thismaycontain characters that need to be escaped outside of CDATA sections and that, depending on the character encoding ("charset") chosen for serialization, it may be impossible to write out some characters as part of a CDATA section.

    TheCDATASectioninterface inherits from theCharacterDatainterface through theTextinterface. AdjacentCDATASectionnodes are not merged by use of thenormalizemethod of theNodeinterface.

    No lexical check is done on the content of a CDATA section and it is therefore possible to have the character sequence"]]>"in the content, which is illegal in a CDATA section per section 2.7 of. The presence of this character sequence must generate a fatal error during serialization or the cdata section must be splitted before the serialization (see also the parameter"split-cdata-sections"in theDOMConfigurationinterface).

    Because no markup is recognized within aCDATASection, character numeric references cannot be used as an escape mechanism when serializing. Therefore, action needs to be taken when serializing aCDATASectionwith a character encoding where some of the contained characters cannot be represented. Failure to do so would not produce well-formed XML.

    One potential solution in the serialization process is to end the CDATA section before the character, output the character using a character reference or entity reference, and open a new CDATA section for any further characters in the text node. Note, however, that some code conversion libraries at the time of writing do not return an error or exception when a character is missing from the encoding, making the task of ensuring that data is not corrupted on serialization more difficult.

    EachDocumenthas adoctypeattribute whose value is eithernullor aDocumentTypeobject. TheDocumentTypeinterface in the DOM Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various XML schema efforts on DTD representation are not clearly understood as of this writing.

    DOM Level 3 doesn't support editingDocumentTypenodes.DocumentTypenodes areread-only.

    The name of DTD; i.e., the name immediately following theDOCTYPEkeyword.

    ANamedNodeMapcontaining the general entities, both external and internal, declared in the DTD. Parameter entities are not contained. Duplicates are discarded. For example in:<!DOCTYPE ex SYSTEM "ex.dtd" [ <!ENTITY foo "foo"> <!ENTITY bar "bar"> <!ENTITY bar "bar2"> <!ENTITY % baz "baz"> ]> <ex/>the interface provides access tofooand the first declaration ofbarbut not the second declaration ofbarorbaz. Every node in this map also implements theEntityinterface.

    The DOM Level 2 does not support editing entities, thereforeentitiescannot be altered in any way.

    ANamedNodeMapcontaining the notations declared in the DTD. Duplicates are discarded. Every node in this map also implements theNotationinterface.

    The DOM Level 2 does not support editing notations, thereforenotationscannot be altered in any way.

    The public identifier of the external subset.

    The system identifier of the external subset. This may be an absolute URI or not.

    The internal subset as a string, ornullif there is none. This is does not contain the delimiting square brackets.

    The actual content returned depends on how much information is available to the implementation. This may vary depending on various parameters, including the XML processor used to build the document.

    This interface represents a notation declared in the DTD. A notation either declares, by name, the format of an unparsed entity (seesection 4.7of the XML 1.0 specification), or is used for formal declaration of processing instruction targets (seesection 2.6of the XML 1.0 specification). ThenodeNameattribute inherited fromNodeis set to the declared name of the notation.

    The DOM Core does not support editingNotationnodes; they are thereforereadonly.

    ANotationnode does not have any parent.

    The public identifier of this notation. If the public identifier was not specified, this isnull.

    The system identifier of this notation. If the system identifier was not specified, this isnull. This may be an absolute URI or not.

    This interface represents a known entity, either parsed or unparsed, in an XML document. Note that this models the entity itselfnotthe entity declaration.

    ThenodeNameattribute that is inherited fromNodecontains the name of the entity.

    An XML processor may choose to completely expand entities before the structure model is passed to the DOM; in this case there will be noEntityReferencenodes in the document tree.

    XML does not mandate that a non-validating XML processor read and process entity declarations made in the external subset or declared in parameter entities. This means that parsed entities declared in the external subset need not be expanded by some classes of applications, and that the replacement text of the entity may not be available. When thereplacement textis available, the correspondingEntitynode's child list represents the structure of that replacement value. Otherwise, the child list is empty.

    DOM Level 3 does not support editingEntitynodes; if a user wants to make changes to the contents of anEntity, every relatedEntityReferencenode has to be replaced in the structure model by a clone of theEntity's contents, and then the desired changes must be made to each of those clones instead.Entitynodes and all theirdescendantsarereadonly.

    AnEntitynode does not have any parent.

    If the entity contains an unboundnamespace prefix, thenamespaceURIof the corresponding node in theEntitynode subtree isnull. The same is true forEntityReferencenodes that refer to this entity, when they are created using thecreateEntityReferencemethod of theDocumentinterface.

    The public identifier associated with the entity if specified, andnullotherwise.

    The system identifier associated with the entity if specified, andnullotherwise. This may be an absolute URI or not.

    For unparsed entities, the name of the notation for the entity. For parsed entities, this isnull.

    An attribute specifying the encoding used for this entity at the time of parsing, when it is an external parsed entity. This isnullif it an entity from the internal subset or if it is not known.

    An attribute specifying, as part of the text declaration, the encoding of this entity, when it is an external parsed entity. This isnullotherwise.

    An attribute specifying, as part of the text declaration, the version number of this entity, when it is an external parsed entity. This isnullotherwise.

    EntityReferencenodes may be used to represent an entity reference in the tree. Note that character references and references to predefined entities are considered to be expanded by the HTML or XML processor so that characters are represented by their Unicode equivalent rather than by an entity reference. Moreover, the XML processor may completely expand references to entities while building theDocument, instead of providingEntityReferencenodes. If it does provide such nodes, then for anEntityReferencenode that represents a reference to a known entity anEntityexists, and the subtree of theEntityReferencenode is a copy of theEntitynode subtree. However, the latter may not be true when an entity contains an unboundnamespace prefix. In such a case, because the namespace prefix resolution depends on where the entity reference is, thedescendantsof theEntityReferencenode may be bound to differentnamespace URIs. When anEntityReferencenode represents a reference to an unknown entity, the node has no children and its replacement value, when used byAttr.valuefor example, is empty.

    As forEntitynodes,EntityReferencenodes and all theirdescendantsarereadonly.

    EntityReferencenodes may cause element content and attribute value normalization problems when, such as in XML 1.0 and XML Schema, the normalization is performed after entity reference are expanded.

    TheProcessingInstructioninterface represents a "processing instruction", used in XML as a way to keep processor-specific information in the text of the document.

    No lexical check is done on the content of a processing instruction and it is therefore possible to have the character sequence"?>"in the content, which is illegal a processing instruction per section 2.6 of. The presence of this character sequence must generate a fatal error during serialization.

    The target of this processing instruction. XML defines this as being the firsttokenfollowing the markup that begins the processing instruction.

    The content of this processing instruction. This is from the first non white space character after the target to the character immediately preceding the?>.

    NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.

    Extensions to a language's native String class or interface

    Returns the UTF-16 offset that corresponds to a UTF-32 offset. Used for random access.

    You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

    UTF-32 offset.

    UTF-16 offset

    ifoffset32is out of bounds.

    Returns the UTF-32 offset corresponding to a UTF-16 offset. Used for random access. To find the UTF-32 length of a string, use:len32 = findOffset32(source, source.length());

    If the UTF-16 offset is into the middle of a surrogate pair, then the UTF-32 offset of theendof the pair is returned; that is, the index of the char after the end of the pair. You can always round-trip from a UTF-32 offset to a UTF-16 offset and back. You can round-trip from a UTF-16 offset to a UTF-32 offset and back if and only if the offset16 is not in the middle of a surrogate pair. Unmatched surrogates count as a single UTF-16 value.

    UTF-16 offset

    UTF-32 offset

    if offset16 is out of bounds.

    netsurf-all-3.2/libdom/README0000644000175000017500000000171512377676745014766 0ustar vincevinceLibDOM -- an implementation of the W3C DOM ========================================== Overview -------- LibDOM is an implementation of the W3C DOM API in C. Requirements ------------ libdom requires the following tools: + A C99 capable C compiler + GNU make or compatible + Perl (for the testcases) LibDOM also requires the following libraries to be installed: + LibParserUtils + LibWapcaplet Compilation ----------- If necessary, modify the toolchain settings in the Makefile. Invoke make: $ make Verification ------------ To verify that the library is working, it is necessary to specify a different makefile target than that used for normal compilation, thus: $ make test API documentation ----------------- Currently, there is none. However, the code is well commented and the public API may be found in the "include" directory. The testcase sources may also be of use in working out how to use it. netsurf-all-3.2/libdom/gdb/0000755000175000017500000000000012377713347014624 5ustar vincevincenetsurf-all-3.2/libdom/gdb/libdom.py0000644000175000017500000001130712377676745016460 0ustar vincevince# LibDOM related commands and utilities for gdb import gdb def dom_get_type_ptr(typename): return gdb.lookup_type(typename).pointer() def dom_node_at(ptr): nodetype = dom_get_type_ptr("dom_node_internal") return ptr.cast(nodetype).dereference() def dom_document_at(ptr): doctype = dom_get_type_ptr("dom_document") return ptr.cast(doctype).dereference() def dom_node_type(node): return node["type"] def dom_node_refcnt(node): return node["base"]["refcnt"] def lwc_string_value(strptr): cptr = strptr+1 charptr = cptr.cast(dom_get_type_ptr("char")) return charptr.string() def dom_string__is_intern(intstr): return str(intstr['type']) == "DOM_STRING_INTERNED" def cdata_string_value(cdata): cptr = cdata['ptr'] charptr = cptr.cast(dom_get_type_ptr("char")) return charptr.string() def dom_string_value(stringptr): intstr = stringptr.cast(dom_get_type_ptr("dom_string_internal")).dereference() if intstr.address == gdb.parse_and_eval("(dom_string_internal*)0"): return "" if dom_string__is_intern(intstr): return lwc_string_value(intstr['data']['intern']) else: return cdata_string_value(intstr['data']['cdata']) def dom_node_name(node): namestr = node["name"] return " '%s'" % dom_string_value(namestr) def dom_node_pending_offset(): return gdb.parse_and_eval("(int)&((struct dom_node_internal *)0)->pending_list") def dom_print_node(node, prefix = ""): print("%s%s @ %s [%s]%s" % (prefix, dom_node_type(node), node.address, dom_node_refcnt(node), dom_node_name(node))) def dom_walk_tree(node, prefix = ""): dom_print_node(node, prefix) current = node['first_child'].dereference() while current.address != 0: dom_walk_tree(current, "%s " % prefix) current = current['next'].dereference() def dom_document_show(doc): print "Node Tree:" node = dom_node_at(doc.address) dom_walk_tree(node, " ") pending = doc['pending_nodes'] if pending['next'] != pending.address: print "Pending Node trees:" current_list_entry = pending['next'] while current_list_entry is not None: voidp = current_list_entry.cast(dom_get_type_ptr("void")) voidp = voidp - dom_node_pending_offset() node = dom_node_at(voidp) dom_walk_tree(node, " ") current_list_entry = node['pending_list']['next'] if current_list_entry == pending.address: current_list_entry = None class DOMCommand(gdb.Command): """DOM related commands""" def __init__(self): gdb.Command.__init__(self, "dom", gdb.COMMAND_DATA, gdb.COMPLETE_COMMAND, True) class DOMNodeCommand(gdb.Command): """DOMNode related commands""" def __init__(self): gdb.Command.__init__(self, "dom node", gdb.COMMAND_DATA, gdb.COMPLETE_COMMAND, True) class DOMDocumentCommand(gdb.Command): """DOMDocument related commands""" def __init__(self): gdb.Command.__init__(self, "dom document", gdb.COMMAND_DATA, gdb.COMPLETE_COMMAND, True) class DOMNodeShowCommand(gdb.Command): """Show a node at a given address.""" def __init__(self): gdb.Command.__init__(self, "dom node show", gdb.COMMAND_DATA, gdb.COMPLETE_NONE, True) def invoke(self, arg, from_tty): args = gdb.string_to_argv(arg) self._invoke(*args) def _invoke(self, nodeptr): _ptr = gdb.parse_and_eval(nodeptr) node = dom_node_at(_ptr) dom_print_node(node) class DOMNodeWalkCommand(gdb.Command): """Walk a node tree at a given address.""" def __init__(self): gdb.Command.__init__(self, "dom node walk", gdb.COMMAND_DATA, gdb.COMPLETE_NONE, True) def invoke(self, arg, from_tty): args = gdb.string_to_argv(arg) self._invoke(*args) def _invoke(self, nodeptr): _ptr = gdb.parse_and_eval(nodeptr) node = dom_node_at(_ptr) dom_walk_tree(node) class DOMDocumentShowCommand(gdb.Command): """Show a document at a given address.""" def __init__(self): gdb.Command.__init__(self, "dom document show", gdb.COMMAND_DATA, gdb.COMPLETE_NONE, True) def invoke(self, arg, from_tty): args = gdb.string_to_argv(arg) self._invoke(*args) def _invoke(self, docptr): _ptr = gdb.parse_and_eval(docptr) doc = dom_document_at(_ptr) dom_document_show(doc) DOMCommand() DOMNodeCommand() DOMNodeShowCommand() DOMNodeWalkCommand() DOMDocumentCommand() DOMDocumentShowCommand() netsurf-all-3.2/libdom/Makefile.config0000644000175000017500000000074312377676745017012 0ustar vincevince# Configuration Makefile fragment # Build the libxml2 binding? # yes | no WITH_LIBXML_BINDING := no WITH_EXPAT_BINDING := yes # Build the hubbub binding? # yes | no WITH_HUBBUB_BINDING := yes # ---------------------------------------------------------------------------- # BeOS-specific options # ---------------------------------------------------------------------------- ifeq ($(TARGET),beos) # temporary WITH_LIBXML_BINDING := no endif -include Makefile.config.override netsurf-all-3.2/libdom/COPYING0000644000175000017500000000204512377676745015136 0ustar vincevinceCopyright (C) 2007 J-M Bell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. netsurf-all-3.2/libdom/libdom.pc.in0000644000175000017500000000034212377676745016300 0ustar vincevinceprefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/LIBDIR includedir=${prefix}/include Name: libdom Description: W3C DOM implementation Version: VERSION REQUIRED Libs: -L${libdir} -ldom -lexpat Cflags: -I${includedir} netsurf-all-3.2/libdom/examples/0000755000175000017500000000000012377713347015706 5ustar vincevincenetsurf-all-3.2/libdom/examples/dom-structure-dump.c0000644000175000017500000002056712377676745021656 0ustar vincevince/* * This file is part of LibDOM. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * * Copyright 2010 - 2011 Michael Drake */ /* * Load an HTML file into LibDOM with Hubbub and print out the DOM structure. * * This example demonstrates the following: * * 1. Using LibDOM's Hubbub binding to read an HTML file into LibDOM. * 2. Walking around the DOM tree. * 3. Accessing DOM node attributes. * * Example input: *

    NetSurf

    *

    NetSurf is awesome!

    *

    Hubbub

    Hubbub is too.

    *

    Big time.

    * * Example output: * * HTML * +-BODY * | +-H1 class="woo" * | +-P * | | +-EM * | +-DIV * | | +-H2 * | | +-P * | | +-P * */ #include #include #include #include #include #include #include #include #include /** * Generate a LibDOM document DOM from an HTML file * * \param file The file path * \return pointer to DOM document, or NULL on error */ dom_document *create_doc_dom_from_file(char *file) { size_t buffer_size = 1024; dom_hubbub_parser *parser = NULL; FILE *handle; int chunk_length; dom_hubbub_error error; dom_hubbub_parser_params params; dom_document *doc; unsigned char buffer[buffer_size]; params.enc = NULL; params.fix_enc = true; params.enable_script = false; params.msg = NULL; params.script = NULL; params.ctx = NULL; params.daf = NULL; /* Create Hubbub parser */ error = dom_hubbub_parser_create(¶ms, &parser, &doc); if (error != DOM_HUBBUB_OK) { printf("Can't create Hubbub Parser\n"); return NULL; } /* Open input file */ handle = fopen(file, "rb"); if (handle == NULL) { dom_hubbub_parser_destroy(parser); printf("Can't open test input file: %s\n", file); return NULL; } /* Parse input file in chunks */ chunk_length = buffer_size; while (chunk_length == buffer_size) { chunk_length = fread(buffer, 1, buffer_size, handle); error = dom_hubbub_parser_parse_chunk(parser, buffer, chunk_length); if (error != DOM_HUBBUB_OK) { dom_hubbub_parser_destroy(parser); printf("Parsing errors occur\n"); return NULL; } } /* Done parsing file */ error = dom_hubbub_parser_completed(parser); if (error != DOM_HUBBUB_OK) { dom_hubbub_parser_destroy(parser); printf("Parsing error when construct DOM\n"); return NULL; } /* Finished with parser */ dom_hubbub_parser_destroy(parser); /* Close input file */ if (fclose(handle) != 0) { printf("Can't close test input file: %s\n", file); return NULL; } return doc; } /** * Dump attribute/value for an element node * * \param node The element node to dump attribute details for * \param attribute The attribute to dump * \return true on success, or false on error */ bool dump_dom_element_attribute(dom_node *node, char *attribute) { dom_exception exc; dom_string *attr = NULL; dom_string *attr_value = NULL; dom_node_type type; const char *string; size_t length; /* Should only have element nodes here */ exc = dom_node_get_node_type(node, &type); if (exc != DOM_NO_ERR) { printf(" Exception raised for node_get_node_type\n"); return false; } assert(type == DOM_ELEMENT_NODE); /* Create a dom_string containing required attribute name. */ exc = dom_string_create_interned((uint8_t *)attribute, strlen(attribute), &attr); if (exc != DOM_NO_ERR) { printf(" Exception raised for dom_string_create\n"); return false; } /* Get class attribute's value */ exc = dom_element_get_attribute(node, attr, &attr_value); if (exc != DOM_NO_ERR) { printf(" Exception raised for element_get_attribute\n"); dom_string_unref(attr); return false; } else if (attr_value == NULL) { /* Element lacks required attribute */ dom_string_unref(attr); return true; } /* Finished with the attr dom_string */ dom_string_unref(attr); /* Get attribute value's string data */ string = dom_string_data(attr_value); length = dom_string_byte_length(attr_value); /* Print attribute info */ printf(" %s=\"%.*s\"", attribute, (int)length, string); /* Finished with the attr_value dom_string */ dom_string_unref(attr_value); return true; } /** * Print a line in a DOM structure dump for an element * * \param node The node to dump * \param depth The node's depth * \return true on success, or false on error */ bool dump_dom_element(dom_node *node, int depth) { dom_exception exc; dom_string *node_name = NULL; dom_node_type type; int i; const char *string; size_t length; /* Only interested in element nodes */ exc = dom_node_get_node_type(node, &type); if (exc != DOM_NO_ERR) { printf("Exception raised for node_get_node_type\n"); return false; } else if (type != DOM_ELEMENT_NODE) { /* Nothing to print */ return true; } /* Get element name */ exc = dom_node_get_node_name(node, &node_name); if (exc != DOM_NO_ERR) { printf("Exception raised for get_node_name\n"); return false; } else if (node_name == NULL) { printf("Broken: root_name == NULL\n"); return false; } /* Print ASCII tree structure for current node */ if (depth > 0) { for (i = 0; i < depth; i++) { printf("| "); } printf("+-"); } /* Get string data and print element name */ string = dom_string_data(node_name); length = dom_string_byte_length(node_name); printf("[%.*s]", (int)length, string); if (length == 5 && strncmp(string, "title", 5) == 0) { /* Title tag, gather the title */ dom_string *str; exc = dom_node_get_text_content(node, &str); if (exc == DOM_NO_ERR && str != NULL) { printf(" $%.*s$", (int)dom_string_byte_length(str), dom_string_data(str)); dom_string_unref(str); } } /* Finished with the node_name dom_string */ dom_string_unref(node_name); /* Print the element's id & class, if it has them */ if (dump_dom_element_attribute(node, "id") == false || dump_dom_element_attribute(node, "class") == false) { /* Error occured */ printf("\n"); return false; } printf("\n"); return true; } /** * Walk though a DOM (sub)tree, in depth first order, printing DOM structure. * * \param node The root node to start from * \param depth The depth of 'node' in the (sub)tree */ bool dump_dom_structure(dom_node *node, int depth) { dom_exception exc; dom_node *child; /* Print this node's entry */ if (dump_dom_element(node, depth) == false) { /* There was an error; return */ return false; } /* Get the node's first child */ exc = dom_node_get_first_child(node, &child); if (exc != DOM_NO_ERR) { printf("Exception raised for node_get_first_child\n"); return false; } else if (child != NULL) { /* node has children; decend to children's depth */ depth++; /* Loop though all node's children */ do { dom_node *next_child; /* Visit node's descendents */ if (dump_dom_structure(child, depth) == false) { /* There was an error; return */ dom_node_unref(child); return false; } /* Go to next sibling */ exc = dom_node_get_next_sibling(child, &next_child); if (exc != DOM_NO_ERR) { printf("Exception raised for " "node_get_next_sibling\n"); dom_node_unref(child); return false; } dom_node_unref(child); child = next_child; } while (child != NULL); /* No more children */ } return true; } /** * Main entry point from OS. */ int main(int argc, char **argv) { dom_exception exc; /* returned by libdom functions */ dom_document *doc = NULL; /* document, loaded into libdom */ dom_node *root = NULL; /* root element of document */ /* Load up the input HTML file */ doc = create_doc_dom_from_file((argc > 1) ? (argv[1]) : "files/test.html"); if (doc == NULL) { printf("Failed to load document.\n"); return EXIT_FAILURE; } /* Get root element */ exc = dom_document_get_document_element(doc, &root); if (exc != DOM_NO_ERR) { printf("Exception raised for get_document_element\n"); dom_node_unref(doc); return EXIT_FAILURE; } else if (root == NULL) { printf("Broken: root == NULL\n"); dom_node_unref(doc); return EXIT_FAILURE; } /* Dump DOM structure */ if (dump_dom_structure(root, 0) == false) { printf("Failed to complete DOM structure dump.\n"); dom_node_unref(root); dom_node_unref(doc); return EXIT_FAILURE; } dom_node_unref(root); /* Finished with the dom_document */ dom_node_unref(doc); return EXIT_SUCCESS; } netsurf-all-3.2/libdom/examples/files/0000755000175000017500000000000012377713347017010 5ustar vincevincenetsurf-all-3.2/libdom/examples/files/test.html0000644000175000017500000002353612377676745020700 0ustar vincevince NetSurf Web Browser

    NetSurf

    Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser for RISC OS, UNIX-like platforms (including Linux) and more.

    Whether you want to check your webmail, read the news or post to discussion forums, NetSurf is your lightweight gateway to the world wide web. Actively developed, NetSurf is continually evolving and improving.

    Written in C, this award winning open source project features its own layout engine. It is licensed under GPL version 2.

    Why choose NetSurf?

    Speed
    Efficiency lies at the heart of the NetSurf engine, allowing it to outwit the heavyweights of the web browser world. The NetSurf team continue to squeeze more speed out of their code.
    Interface innovation
    Simple to use and easy to grasp, NetSurf significantly raised the bar for user interface design on the RISC OS platform. Designed carefully by RISC OS users and developers to integrate well with the desktop, NetSurf is seen as the benchmark for future applications. NetSurf pioneered the concept of web page thumbnailing, offering an intuitive graphical tree-like view of visited web sites.
    Lean requirements
    From a modern monster PC to a humble 30MHz ARM 6 computer with 16MB of RAM, the web browser will keep you surfing the web whatever your system. Originally written for computer hardware normally found in PDAs, cable TV boxes, mobile phones and other hand-held gadgets, NetSurf is compact and low maintenance by design.
    Portable
    NetSurf can be built for a number of modern computer platforms 'out of the box'. Written in C, with portability in mind, NetSurf is developed by programmers from a wide range of computing backgrounds, ensuring it remains available for as many users as possible.
    Standards compliant
    Despite a myriad of standards to support, NetSurf makes surfing the web enjoyable and stress-free by striving for complete standards compliancy. As an actively developed project, NetSurf aims to stay abreast of new and upcoming web technologies.

    See the project goals and progress page for further information on where NetSurf is headed.

    Want to help?

    There are always things that need doing, and not enough time in the day, so we'd be delighted if you want to help develop NetSurf. Visit the "How can I help?" page to see ideas for contributing to the project.

    If you can program and you'd like to improve NetSurf, then we'd love to hear from you. Pick an area you'd like to improve or a feature you want to add and contact the developers. Also, take a look at the developer and contributor area of this site.

    Latest news

    NetSurf 2.6 released 21 Sep 2010
    NetSurf 2.6 is primarily a bug fix release. It contains some improvements to page rendering, fetching & caching, memory usage, as well as some front-end specific fixes. Full details in the change log. We recommend all users upgrade.
    NetSurf 2.5 released 24 Apr 2010
    NetSurf 2.5 contains many improvements over the previous release. The major changes are the use of our brand new CSS parser and selection engine (LibCSS), and a newly designed cache for fetched content. Full details in the change log. We recommend all users upgrade.
    NetSurf at Wakefield Show 2010 14 Jan 2010
    NetSurf 2.5 is expected to be released at the Wakefield RISC OS Show. The release will focus on the CSS engine, memory usage and speed, as well as fixing bugs. NetSurf 2.5 is likely to be the last release for RISC OS.

    See more news

    NetSurf 2.6 features

    NetSurf 2.6 is available for: RISC OS; Linux and other UNIX-like systems; and AmigaOS 4.

    General
    • Web standards: HTML 4.01 and CSS 2.1
    • Image formats: PNG, GIF, JPEG, SVG, JNG, MNG and BMP
    • HTTPS for secure online transactions
    • Unicode text
    • Web page thumbnailing
    • Local history trees
    • Global history
    • URL completion
    • Text selection
    • Scale view
    • Search-as-you-type text search highlighting
    • Save pages complete with images
    RISC OS only
    • Image formats: Sprite, Drawfile and ArtWorks
    • Hotlist management (bookmarks)
    • Cookie viewer
    • Drawfile export

    Awards

    NetSurf picked up another accolade, winning in the "best non-commercial product" category at The Icon Bar Awards 2009. NetSurf had previously been nominated by The Icon Bar's readers.

    At Drobe Launch Pad's annual awards, NetSurf triumphed again in the category for "best non-commercial software", winning the 2008 award.

    See more awards

    netsurf-all-3.2/libdom/examples/makefile0000644000175000017500000000056412377676745017425 0ustar vincevinceCC := gcc LD := gcc CFLAGS := `pkg-config --cflags libdom` `pkg-config --cflags libwapcaplet` -Wall -O0 -g LDFLAGS := `pkg-config --libs libdom` `pkg-config --libs libwapcaplet` SRC := dom-structure-dump.c dom-structure-dump: $(SRC:.c=.o) @$(LD) -o $@ $^ $(LDFLAGS) .PHONY: clean clean: $(RM) dom-structure-dump $(SRC:.c=.o) %.o: %.c @$(CC) -c $(CFLAGS) -o $@ $< netsurf-all-3.2/libdom/src/0000755000175000017500000000000012377713347014657 5ustar vincevincenetsurf-all-3.2/libdom/src/events/0000755000175000017500000000000012377713347016163 5ustar vincevincenetsurf-all-3.2/libdom/src/events/text_event.h0000644000175000017500000000153012377676745020532 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_text_event_h_ #define dom_internal_events_text_event_h_ #include #include "events/ui_event.h" /** * The TextEvent */ struct dom_text_event { struct dom_ui_event base; dom_string *data; }; /* Constructor */ dom_exception _dom_text_event_create(struct dom_document *doc, struct dom_text_event **evt); /* Destructor */ void _dom_text_event_destroy(struct dom_text_event *evt); /* Initialise function */ dom_exception _dom_text_event_initialise(struct dom_document *doc, struct dom_text_event *evt); /* Finalise function */ void _dom_text_event_finalise(struct dom_text_event *evt); #endif netsurf-all-3.2/libdom/src/events/event_listener.c0000644000175000017500000000252312377676745021371 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/event_listener.h" #include "core/document.h" /** * Create an EventListener * * \param doc The document object * \param handler The event function * \param pw The private data * \param listener The returned EventListener * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion. */ dom_exception dom_event_listener_create(struct dom_document *doc, handle_event handler, void *pw, dom_event_listener **listener) { dom_event_listener *ret = malloc(sizeof(dom_event_listener)); if (ret == NULL) return DOM_NO_MEM_ERR; ret->handler = handler; ret->pw = pw; ret->refcnt = 1; ret->doc = doc; *listener = ret; return DOM_NO_ERR; } /** * Claim a new reference on the listener object * * \param listener The EventListener object */ void dom_event_listener_ref(dom_event_listener *listener) { listener->refcnt++; } /** * Release a reference on the listener object * * \param listener The EventListener object */ void dom_event_listener_unref(dom_event_listener *listener) { if (listener->refcnt > 0) listener->refcnt--; if (listener->refcnt == 0) free(listener); } netsurf-all-3.2/libdom/src/events/mouse_event.c0000644000175000017500000002361712377676745020703 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "events/mouse_event.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_mouse_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_mouse_event_destroy }; /* Constructor */ dom_exception _dom_mouse_event_create(struct dom_document *doc, struct dom_mouse_event **evt) { *evt = malloc(sizeof(dom_mouse_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_mouse_event_initialise(doc, *evt); } /* Destructor */ void _dom_mouse_event_destroy(struct dom_mouse_event *evt) { _dom_mouse_event_finalise((dom_ui_event *) evt); free(evt); } /* Initialise function */ dom_exception _dom_mouse_event_initialise(struct dom_document *doc, struct dom_mouse_event *evt) { evt->modifier_state = 0; return _dom_ui_event_initialise(doc, (dom_ui_event *) evt); } /* The virtual destroy function */ void _virtual_dom_mouse_event_destroy(struct dom_event *evt) { _dom_mouse_event_destroy((dom_mouse_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get screenX * * \param evt The Event object * \param x The returned screenX * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt, int32_t *x) { *x = evt->sx; return DOM_NO_ERR; } /** * Get screenY * * \param evt The Event object * \param y The returned screenY * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt, int32_t *y) { *y = evt->sy; return DOM_NO_ERR; } /** * Get clientX * * \param evt The Event object * \param x The returned clientX * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt, int32_t *x) { *x = evt->cx; return DOM_NO_ERR; } /** * Get clientY * * \param evt The Event object * \param y The returned clientY * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_client_y(dom_mouse_event *evt, int32_t *y) { *y = evt->cy; return DOM_NO_ERR; } /** * Get the ctrl key state * * \param evt The Event object * \param key Whether the Control key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_ctrl_key(dom_mouse_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_CTRL) != 0); return DOM_NO_ERR; } /** * Get the shift key state * * \param evt The Event object * \param key Whether the Shift key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_shift_key(dom_mouse_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_SHIFT) != 0); return DOM_NO_ERR; } /** * Get the alt key state * * \param evt The Event object * \param key Whether the Alt key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_alt_key(dom_mouse_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_ALT) != 0); return DOM_NO_ERR; } /** * Get the meta key state * * \param evt The Event object * \param key Whether the Meta key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_meta_key(dom_mouse_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_META) != 0); return DOM_NO_ERR; } /** * Get the button which get pressed * * \param evt The Event object * \param button The pressed mouse button * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_button(dom_mouse_event *evt, unsigned short *button) { *button = evt->button; return DOM_NO_ERR; } /** * Get the related target * * \param evt The Event object * \param et The related EventTarget * \return DOM_NO_ERR. */ dom_exception _dom_mouse_event_get_related_target(dom_mouse_event *evt, dom_event_target **et) { *et = evt->related_target; return DOM_NO_ERR; } /** * Query the state of a modifier using a key identifier * * \param evt The event object * \param ml The modifier identifier, such as "Alt", "Control", "Meta", * "AltGraph", "CapsLock", "NumLock", "Scroll", "Shift". * \param state Whether the modifier key is pressed * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * @note: If an application wishes to distinguish between right and left * modifiers, this information could be deduced using keyboard events and * KeyboardEvent.keyLocation. */ dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt, dom_string *m, bool *state) { const char *data; size_t len; if (m == NULL) { *state = false; return DOM_NO_ERR; } data = dom_string_data(m); len = dom_string_byte_length(m); if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0); } else if (len == SLEN("Alt") && strncmp(data, "Alt", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_ALT) != 0); } else if (len == SLEN("CapsLock") && strncmp(data, "CapsLock", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_CAPS_LOCK) != 0); } else if (len == SLEN("Control") && strncmp(data, "Control", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_CTRL) != 0); } else if (len == SLEN("Meta") && strncmp(data, "Meta", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_META) != 0); } else if (len == SLEN("NumLock") && strncmp(data, "NumLock", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_NUM_LOCK) != 0); } else if (len == SLEN("Scroll") && strncmp(data, "Scroll", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_SCROLL) != 0); } else if (len == SLEN("Shift") && strncmp(data, "Shift", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_SHIFT) != 0); } return DOM_NO_ERR; } /** * Initialise this mouse event * * \param evt The Event object * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param detail The detail information of this mouse event * \param screen_x The x position of the mouse pointer in screen * \param screen_y The y position of the mouse pointer in screen * \param client_x The x position of the mouse pointer in client window * \param client_y The y position of the mouse pointer in client window * \param alt The state of Alt key, true for pressed, false otherwise * \param shift The state of Shift key, true for pressed, false otherwise * \param mata The state of Meta key, true for pressed, false otherwise * \param button The mouse button pressed * \param et The related target of this event, may be NULL * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mouse_event_init(dom_mouse_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et) { evt->sx = screen_x; evt->sy = screen_y; evt->cx = client_x; evt->cy = client_y; evt->modifier_state = 0; if (ctrl == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_CTRL; } if (alt == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_ALT; } if (shift == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_SHIFT; } if (meta == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_META; } evt->button = button; evt->related_target = et; return _dom_ui_event_init(&evt->base, type, bubble, cancelable, view, detail); } /** * Initialise the event with namespace * * \param evt The Event object * \param namespace The namespace of this event * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param detail The detail information of this mouse event * \param screen_x The x position of the mouse pointer in screen * \param screen_y The y position of the mouse pointer in screen * \param client_x The x position of the mouse pointer in client window * \param client_y The y position of the mouse pointer in client window * \param alt The state of Alt key, true for pressed, false otherwise * \param shift The state of Shift key, true for pressed, false otherwise * \param mata The state of Meta key, true for pressed, false otherwise * \param button The mouse button pressed * \param et The related target of this event, may be NULL * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mouse_event_init_ns(dom_mouse_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et) { evt->sx = screen_x; evt->sy = screen_y; evt->cx = client_x; evt->cy = client_y; evt->modifier_state = 0; if (ctrl == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_CTRL; } if (alt == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_ALT; } if (shift == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_SHIFT; } if (meta == true) { evt->modifier_state = evt->modifier_state | DOM_MOD_META; } evt->button = button; evt->related_target = et; return _dom_ui_event_init_ns(&evt->base, namespace, type, bubble, cancelable, view, detail); } netsurf-all-3.2/libdom/src/events/event.c0000644000175000017500000001532612377676745017471 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include "events/event.h" #include "core/string.h" #include "core/node.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_event_destroy(dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_event_destroy }; /* Constructor */ dom_exception _dom_event_create(dom_document *doc, dom_event **evt) { *evt = (dom_event *) malloc(sizeof(dom_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; (*evt)->vtable = &_event_vtable; return _dom_event_initialise(doc, *evt); } /* Destructor */ void _dom_event_destroy(dom_event *evt) { _dom_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_event_initialise(dom_document *doc, dom_event *evt) { assert(doc != NULL); evt->doc = doc; evt->stop = false; evt->stop_now = false; evt->prevent_default = false; evt->custom = false; evt->type = NULL; evt->namespace = NULL; evt->refcnt = 1; evt->in_dispatch = false; return DOM_NO_ERR; } /* Finalise function */ void _dom_event_finalise(dom_event *evt) { if (evt->type != NULL) dom_string_unref(evt->type); if (evt->namespace != NULL) dom_string_unref(evt->namespace); evt->stop = false; evt->stop_now = false; evt->prevent_default = false; evt->custom = false; evt->type = NULL; evt->namespace = NULL; evt->in_dispatch = false; } /* The virtual destroy function */ void _virtual_dom_event_destroy(dom_event *evt) { _dom_event_destroy(evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Claim a reference on this event object * * \param evt The Event object */ void _dom_event_ref(dom_event *evt) { evt->refcnt++; } /** * Release a reference on this event object * * \param evt The Event object */ void _dom_event_unref(dom_event *evt) { if (evt->refcnt > 0) evt->refcnt--; if (evt->refcnt == 0) dom_event_destroy(evt); } /** * Get the event type * * \param evt The event object * \parnm type The returned event type * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_get_type(dom_event *evt, dom_string **type) { *type = dom_string_ref(evt->type); return DOM_NO_ERR; } /** * Get the target node of this event * * \param evt The event object * \param target The target node * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_get_target(dom_event *evt, dom_event_target **target) { *target = evt->target; dom_node_ref(*target); return DOM_NO_ERR; } /** * Get the current target of this event * * \param evt The event object * \param current The current event target node * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_get_current_target(dom_event *evt, dom_event_target **current) { *current = evt->current; dom_node_ref(*current); return DOM_NO_ERR; } /** * Get whether this event can bubble * * \param evt The Event object * \param bubbles The returned value * \return DOM_NO_ERR. */ dom_exception _dom_event_get_bubbles(dom_event *evt, bool *bubbles) { *bubbles = evt->bubble; return DOM_NO_ERR; } /** * Get whether this event can be cancelable * * \param evt The Event object * \param cancelable The returned value * \return DOM_NO_ERR. */ dom_exception _dom_event_get_cancelable(dom_event *evt, bool *cancelable) { *cancelable = evt->cancelable; return DOM_NO_ERR; } /** * Get the event's generation timestamp * * \param evt The Event object * \param timestamp The returned value * \return DOM_NO_ERR. */ dom_exception _dom_event_get_timestamp(dom_event *evt, unsigned int *timestamp) { *timestamp = evt->timestamp; return DOM_NO_ERR; } /** * Stop propagation of the event * * \param evt The Event object * \return DOM_NO_ERR. */ dom_exception _dom_event_stop_propagation(dom_event *evt) { evt->stop = true; return DOM_NO_ERR; } /** * Prevent the default action of this event * * \param evt The Event object * \return DOM_NO_ERR. */ dom_exception _dom_event_prevent_default(dom_event *evt) { evt->prevent_default = true; return DOM_NO_ERR; } /** * Initialise the event object * * \param evt The event object * \param type The type of this event * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_init(dom_event *evt, dom_string *type, bool bubble, bool cancelable) { assert(evt->doc != NULL); evt->type = dom_string_ref(type); evt->bubble = bubble; evt->cancelable = cancelable; evt->timestamp = time(NULL); return DOM_NO_ERR; } /** * Get the namespace of this event * * \param evt The event object * \param namespace The returned namespace of this event * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_get_namespace(dom_event *evt, dom_string **namespace) { *namespace = dom_string_ref(evt->namespace); return DOM_NO_ERR; } /** * Whether this is a custom event * * \param evt The event object * \param custom The returned value * \return DOM_NO_ERR. */ dom_exception _dom_event_is_custom(dom_event *evt, bool *custom) { *custom = evt->custom; return DOM_NO_ERR; } /** * Stop the event propagation immediately * * \param evt The event object * \return DOM_NO_ERR. */ dom_exception _dom_event_stop_immediate_propagation(dom_event *evt) { evt->stop_now = true; return DOM_NO_ERR; } /** * Whether the default action is prevented * * \param evt The event object * \param prevented The returned value * \return DOM_NO_ERR. */ dom_exception _dom_event_is_default_prevented(dom_event *evt, bool *prevented) { *prevented = evt->prevent_default; return DOM_NO_ERR; } /** * Initialise the event with namespace * * \param evt The event object * \param namespace The namespace of this event * \param type The event type * \param bubble Whether this event has a bubble phase * \param cancelable Whether this event is cancelable * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_init_ns(dom_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable) { assert(evt->doc != NULL); evt->type = dom_string_ref(type); evt->namespace = dom_string_ref(namespace); evt->bubble = bubble; evt->cancelable = cancelable; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/events/event_target.h0000644000175000017500000000502612377676745021040 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_event_target_h_ #define dom_internal_events_event_target_h_ #include #include #include #include #include #include "events/dispatch.h" #include "utils/list.h" /** * Listener Entry */ struct listener_entry { struct list_entry list; /**< The listener list registered at the same * EventTarget */ dom_string *type; /**< Event type */ dom_event_listener *listener; /**< The EventListener */ bool capture; /**< Whether this listener is in capture phase */ }; /** * EventTarget internal class */ struct dom_event_target_internal { struct listener_entry *listeners; /**< The listeners of this EventTarget. */ }; typedef struct dom_event_target_internal dom_event_target_internal; /* Entry for a EventTarget, used to record the bubbling list */ typedef struct dom_event_target_entry { struct list_entry entry; /**< The list entry */ dom_event_target *et; /**< The node */ } dom_event_target_entry; /** * Constructor and destructor: Since this object is not intended to be * allocated alone, it should be embedded into the Node object, there is * no constructor and destructor for it. */ /* Initialise this EventTarget */ dom_exception _dom_event_target_internal_initialise( dom_event_target_internal *eti); /* Finalise this EventTarget */ void _dom_event_target_internal_finalise(dom_event_target_internal *eti); dom_exception _dom_event_target_add_event_listener( dom_event_target_internal *eti, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_event_target_remove_event_listener( dom_event_target_internal *eti, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_event_target_add_event_listener_ns( dom_event_target_internal *eti, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_event_target_remove_event_listener_ns( dom_event_target_internal *eti, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_event_target_dispatch(dom_event_target *et, dom_event_target_internal *eti, struct dom_event *evt, dom_event_flow_phase phase, bool *success); #endif netsurf-all-3.2/libdom/src/events/mutation_event.h0000644000175000017500000000177212377676745021416 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_mutation_event_h_ #define dom_interntal_events_mutation_event_h_ #include #include "events/event.h" /** * The MutationEvent */ struct dom_mutation_event { struct dom_event base; struct dom_node *related_node; dom_string *prev_value; dom_string *new_value; dom_string *attr_name; dom_mutation_type change; }; /* Constructor */ dom_exception _dom_mutation_event_create(struct dom_document *doc, struct dom_mutation_event **evt); /* Destructor */ void _dom_mutation_event_destroy(struct dom_mutation_event *evt); /* Initialise function */ dom_exception _dom_mutation_event_initialise(struct dom_document *doc, struct dom_mutation_event *evt); /* Finalise function */ void _dom_mutation_event_finalise(struct dom_mutation_event *evt); #endif netsurf-all-3.2/libdom/src/events/mouse_wheel_event.h0000644000175000017500000000173412377676745022070 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_events_internal_mouse_wheel_event_h_ #define dom_events_internal_mouse_wheel_event_h_ #include #include "events/mouse_event.h" /** * The MouseWheelEvent */ struct dom_mouse_wheel_event { struct dom_mouse_event base; /**< The base class */ int32_t delta; /**< The wheelDelta */ }; /* Constructor */ dom_exception _dom_mouse_wheel_event_create(struct dom_document *doc, struct dom_mouse_wheel_event **evt); /* Destructor */ void _dom_mouse_wheel_event_destroy(struct dom_mouse_wheel_event *evt); /* Initialise function */ dom_exception _dom_mouse_wheel_event_initialise(struct dom_document *doc, struct dom_mouse_wheel_event *evt); /* Finalise function */ #define _dom_mouse_wheel_event_finalise _dom_mouse_event_finalise #endif netsurf-all-3.2/libdom/src/events/event_listener.h0000644000175000017500000000126012377676745021373 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_event_listener_h_ #define dom_internal_events_event_listener_h_ #include #include "utils/list.h" /** * The EventListener class */ struct dom_event_listener { handle_event handler; /**< The event handler function */ void *pw; /**< The private data of this listener */ unsigned int refcnt; /**< The reference count of this listener */ struct dom_document *doc; /**< The document which create this listener */ }; #endif netsurf-all-3.2/libdom/src/events/keyboard_event.h0000644000175000017500000000263412377676745021354 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_keyboard_event_h_ #define dom_interntal_events_keyboard_event_h_ #include #include "events/ui_event.h" /** * The keyboard event */ struct dom_keyboard_event { struct dom_ui_event base; /**< The base class */ dom_string *key_ident; /**< The identifier of the key in this * event, please refer: * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set * for detail */ dom_key_location key_loc; /**< Indicate the location of the key on * the keyboard */ uint32_t modifier_state; /**< The modifier keys state */ }; /* Constructor */ dom_exception _dom_keyboard_event_create(struct dom_document *doc, struct dom_keyboard_event **evt); /* Destructor */ void _dom_keyboard_event_destroy(struct dom_keyboard_event *evt); /* Initialise function */ dom_exception _dom_keyboard_event_initialise(struct dom_document *doc, struct dom_keyboard_event *evt); /* Finalise function */ void _dom_keyboard_event_finalise(struct dom_keyboard_event *evt); /* Parse the modifier list string to corresponding bool variable state */ dom_exception _dom_parse_modifier_list(dom_string *modifier_list, uint32_t *modifier_state); #endif netsurf-all-3.2/libdom/src/events/ui_event.c0000644000175000017500000000652412377676745020166 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/ui_event.h" #include "core/document.h" static void _virtual_dom_ui_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_ui_event_destroy }; /* Constructor */ dom_exception _dom_ui_event_create(struct dom_document *doc, struct dom_ui_event **evt) { *evt = malloc(sizeof(dom_ui_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_ui_event_initialise(doc, *evt); } /* Destructor */ void _dom_ui_event_destroy(struct dom_ui_event *evt) { _dom_ui_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_ui_event_initialise(struct dom_document *doc, struct dom_ui_event *evt) { evt->view = NULL; return _dom_event_initialise(doc, &evt->base); } /* Finalise function */ void _dom_ui_event_finalise(struct dom_ui_event *evt) { evt->view = NULL; _dom_event_finalise(&evt->base); } /* The virtual destroy function */ void _virtual_dom_ui_event_destroy(struct dom_event *evt) { _dom_ui_event_destroy((dom_ui_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the AbstractView inside this event * * \param evt The Event object * \param view The returned AbstractView * \return DOM_NO_ERR. */ dom_exception _dom_ui_event_get_view(dom_ui_event *evt, struct dom_abstract_view **view) { *view = evt->view; return DOM_NO_ERR; } /** * Get the detail param of this event * * \param evt The Event object * \param detail The detail object * \return DOM_NO_ERR. */ dom_exception _dom_ui_event_get_detail(dom_ui_event *evt, int32_t *detail) { *detail = evt->detail; return DOM_NO_ERR; } /** * Initialise the UIEvent * * \param evt The Event object * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param view The AbstractView of this UIEvent * \param detail The detail object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_ui_event_init(dom_ui_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail) { evt->view = view; evt->detail = detail; return _dom_event_init(&evt->base, type, bubble, cancelable); } /** * Initialise the UIEvent with namespace * * \param evt The Event object * \param namespace The namespace of this Event * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param view The AbstractView of this UIEvent * \param detail The detail object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_ui_event_init_ns(dom_ui_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail) { evt->view = view; evt->detail = detail; return _dom_event_init_ns(&evt->base, namespace, type, bubble, cancelable); } netsurf-all-3.2/libdom/src/events/mouse_wheel_event.c0000644000175000017500000000701312377676745022057 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/mouse_wheel_event.h" #include "events/keyboard_event.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_mouse_wheel_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_mouse_wheel_event_destroy }; /* Constructor */ dom_exception _dom_mouse_wheel_event_create(struct dom_document *doc, struct dom_mouse_wheel_event **evt) { *evt = malloc(sizeof(dom_mouse_wheel_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_mouse_wheel_event_initialise(doc, (dom_mouse_wheel_event *) *evt); } /* Destructor */ void _dom_mouse_wheel_event_destroy(struct dom_mouse_wheel_event *evt) { _dom_mouse_wheel_event_finalise((dom_ui_event *) evt); free(evt); } /* Initialise function */ dom_exception _dom_mouse_wheel_event_initialise(struct dom_document *doc, struct dom_mouse_wheel_event *evt) { return _dom_mouse_event_initialise(doc, (dom_mouse_event *) evt); } /* The virtual destroy function */ void _virtual_dom_mouse_wheel_event_destroy(struct dom_event *evt) { _dom_mouse_wheel_event_destroy((dom_mouse_wheel_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get wheelDelta * * \param evt The Event object * \param d The wheelDelta * \return DOM_NO_ERR. */ dom_exception _dom_mouse_wheel_event_get_wheel_delta( dom_mouse_wheel_event *evt, int32_t *d) { *d = evt->delta; return DOM_NO_ERR; } /** * Intialise this event with namespace * * \param evt The Event object * \param namespace The namespace of this event * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param detail The detail information of this mouse event * \param screen_x The x position of the mouse pointer in screen * \param screen_y The y position of the mouse pointer in screen * \param client_x The x position of the mouse pointer in client window * \param client_y The y position of the mouse pointer in client window * \param button The mouse button pressed * \param et The related target of this event, may be NULL * \param modifier_list The string contains the modifier identifier strings * \param wheel_delta The wheelDelta * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mouse_wheel_event_init_ns( dom_mouse_wheel_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, unsigned short button, dom_event_target *et, dom_string *modifier_list, int32_t wheel_delta) { dom_exception err; dom_mouse_event *e = (dom_mouse_event *) evt; evt->delta = wheel_delta; err = _dom_parse_modifier_list(modifier_list, &e->modifier_state); if (err != DOM_NO_ERR) return err; return _dom_mouse_event_init_ns(&evt->base, namespace, type, bubble, cancelable, view, detail ,screen_x, screen_y, client_x, client_y, false, false, false, false, button, et); } netsurf-all-3.2/libdom/src/events/keyboard_event.c0000644000175000017500000002310212377676745021340 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "events/keyboard_event.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_keyboard_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_keyboard_event_destroy }; /* Constructor */ dom_exception _dom_keyboard_event_create(struct dom_document *doc, struct dom_keyboard_event **evt) { *evt = malloc(sizeof(dom_keyboard_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_keyboard_event_initialise(doc, *evt); } /* Destructor */ void _dom_keyboard_event_destroy(struct dom_keyboard_event *evt) { _dom_keyboard_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_keyboard_event_initialise(struct dom_document *doc, struct dom_keyboard_event *evt) { evt->key_ident = NULL; evt->modifier_state = 0; return _dom_ui_event_initialise(doc, &evt->base); } /* Finalise function */ void _dom_keyboard_event_finalise(struct dom_keyboard_event *evt) { _dom_ui_event_finalise(&evt->base); } /* The virtual destroy function */ void _virtual_dom_keyboard_event_destroy(struct dom_event *evt) { _dom_keyboard_event_destroy((dom_keyboard_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the key identifier * * \param evt The Event object * \param ident The returned key identifier * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_key_identifier(dom_keyboard_event *evt, dom_string **ident) { *ident = evt->key_ident; dom_string_ref(*ident); return DOM_NO_ERR; } /** * Get the key location * * \param evt The Event object * \param loc The returned key location * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_key_location(dom_keyboard_event *evt, dom_key_location *loc) { *loc = evt->key_loc; return DOM_NO_ERR; } /** * Get the ctrl key state * * \param evt The Event object * \param key Whether the Control key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_ctrl_key(dom_keyboard_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_CTRL) != 0); return DOM_NO_ERR; } /** * Get the shift key state * * \param evt The Event object * \param key Whether the Shift key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_shift_key(dom_keyboard_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_SHIFT) != 0); return DOM_NO_ERR; } /** * Get the alt key state * * \param evt The Event object * \param key Whether the Alt key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_alt_key(dom_keyboard_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_ALT) != 0); return DOM_NO_ERR; } /** * Get the meta key state * * \param evt The Event object * \param key Whether the Meta key is pressed down * \return DOM_NO_ERR. */ dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt, bool *key) { *key = ((evt->modifier_state & DOM_MOD_META) != 0); return DOM_NO_ERR; } /** * Query the state of a modifier using a key identifier * * \param evt The event object * \param ml The modifier identifier, such as "Alt", "Control", "Meta", * "AltGraph", "CapsLock", "NumLock", "Scroll", "Shift". * \param state Whether the modifier key is pressed * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * @note: If an application wishes to distinguish between right and left * modifiers, this information could be deduced using keyboard events and * KeyboardEvent.keyLocation. */ dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt, dom_string *m, bool *state) { const char *data; size_t len; if (m == NULL) { *state = false; return DOM_NO_ERR; } data = dom_string_data(m); len = dom_string_byte_length(m); if (len == SLEN("AltGraph") && strncmp(data, "AltGraph", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_ALT_GRAPH) != 0); } else if (len == SLEN("Alt") && strncmp(data, "Alt", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_ALT) != 0); } else if (len == SLEN("CapsLock") && strncmp(data, "CapsLock", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_CAPS_LOCK) != 0); } else if (len == SLEN("Control") && strncmp(data, "Control", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_CTRL) != 0); } else if (len == SLEN("Meta") && strncmp(data, "Meta", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_META) != 0); } else if (len == SLEN("NumLock") && strncmp(data, "NumLock", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_NUM_LOCK) != 0); } else if (len == SLEN("Scroll") && strncmp(data, "Scroll", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_SCROLL) != 0); } else if (len == SLEN("Shift") && strncmp(data, "Shift", len) == 0) { *state = ((evt->modifier_state & DOM_MOD_SHIFT) != 0); } return DOM_NO_ERR; } /** * Initialise the keyboard event * * \param evt The Event object * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param key_indent The key identifier of pressed key * \param key_loc The key location of the preesed key * \param modifier_list A string of modifier key identifiers, separated with * space * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_keyboard_event_init(dom_keyboard_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key_ident, dom_key_location key_loc, dom_string *modifier_list) { dom_exception err; evt->key_ident = key_ident; dom_string_ref(evt->key_ident); evt->key_loc = key_loc; err = _dom_parse_modifier_list(modifier_list, &evt->modifier_state); if (err != DOM_NO_ERR) return err; return _dom_ui_event_init(&evt->base, type, bubble, cancelable, view, 0); } /** * Initialise the keyboard event with namespace * * \param evt The Event object * \param namespace The namespace of this event * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param key_indent The key identifier of pressed key * \param key_loc The key location of the preesed key * \param modifier_list A string of modifier key identifiers, separated with * space * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key_ident, dom_key_location key_loc, dom_string *modifier_list) { dom_exception err; evt->key_ident = key_ident; dom_string_ref(evt->key_ident); evt->key_loc = key_loc; err = _dom_parse_modifier_list(modifier_list, &evt->modifier_state); if (err != DOM_NO_ERR) return err; return _dom_ui_event_init_ns(&evt->base, namespace, type, bubble, cancelable, view, 0); } /*-------------------------------------------------------------------------*/ /** * Parse the modifier list string to corresponding bool variable state * * \param modifier_list The modifier list string * \param modifier_state The returned state * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_parse_modifier_list(dom_string *modifier_list, uint32_t *modifier_state) { const char *data; const char *m; size_t len = 0; *modifier_state = 0; if (modifier_list == NULL) return DOM_NO_ERR; data = dom_string_data(modifier_list); m = data; while (true) { /* If we reach a space or end of the string, we should parse * the new token. */ if (*data == ' ' || *data == '\0') { if (len == SLEN("AltGraph") && strncmp(m, "AltGraph", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_ALT_GRAPH; } else if (len == SLEN("Alt") && strncmp(m, "Alt", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_ALT; } else if (len == SLEN("CapsLock") && strncmp(m, "CapsLock", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_CAPS_LOCK; } else if (len == SLEN("Control") && strncmp(m, "Control", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_CTRL; } else if (len == SLEN("Meta") && strncmp(m, "Meta", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_META; } else if (len == SLEN("NumLock") && strncmp(m, "NumLock", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_NUM_LOCK; } else if (len == SLEN("Scroll") && strncmp(m, "Scroll", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_SCROLL; } else if (len == SLEN("Shift") && strncmp(m, "Shift", len) == 0) { *modifier_state = *modifier_state | DOM_MOD_SHIFT; } while (*data == ' ') { data++; } /* Finished parsing and break */ if (*data == '\0') break; m = data; len = 0; } data++; len++; } return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/events/document_event.c0000644000175000017500000001117312377676745021363 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include "core/string.h" #include "core/node.h" #include "core/document.h" #include "events/document_event.h" #include "events/event.h" #include "events/ui_event.h" #include "events/custom_event.h" #include "events/text_event.h" #include "events/keyboard_event.h" #include "events/mouse_event.h" #include "events/mouse_multi_wheel_event.h" #include "events/mouse_wheel_event.h" #include "events/mutation_event.h" #include "events/mutation_name_event.h" #include "utils/utils.h" static const char *__event_types[] = { "Event", "CustomEvent", "UIEvent", "TextEvent", "KeyboardEvent", "MouseEvent", "MouseMultiWheelEvent", "MouseWheelEvent", "MutationEvent", "MutationNameEvent" }; /** * Initialise this DocumentEvent * * \param doc The document object * \param dei The DocumentEvent internal object * \param actions The default action fetcher, the browser should provide such * a function to Event module. * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_document_event_internal_initialise(struct dom_document *doc, dom_document_event_internal *dei, dom_events_default_action_fetcher actions, void *actions_ctx) { lwc_error err; int i; UNUSED(doc); for (i = 0; i < DOM_EVENT_COUNT; i++) { err = lwc_intern_string(__event_types[i], strlen(__event_types[i]), &dei->event_types[i]); if (err != lwc_error_ok) return _dom_exception_from_lwc_error(err); } dei->actions = actions; dei->actions_ctx = actions_ctx; return DOM_NO_ERR; } /* Finalise this DocumentEvent */ void _dom_document_event_internal_finalise(struct dom_document *doc, dom_document_event_internal *dei) { int i; UNUSED(doc); for (i = 0; i < DOM_EVENT_COUNT; i++) { if (dei->event_types[i] != NULL) lwc_string_unref(dei->event_types[i]); } return; } /*-------------------------------------------------------------------------*/ /* Public API */ /** * Create an Event object * * \param de The DocumentEvent object * \param type The Event type * \param evt The returned Event object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_document_event_create_event(dom_document_event *de, dom_string *type, struct dom_event **evt) { lwc_string *t = NULL; dom_exception err; struct dom_document *doc = de; int i, et = 0; dom_document_event_internal *dei; err = dom_string_intern(type, &t); if (err != DOM_NO_ERR) return err; assert(t != NULL); dei = &de->dei; for (i = 0; i < DOM_EVENT_COUNT; i++) { if (dei->event_types[i] == t) { et = i; break; } } lwc_string_unref(t); switch (et) { case DOM_EVENT: err = _dom_event_create(doc, evt); break; case DOM_CUSTOM_EVENT: err = _dom_custom_event_create(doc, (dom_custom_event **) evt); break; case DOM_UI_EVENT: err = _dom_ui_event_create(doc, (dom_ui_event **) evt); break; case DOM_TEXT_EVENT: err = _dom_text_event_create(doc, (dom_text_event **) evt); break; case DOM_KEYBOARD_EVENT: err = _dom_keyboard_event_create(doc, (dom_keyboard_event **) evt); break; case DOM_MOUSE_EVENT: err = _dom_mouse_event_create(doc, (dom_mouse_event **) evt); break; case DOM_MOUSE_MULTI_WHEEL_EVENT: err = _dom_mouse_multi_wheel_event_create(doc, (dom_mouse_multi_wheel_event **) evt); break; case DOM_MOUSE_WHEEL_EVENT: err = _dom_mouse_wheel_event_create(doc, (dom_mouse_wheel_event **) evt); break; case DOM_MUTATION_EVENT: err = _dom_mutation_event_create(doc, (dom_mutation_event **) evt); break; case DOM_MUTATION_NAME_EVENT: err = _dom_mutation_name_event_create(doc, (dom_mutation_name_event **) evt); break; } return err; } /** * Tests if the implementation can generate events of a specified type * * \param de The DocumentEvent * \param namespace The namespace of the event * \param type The type of the event * \param can True if we can generate such an event, false otherwise * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so the return value should always * DOM_NO_SUPPORTED_ERR. */ dom_exception _dom_document_event_can_dispatch(dom_document_event *de, dom_string *namespace, dom_string *type, bool *can) { UNUSED(de); UNUSED(namespace); UNUSED(type); UNUSED(can); return DOM_NOT_SUPPORTED_ERR; } netsurf-all-3.2/libdom/src/events/document_event.h0000644000175000017500000000314612377676745021371 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_document_event_h_ #define dom_internal_events_document_event_h_ #include struct dom_event_listener; struct lwc_string_s; struct dom_document; /** * Type of Events */ typedef enum { DOM_EVENT = 0, DOM_CUSTOM_EVENT, DOM_UI_EVENT, DOM_TEXT_EVENT, DOM_KEYBOARD_EVENT, DOM_MOUSE_EVENT, DOM_MOUSE_MULTI_WHEEL_EVENT, DOM_MOUSE_WHEEL_EVENT, DOM_MUTATION_EVENT, DOM_MUTATION_NAME_EVENT, DOM_EVENT_COUNT } dom_event_type; /** * The DocumentEvent internal class */ struct dom_document_event_internal { dom_events_default_action_fetcher actions; /**< The default action fetecher */ void *actions_ctx; /**< The default action fetcher context */ struct lwc_string_s *event_types[DOM_EVENT_COUNT]; /**< Events type names */ }; typedef struct dom_document_event_internal dom_document_event_internal; /** * Constructor and destructor: Since this object is not intended to be * allocated alone, it should be embedded into the Document object, there * is no constructor and destructor for it. */ /* Initialise this DocumentEvent */ dom_exception _dom_document_event_internal_initialise(struct dom_document *doc, dom_document_event_internal *dei, dom_events_default_action_fetcher actions, void *actions_ctx); /* Finalise this DocumentEvent */ void _dom_document_event_internal_finalise(struct dom_document *doc, dom_document_event_internal *dei); #endif netsurf-all-3.2/libdom/src/events/mouse_multi_wheel_event.h0000644000175000017500000000215512377676745023300 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_events_internal_mouse_multi_wheel_event_h_ #define dom_events_internal_mouse_multi_wheel_event_h_ #include #include "events/mouse_event.h" /** * The MouseMultiWheelEvent */ struct dom_mouse_multi_wheel_event { struct dom_mouse_event base; /**< The base class */ int32_t x; /**< The wheelDeltaX */ int32_t y; /**< The wheelDeltaY */ int32_t z; /**< The wheelDeltaZ */ }; /* Constructor */ dom_exception _dom_mouse_multi_wheel_event_create(struct dom_document *doc, struct dom_mouse_multi_wheel_event **evt); /* Destructor */ void _dom_mouse_multi_wheel_event_destroy( struct dom_mouse_multi_wheel_event *evt); /* Initialise function */ dom_exception _dom_mouse_multi_wheel_event_initialise(struct dom_document *doc, struct dom_mouse_multi_wheel_event *evt); /* Finalise function */ #define _dom_mouse_multi_wheel_event_finalise _dom_mouse_event_finalise #endif netsurf-all-3.2/libdom/src/events/custom_event.c0000644000175000017500000000471712377676745021065 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/custom_event.h" #include "core/document.h" static void _virtual_dom_custom_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_custom_event_destroy }; /* Constructor */ dom_exception _dom_custom_event_create(struct dom_document *doc, struct dom_custom_event **evt) { *evt = malloc(sizeof(dom_custom_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_custom_event_initialise(doc, *evt); } /* Destructor */ void _dom_custom_event_destroy(struct dom_custom_event *evt) { _dom_custom_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_custom_event_initialise(struct dom_document *doc, struct dom_custom_event *evt) { evt->detail = NULL; return _dom_event_initialise(doc, &evt->base); } /* Finalise function */ void _dom_custom_event_finalise(struct dom_custom_event *evt) { evt->detail = NULL; _dom_event_finalise(&evt->base); } /* The virtual destroy function */ void _virtual_dom_custom_event_destroy(struct dom_event *evt) { _dom_custom_event_destroy((dom_custom_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the detail object of this custom event * * \param evt The Event object * \param detail The returned detail object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_custom_event_get_detail(dom_custom_event *evt, void **detail) { *detail = evt->detail; return DOM_NO_ERR; } /** * Initialise this custom event * * \param evt The Event object * \param namespace The namespace of this new Event * \param type The Event type * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param detail The detail object of this custom event * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_custom_event_init_ns(dom_custom_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, void *detail) { evt->detail = detail; return _dom_event_init_ns(&evt->base, namespace, type, bubble, cancelable); } netsurf-all-3.2/libdom/src/events/mouse_event.h0000644000175000017500000000221412377676745020676 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_mouse_event_h_ #define dom_interntal_events_mouse_event_h_ #include #include "events/ui_event.h" /** * The mouse event */ struct dom_mouse_event { struct dom_ui_event base; /**< Base class */ int32_t sx; /**< ScreenX */ int32_t sy; /**< ScreenY */ int32_t cx; /**< ClientX */ int32_t cy; /**< ClientY */ uint32_t modifier_state; /**< The modifier keys state */ unsigned short button; /**< Which button is clicked */ dom_event_target *related_target; /**< The related target */ }; /* Constructor */ dom_exception _dom_mouse_event_create(struct dom_document *doc, struct dom_mouse_event **evt); /* Destructor */ void _dom_mouse_event_destroy(struct dom_mouse_event *evt); /* Initialise function */ dom_exception _dom_mouse_event_initialise(struct dom_document *doc, struct dom_mouse_event *evt); /* Finalise function */ #define _dom_mouse_event_finalise _dom_ui_event_finalise #endif netsurf-all-3.2/libdom/src/events/event_target.c0000644000175000017500000001421412377676745021032 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "events/event.h" #include "events/event_listener.h" #include "events/event_target.h" #include "core/document.h" #include "core/node.h" #include "core/string.h" #include "utils/utils.h" #include "utils/validate.h" static void event_target_destroy_listeners(struct listener_entry *list) { struct listener_entry *next = NULL; for (; list != next; list = next) { next = (struct listener_entry *) list->list.next; list_del(&list->list); dom_event_listener_unref(list->listener); dom_string_unref(list->type); free(list); } } /* Initialise this EventTarget */ dom_exception _dom_event_target_internal_initialise( dom_event_target_internal *eti) { eti->listeners = NULL; return DOM_NO_ERR; } /* Finalise this EventTarget */ void _dom_event_target_internal_finalise(dom_event_target_internal *eti) { if (eti->listeners != NULL) event_target_destroy_listeners(eti->listeners); } /*-------------------------------------------------------------------------*/ /* The public API */ /** * Add an EventListener to the EventTarget * * \param et The EventTarget object * \param type The event type which this event listener listens for * \param listener The event listener object * \param capture Whether add this listener in the capturing phase * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_target_add_event_listener( dom_event_target_internal *eti, dom_string *type, struct dom_event_listener *listener, bool capture) { struct listener_entry *le = NULL; le = malloc(sizeof(struct listener_entry)); if (le == NULL) return DOM_NO_MEM_ERR; /* Initialise the listener_entry */ list_init(&le->list); le->type = dom_string_ref(type); le->listener = listener; dom_event_listener_ref(listener); le->capture = capture; if (eti->listeners == NULL) { eti->listeners = le; } else { list_append(&eti->listeners->list, &le->list); } return DOM_NO_ERR; } /** * Remove an EventListener from the EventTarget * * \param et The EventTarget object * \param type The event type this listener is registered for * \param listener The listener object * \param capture Whether the listener is registered at the capturing phase * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_target_remove_event_listener( dom_event_target_internal *eti, dom_string *type, struct dom_event_listener *listener, bool capture) { if (eti->listeners != NULL) { struct listener_entry *le = eti->listeners; do { if (dom_string_isequal(le->type, type) && le->listener == listener && le->capture == capture) { list_del(&le->list); dom_event_listener_unref(le->listener); dom_string_unref(le->type); free(le); break; } le = (struct listener_entry *) le->list.next; } while (le != eti->listeners); } return DOM_NO_ERR; } /** * Add an EventListener * * \param et The EventTarget object * \param namespace The namespace of this listener * \param type The event type which this event listener listens for * \param listener The event listener object * \param capture Whether add this listener in the capturing phase * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so it always return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_event_target_add_event_listener_ns( dom_event_target_internal *eti, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture) { UNUSED(eti); UNUSED(namespace); UNUSED(type); UNUSED(listener); UNUSED(capture); return DOM_NOT_SUPPORTED_ERR; } /** * Remove an EventListener * * \param et The EventTarget object * \param namespace The namespace of this listener * \param type The event type which this event listener listens for * \param listener The event listener object * \param capture Whether add this listener in the capturing phase * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so it always return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_event_target_remove_event_listener_ns( dom_event_target_internal *eti, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture) { UNUSED(eti); UNUSED(namespace); UNUSED(type); UNUSED(listener); UNUSED(capture); return DOM_NOT_SUPPORTED_ERR; } /*-------------------------------------------------------------------------*/ /** * Dispatch an event on certain EventTarget * * \param et The EventTarget object * \param eti Internal EventTarget object * \param evt The event object * \param success Indicates whether any of the listeners which handled the * event called Event.preventDefault(). If * Event.preventDefault() was called the returned value is * false, else it is true. * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_event_target_dispatch(dom_event_target *et, dom_event_target_internal *eti, struct dom_event *evt, dom_event_flow_phase phase, bool *success) { if (eti->listeners != NULL) { struct listener_entry *le = eti->listeners; evt->current = et; do { if (dom_string_isequal(le->type, evt->type)) { assert(le->listener->handler != NULL); if ((le->capture && phase == DOM_CAPTURING_PHASE) || (le->capture == false && phase == DOM_BUBBLING_PHASE) || (evt->target == evt->current && phase == DOM_AT_TARGET)) { le->listener->handler(evt, le->listener->pw); /* If the handler called * stopImmediatePropagation, we should * break */ if (evt->stop_now == true) break; } } le = (struct listener_entry *) le->list.next; } while (le != eti->listeners); } if (evt->prevent_default == true) *success = false; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/events/text_event.c0000644000175000017500000000627012377676745020533 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/text_event.h" #include "core/document.h" static void _virtual_dom_text_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_text_event_destroy }; /* Constructor */ dom_exception _dom_text_event_create(struct dom_document *doc, struct dom_text_event **evt) { *evt = malloc(sizeof(dom_text_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_text_event_initialise(doc, *evt); } /* Destructor */ void _dom_text_event_destroy(struct dom_text_event *evt) { _dom_text_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_text_event_initialise(struct dom_document *doc, struct dom_text_event *evt) { evt->data = NULL; return _dom_ui_event_initialise(doc, &evt->base); } /* Finalise function */ void _dom_text_event_finalise(struct dom_text_event *evt) { dom_string_unref(evt->data); _dom_ui_event_finalise(&evt->base); } /* The virtual destroy function */ void _virtual_dom_text_event_destroy(struct dom_event *evt) { _dom_text_event_destroy((dom_text_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the internal data of this event * * \param evt The Event object * \param data The internal data of this Event * \return DOM_NO_ERR. */ dom_exception _dom_text_event_get_data(dom_text_event *evt, dom_string **data) { *data = evt->data; dom_string_ref(*data); return DOM_NO_ERR; } /** * Initialise the TextEvent * * \param evt The Event object * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param view The AbstractView of this UIEvent * \param data The text data * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_text_event_init(dom_text_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *data) { evt->data = data; dom_string_ref(data); return _dom_ui_event_init(&evt->base, type, bubble, cancelable, view, 0); } /** * Initialise the TextEvent with namespace * * \param evt The Event object * \param namespace The namespace of this Event * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param view The AbstractView of this UIEvent * \param data The text data * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_text_event_init_ns(dom_text_event *evt, dom_string *namespace_name, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *data) { evt->data = data; dom_string_ref(data); return _dom_ui_event_init_ns(&evt->base, namespace_name, type, bubble, cancelable, view, 0); } netsurf-all-3.2/libdom/src/events/mouse_multi_wheel_event.c0000644000175000017500000001051412377676745023271 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/mouse_multi_wheel_event.h" #include "events/keyboard_event.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_mouse_multi_wheel_event_destroy( struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_mouse_multi_wheel_event_destroy }; /* Constructor */ dom_exception _dom_mouse_multi_wheel_event_create(struct dom_document *doc, struct dom_mouse_multi_wheel_event **evt) { *evt = malloc(sizeof(dom_mouse_multi_wheel_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_mouse_multi_wheel_event_initialise(doc, *evt); } /* Destructor */ void _dom_mouse_multi_wheel_event_destroy( struct dom_mouse_multi_wheel_event *evt) { _dom_mouse_multi_wheel_event_finalise((dom_ui_event *) evt); free(evt); } /* Initialise function */ dom_exception _dom_mouse_multi_wheel_event_initialise(struct dom_document *doc, struct dom_mouse_multi_wheel_event *evt) { return _dom_mouse_event_initialise(doc, (dom_mouse_event *) evt); } /* The virtual destroy function */ void _virtual_dom_mouse_multi_wheel_event_destroy(struct dom_event *evt) { _dom_mouse_multi_wheel_event_destroy( (dom_mouse_multi_wheel_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get wheelDeltaX * * \param evt The Event object * \param x The returned wheelDeltaX * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x( dom_mouse_multi_wheel_event *evt, int32_t *x) { *x = evt->x; return DOM_NO_ERR; } /** * Get wheelDeltaY * * \param evt The Event object * \param y The returned wheelDeltaY * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y( dom_mouse_multi_wheel_event *evt, int32_t *y) { *y = evt->y; return DOM_NO_ERR; } /** * Get wheelDeltaZ * * \param evt The Event object * \param z The returned wheelDeltaZ * \return DOM_NO_ERR. */ dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z( dom_mouse_multi_wheel_event *evt, int32_t *z) { *z = evt->z; return DOM_NO_ERR; } /** * Intialise this event with namespace * * \param evt The Event object * \param namespace The namespace of this event * \param type The event's type * \param bubble Whether this is a bubbling event * \param cancelable Whether this is a cancelable event * \param view The AbstractView associated with this event * \param detail The detail information of this mouse event * \param screen_x The x position of the mouse pointer in screen * \param screen_y The y position of the mouse pointer in screen * \param client_x The x position of the mouse pointer in client window * \param client_y The y position of the mouse pointer in client window * \param button The mouse button pressed * \param et The related target of this event, may be NULL * \param modifier_list The string contains the modifier identifier strings * \param wheel_delta_x The wheelDeltaX * \param wheel_delta_y The wheelDeltaY * \param wheel_delta_z The wheelDeltaZ * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mouse_multi_wheel_event_init_ns( dom_mouse_multi_wheel_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, unsigned short button, dom_event_target *et, dom_string *modifier_list, int32_t wheel_delta_x, int32_t wheel_delta_y, int32_t wheel_delta_z) { dom_exception err; dom_mouse_event *e = (dom_mouse_event *) evt; evt->x = wheel_delta_x; evt->y = wheel_delta_y; evt->z = wheel_delta_z; err = _dom_parse_modifier_list(modifier_list, &e->modifier_state); if (err != DOM_NO_ERR) return err; return _dom_mouse_event_init_ns(&evt->base, namespace, type, bubble, cancelable, view, detail ,screen_x, screen_y, client_x, client_y, false, false, false, false, button, et); } netsurf-all-3.2/libdom/src/events/mutation_name_event.c0000644000175000017500000001036112377676745022403 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/mutation_name_event.h" #include "core/document.h" #include "utils/utils.h" static void _virtual_dom_mutation_name_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_mutation_name_event_destroy }; /* Constructor */ dom_exception _dom_mutation_name_event_create(struct dom_document *doc, struct dom_mutation_name_event **evt) { *evt = malloc(sizeof(dom_mutation_name_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_mutation_name_event_initialise(doc, *evt); } /* Destructor */ void _dom_mutation_name_event_destroy(struct dom_mutation_name_event *evt) { _dom_mutation_name_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_mutation_name_event_initialise(struct dom_document *doc, struct dom_mutation_name_event *evt) { evt->prev_namespace = NULL; evt->prev_nodename = NULL; return _dom_event_initialise(doc, (dom_event *) evt); } /* Finalise function */ void _dom_mutation_name_event_finalise(struct dom_mutation_name_event *evt) { dom_string_unref(evt->prev_namespace); dom_string_unref(evt->prev_nodename); _dom_event_finalise((dom_event *) evt); } /* The virtual destroy function */ void _virtual_dom_mutation_name_event_destroy(struct dom_event *evt) { _dom_mutation_name_event_destroy((dom_mutation_name_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the previous namespace * * \param evt The Event object * \param namespace The previous namespace of this event * \return DOM_NO_ERR. */ dom_exception _dom_mutation_name_event_get_prev_namespace( dom_mutation_name_event *evt, dom_string **namespace) { *namespace = evt->prev_namespace; dom_string_ref(*namespace); return DOM_NO_ERR; } /** * Get the previous node name * * \param evt The Event object * \param name The previous node name * \return DOM_NO_ERR. */ dom_exception _dom_mutation_name_event_get_prev_node_name( dom_mutation_name_event *evt, dom_string **name) { *name = evt->prev_nodename; dom_string_ref(*name); return DOM_NO_ERR; } /** * Initialise the MutationNameEvent * * \param evt The Event object * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param node The node whose name change * \param prev_ns The old namespace * \param prev_name The old name * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mutation_name_event_init(dom_mutation_name_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_node *node, dom_string *prev_ns, dom_string *prev_name) { evt->prev_namespace = prev_ns; dom_string_ref(prev_ns); evt->prev_nodename = prev_name; dom_string_ref(prev_name); return _dom_mutation_event_init((dom_mutation_event *) evt, type, bubble, cancelable, node, NULL, NULL, NULL, DOM_MUTATION_MODIFICATION); } /** * Initialise the MutationNameEvent with namespace * * \param evt The Event object * \param namespace The namespace * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param node The node whose name change * \param prev_ns The old namespace * \param prev_name The old name * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mutation_name_event_init_ns(dom_mutation_name_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_node *node, dom_string *prev_ns, dom_string *prev_name) { evt->prev_namespace = prev_ns; dom_string_ref(prev_ns); evt->prev_nodename = prev_name; dom_string_ref(prev_name); return _dom_mutation_event_init_ns((dom_mutation_event *) evt, namespace, type, bubble, cancelable, node, NULL, NULL, NULL, DOM_MUTATION_MODIFICATION); } netsurf-all-3.2/libdom/src/events/ui_event.h0000644000175000017500000000230612377676745020165 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_ui_event_h_ #define dom_interntal_events_ui_event_h_ #include #include "events/event.h" /** * The modifier key state */ typedef enum { DOM_MOD_CTRL = (1<<0), DOM_MOD_META = (1<<1), DOM_MOD_SHIFT = (1<<2), DOM_MOD_ALT = (1<<3), DOM_MOD_ALT_GRAPH = (1<<4), DOM_MOD_CAPS_LOCK = (1<<5), DOM_MOD_NUM_LOCK = (1<<6), DOM_MOD_SCROLL = (1<<7) } dom_modifier_key; /** * The UIEvent */ struct dom_ui_event { struct dom_event base; /**< The base class */ struct dom_abstract_view *view; /**< The AbstractView */ int32_t detail; /**< Some private data for this event */ }; /* Constructor */ dom_exception _dom_ui_event_create(struct dom_document *doc, struct dom_ui_event **evt); /* Destructor */ void _dom_ui_event_destroy(struct dom_ui_event *evt); /* Initialise function */ dom_exception _dom_ui_event_initialise(struct dom_document *doc, struct dom_ui_event *evt); /* Finalise function */ void _dom_ui_event_finalise(struct dom_ui_event *evt); #endif netsurf-all-3.2/libdom/src/events/Makefile0000644000175000017500000000045112377676745017635 0ustar vincevince# Sources DIR_SOURCES := event.c dispatch.c event_target.c document_event.c \ custom_event.c keyboard_event.c mouse_wheel_event.c \ text_event.c event_listener.c mouse_event.c mutation_event.c \ ui_event.c mouse_multi_wheel_event.c mutation_name_event.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libdom/src/events/custom_event.h0000644000175000017500000000151612377676745021064 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_custom_event_h_ #define dom_interntal_events_custom_event_h_ #include #include "events/event.h" struct dom_custom_event { struct dom_event base; void *detail; }; /* Constructor */ dom_exception _dom_custom_event_create(struct dom_document *doc, struct dom_custom_event **evt); /* Destructor */ void _dom_custom_event_destroy(struct dom_custom_event *evt); /* Initialise function */ dom_exception _dom_custom_event_initialise(struct dom_document *doc, struct dom_custom_event *evt); /* Finalise function */ void _dom_custom_event_finalise(struct dom_custom_event *evt); #endif netsurf-all-3.2/libdom/src/events/dispatch.c0000644000175000017500000001636312377676745020151 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "core/document.h" #include "events/dispatch.h" #include "events/mutation_event.h" #include "utils/utils.h" /** * Dispatch a DOMNodeInserted/DOMNodeRemoved event * * \param doc The document object * \param et The EventTarget object * \param type "DOMNodeInserted" or "DOMNodeRemoved" * \param related The parent of the removed/inserted node * \param success Whether this event's default action get called * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception __dom_dispatch_node_change_event(dom_document *doc, dom_event_target *et, dom_event_target *related, dom_mutation_type change, bool *success) { struct dom_mutation_event *evt; dom_string *type = NULL; dom_exception err; err = _dom_mutation_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; if (change == DOM_MUTATION_ADDITION) { type = dom_string_ref(doc->_memo_domnodeinserted); } else if (change == DOM_MUTATION_REMOVAL) { type = dom_string_ref(doc->_memo_domnoderemoved); } else { assert("Should never be here" == NULL); } /* Initialise the event with corresponding parameters */ err = dom_mutation_event_init(evt, type, true, false, related, NULL, NULL, NULL, change); dom_string_unref(type); if (err != DOM_NO_ERR) { goto cleanup; } err = dom_event_target_dispatch_event(et, evt, success); if (err != DOM_NO_ERR) goto cleanup; cleanup: _dom_mutation_event_destroy(evt); return err; } /** * Dispatch a DOMNodeInsertedIntoDocument/DOMNodeRemovedFromDocument event * * \param doc The document object * \param et The EventTarget object * \param type "DOMNodeInserted" or "DOMNodeRemoved" * \param success Whether this event's default action get called * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception __dom_dispatch_node_change_document_event(dom_document *doc, dom_event_target *et, dom_mutation_type change, bool *success) { struct dom_mutation_event *evt; dom_string *type = NULL; dom_exception err; err = _dom_mutation_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; if (change == DOM_MUTATION_ADDITION) { type = dom_string_ref(doc->_memo_domnodeinsertedintodocument); } else if (change == DOM_MUTATION_REMOVAL) { type = dom_string_ref(doc->_memo_domnoderemovedfromdocument); } else { assert("Should never be here" == NULL); } /* Initialise the event with corresponding parameters */ err = dom_mutation_event_init(evt, type, true, false, NULL, NULL, NULL, NULL, change); dom_string_unref(type); if (err != DOM_NO_ERR) goto cleanup; err = dom_event_target_dispatch_event(et, evt, success); if (err != DOM_NO_ERR) goto cleanup; cleanup: _dom_mutation_event_destroy(evt); return err; } /** * Dispatch a DOMAttrModified event * * \param doc The Document object * \param et The EventTarget * \param prev The previous value before change * \param new The new value after change * \param related The related EventTarget * \param attr_name The Attribute name * \param change How this attribute change * \param success Whether this event's default handler get called * \return DOM_NO_ERR on success, appropirate dom_exception on failure. */ dom_exception __dom_dispatch_attr_modified_event(dom_document *doc, dom_event_target *et, dom_string *prev, dom_string *new, dom_event_target *related, dom_string *attr_name, dom_mutation_type change, bool *success) { struct dom_mutation_event *evt; dom_string *type = NULL; dom_exception err; err = _dom_mutation_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; type = dom_string_ref(doc->_memo_domattrmodified); /* Initialise the event with corresponding parameters */ err = dom_mutation_event_init(evt, type, true, false, related, prev, new, attr_name, change); dom_string_unref(type); if (err != DOM_NO_ERR) { goto cleanup; } err = dom_event_target_dispatch_event(et, evt, success); cleanup: _dom_mutation_event_destroy(evt); return err; } /** * Dispatch a DOMCharacterDataModified event * * \param et The EventTarget object * \param prev The preValue of the DOMCharacterData * \param new The newValue of the DOMCharacterData * \param success Whether this event's default handler get called * \return DOM_NO_ERR on success, appropirate dom_exception on failure. * * TODO: * The character_data object may be a part of a Attr node, if so, another * DOMAttrModified event should be dispatched, too. But for now, we did not * support any XML feature, so just leave it as this. */ dom_exception __dom_dispatch_characterdata_modified_event( dom_document *doc, dom_event_target *et, dom_string *prev, dom_string *new, bool *success) { struct dom_mutation_event *evt; dom_string *type = NULL; dom_exception err; err = _dom_mutation_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; type = dom_string_ref(doc->_memo_domcharacterdatamodified); err = dom_mutation_event_init(evt, type, true, false, et, prev, new, NULL, DOM_MUTATION_MODIFICATION); dom_string_unref(type); if (err != DOM_NO_ERR) { goto cleanup; } err = dom_event_target_dispatch_event(et, evt, success); cleanup: _dom_mutation_event_destroy(evt); return err; } /** * Dispatch a DOMSubtreeModified event * * \param doc The Document * \param et The EventTarget object * \param success Whether this event's default handler get called * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception __dom_dispatch_subtree_modified_event(dom_document *doc, dom_event_target *et, bool *success) { struct dom_mutation_event *evt; dom_string *type = NULL; dom_exception err; err = _dom_mutation_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; type = dom_string_ref(doc->_memo_domsubtreemodified); err = dom_mutation_event_init(evt, type, true, false, et, NULL, NULL, NULL, DOM_MUTATION_MODIFICATION); dom_string_unref(type); if (err != DOM_NO_ERR) { goto cleanup; } err = dom_event_target_dispatch_event(et, evt, success); cleanup: _dom_mutation_event_destroy(evt); return err; } /** * Dispatch a generic event * * \param doc The Document * \param et The EventTarget object * \param name The name of the event * \param len The length of the name string * \param bubble Whether this event bubbles * \param cancelable Whether this event can be cancelable * \param success Whether this event's default handler get called * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_dispatch_generic_event(dom_document *doc, dom_event_target *et, dom_string *event_name, bool bubble, bool cancelable, bool *success) { struct dom_event *evt; dom_exception err; err = _dom_event_create(doc, &evt); if (err != DOM_NO_ERR) return err; err = dom_event_init(evt, event_name, bubble, cancelable); if (err != DOM_NO_ERR) { goto cleanup; } err = dom_event_target_dispatch_event(et, evt, success); cleanup: _dom_event_destroy(evt); return err; } netsurf-all-3.2/libdom/src/events/dispatch.h0000644000175000017500000000563112377676745020152 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_dispatch_h_ #define dom_internal_events_dispatch_h_ #include #include #include /* Dispatch a DOMNodeInserted/DOMNodeRemoved event */ dom_exception __dom_dispatch_node_change_event(dom_document *doc, dom_event_target *et, dom_event_target *related, dom_mutation_type change, bool *success); #define _dom_dispatch_node_change_event(doc, et, related, change, success) \ __dom_dispatch_node_change_event((dom_document *) (doc), \ (dom_event_target *) (et), \ (dom_event_target *) (related), \ (dom_mutation_type) (change), \ (bool *) (success)) /* Dispatch a DOMNodeInsertedIntoDocument/DOMNodeRemovedFromDocument event */ dom_exception __dom_dispatch_node_change_document_event(dom_document *doc, dom_event_target *et, dom_mutation_type change, bool *success); #define _dom_dispatch_node_change_document_event(doc, et, change, success) \ __dom_dispatch_node_change_document_event((dom_document *) (doc), \ (dom_event_target *) (et), \ (dom_mutation_type) (change), \ (bool *) (success)) /* Dispatch a DOMCharacterDataModified event */ dom_exception __dom_dispatch_characterdata_modified_event( dom_document *doc, dom_event_target *et, dom_string *prev, dom_string *new, bool *success); #define _dom_dispatch_characterdata_modified_event(doc, et, \ prev, new, success) \ __dom_dispatch_characterdata_modified_event((dom_document *) (doc), \ (dom_event_target *) (et), \ (dom_string *) (prev), \ (dom_string *) (new), \ (bool *) (success)) /* Dispatch a DOMAttrModified event */ dom_exception __dom_dispatch_attr_modified_event(dom_document *doc, dom_event_target *et, dom_string *prev, dom_string *new, dom_event_target *related, dom_string *attr_name, dom_mutation_type change, bool *success); #define _dom_dispatch_attr_modified_event(doc, et, prev, new, \ related, attr_name, change, success) \ __dom_dispatch_attr_modified_event((dom_document *) (doc), \ (dom_event_target *) (et), \ (dom_string *) (prev), \ (dom_string *) (new), \ (dom_event_target *) (related), \ (dom_string *) (attr_name), \ (dom_mutation_type) (change), \ (bool *) (success)) /* Dispatch a DOMSubtreeModified event */ dom_exception __dom_dispatch_subtree_modified_event(dom_document *doc, dom_event_target *et, bool *success); #define _dom_dispatch_subtree_modified_event(doc, et, success) \ __dom_dispatch_subtree_modified_event((dom_document *) (doc), \ (dom_event_target *) (et), \ (bool *) (success)) /* Dispatch a generic event */ dom_exception _dom_dispatch_generic_event(dom_document *doc, dom_event_target *et, dom_string *event_name, bool bubble, bool cancelable, bool *success); #endif netsurf-all-3.2/libdom/src/events/mutation_event.c0000644000175000017500000001255512377676745021412 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "events/mutation_event.h" #include "core/document.h" static void _virtual_dom_mutation_event_destroy(struct dom_event *evt); static struct dom_event_private_vtable _event_vtable = { _virtual_dom_mutation_event_destroy }; /* Constructor */ dom_exception _dom_mutation_event_create(struct dom_document *doc, struct dom_mutation_event **evt) { *evt = malloc(sizeof(dom_mutation_event)); if (*evt == NULL) return DOM_NO_MEM_ERR; ((struct dom_event *) *evt)->vtable = &_event_vtable; return _dom_mutation_event_initialise(doc, *evt); } /* Destructor */ void _dom_mutation_event_destroy(struct dom_mutation_event *evt) { _dom_mutation_event_finalise(evt); free(evt); } /* Initialise function */ dom_exception _dom_mutation_event_initialise(struct dom_document *doc, struct dom_mutation_event *evt) { evt->related_node = NULL; evt->prev_value = NULL; evt->new_value = NULL; evt->attr_name = NULL; return _dom_event_initialise(doc, &evt->base); } /* Finalise function */ void _dom_mutation_event_finalise(struct dom_mutation_event *evt) { dom_node_unref(evt->related_node); dom_string_unref(evt->prev_value); dom_string_unref(evt->new_value); dom_string_unref(evt->attr_name); evt->related_node = NULL; evt->prev_value = NULL; evt->new_value = NULL; evt->attr_name = NULL; _dom_event_finalise(&evt->base); } /* The virtual destroy function */ void _virtual_dom_mutation_event_destroy(struct dom_event *evt) { _dom_mutation_event_destroy((dom_mutation_event *) evt); } /*----------------------------------------------------------------------*/ /* The public API */ /** * Get the related node * * \param evt The Event object * \param node The related node * \return DOM_NO_ERR. */ dom_exception _dom_mutation_event_get_related_node(dom_mutation_event *evt, struct dom_node **node) { *node = evt->related_node; dom_node_ref(*node); return DOM_NO_ERR; } /** * Get the old value * * \param evt The Event object * \param ret The old value * \return DOM_NO_ERR. */ dom_exception _dom_mutation_event_get_prev_value(dom_mutation_event *evt, dom_string **ret) { *ret = evt->prev_value; dom_string_ref(*ret); return DOM_NO_ERR; } /** * Get the new value * * \param evt The Event object * \param ret The new value * \return DOM_NO_ERR. */ dom_exception _dom_mutation_event_get_new_value(dom_mutation_event *evt, dom_string **ret) { *ret = evt->new_value; dom_string_ref(*ret); return DOM_NO_ERR; } /** * Get the attr name * * \param evt The Event object * \param ret The attribute name * \return DOM_NO_ERR. */ dom_exception _dom_mutation_event_get_attr_name(dom_mutation_event *evt, dom_string **ret) { *ret = evt->attr_name; dom_string_ref(*ret); return DOM_NO_ERR; } /** * Get the way the attribute change * * \param evt The Event object * \param type The change type * \return DOM_NO_ERR. */ dom_exception _dom_mutation_event_get_attr_change(dom_mutation_event *evt, dom_mutation_type *type) { *type = evt->change; return DOM_NO_ERR; } /** * Initialise the MutationEvent * * \param evt The Event object * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param node The mutation node * \param prev_value The old value * \param new_value The new value * \param attr_name The attribute's name * \param change The change type * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mutation_event_init(dom_mutation_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_node *node, dom_string *prev_value, dom_string *new_value, dom_string *attr_name, dom_mutation_type change) { evt->related_node = node; dom_node_ref(node); evt->prev_value = prev_value; dom_string_ref(prev_value); evt->new_value = new_value; dom_string_ref(new_value); evt->attr_name = attr_name; dom_string_ref(attr_name); evt->change = change; return _dom_event_init(&evt->base, type, bubble, cancelable); } /** * Initialise the MutationEvent with namespace * * \param evt The Event object * \param namespace The namespace * \param type The type of this UIEvent * \param bubble Whether this event can bubble * \param cancelable Whether this event is cancelable * \param node The mutation node * \param prev_value The old value * \param new_value The new value * \param attr_name The attribute's name * \param change The change type * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_mutation_event_init_ns(dom_mutation_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_node *node, dom_string *prev_value, dom_string *new_value, dom_string *attr_name, dom_mutation_type change) { evt->related_node = node; dom_node_ref(node); evt->prev_value = prev_value; dom_string_ref(prev_value); evt->new_value = new_value; dom_string_ref(new_value); evt->attr_name = attr_name; dom_string_ref(attr_name); evt->change = change; return _dom_event_init_ns(&evt->base, namespace, type, bubble, cancelable); } netsurf-all-3.2/libdom/src/events/mutation_name_event.h0000644000175000017500000000200312377676745022402 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_interntal_events_mutation_name_event_h_ #define dom_interntal_events_mutation_name_event_h_ #include #include "events/mutation_event.h" /** * The MutationName event */ struct dom_mutation_name_event { struct dom_mutation_event base; dom_string *prev_namespace; dom_string *prev_nodename; }; /* Constructor */ dom_exception _dom_mutation_name_event_create(struct dom_document *doc, struct dom_mutation_name_event **evt); /* Destructor */ void _dom_mutation_name_event_destroy(struct dom_mutation_name_event *evt); /* Initialise function */ dom_exception _dom_mutation_name_event_initialise(struct dom_document *doc, struct dom_mutation_name_event *evt); /* Finalise function */ void _dom_mutation_name_event_finalise(struct dom_mutation_name_event *evt); #endif netsurf-all-3.2/libdom/src/events/event.h0000644000175000017500000000401512377676745017467 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_events_event_h_ #define dom_internal_events_event_h_ #include #include #include #include #include "utils/list.h" /* The private virtual table */ struct dom_event_private_vtable { void (*destroy)(dom_event *evt); }; /** * The Event Object */ struct dom_event { dom_string *type; /**< The type of the event */ dom_event_target *target; /**< The event target */ dom_event_target *current; /**< The current event target */ dom_event_flow_phase phase; /**< The event phase */ bool bubble; /**< Whether this event is a bubbling event */ bool cancelable; /**< Whether this event is cancelable */ unsigned int timestamp; /**< The timestamp this event is created */ dom_string *namespace; /**< The namespace of this event */ dom_document *doc; /**< The document which created this event */ bool stop; /**< Whether stopPropagation is called */ bool stop_now; /**< Whether stopImmediatePropagation is called */ bool prevent_default; /**< Whether the default action is prevented */ bool custom; /**< Whether this is a custom event */ uint32_t refcnt; /**< The reference count of this object */ struct dom_event_private_vtable *vtable; /**< The private virtual function table of Event */ bool in_dispatch; /**< Whether this event is in dispatch */ }; /* Constructor */ dom_exception _dom_event_create(dom_document *doc, dom_event **evt); /* Destructor */ void _dom_event_destroy(dom_event *evt); /* Initialise function */ dom_exception _dom_event_initialise(dom_document *doc, dom_event *evt); /* Finalise function */ void _dom_event_finalise(dom_event *evt); static inline void dom_event_destroy(dom_event *evt) { evt->vtable->destroy(evt); } #define dom_event_destroy(e) dom_event_destroy((dom_event *) (e)) #endif netsurf-all-3.2/libdom/src/core/0000755000175000017500000000000012377713347015607 5ustar vincevincenetsurf-all-3.2/libdom/src/core/attr.c0000644000175000017500000005006312377676745016743 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include #include #include "core/attr.h" #include "core/document.h" #include "core/entity_ref.h" #include "core/node.h" #include "core/element.h" #include "utils/utils.h" struct dom_element; /** * DOM attribute node */ struct dom_attr { struct dom_node_internal base; /**< Base node */ struct dom_type_info *schema_type_info; /**< Type information */ dom_attr_type type; /**< The type of this attribute */ union { uint32_t lvalue; unsigned short svalue; bool bvalue; } value; /**< The special type value of this attribute */ bool specified; /**< Whether the attribute is specified or default */ bool is_id; /**< Whether this attribute is a ID attribute */ bool read_only; /**< Whether this attribute is readonly */ }; /* The vtable for dom_attr node */ static struct dom_attr_vtable attr_vtable = { { { DOM_NODE_EVENT_TARGET_VTABLE, }, DOM_NODE_VTABLE_ATTR }, DOM_ATTR_VTABLE }; /* The protected vtable for dom_attr */ static struct dom_node_protect_vtable attr_protect_vtable = { DOM_ATTR_PROTECT_VTABLE }; /* -------------------------------------------------------------------- */ /* Constructor and destructor */ /** * Create an attribute node * * \param doc The owning document * \param name The (local) name of the node to create * \param namespace The namespace URI of the attribute, or NULL * \param prefix The namespace prefix of the attribute, or NULL * \param specified Whether this attribute is specified * \param result Pointer to location to receive created attribute * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc and ::name will have their reference counts increased. The * caller should make sure that ::name is a valid NCName here. * * The returned attribute will already be referenced. */ dom_exception _dom_attr_create(struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, bool specified, struct dom_attr **result) { struct dom_attr *a; dom_exception err; /* Allocate the attribute node */ a = malloc(sizeof(struct dom_attr)); if (a == NULL) return DOM_NO_MEM_ERR; /* Initialise the vtable */ a->base.base.vtable = &attr_vtable; a->base.vtable = &attr_protect_vtable; /* Initialise the class */ err = _dom_attr_initialise(a, doc, name, namespace, prefix, specified, result); if (err != DOM_NO_ERR) { free(a); return err; } return DOM_NO_ERR; } /** * Initialise a dom_attr * * \param a The dom_attr * \param doc The document * \param name The name of this attribute node * \param namespace The namespace of this attribute * \param prefix The prefix * \param specified Whether this node is a specified one * \param result The returned node * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_attr_initialise(dom_attr *a, struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, bool specified, struct dom_attr **result) { dom_exception err; err = _dom_node_initialise(&a->base, doc, DOM_ATTRIBUTE_NODE, name, NULL, namespace, prefix); if (err != DOM_NO_ERR) { return err; } a->specified = specified; a->schema_type_info = NULL; a->is_id = false; /* The attribute type is unset when it is created */ a->type = DOM_ATTR_UNSET; a->read_only = false; *result = a; return DOM_NO_ERR; } /** * The destructor of dom_attr * * \param attr The attribute */ void _dom_attr_finalise(dom_attr *attr) { /* Now, clean up this node and destroy it */ if (attr->schema_type_info != NULL) { /** \todo destroy schema type info */ } _dom_node_finalise(&attr->base); } /** * Destroy an attribute node * * \param attr The attribute to destroy * * The contents of ::attr will be destroyed and ::attr will be freed */ void _dom_attr_destroy(struct dom_attr *attr) { _dom_attr_finalise(attr); free(attr); } /*-----------------------------------------------------------------------*/ /* Following are our implementation specific APIs */ /** * Get the Attr Node type * * \param a The attribute node * \return the type */ dom_attr_type dom_attr_get_type(dom_attr *a) { return a->type; } /** * Get the integer value of this attribute * * \param a The attribute object * \param value The returned value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a integer * attribute */ dom_exception dom_attr_get_integer(dom_attr *a, uint32_t *value) { if (a->type != DOM_ATTR_INTEGER) return DOM_ATTR_WRONG_TYPE_ERR; *value = a->value.lvalue; return DOM_NO_ERR; } /** * Set the integer value of this attribute * * \param a The attribute object * \param value The new value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a integer * attribute */ dom_exception dom_attr_set_integer(dom_attr *a, uint32_t value) { struct dom_document *doc; struct dom_node_internal *ele; bool success = true; dom_exception err; /* If this is the first set method, we should fix this attribute * type */ if (a->type == DOM_ATTR_UNSET) a->type = DOM_ATTR_INTEGER; if (a->type != DOM_ATTR_INTEGER) return DOM_ATTR_WRONG_TYPE_ERR; if (a->value.lvalue == value) return DOM_NO_ERR; a->value.lvalue = value; doc = dom_node_get_owner(a); ele = dom_node_get_parent(a); err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL, (dom_event_target *) a, NULL, DOM_MUTATION_MODIFICATION, &success); if (err != DOM_NO_ERR) return err; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) a, &success); return err; } /** * Get the short value of this attribute * * \param a The attribute object * \param value The returned value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a short * attribute */ dom_exception dom_attr_get_short(dom_attr *a, unsigned short *value) { if (a->type != DOM_ATTR_SHORT) return DOM_ATTR_WRONG_TYPE_ERR; *value = a->value.svalue; return DOM_NO_ERR; } /** * Set the short value of this attribute * * \param a The attribute object * \param value The new value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a short * attribute */ dom_exception dom_attr_set_short(dom_attr *a, unsigned short value) { struct dom_document *doc; struct dom_node_internal *ele; bool success = true; dom_exception err; /* If this is the first set method, we should fix this attribute * type */ if (a->type == DOM_ATTR_UNSET) a->type = DOM_ATTR_SHORT; if (a->type != DOM_ATTR_SHORT) return DOM_ATTR_WRONG_TYPE_ERR; if (a->value.svalue == value) return DOM_NO_ERR; a->value.svalue = value; doc = dom_node_get_owner(a); ele = dom_node_get_parent(a); err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL, (dom_event_target *) a, NULL, DOM_MUTATION_MODIFICATION, &success); if (err != DOM_NO_ERR) return err; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) a, &success); return err; } /** * Get the bool value of this attribute * * \param a The attribute object * \param value The returned value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a bool * attribute */ dom_exception dom_attr_get_bool(dom_attr *a, bool *value) { if (a->type != DOM_ATTR_BOOL) return DOM_ATTR_WRONG_TYPE_ERR; *value = a->value.bvalue; return DOM_NO_ERR; } /** * Set the bool value of this attribute * * \param a The attribute object * \param value The new value * \return DOM_NO_ERR on success, * DOM_ATTR_WRONG_TYPE_ERR if the attribute node is not a bool * attribute */ dom_exception dom_attr_set_bool(dom_attr *a, bool value) { struct dom_document *doc; struct dom_node_internal *ele; bool success = true; dom_exception err; /* If this is the first set method, we should fix this attribute * type */ if (a->type == DOM_ATTR_UNSET) a->type = DOM_ATTR_BOOL; if (a->type != DOM_ATTR_BOOL) return DOM_ATTR_WRONG_TYPE_ERR; if (a->value.bvalue == value) return DOM_NO_ERR; a->value.bvalue = value; doc = dom_node_get_owner(a); ele = dom_node_get_parent(a); err = _dom_dispatch_attr_modified_event(doc, ele, NULL, NULL, (dom_event_target *) a, NULL, DOM_MUTATION_MODIFICATION, &success); if (err != DOM_NO_ERR) return err; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) a, &success); return err; } /** * Set the node as a readonly attribute * * \param a The attribute */ void dom_attr_mark_readonly(dom_attr *a) { a->read_only = true; } /* -------------------------------------------------------------------- */ /* The public virtual functions */ /** * Retrieve an attribute's name * * \param attr Attribute to retrieve name from * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, appropriate dom_exception on failure * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_attr_get_name(struct dom_attr *attr, dom_string **result) { /* This is the same as nodeName */ return dom_node_get_node_name(attr, result); } /** * Determine if attribute was specified or default * * \param attr Attribute to inspect * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_attr_get_specified(struct dom_attr *attr, bool *result) { *result = attr->specified; return DOM_NO_ERR; } /** * Retrieve an attribute's value * * \param attr Attribute to retrieve value from * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, appropriate dom_exception on failure * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_attr_get_value(struct dom_attr *attr, dom_string **result) { struct dom_node_internal *a = (struct dom_node_internal *) attr; struct dom_node_internal *c; dom_string *value, *temp; dom_exception err; /* Attempt to shortcut for a single text node child with value */ if ((a->first_child != NULL) && (a->first_child == a->last_child) && (a->first_child->type == DOM_TEXT_NODE) && (a->first_child->value != NULL)) { *result = dom_string_ref(a->first_child->value); return DOM_NO_ERR; } err = dom_string_create(NULL, 0, &value); if (err != DOM_NO_ERR) { return err; } /* Force unknown types to strings, if necessary */ if (attr->type == DOM_ATTR_UNSET && a->first_child != NULL) { attr->type = DOM_ATTR_STRING; } /* If this attribute node is not a string one, we just return an empty * string */ if (attr->type != DOM_ATTR_STRING) { *result = value; return DOM_NO_ERR; } /* Traverse children, building a string representation as we go */ for (c = a->first_child; c != NULL; c = c->next) { if (c->type == DOM_TEXT_NODE && c->value != NULL) { /* Append to existing value */ err = dom_string_concat(value, c->value, &temp); if (err != DOM_NO_ERR) { dom_string_unref(value); return err; } /* Finished with previous value */ dom_string_unref(value); /* Claim new value */ value = temp; } else if (c->type == DOM_ENTITY_REFERENCE_NODE) { dom_string *tr; /* Get textual representation of entity */ err = _dom_entity_reference_get_textual_representation( (struct dom_entity_reference *) c, &tr); if (err != DOM_NO_ERR) { dom_string_unref(value); return err; } /* Append to existing value */ err = dom_string_concat(value, tr, &temp); if (err != DOM_NO_ERR) { dom_string_unref(tr); dom_string_unref(value); return err; } /* No int32_ter need textual representation */ dom_string_unref(tr); /* Finished with previous value */ dom_string_unref(value); /* Claim new value */ value = temp; } } *result = value; return DOM_NO_ERR; } /** * Set an attribute's value * * \param attr Attribute to retrieve value from * \param value New value for attribute * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if attribute is readonly. */ dom_exception _dom_attr_set_value(struct dom_attr *attr, dom_string *value) { struct dom_node_internal *a = (struct dom_node_internal *) attr; struct dom_node_internal *c, *d; struct dom_text *text; dom_exception err; dom_string *name = NULL; dom_string *parsed = NULL; /* Ensure attribute is writable */ if (_dom_node_readonly(a)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* If this is the first set method, we should fix this attribute * type */ if (attr->type == DOM_ATTR_UNSET) attr->type = DOM_ATTR_STRING; if (attr->type != DOM_ATTR_STRING) return DOM_ATTR_WRONG_TYPE_ERR; err = _dom_attr_get_name(attr, &name); if (err != DOM_NO_ERR) return err; err = dom_element_parse_attribute(a->parent, name, value, &parsed); dom_string_unref(name); if (err != DOM_NO_ERR) { return err; } /* Create text node containing new value */ err = dom_document_create_text_node(a->owner, parsed, &text); dom_string_unref(parsed); if (err != DOM_NO_ERR) return err; /* Destroy children of this node */ for (c = a->first_child; c != NULL; c = d) { d = c->next; /* Detach child */ c->parent = NULL; /* Detach from sibling list */ c->previous = NULL; c->next = NULL; dom_node_try_destroy(c); } /* And insert the text node as the value */ ((struct dom_node_internal *) text)->parent = a; a->first_child = a->last_child = (struct dom_node_internal *) text; dom_node_unref(text); dom_node_remove_pending(text); /* Now the attribute node is specified */ attr->specified = true; return DOM_NO_ERR; } /** * Retrieve the owning element of an attribute * * \param attr The attribute to extract owning element from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. The caller * should unref it once it has finished with it. */ dom_exception _dom_attr_get_owner(struct dom_attr *attr, struct dom_element **result) { struct dom_node_internal *a = (struct dom_node_internal *) attr; /* If there is an owning element, increase its reference count */ if (a->parent != NULL) dom_node_ref(a->parent); *result = (struct dom_element *) a->parent; return DOM_NO_ERR; } /** * Retrieve an attribute's type information * * \param attr The attribute to extract type information from * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. * * The returned type info will have its reference count increased. The caller * should unref it once it has finished with it. */ dom_exception _dom_attr_get_schema_type_info(struct dom_attr *attr, struct dom_type_info **result) { UNUSED(attr); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Determine if an attribute if of type ID * * \param attr The attribute to inspect * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_attr_is_id(struct dom_attr *attr, bool *result) { *result = attr->is_id; return DOM_NO_ERR; } /*------------- The overload virtual functions ------------------------*/ /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_get_node_value(dom_node_internal *node, dom_string **result) { dom_attr *attr = (dom_attr *) node; return _dom_attr_get_value(attr, result); } /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result) { dom_exception err; dom_attr *attr; /* Discard the warnings */ UNUSED(deep); /* Clone an Attr always clone all its children */ err = _dom_node_clone_node(node, true, result); if (err != DOM_NO_ERR) return err; attr = (dom_attr *) *result; /* Clone an Attr always result a specified Attr, * see DOM Level 3 Node.cloneNode */ attr->specified = true; return DOM_NO_ERR; } /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_set_prefix(dom_node_internal *node, dom_string *prefix) { /* Really I don't know whether there should something * special to do here */ return _dom_node_set_prefix(node, prefix); } /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result) { struct dom_element *owner; dom_exception err; err = dom_attr_get_owner_element(node, &owner); if (err != DOM_NO_ERR) return err; if (owner == NULL) { *result = NULL; return DOM_NO_ERR; } return dom_node_lookup_prefix(owner, namespace, result); } /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result) { struct dom_element *owner; dom_exception err; err = dom_attr_get_owner_element(node, &owner); if (err != DOM_NO_ERR) return err; if (owner == NULL) { *result = false; return DOM_NO_ERR; } return dom_node_is_default_namespace(owner, namespace, result); } /* Overload function of Node, please refer node.c for the detail of this * function. */ dom_exception _dom_attr_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result) { struct dom_element *owner; dom_exception err; err = dom_attr_get_owner_element(node, &owner); if (err != DOM_NO_ERR) return err; if (owner == NULL) { *result = NULL; return DOM_NO_ERR; } return dom_node_lookup_namespace(owner, prefix, result); } /*----------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual destroy function of this class */ void __dom_attr_destroy(dom_node_internal *node) { _dom_attr_destroy((dom_attr *) node); } /* The memory allocator of this class */ dom_exception _dom_attr_copy(dom_node_internal *n, dom_node_internal **copy) { dom_attr *old = (dom_attr *) n; dom_attr *a; dom_exception err; a = malloc(sizeof(struct dom_attr)); if (a == NULL) return DOM_NO_MEM_ERR; err = dom_node_copy_internal(n, a); if (err != DOM_NO_ERR) { free(a); return err; } a->specified = old->specified; /* TODO: deal with dom_type_info, it get no definition ! */ a->schema_type_info = NULL; a->is_id = old->is_id; a->type = old->type; a->value = old->value; /* TODO: is this correct? */ a->read_only = false; *copy = (dom_node_internal *) a; return DOM_NO_ERR; } /** * Set/Unset whether this attribute is a ID attribute * * \param attr The attribute * \param is_id Whether it is a ID attribute */ void _dom_attr_set_isid(struct dom_attr *attr, bool is_id) { attr->is_id = is_id; } /** * Set/Unset whether the attribute is a specified one. * * \param attr The attribute node * \param specified Whether this attribute is a specified one */ void _dom_attr_set_specified(struct dom_attr *attr, bool specified) { attr->specified = specified; } /** * Whether this attribute node is readonly * * \param a The node * \return true if this Attr is readonly, false otherwise */ bool _dom_attr_readonly(const dom_attr *a) { return a->read_only; } netsurf-all-3.2/libdom/src/core/characterdata.h0000644000175000017500000001007412377676745020562 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_characterdata_h_ #define dom_internal_core_characterdata_h_ #include #include "core/node.h" /** * DOM character data node */ struct dom_characterdata { struct dom_node_internal base; /**< Base node */ }; /* The CharacterData is a intermediate node type, so the following function * may never be used */ dom_characterdata *_dom_characterdata_create(void); dom_exception _dom_characterdata_initialise(struct dom_characterdata *cdata, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value); void _dom_characterdata_finalise(struct dom_characterdata *cdata); /* The virtual functions for dom_characterdata */ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, dom_string **data); dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, dom_string *data); dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, uint32_t *length); dom_exception _dom_characterdata_substring_data( struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string **data); dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, dom_string *data); dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, uint32_t offset, dom_string *data); dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count); dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string *data); dom_exception _dom_characterdata_get_text_content( dom_node_internal *node, dom_string **result); dom_exception _dom_characterdata_set_text_content( dom_node_internal *node, dom_string *content); #define DOM_CHARACTERDATA_VTABLE \ _dom_characterdata_get_data, \ _dom_characterdata_set_data, \ _dom_characterdata_get_length, \ _dom_characterdata_substring_data, \ _dom_characterdata_append_data, \ _dom_characterdata_insert_data, \ _dom_characterdata_delete_data, \ _dom_characterdata_replace_data #define DOM_NODE_VTABLE_CHARACTERDATA \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_node_get_attributes, \ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_node_clone_node, \ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_node_set_prefix, \ _dom_node_get_local_name, \ _dom_node_has_attributes, \ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_characterdata_get_text_content, /* override */ \ _dom_characterdata_set_text_content, /* override */ \ _dom_node_is_same, \ _dom_node_lookup_prefix, \ _dom_node_is_default_namespace, \ _dom_node_lookup_namespace, \ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /* Following comes the protected vtable * * Only the _copy function can be used by sub-class of this. */ void _dom_characterdata_destroy(dom_node_internal *node); dom_exception _dom_characterdata_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_CHARACTERDATA_PROTECT_VTABLE \ _dom_characterdata_destroy, \ _dom_characterdata_copy extern struct dom_characterdata_vtable characterdata_vtable; dom_exception _dom_characterdata_copy_internal(dom_characterdata *old, dom_characterdata *new); #define dom_characterdata_copy_internal(o, n) \ _dom_characterdata_copy_internal( \ (dom_characterdata *) (o), (dom_characterdata *) (n)) #endif netsurf-all-3.2/libdom/src/core/doc_fragment.c0000644000175000017500000000541312377676745020420 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include "core/document.h" #include "core/doc_fragment.h" #include "core/node.h" #include "utils/utils.h" /** * A DOM document fragment */ struct dom_document_fragment { dom_node_internal base; /**< Base node */ }; static struct dom_node_vtable df_vtable = { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE }; static struct dom_node_protect_vtable df_protect_vtable = { DOM_DF_PROTECT_VTABLE }; /** * Create a document fragment * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_document_fragment_create(dom_document *doc, dom_string *name, dom_string *value, dom_document_fragment **result) { dom_document_fragment *f; dom_exception err; f = malloc(sizeof(dom_document_fragment)); if (f == NULL) return DOM_NO_MEM_ERR; f->base.base.vtable = &df_vtable; f->base.vtable = &df_protect_vtable; /* And initialise the node */ err = _dom_document_fragment_initialise(&f->base, doc, DOM_DOCUMENT_FRAGMENT_NODE, name, value, NULL, NULL); if (err != DOM_NO_ERR) { free(f); return err; } *result = f; return DOM_NO_ERR; } /** * Destroy a document fragment * * \param frag The document fragment to destroy * * The contents of ::frag will be destroyed and ::frag will be freed. */ void _dom_document_fragment_destroy(dom_document_fragment *frag) { /* Finalise base class */ _dom_document_fragment_finalise(&frag->base); /* Destroy fragment */ free(frag); } /*-----------------------------------------------------------------------*/ /* Overload protected functions */ /* The virtual destroy function of this class */ void _dom_df_destroy(dom_node_internal *node) { _dom_document_fragment_destroy((dom_document_fragment *) node); } /* The copy constructor of this class */ dom_exception _dom_df_copy(dom_node_internal *old, dom_node_internal **copy) { dom_document_fragment *new_f; dom_exception err; new_f = malloc(sizeof(dom_document_fragment)); if (new_f == NULL) return DOM_NO_MEM_ERR; err = dom_node_copy_internal(old, new_f); if (err != DOM_NO_ERR) { free(new_f); return err; } *copy = (dom_node_internal *) new_f; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/comment.c0000644000175000017500000000524412377676745017434 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include "core/characterdata.h" #include "core/comment.h" #include "core/document.h" #include "utils/utils.h" /** * A DOM Comment node */ struct dom_comment { dom_characterdata base; /**< Base node */ }; static struct dom_node_protect_vtable comment_protect_vtable = { DOM_COMMENT_PROTECT_VTABLE }; /** * Create a comment node * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_comment_create(dom_document *doc, dom_string *name, dom_string *value, dom_comment **result) { dom_comment *c; dom_exception err; /* Allocate the comment node */ c = malloc(sizeof(dom_comment)); if (c == NULL) return DOM_NO_MEM_ERR; /* Set the virtual table */ ((dom_node_internal *) c)->base.vtable = &characterdata_vtable; ((dom_node_internal *) c)->vtable = &comment_protect_vtable; /* And initialise the node */ err = _dom_characterdata_initialise(&c->base, doc, DOM_COMMENT_NODE, name, value); if (err != DOM_NO_ERR) { free(c); return err; } *result = c; return DOM_NO_ERR; } /** * Destroy a comment node * * \param comment The node to destroy * * The contents of ::comment will be destroyed and ::comment will be freed */ void _dom_comment_destroy(dom_comment *comment) { /* Finalise base class contents */ _dom_characterdata_finalise(&comment->base); /* Free node */ free(comment); } /*-----------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual destroy function */ void __dom_comment_destroy(dom_node_internal *node) { _dom_comment_destroy((dom_comment *) node); } /* The copy constructor of this class */ dom_exception _dom_comment_copy(dom_node_internal *old, dom_node_internal **copy) { dom_comment *new_comment; dom_exception err; new_comment = malloc(sizeof(dom_comment)); if (new_comment == NULL) return DOM_NO_MEM_ERR; err = dom_characterdata_copy_internal(old, new_comment); if (err != DOM_NO_ERR) { free(new_comment); return err; } *copy = (dom_node_internal *) new_comment; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/namednodemap.h0000644000175000017500000000372312377676745020427 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_namednodemap_h_ #define dom_internal_core_namednodemap_h_ #include #include #include struct dom_document; struct dom_node; struct dom_namednodemap; struct nnm_operation { dom_exception (*namednodemap_get_length)(void *priv, uint32_t *length); dom_exception (*namednodemap_get_named_item)(void *priv, dom_string *name, struct dom_node **node); dom_exception (*namednodemap_set_named_item)(void *priv, struct dom_node *arg, struct dom_node **node); dom_exception (*namednodemap_remove_named_item)( void *priv, dom_string *name, struct dom_node **node); dom_exception (*namednodemap_item)(void *priv, uint32_t index, struct dom_node **node); dom_exception (*namednodemap_get_named_item_ns)( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node); dom_exception (*namednodemap_set_named_item_ns)( void *priv, struct dom_node *arg, struct dom_node **node); dom_exception (*namednodemap_remove_named_item_ns)( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node); void (*namednodemap_destroy)(void *priv); bool (*namednodemap_equal)(void *p1, void *p2); }; /* Create a namednodemap */ dom_exception _dom_namednodemap_create(struct dom_document *doc, void *priv, struct nnm_operation *opt, struct dom_namednodemap **map); /* Update the private data */ void _dom_namednodemap_update(struct dom_namednodemap *map, void *priv); /* Test whether two maps are equal */ bool _dom_namednodemap_equal(struct dom_namednodemap *m1, struct dom_namednodemap *m2); #define dom_namednodemap_equal(m1, m2) _dom_namednodemap_equal( \ (struct dom_namednodemap *) (m1), \ (struct dom_namednodemap *) (m2)) #endif netsurf-all-3.2/libdom/src/core/node.h0000644000175000017500000002571212377676745016726 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_node_h_ #define dom_internal_core_node_h_ #include #include #include #include #include "events/event_target.h" #include "events/mutation_event.h" #include "utils/list.h" /** * User data context attached to a DOM node */ struct dom_user_data { dom_string *key; /**< Key for data */ void *data; /**< Client-specific data */ dom_user_data_handler handler; /**< Callback function */ struct dom_user_data *next; /**< Next in list */ struct dom_user_data *prev; /**< Previous in list */ }; typedef struct dom_user_data dom_user_data; /** * The internally used virtual function table. */ typedef struct dom_node_protect_vtable { void (*destroy)(dom_node_internal *n); /**< The destroy virtual function, it * should be private to client */ dom_exception (*copy)(dom_node_internal *old, dom_node_internal **copy); /**< Copy the old to new as well as * all its attributes, but not its children */ } dom_node_protect_vtable; /** * The real DOM node object * * DOM nodes are reference counted */ struct dom_node_internal { struct dom_node base; /**< The vtable base */ void *vtable; /**< The protected vtable */ dom_string *name; /**< Node name (this is the local part * of a QName in the cases where a * namespace exists) */ dom_string *value; /**< Node value */ dom_node_type type; /**< Node type */ dom_node_internal *parent; /**< Parent node */ dom_node_internal *first_child; /**< First child node */ dom_node_internal *last_child; /**< Last child node */ dom_node_internal *previous; /**< Previous sibling */ dom_node_internal *next; /**< Next sibling */ struct dom_document *owner; /**< Owning document */ dom_string *namespace; /**< Namespace URI */ dom_string *prefix; /**< Namespace prefix */ struct dom_user_data *user_data; /**< User data list */ struct list_entry pending_list; /**< The document delete pending list */ dom_event_target_internal eti; /**< The EventTarget interface */ }; dom_node_internal * _dom_node_create(void); dom_exception _dom_node_initialise(struct dom_node_internal *node, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value, dom_string *namespace, dom_string *prefix); void _dom_node_finalise(dom_node_internal *node); bool _dom_node_readonly(const dom_node_internal *node); /* Event Target implementation */ dom_exception _dom_node_add_event_listener(dom_event_target *et, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_node_remove_event_listener(dom_event_target *et, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_node_add_event_listener_ns(dom_event_target *et, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_node_remove_event_listener_ns(dom_event_target *et, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture); dom_exception _dom_node_dispatch_event(dom_event_target *et, struct dom_event *evt, bool *success); /* The DOM Node's vtable methods */ dom_exception _dom_node_get_node_name(dom_node_internal *node, dom_string **result); dom_exception _dom_node_get_node_value(dom_node_internal *node, dom_string **result); dom_exception _dom_node_set_node_value(dom_node_internal *node, dom_string *value); dom_exception _dom_node_get_node_type(dom_node_internal *node, dom_node_type *result); dom_exception _dom_node_get_parent_node(dom_node_internal *node, dom_node_internal **result); dom_exception _dom_node_get_child_nodes(dom_node_internal *node, struct dom_nodelist **result); dom_exception _dom_node_get_first_child(dom_node_internal *node, dom_node_internal **result); dom_exception _dom_node_get_last_child(dom_node_internal *node, dom_node_internal **result); dom_exception _dom_node_get_previous_sibling(dom_node_internal *node, dom_node_internal **result); dom_exception _dom_node_get_next_sibling(dom_node_internal *node, dom_node_internal **result); dom_exception _dom_node_get_attributes(dom_node_internal *node, struct dom_namednodemap **result); dom_exception _dom_node_get_owner_document(dom_node_internal *node, struct dom_document **result); dom_exception _dom_node_insert_before(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal *ref_child, dom_node_internal **result); dom_exception _dom_node_replace_child(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal *old_child, dom_node_internal **result); dom_exception _dom_node_remove_child(dom_node_internal *node, dom_node_internal *old_child, dom_node_internal **result); dom_exception _dom_node_append_child(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal **result); dom_exception _dom_node_has_child_nodes(dom_node_internal *node, bool *result); dom_exception _dom_node_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result); dom_exception _dom_node_normalize(dom_node_internal *node); dom_exception _dom_node_is_supported(dom_node_internal *node, dom_string *feature, dom_string *version, bool *result); dom_exception _dom_node_get_namespace(dom_node_internal *node, dom_string **result); dom_exception _dom_node_get_prefix(dom_node_internal *node, dom_string **result); dom_exception _dom_node_set_prefix(dom_node_internal *node, dom_string *prefix); dom_exception _dom_node_get_local_name(dom_node_internal *node, dom_string **result); dom_exception _dom_node_has_attributes(dom_node_internal *node, bool *result); dom_exception _dom_node_get_base(dom_node_internal *node, dom_string **result); dom_exception _dom_node_compare_document_position(dom_node_internal *node, dom_node_internal *other, uint16_t *result); dom_exception _dom_node_get_text_content(dom_node_internal *node, dom_string **result); dom_exception _dom_node_set_text_content(dom_node_internal *node, dom_string *content); dom_exception _dom_node_is_same(dom_node_internal *node, dom_node_internal *other, bool *result); dom_exception _dom_node_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result); dom_exception _dom_node_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result); dom_exception _dom_node_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result); dom_exception _dom_node_is_equal(dom_node_internal *node, dom_node_internal *other, bool *result); dom_exception _dom_node_get_feature(dom_node_internal *node, dom_string *feature, dom_string *version, void **result); dom_exception _dom_node_set_user_data(dom_node_internal *node, dom_string *key, void *data, dom_user_data_handler handler, void **result); dom_exception _dom_node_get_user_data(dom_node_internal *node, dom_string *key, void **result); #define DOM_NODE_EVENT_TARGET_VTABLE \ _dom_node_add_event_listener, \ _dom_node_remove_event_listener, \ _dom_node_dispatch_event, \ _dom_node_add_event_listener_ns, \ _dom_node_remove_event_listener_ns #define DOM_NODE_VTABLE \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_node_get_attributes, \ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_node_clone_node, \ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_node_set_prefix, \ _dom_node_get_local_name, \ _dom_node_has_attributes, \ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_node_get_text_content, \ _dom_node_set_text_content, \ _dom_node_is_same, \ _dom_node_lookup_prefix, \ _dom_node_is_default_namespace, \ _dom_node_lookup_namespace, \ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /* Following comes the protected vtable */ void _dom_node_destroy(struct dom_node_internal *node); dom_exception _dom_node_copy(struct dom_node_internal *old, struct dom_node_internal **copy); #define DOM_NODE_PROTECT_VTABLE \ _dom_node_destroy, \ _dom_node_copy /* The destroy API should be used inside DOM module */ static inline void dom_node_destroy(struct dom_node_internal *node) { ((dom_node_protect_vtable *) node->vtable)->destroy(node); } #define dom_node_destroy(n) dom_node_destroy((dom_node_internal *) (n)) /* Copy the Node old to new */ static inline dom_exception dom_node_copy(struct dom_node_internal *old, struct dom_node_internal **copy) { return ((dom_node_protect_vtable *) old->vtable)->copy(old, copy); } #define dom_node_copy(o,c) dom_node_copy((dom_node_internal *) (o), \ (dom_node_internal **) (c)) /* Following are some helper functions */ dom_exception _dom_node_copy_internal(dom_node_internal *old, dom_node_internal *new); #define dom_node_copy_internal(o, n) _dom_node_copy_internal( \ (dom_node_internal *) (o), (dom_node_internal *) (n)) #define dom_node_get_owner(n) ((dom_node_internal *) (n))->owner #define dom_node_set_owner(n, d) ((dom_node_internal *) (n))->owner = \ (struct dom_document *) (d) #define dom_node_get_parent(n) ((dom_node_internal *) (n))->parent #define dom_node_set_parent(n, p) ((dom_node_internal *) (n))->parent = \ (dom_node_internal *) (p) #define dom_node_get_refcount(n) ((dom_node_internal *) (n))->refcnt dom_exception _dom_merge_adjacent_text(dom_node_internal *p, dom_node_internal *n); /* Try to destroy the node, if its refcnt is not zero, then append it to the * owner document's pending list */ dom_exception _dom_node_try_destroy(dom_node_internal *node); /* To add some node to the pending list */ void _dom_node_mark_pending(dom_node_internal *node); #define dom_node_mark_pending(n) _dom_node_mark_pending(\ (dom_node_internal *) (n)) /* To remove the node from the pending list, this may happen when * a node is removed and then appended to another parent */ void _dom_node_remove_pending(dom_node_internal *node); #define dom_node_remove_pending(n) _dom_node_remove_pending(\ (dom_node_internal *) (n)) dom_exception _dom_node_dispatch_node_change_event(dom_document *doc, dom_node_internal *node, dom_node_internal *related, dom_mutation_type change, bool *success); #define dom_node_dispatch_node_change_event( \ doc, node, related, change, success) \ _dom_node_dispatch_node_change_event((dom_document *) (doc), \ (dom_node_internal *) (node), \ (dom_node_internal *) (related), \ (dom_mutation_type) (change), \ (bool *) (success)) #endif netsurf-all-3.2/libdom/src/core/nodelist.h0000644000175000017500000000242412377676745017615 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_nodelist_h_ #define dom_internal_core_nodelist_h_ #include #include struct dom_document; struct dom_node; struct dom_nodelist; /** * The NodeList type */ typedef enum { DOM_NODELIST_CHILDREN, DOM_NODELIST_BY_NAME, DOM_NODELIST_BY_NAMESPACE, DOM_NODELIST_BY_NAME_CASELESS, DOM_NODELIST_BY_NAMESPACE_CASELESS } nodelist_type; /* Create a nodelist */ dom_exception _dom_nodelist_create(struct dom_document *doc, nodelist_type type, struct dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname, struct dom_nodelist **list); /* Match a nodelist instance against a set of nodelist creation parameters */ bool _dom_nodelist_match(struct dom_nodelist *list, nodelist_type type, struct dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname); bool _dom_nodelist_equal(struct dom_nodelist *l1, struct dom_nodelist *l2); #define dom_nodelist_equal(l1, l2) _dom_nodelist_equal( \ (struct dom_nodelist *) (l1), (struct dom_nodelist *) (l2)) #endif netsurf-all-3.2/libdom/src/core/doc_fragment.h0000644000175000017500000000165212377676745020426 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_documentfragment_h_ #define dom_internal_core_documentfragment_h_ #include #include dom_exception _dom_document_fragment_create(dom_document *doc, dom_string *name, dom_string *value, dom_document_fragment **result); void _dom_document_fragment_destroy(dom_document_fragment *frag); #define _dom_document_fragment_initialise _dom_node_initialise #define _dom_document_fragment_finalise _dom_node_finalise /* Following comes the protected vtable */ void _dom_df_destroy(dom_node_internal *node); dom_exception _dom_df_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_DF_PROTECT_VTABLE \ _dom_df_destroy, \ _dom_df_copy #endif netsurf-all-3.2/libdom/src/core/namednodemap.c0000644000175000017500000002463712377676745020431 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include "core/document.h" #include "core/element.h" #include "core/namednodemap.h" #include "core/node.h" #include "utils/utils.h" /** * DOM named node map */ struct dom_namednodemap { dom_document *owner; /**< Owning document */ void *priv; /**< Private data */ struct nnm_operation *opt; /**< The underlaid operation * implementations */ uint32_t refcnt; /**< Reference count */ }; /** * Create a namednodemap * * \param doc The owning document * \param priv The private data of this dom_namednodemap * \param opt The operation function pointer * \param map Pointer to location to receive created map * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * ::head must be a node owned by ::doc and must be either an Element or * DocumentType node. * * If ::head is of type Element, ::type must be DOM_ATTRIBUTE_NODE * If ::head is of type DocumentType, ::type may be either * DOM_ENTITY_NODE or DOM_NOTATION_NODE. * * The returned map will already be referenced, so the client need not * explicitly reference it. The client must unref the map once it is * finished with it. */ dom_exception _dom_namednodemap_create(dom_document *doc, void *priv, struct nnm_operation *opt, dom_namednodemap **map) { dom_namednodemap *m; m = malloc(sizeof(dom_namednodemap)); if (m == NULL) return DOM_NO_MEM_ERR; m->owner = doc; m->priv = priv; m->opt = opt; m->refcnt = 1; *map = m; return DOM_NO_ERR; } /** * Claim a reference on a DOM named node map * * \param map The map to claim a reference on */ void dom_namednodemap_ref(dom_namednodemap *map) { assert(map != NULL); map->refcnt++; } /** * Release a reference on a DOM named node map * * \param map The map to release the reference from * * If the reference count reaches zero, any memory claimed by the * map will be released */ void dom_namednodemap_unref(dom_namednodemap *map) { if (map == NULL) return; if (--map->refcnt == 0) { /* Call the implementation specific destroy */ map->opt->namednodemap_destroy(map->priv); /* Destroy the map object */ free(map); } } /** * Retrieve the length of a named node map * * \param map Map to retrieve length of * \param length Pointer to location to receive length * \return DOM_NO_ERR. */ dom_exception dom_namednodemap_get_length(dom_namednodemap *map, uint32_t *length) { assert(map->opt != NULL); return map->opt->namednodemap_get_length(map->priv, length); } /** * Retrieve an item by name from a named node map * * \param map The map to retrieve the item from * \param name The name of the item to retrieve * \param node Pointer to location to receive item * \return DOM_NO_ERR. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_get_named_item(dom_namednodemap *map, dom_string *name, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_get_named_item(map->priv, name, node); } /** * Add a node to a named node map, replacing any matching existing node * * \param map The map to add to * \param arg The node to add * \param node Pointer to location to receive replaced node * \return DOM_NO_ERR on success, * DOM_WRONG_DOCUMENT_ERR if ::arg was created from a * different document than ::map, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly, * DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is * already an attribute on another * Element, * DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not * permitted as a member of ::map. * * ::arg's nodeName attribute will be used to store it in ::map. It will * be accessible using the nodeName attribute as the key for lookup. * * Replacing a node by itself has no effect. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_set_named_item(dom_namednodemap *map, dom_node *arg, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_set_named_item(map->priv, arg, node); } /** * Remove an item by name from a named node map * * \param map The map to remove from * \param name The name of the item to remove * \param node Pointer to location to receive removed item * \return DOM_NO_ERR on success, * DOM_NOT_FOUND_ERR if there is no node named ::name * in ::map, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_remove_named_item( dom_namednodemap *map, dom_string *name, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_remove_named_item(map->priv, name, node); } /** * Retrieve an item from a named node map * * \param map The map to retrieve the item from * \param index The map index to retrieve * \param node Pointer to location to receive item * \return DOM_NO_ERR. * * ::index is a zero-based index into ::map. * ::index lies in the range [0, length-1] * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_item(dom_namednodemap *map, uint32_t index, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_item(map->priv, index, node); } /** * Retrieve an item by namespace/localname from a named node map * * \param map The map to retrieve the item from * \param namespace The namespace URI of the item to retrieve * \param localname The local name of the node to retrieve * \param node Pointer to location to receive item * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support the * feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_get_named_item_ns( dom_namednodemap *map, dom_string *namespace, dom_string *localname, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_get_named_item_ns(map->priv, namespace, localname, node); } /** * Add a node to a named node map, replacing any matching existing node * * \param map The map to add to * \param arg The node to add * \param node Pointer to location to receive replaced node * \return DOM_NO_ERR on success, * DOM_WRONG_DOCUMENT_ERR if ::arg was created from a * different document than ::map, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly, * DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is * already an attribute on another * Element, * DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not * permitted as a member of ::map. * DOM_NOT_SUPPORTED_ERR if the implementation does not support the * feature "XML" and the language exposed * through the Document does not support * Namespaces. * * ::arg's namespaceURI and localName attributes will be used to store it in * ::map. It will be accessible using the namespaceURI and localName * attributes as the keys for lookup. * * Replacing a node by itself has no effect. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_set_named_item_ns( dom_namednodemap *map, dom_node *arg, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_set_named_item_ns(map->priv, arg, node); } /** * Remove an item by namespace/localname from a named node map * * \param map The map to remove from * \param namespace The namespace URI of the item to remove * \param localname The local name of the item to remove * \param node Pointer to location to receive removed item * \return DOM_NO_ERR on success, * DOM_NOT_FOUND_ERR if there is no node named ::name * in ::map, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly. * DOM_NOT_SUPPORTED_ERR if the implementation does not support the * feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_namednodemap_remove_named_item_ns( dom_namednodemap *map, dom_string *namespace, dom_string *localname, dom_node **node) { assert(map->opt != NULL); return map->opt->namednodemap_remove_named_item_ns(map->priv, namespace, localname, node); } /** * Compare whether two NamedNodeMap are equal. * */ bool _dom_namednodemap_equal(dom_namednodemap *m1, dom_namednodemap *m2) { assert(m1->opt != NULL); return (m1->opt == m2->opt && m1->opt->namednodemap_equal(m1->priv, m2->priv)); } /** * Update the dom_namednodemap to make it as a proxy of another object * * \param map The dom_namednodemap * \param priv The private data to change to */ void _dom_namednodemap_update(dom_namednodemap *map, void *priv) { map->priv = priv; } netsurf-all-3.2/libdom/src/core/document.h0000644000175000017500000002441512377676745017616 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_document_h_ #define dom_internal_core_document_h_ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "core/string.h" #include "core/node.h" #include "core/nodelist.h" #include "utils/hashtable.h" #include "utils/list.h" #include "events/document_event.h" struct dom_doc_nl; /** * DOM document * This should be protected, because later the HTMLDocument will inherit from * this. */ struct dom_document { dom_node_internal base; /**< Base node */ struct dom_doc_nl *nodelists; /**< List of active nodelists */ dom_string *uri; /**< The uri of this document */ struct list_entry pending_nodes; /**< The deletion pending list */ dom_string *id_name; /**< The ID attribute's name */ dom_string *class_string; /**< The string "class". */ dom_string *script_string; /**< The string "script". */ dom_document_event_internal dei; /**< The DocumentEvent interface */ dom_document_quirks_mode quirks; /**< Document is in quirks mode */ dom_string *_memo_empty; /**< The string ''. */ /* Memoised event strings */ dom_string *_memo_domnodeinserted; /**< DOMNodeInserted */ dom_string *_memo_domnoderemoved; /**< DOMNodeRemoved */ dom_string *_memo_domnodeinsertedintodocument; /**< DOMNodeInsertedIntoDocument */ dom_string *_memo_domnoderemovedfromdocument; /**< DOMNodeRemovedFromDocument */ dom_string *_memo_domattrmodified; /**< DOMAttrModified */ dom_string *_memo_domcharacterdatamodified; /**< DOMCharacterDataModified */ dom_string *_memo_domsubtreemodified; /**< DOMSubtreeModified */ }; /* Create a DOM document */ dom_exception _dom_document_create(dom_events_default_action_fetcher daf, void *daf_ctx, dom_document **doc); /* Initialise the document */ dom_exception _dom_document_initialise(dom_document *doc, dom_events_default_action_fetcher daf, void *daf_ctx); /* Finalise the document */ bool _dom_document_finalise(dom_document *doc); /* Begin the virtual functions */ dom_exception _dom_document_get_doctype(dom_document *doc, dom_document_type **result); dom_exception _dom_document_get_implementation(dom_document *doc, dom_implementation **result); dom_exception _dom_document_get_document_element(dom_document *doc, dom_element **result); dom_exception _dom_document_create_element(dom_document *doc, dom_string *tag_name, dom_element **result); dom_exception _dom_document_create_document_fragment(dom_document *doc, dom_document_fragment **result); dom_exception _dom_document_create_text_node(dom_document *doc, dom_string *data, dom_text **result); dom_exception _dom_document_create_comment(dom_document *doc, dom_string *data, dom_comment **result); dom_exception _dom_document_create_cdata_section(dom_document *doc, dom_string *data, dom_cdata_section **result); dom_exception _dom_document_create_processing_instruction( dom_document *doc, dom_string *target, dom_string *data, dom_processing_instruction **result); dom_exception _dom_document_create_attribute(dom_document *doc, dom_string *name, dom_attr **result); dom_exception _dom_document_create_entity_reference(dom_document *doc, dom_string *name, dom_entity_reference **result); dom_exception _dom_document_get_elements_by_tag_name(dom_document *doc, dom_string *tagname, dom_nodelist **result); dom_exception _dom_document_import_node(dom_document *doc, dom_node *node, bool deep, dom_node **result); dom_exception _dom_document_create_element_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_element **result); dom_exception _dom_document_create_attribute_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_attr **result); dom_exception _dom_document_get_elements_by_tag_name_ns( dom_document *doc, dom_string *namespace, dom_string *localname, dom_nodelist **result); dom_exception _dom_document_get_element_by_id(dom_document *doc, dom_string *id, dom_element **result); dom_exception _dom_document_get_input_encoding(dom_document *doc, dom_string **result); dom_exception _dom_document_get_xml_encoding(dom_document *doc, dom_string **result); dom_exception _dom_document_get_xml_standalone(dom_document *doc, bool *result); dom_exception _dom_document_set_xml_standalone(dom_document *doc, bool standalone); dom_exception _dom_document_get_xml_version(dom_document *doc, dom_string **result); dom_exception _dom_document_set_xml_version(dom_document *doc, dom_string *version); dom_exception _dom_document_get_strict_error_checking( dom_document *doc, bool *result); dom_exception _dom_document_set_strict_error_checking( dom_document *doc, bool strict); dom_exception _dom_document_get_uri(dom_document *doc, dom_string **result); dom_exception _dom_document_set_uri(dom_document *doc, dom_string *uri); dom_exception _dom_document_adopt_node(dom_document *doc, dom_node *node, dom_node **result); dom_exception _dom_document_get_dom_config(dom_document *doc, struct dom_configuration **result); dom_exception _dom_document_normalize(dom_document *doc); dom_exception _dom_document_rename_node(dom_document *doc, dom_node *node, dom_string *namespace, dom_string *qname, dom_node **result); dom_exception _dom_document_get_quirks_mode(dom_document *doc, dom_document_quirks_mode *result); dom_exception _dom_document_set_quirks_mode(dom_document *doc, dom_document_quirks_mode result); dom_exception _dom_document_get_text_content(dom_node_internal *node, dom_string **result); dom_exception _dom_document_set_text_content(dom_node_internal *node, dom_string *content); #define DOM_DOCUMENT_VTABLE \ _dom_document_get_doctype, \ _dom_document_get_implementation, \ _dom_document_get_document_element, \ _dom_document_create_element, \ _dom_document_create_document_fragment, \ _dom_document_create_text_node, \ _dom_document_create_comment, \ _dom_document_create_cdata_section, \ _dom_document_create_processing_instruction, \ _dom_document_create_attribute, \ _dom_document_create_entity_reference, \ _dom_document_get_elements_by_tag_name, \ _dom_document_import_node, \ _dom_document_create_element_ns, \ _dom_document_create_attribute_ns, \ _dom_document_get_elements_by_tag_name_ns, \ _dom_document_get_element_by_id, \ _dom_document_get_input_encoding, \ _dom_document_get_xml_encoding, \ _dom_document_get_xml_standalone, \ _dom_document_set_xml_standalone, \ _dom_document_get_xml_version, \ _dom_document_set_xml_version, \ _dom_document_get_strict_error_checking, \ _dom_document_set_strict_error_checking, \ _dom_document_get_uri, \ _dom_document_set_uri, \ _dom_document_adopt_node, \ _dom_document_get_dom_config, \ _dom_document_normalize, \ _dom_document_rename_node, \ _dom_document_get_quirks_mode, \ _dom_document_set_quirks_mode /* End of vtable */ #define DOM_NODE_VTABLE_DOCUMENT \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_node_get_attributes, \ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_node_clone_node, \ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_node_set_prefix, \ _dom_node_get_local_name, \ _dom_node_has_attributes, \ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_document_get_text_content, \ _dom_document_set_text_content, \ _dom_node_is_same, \ _dom_node_lookup_prefix, \ _dom_node_is_default_namespace, \ _dom_node_lookup_namespace, \ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /** \todo Unused! */ /** * The internal used vtable for document */ struct dom_document_protected_vtable { struct dom_node_protect_vtable base; dom_exception (*dom_document_get_base)(dom_document *doc, dom_string **base_uri); /* Get the document's base uri */ }; typedef struct dom_document_protected_vtable dom_document_protected_vtable; /* Get the document's base URI */ static inline dom_exception dom_document_get_base(dom_document *doc, dom_string **base_uri) { dom_node_internal *node = (dom_node_internal *) doc; return ((dom_document_protected_vtable *) node->vtable)-> dom_document_get_base(doc, base_uri); } #define dom_document_get_base(d, b) dom_document_get_base( \ (dom_document *) (d), (dom_string **) (b)) /* Following comes the protected vtable */ void _dom_document_destroy(dom_node_internal *node); dom_exception _dom_document_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_DOCUMENT_PROTECT_VTABLE \ _dom_document_destroy, \ _dom_document_copy /*---------------------------- Helper functions ---------------------------*/ /* Try to destroy the document: * When the refcnt is zero and the pending list is empty, we can destroy this * document. */ void _dom_document_try_destroy(dom_document *doc); /* Get a nodelist, creating one if necessary */ dom_exception _dom_document_get_nodelist(dom_document *doc, nodelist_type type, dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname, dom_nodelist **list); /* Remove a nodelist */ void _dom_document_remove_nodelist(dom_document *doc, dom_nodelist *list); /* Find element with certain ID in the subtree rooted at root */ dom_exception _dom_find_element_by_id(dom_node_internal *root, dom_string *id, dom_element **result); /* Set the ID attribute name of this document */ void _dom_document_set_id_name(dom_document *doc, dom_string *name); #define _dom_document_get_id_name(d) (d->id_name) #endif netsurf-all-3.2/libdom/src/core/attr.h0000644000175000017500000000754112377676745016753 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_attr_h_ #define dom_internal_core_attr_h_ #include struct dom_document; struct dom_type_info; dom_exception _dom_attr_create(struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, bool specified, struct dom_attr **result); void _dom_attr_destroy(struct dom_attr *attr); dom_exception _dom_attr_initialise(struct dom_attr *a, struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, bool specified, struct dom_attr **result); void _dom_attr_finalise(struct dom_attr *attr); /* Virtual functions for dom_attr */ dom_exception _dom_attr_get_name(struct dom_attr *attr, dom_string **result); dom_exception _dom_attr_get_specified(struct dom_attr *attr, bool *result); dom_exception _dom_attr_get_value(struct dom_attr *attr, dom_string **result); dom_exception _dom_attr_set_value(struct dom_attr *attr, dom_string *value); dom_exception _dom_attr_get_owner(struct dom_attr *attr, struct dom_element **result); dom_exception _dom_attr_get_schema_type_info(struct dom_attr *attr, struct dom_type_info **result); dom_exception _dom_attr_is_id(struct dom_attr *attr, bool *result); #define DOM_ATTR_VTABLE \ _dom_attr_get_name, \ _dom_attr_get_specified, \ _dom_attr_get_value, \ _dom_attr_set_value, \ _dom_attr_get_owner, \ _dom_attr_get_schema_type_info, \ _dom_attr_is_id /* Overloading dom_node functions */ dom_exception _dom_attr_get_node_value(dom_node_internal *node, dom_string **result); dom_exception _dom_attr_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result); dom_exception _dom_attr_set_prefix(dom_node_internal *node, dom_string *prefix); dom_exception _dom_attr_normalize(dom_node_internal *node); dom_exception _dom_attr_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result); dom_exception _dom_attr_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result); dom_exception _dom_attr_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result); #define DOM_NODE_VTABLE_ATTR \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_attr_get_node_value, /*overload*/\ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_node_get_attributes, \ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_attr_clone_node, /*overload*/\ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_attr_set_prefix, /*overload*/\ _dom_node_get_local_name, \ _dom_node_has_attributes, \ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_node_get_text_content, \ _dom_node_set_text_content, \ _dom_node_is_same, \ _dom_attr_lookup_prefix, /*overload*/\ _dom_attr_is_default_namespace, /*overload*/\ _dom_attr_lookup_namespace, /*overload*/\ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /* The protected virtual functions */ void __dom_attr_destroy(dom_node_internal *node); dom_exception _dom_attr_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_ATTR_PROTECT_VTABLE \ __dom_attr_destroy, \ _dom_attr_copy void _dom_attr_set_isid(struct dom_attr *attr, bool is_id); void _dom_attr_set_specified(struct dom_attr *attr, bool specified); bool _dom_attr_readonly(const dom_attr *a); #endif netsurf-all-3.2/libdom/src/core/pi.c0000644000175000017500000000547712377676745016412 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include "core/document.h" #include "core/node.h" #include "core/pi.h" #include "utils/utils.h" /** * A DOM processing instruction */ struct dom_processing_instruction { dom_node_internal base; /**< Base node */ }; static struct dom_node_vtable pi_vtable = { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE }; static struct dom_node_protect_vtable pi_protect_vtable = { DOM_PI_PROTECT_VTABLE }; /** * Create a processing instruction * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_processing_instruction_create(dom_document *doc, dom_string *name, dom_string *value, dom_processing_instruction **result) { dom_processing_instruction *p; dom_exception err; /* Allocate the comment node */ p = malloc(sizeof(dom_processing_instruction)); if (p == NULL) return DOM_NO_MEM_ERR; p->base.base.vtable = &pi_vtable; p->base.vtable = &pi_protect_vtable; /* And initialise the node */ err = _dom_processing_instruction_initialise(&p->base, doc, DOM_PROCESSING_INSTRUCTION_NODE, name, value, NULL, NULL); if (err != DOM_NO_ERR) { free(p); return err; } *result = p; return DOM_NO_ERR; } /** * Destroy a processing instruction * * \param pi The processing instruction to destroy * * The contents of ::pi will be destroyed and ::pi will be freed. */ void _dom_processing_instruction_destroy(dom_processing_instruction *pi) { /* Finalise base class */ _dom_processing_instruction_finalise(&pi->base); /* Free processing instruction */ free(pi); } /*-----------------------------------------------------------------------*/ /* Following comes the protected vtable */ /* The virtual destroy function of this class */ void _dom_pi_destroy(dom_node_internal *node) { _dom_processing_instruction_destroy( (dom_processing_instruction *) node); } /* The copy constructor of this class */ dom_exception _dom_pi_copy(dom_node_internal *old, dom_node_internal **copy) { dom_processing_instruction *new_pi; dom_exception err; new_pi = malloc(sizeof(dom_processing_instruction)); if (new_pi == NULL) return DOM_NO_MEM_ERR; err = dom_node_copy_internal(old, new_pi); if (err != DOM_NO_ERR) { free(new_pi); return err; } *copy = (dom_node_internal *) copy; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/element.c0000644000175000017500000020370012377676745017420 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include #include #include #include #include #include #include "core/attr.h" #include "core/document.h" #include "core/element.h" #include "core/node.h" #include "core/namednodemap.h" #include "utils/validate.h" #include "utils/namespace.h" #include "utils/utils.h" #include "utils/list.h" #include "events/mutation_event.h" struct dom_element_vtable _dom_element_vtable = { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE_ELEMENT }, DOM_ELEMENT_VTABLE }; static struct dom_element_protected_vtable element_protect_vtable = { { DOM_NODE_PROTECT_VTABLE_ELEMENT }, DOM_ELEMENT_PROTECT_VTABLE }; typedef struct dom_attr_list { struct list_entry list; /**< Linked list links to prev/next entries */ struct dom_attr *attr; struct dom_string *name; struct dom_string *namespace; } dom_attr_list; /** * Destroy element's class cache * * \param ele The element */ static void _dom_element_destroy_classes(struct dom_element *ele) { /* Destroy the pre-separated class names */ if (ele->classes != NULL) { unsigned int class; for (class = 0; class < ele->n_classes; class++) { lwc_string_unref(ele->classes[class]); } free(ele->classes); } ele->n_classes = 0; ele->classes = NULL; } /** * Create element's class cache from class attribute value * * \param ele The element * \param value The class attribute value * * Destroys any existing cached classes. */ static dom_exception _dom_element_create_classes(struct dom_element *ele, const char *value) { const char *pos; lwc_string **classes = NULL; uint32_t n_classes = 0; /* Any existing cached classes are replaced; destroy them */ _dom_element_destroy_classes(ele); /* Count number of classes */ for (pos = value; *pos != '\0'; ) { if (*pos != ' ') { while (*pos != ' ' && *pos != '\0') pos++; n_classes++; } else { while (*pos == ' ') pos++; } } /* If there are some, unpack them */ if (n_classes > 0) { classes = malloc(n_classes * sizeof(lwc_string *)); if (classes == NULL) return DOM_NO_MEM_ERR; for (pos = value, n_classes = 0; *pos != '\0'; ) { if (*pos != ' ') { const char *s = pos; while (*pos != ' ' && *pos != '\0') pos++; if (lwc_intern_string(s, pos - s, &classes[n_classes++]) != lwc_error_ok) goto error; } else { while (*pos == ' ') pos++; } } } ele->n_classes = n_classes; ele->classes = classes; return DOM_NO_ERR; error: while (n_classes > 0) lwc_string_unref(classes[--n_classes]); free(classes); return DOM_NO_MEM_ERR; } /* Attribute linked list releated functions */ /** * Get the next attribute in the list * * \param n The attribute list node * \return The next attribute node */ static dom_attr_list * _dom_element_attr_list_next(const dom_attr_list *n) { return (dom_attr_list *)(n->list.next); } /** * Unlink an attribute list node from its linked list * * \param n The attribute list node */ static void _dom_element_attr_list_node_unlink(dom_attr_list *n) { if (n == NULL) return; list_del(&n->list); } /** * Insert attribute list node into attribute list * * \param list The list header * \param new_attr The attribute node to insert */ static void _dom_element_attr_list_insert(dom_attr_list *list, dom_attr_list *new_attr) { assert(list != NULL); assert(new_attr != NULL); list_append(&list->list, &new_attr->list); } /** * Get attribute from attribute list, which matches given name * * \param list The attribute list to search * \param name The name of the attribute to search for * \param name The namespace of the attribute to search for (may be NULL) * \return the matching attribute, or NULL if none found */ static dom_attr_list * _dom_element_attr_list_find_by_name( dom_attr_list *list, dom_string *name, dom_string *namespace) { dom_attr_list *attr = list; if (list == NULL || name == NULL) return NULL; do { if (((namespace == NULL && attr->namespace == NULL) || (namespace != NULL && attr->namespace != NULL && dom_string_isequal(namespace, attr->namespace))) && dom_string_isequal(name, attr->name)) { /* Both have NULL namespace or matching namespace, * and both have same name */ return attr; } attr = _dom_element_attr_list_next(attr); assert(attr != NULL); } while (attr != list); return NULL; } /** * Get the number of elements in this attribute list * * \param list The attribute list * \return the number attribute list node elements */ static unsigned int _dom_element_attr_list_length(dom_attr_list *list) { dom_attr_list *attr = list; unsigned int count = 0; if (list == NULL) return count; do { count++; attr = _dom_element_attr_list_next(attr); } while (attr != list); return count; } /** * Get the attribute list node at the given index * * \param list The attribute list * \param index The index number * \return the attribute list node at given index */ static dom_attr_list * _dom_element_attr_list_get_by_index(dom_attr_list *list, unsigned int index) { dom_attr_list *attr = list; if (list == NULL) return NULL; do { if (--index == 0) return attr; attr = _dom_element_attr_list_next(attr); } while (attr != list); return NULL; } /** * Destroy an attribute list node, and its attribute * * \param n The attribute list node to destroy */ static void _dom_element_attr_list_node_destroy(dom_attr_list *n) { dom_node_internal *a; dom_document *doc; assert(n != NULL); assert(n->attr != NULL); assert(n->name != NULL); a = (dom_node_internal *) n->attr; /* Need to destroy classes cache, when removing class attribute */ doc = a->owner; if (n->namespace == NULL && dom_string_isequal(n->name, doc->class_string)) { _dom_element_destroy_classes((dom_element *)(a->parent)); } /* Destroy rest of list node */ dom_string_unref(n->name); if (n->namespace != NULL) dom_string_unref(n->namespace); a->parent = NULL; dom_node_try_destroy(a); free(n); } /** * Create an attribute list node * * \param attr The attribute to create a list node for * \param name The attribute name * \param namespace The attribute namespace (may be NULL) * \return the new attribute list node, or NULL on failure */ static dom_attr_list * _dom_element_attr_list_node_create(dom_attr *attr, dom_element *ele, dom_string *name, dom_string *namespace) { dom_attr_list *new_list_node; dom_node_internal *a; dom_document *doc; if (attr == NULL || name == NULL) return NULL; new_list_node = malloc(sizeof(*new_list_node)); if (new_list_node == NULL) return NULL; list_init(&new_list_node->list); new_list_node->attr = attr; new_list_node->name = name; new_list_node->namespace = namespace; a = (dom_node_internal *) attr; doc = a->owner; if (namespace == NULL && dom_string_isequal(name, doc->class_string)) { dom_string *value; if (DOM_NO_ERR != _dom_attr_get_value(attr, &value)) { _dom_element_attr_list_node_destroy(new_list_node); return NULL; } if (DOM_NO_ERR != _dom_element_create_classes(ele, dom_string_data(value))) { _dom_element_attr_list_node_destroy(new_list_node); dom_string_unref(value); return NULL; } dom_string_unref(value); } return new_list_node; } /** * Destroy an entire attribute list, and its attributes * * \param list The attribute list to destroy */ static void _dom_element_attr_list_destroy(dom_attr_list *list) { dom_attr_list *attr = list; dom_attr_list *next = list; if (list == NULL) return; do { attr = next; next = _dom_element_attr_list_next(attr); _dom_element_attr_list_node_unlink(attr); _dom_element_attr_list_node_destroy(attr); } while (next != attr); return; } /** * Clone an attribute list node, and its attribute * * \param n The attribute list node to clone * \param newe Element to clone attribute for * \return the new attribute list node, or NULL on failure */ static dom_attr_list *_dom_element_attr_list_node_clone(dom_attr_list *n, dom_element *newe) { dom_attr *clone = NULL; dom_attr_list *new_list_node; dom_exception err; assert(n != NULL); assert(n->attr != NULL); assert(n->name != NULL); new_list_node = malloc(sizeof(*new_list_node)); if (new_list_node == NULL) return NULL; list_init(&new_list_node->list); new_list_node->name = NULL; new_list_node->namespace = NULL; err = dom_node_clone_node(n->attr, true, (void *) &clone); if (err != DOM_NO_ERR) { free(new_list_node); return NULL; } dom_node_set_parent(clone, newe); dom_node_remove_pending(clone); dom_node_unref(clone); new_list_node->attr = clone; if (n->name != NULL) new_list_node->name = dom_string_ref(n->name); if (n->namespace != NULL) new_list_node->namespace = dom_string_ref(n->namespace); return new_list_node; } /** * Clone an entire attribute list, and its attributes * * \param list The attribute list to clone * \param newe Element to clone list for * \return the new attribute list, or NULL on failure */ static dom_attr_list *_dom_element_attr_list_clone(dom_attr_list *list, dom_element *newe) { dom_attr_list *attr = list; dom_attr_list *new_list = NULL; dom_attr_list *new_list_node = NULL; if (list == NULL) return NULL; do { new_list_node = _dom_element_attr_list_node_clone(attr, newe); if (new_list_node == NULL) { if (new_list != NULL) _dom_element_attr_list_destroy(new_list); return NULL; } if (new_list == NULL) { new_list = new_list_node; } else { _dom_element_attr_list_insert(new_list, new_list_node); } attr = _dom_element_attr_list_next(attr); } while (attr != list); return new_list; } static dom_exception _dom_element_get_attr(struct dom_element *element, dom_string *namespace, dom_string *name, dom_string **value); static dom_exception _dom_element_set_attr(struct dom_element *element, dom_string *namespace, dom_string *name, dom_string *value); static dom_exception _dom_element_remove_attr(struct dom_element *element, dom_string *namespace, dom_string *name); static dom_exception _dom_element_get_attr_node(struct dom_element *element, dom_string *namespace, dom_string *name, struct dom_attr **result); static dom_exception _dom_element_set_attr_node(struct dom_element *element, dom_string *namespace, struct dom_attr *attr, struct dom_attr **result); static dom_exception _dom_element_remove_attr_node(struct dom_element *element, dom_string *namespace, struct dom_attr *attr, struct dom_attr **result); static dom_exception _dom_element_has_attr(struct dom_element *element, dom_string *namespace, dom_string *name, bool *result); static dom_exception _dom_element_set_id_attr(struct dom_element *element, dom_string *namespace, dom_string *name, bool is_id); /* The operation set for namednodemap */ static dom_exception attributes_get_length(void *priv, uint32_t *length); static dom_exception attributes_get_named_item(void *priv, dom_string *name, struct dom_node **node); static dom_exception attributes_set_named_item(void *priv, struct dom_node *arg, struct dom_node **node); static dom_exception attributes_remove_named_item( void *priv, dom_string *name, struct dom_node **node); static dom_exception attributes_item(void *priv, uint32_t index, struct dom_node **node); static dom_exception attributes_get_named_item_ns( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node); static dom_exception attributes_set_named_item_ns( void *priv, struct dom_node *arg, struct dom_node **node); static dom_exception attributes_remove_named_item_ns( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node); static void attributes_destroy(void *priv); static bool attributes_equal(void *p1, void *p2); static struct nnm_operation attributes_opt = { attributes_get_length, attributes_get_named_item, attributes_set_named_item, attributes_remove_named_item, attributes_item, attributes_get_named_item_ns, attributes_set_named_item_ns, attributes_remove_named_item_ns, attributes_destroy, attributes_equal }; /*----------------------------------------------------------------------*/ /* Constructors and Destructors */ /** * Create an element node * * \param doc The owning document * \param name The (local) name of the node to create * \param namespace The namespace URI of the element, or NULL * \param prefix The namespace prefix of the element, or NULL * \param result Pointer to location to receive created element * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::name is invalid, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name, ::namespace and ::prefix will have their * reference counts increased. * * The returned element will already be referenced. */ dom_exception _dom_element_create(struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, struct dom_element **result) { /* Allocate the element */ *result = malloc(sizeof(struct dom_element)); if (*result == NULL) return DOM_NO_MEM_ERR; /* Initialise the vtables */ (*result)->base.base.vtable = &_dom_element_vtable; (*result)->base.vtable = &element_protect_vtable; return _dom_element_initialise(doc, *result, name, namespace, prefix); } /** * Initialise an element node * * \param doc The owning document * \param el The element * \param name The (local) name of the node to create * \param namespace The namespace URI of the element, or NULL * \param prefix The namespace prefix of the element, or NULL * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::name is invalid, * DOM_NO_MEM_ERR on memory exhaustion. * * The caller should make sure that ::name is a valid NCName. * * ::doc, ::name, ::namespace and ::prefix will have their * reference counts increased. * * The returned element will already be referenced. */ dom_exception _dom_element_initialise(struct dom_document *doc, struct dom_element *el, dom_string *name, dom_string *namespace, dom_string *prefix) { dom_exception err; assert(doc != NULL); el->attributes = NULL; /* Initialise the base class */ err = _dom_node_initialise(&el->base, doc, DOM_ELEMENT_NODE, name, NULL, namespace, prefix); if (err != DOM_NO_ERR) { free(el); return err; } /* Perform our type-specific initialisation */ el->id_ns = NULL; el->id_name = NULL; el->schema_type_info = NULL; el->n_classes = 0; el->classes = NULL; return DOM_NO_ERR; } /** * Finalise a dom_element * * \param ele The element */ void _dom_element_finalise(struct dom_element *ele) { /* Destroy attributes attached to this node */ if (ele->attributes != NULL) { _dom_element_attr_list_destroy(ele->attributes); ele->attributes = NULL; } if (ele->schema_type_info != NULL) { /** \todo destroy schema type info */ } /* Destroy the pre-separated class names */ _dom_element_destroy_classes(ele); /* Finalise base class */ _dom_node_finalise(&ele->base); } /** * Destroy an element * * \param element The element to destroy * * The contents of ::element will be destroyed and ::element will be freed. */ void _dom_element_destroy(struct dom_element *element) { _dom_element_finalise(element); /* Free the element */ free(element); } /*----------------------------------------------------------------------*/ /* The public virtual functions */ /** * Retrieve an element's tag name * * \param element The element to retrieve the name from * \param name Pointer to location to receive name * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_element_get_tag_name(struct dom_element *element, dom_string **name) { /* This is the same as nodeName */ return dom_node_get_node_name((struct dom_node *) element, name); } /** * Retrieve an attribute from an element by name * * \param element The element to retrieve attribute from * \param name The attribute's name * \param value Pointer to location to receive attribute's value * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_element_get_attribute(struct dom_element *element, dom_string *name, dom_string **value) { return _dom_element_get_attr(element, NULL, name, value); } /** * Set an attribute on an element by name * * \param element The element to set attribute on * \param name The attribute's name * \param value The attribute's value * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::name is invalid, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_set_attribute(struct dom_element *element, dom_string *name, dom_string *value) { return _dom_element_set_attr(element, NULL, name, value); } /** * Remove an attribute from an element by name * * \param element The element to remove attribute from * \param name The name of the attribute to remove * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_remove_attribute(struct dom_element *element, dom_string *name) { return _dom_element_remove_attr(element, NULL, name); } /** * Retrieve an attribute node from an element by name * * \param element The element to retrieve attribute node from * \param name The attribute's name * \param result Pointer to location to receive attribute node * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_get_attribute_node(struct dom_element *element, dom_string *name, struct dom_attr **result) { return _dom_element_get_attr_node(element, NULL, name, result); } /** * Set an attribute node on an element, replacing existing node, if present * * \param element The element to add a node to * \param attr The attribute node to add * \param result Pointer to location to receive previous node * \return DOM_NO_ERR on success, * DOM_WRONG_DOCUMENT_ERR if ::attr does not belong to the * same document as ::element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_INUSE_ATTRIBUTE_ERR if ::attr is already an attribute * of another Element node. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_set_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result) { return _dom_element_set_attr_node(element, NULL, attr, result); } /** * Remove an attribute node from an element * * \param element The element to remove attribute node from * \param attr The attribute node to remove * \param result Pointer to location to receive attribute node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_FOUND_ERR if ::attr is not an attribute of * ::element. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_remove_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result) { return _dom_element_remove_attr_node(element, NULL, attr, result); } /** * Retrieve a list of descendant elements of an element which match a given * tag name * * \param element The root of the subtree to search * \param name The tag name to match (or "*" for all tags) * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned nodelist will have its reference count increased. It is * the responsibility of the caller to unref the nodelist once it has * finished with it. */ dom_exception _dom_element_get_elements_by_tag_name( struct dom_element *element, dom_string *name, struct dom_nodelist **result) { dom_exception err; dom_node_internal *base = (dom_node_internal *) element; assert(base->owner != NULL); err = _dom_document_get_nodelist(base->owner, DOM_NODELIST_BY_NAME, (struct dom_node_internal *) element, name, NULL, NULL, result); return err; } /** * Retrieve an attribute from an element by namespace/localname * * \param element The element to retrieve attribute from * \param namespace The attribute's namespace URI, or NULL * \param localname The attribute's local name * \param value Pointer to location to receive attribute's value * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support * the feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_element_get_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, dom_string **value) { return _dom_element_get_attr(element, namespace, localname, value); } /** * Set an attribute on an element by namespace/qualified name * * \param element The element to set attribute on * \param namespace The attribute's namespace URI * \param qname The attribute's qualified name * \param value The attribute's value * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::qname is invalid, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NAMESPACE_ERR if ::qname is malformed, or * ::qname has a prefix and * ::namespace is null, or ::qname * has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" * and ::namespace is not * "http://www.w3.org/2000/xmlns", * or ::namespace is * "http://www.w3.org/2000/xmlns" * and ::qname is not prefixed * "xmlns", * DOM_NOT_SUPPORTED_ERR if the implementation does not * support the feature "XML" and the * language exposed through the * Document does not support * Namespaces. */ dom_exception _dom_element_set_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *qname, dom_string *value) { dom_exception err; dom_string *localname; dom_string *prefix; if (_dom_validate_name(qname) == false) return DOM_INVALID_CHARACTER_ERR; err = _dom_namespace_validate_qname(qname, namespace); if (err != DOM_NO_ERR) return DOM_NAMESPACE_ERR; err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) return err; /* If there is no namespace, must have a prefix */ if (namespace == NULL && prefix != NULL) { dom_string_unref(prefix); dom_string_unref(localname); return DOM_NAMESPACE_ERR; } err = _dom_element_set_attr(element, namespace, localname, value); dom_string_unref(prefix); dom_string_unref(localname); return err; } /** * Remove an attribute from an element by namespace/localname * * \param element The element to remove attribute from * \param namespace The attribute's namespace URI * \param localname The attribute's local name * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_SUPPORTED_ERR if the implementation does not * support the feature "XML" and the * language exposed through the * Document does not support * Namespaces. */ dom_exception _dom_element_remove_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname) { return _dom_element_remove_attr(element, namespace, localname); } /** * Retrieve an attribute node from an element by namespace/localname * * \param element The element to retrieve attribute from * \param namespace The attribute's namespace URI * \param localname The attribute's local name * \param result Pointer to location to receive attribute node * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support * the feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_get_attribute_node_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_attr **result) { return _dom_element_get_attr_node(element, namespace, localname, result); } /** * Set an attribute node on an element, replacing existing node, if present * * \param element The element to add a node to * \param attr The attribute node to add * \param result Pointer to location to recieve previous node * \return DOM_NO_ERR on success, * DOM_WRONG_DOCUMENT_ERR if ::attr does not belong to the * same document as ::element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_INUSE_ATTRIBUTE_ERR if ::attr is already an attribute * of another Element node. * DOM_NOT_SUPPORTED_ERR if the implementation does not * support the feature "XML" and the * language exposed through the * Document does not support * Namespaces. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_set_attribute_node_ns(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result) { dom_exception err; dom_string *namespace; err = dom_node_get_namespace(attr, (void *) &namespace); if (err != DOM_NO_ERR) return err; err = _dom_element_set_attr_node(element, namespace, attr, result); if (namespace != NULL) dom_string_unref(namespace); return err; } /** * Retrieve a list of descendant elements of an element which match a given * namespace/localname pair. * * \param element The root of the subtree to search * \param namespace The namespace URI to match (or "*" for all) * \param localname The local name to match (or "*" for all) * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support * the feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned nodelist will have its reference count increased. It is * the responsibility of the caller to unref the nodelist once it has * finished with it. */ dom_exception _dom_element_get_elements_by_tag_name_ns( struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_nodelist **result) { dom_exception err; /** \todo ensure XML feature is supported */ err = _dom_document_get_nodelist(element->base.owner, DOM_NODELIST_BY_NAMESPACE, (struct dom_node_internal *) element, NULL, namespace, localname, result); return err; } /** * Determine if an element possesses and attribute with the given name * * \param element The element to query * \param name The attribute name to look for * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_element_has_attribute(struct dom_element *element, dom_string *name, bool *result) { return _dom_element_has_attr(element, NULL, name, result); } /** * Determine if an element possesses and attribute with the given * namespace/localname pair. * * \param element The element to query * \param namespace The attribute namespace URI to look for * \param localname The attribute local name to look for * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support * the feature "XML" and the language exposed * through the Document does not support * Namespaces. */ dom_exception _dom_element_has_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, bool *result) { return _dom_element_has_attr(element, namespace, localname, result); } /** * Retrieve the type information associated with an element * * \param element The element to retrieve type information from * \param result Pointer to location to receive type information * \return DOM_NO_ERR. * * The returned typeinfo will have its reference count increased. It is * the responsibility of the caller to unref the typeinfo once it has * finished with it. */ dom_exception _dom_element_get_schema_type_info(struct dom_element *element, struct dom_type_info **result) { UNUSED(element); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * (Un)declare an attribute as being an element's ID by name * * \param element The element containing the attribute * \param name The attribute's name * \param is_id Whether the attribute is an ID * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_FOUND_ERR if the specified node is not an * attribute of ::element. * * @note: The DOM spec does not say: how to deal with when there are two or * more isId attribute nodes. Here, the implementation just maintain only * one such attribute node. */ dom_exception _dom_element_set_id_attribute(struct dom_element *element, dom_string *name, bool is_id) { return _dom_element_set_id_attr(element, NULL, name, is_id); } /** * (Un)declare an attribute as being an element's ID by namespace/localname * * \param element The element containing the attribute * \param namespace The attribute's namespace URI * \param localname The attribute's local name * \param is_id Whether the attribute is an ID * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_FOUND_ERR if the specified node is not an * attribute of ::element. */ dom_exception _dom_element_set_id_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, bool is_id) { dom_exception err; err = _dom_element_set_id_attr(element, namespace, localname, is_id); element->id_ns = dom_string_ref(namespace); return err; } /** * (Un)declare an attribute node as being an element's ID * * \param element The element containing the attribute * \param id_attr The attribute node * \param is_id Whether the attribute is an ID * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_FOUND_ERR if the specified node is not an * attribute of ::element. */ dom_exception _dom_element_set_id_attribute_node(struct dom_element *element, struct dom_attr *id_attr, bool is_id) { dom_exception err; dom_string *namespace; dom_string *localname; err = dom_node_get_namespace(id_attr, &namespace); if (err != DOM_NO_ERR) return err; err = dom_node_get_local_name(id_attr, &localname); if (err != DOM_NO_ERR) return err; err = _dom_element_set_id_attr(element, namespace, localname, is_id); if (err != DOM_NO_ERR) return err; element->id_ns = namespace; return DOM_NO_ERR; } /** * Obtain a pre-parsed array of class names for an element * * \param element Element containing classes * \param classes Pointer to location to receive libdom-owned array * \param n_classes Pointer to location to receive number of classes * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion */ dom_exception _dom_element_get_classes(struct dom_element *element, lwc_string ***classes, uint32_t *n_classes) { if (element->n_classes > 0) { uint32_t classnr; *classes = element->classes; *n_classes = element->n_classes; for (classnr = 0; classnr < element->n_classes; classnr++) lwc_string_ref((*classes)[classnr]); } else { *n_classes = 0; *classes = NULL; } return DOM_NO_ERR; } /** * Determine if an element has an associated class * * \param element Element to consider * \param name Class name to look for * \param match Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_element_has_class(struct dom_element *element, lwc_string *name, bool *match) { dom_exception err; unsigned int class; struct dom_node_internal *node = (struct dom_node_internal *)element; dom_document_quirks_mode quirks_mode; /* Short-circuit case where we have no classes */ if (element->n_classes == 0) { *match = false; return DOM_NO_ERR; } err = dom_document_get_quirks_mode(node->owner, &quirks_mode); if (err != DOM_NO_ERR) return err; if (quirks_mode != DOM_DOCUMENT_QUIRKS_MODE_NONE) { /* Quirks mode: case insensitively match */ for (class = 0; class < element->n_classes; class++) { if (lwc_error_ok == lwc_string_caseless_isequal(name, element->classes[class], match) && *match == true) return DOM_NO_ERR; } } else { /* Standards mode: case sensitively match */ for (class = 0; class < element->n_classes; class++) { if (lwc_error_ok == lwc_string_isequal(name, element->classes[class], match) && *match == true) return DOM_NO_ERR; } } return DOM_NO_ERR; } /** * Get a named ancestor node * * \param element Element to consider * \param name Node name to look for * \param ancestor Pointer to location to receive node pointer * \return DOM_NO_ERR. */ dom_exception dom_element_named_ancestor_node(dom_element *element, lwc_string *name, dom_element **ancestor) { dom_node_internal *node = (dom_node_internal *)element; *ancestor = NULL; for (node = node->parent; node != NULL; node = node->parent) { if (node->type != DOM_ELEMENT_NODE) continue; assert(node->name != NULL); if (dom_string_caseless_lwc_isequal(node->name, name)) { *ancestor = (dom_element *)node; break; } } return DOM_NO_ERR; } /** * Get a named parent node * * \param element Element to consider * \param name Node name to look for * \param parent Pointer to location to receive node pointer * \return DOM_NO_ERR. */ dom_exception dom_element_named_parent_node(dom_element *element, lwc_string *name, dom_element **parent) { dom_node_internal *node = (dom_node_internal *)element; *parent = NULL; for (node = node->parent; node != NULL; node = node->parent) { if (node->type != DOM_ELEMENT_NODE) continue; assert(node->name != NULL); if (dom_string_caseless_lwc_isequal(node->name, name)) { *parent = (dom_element *)node; } break; } return DOM_NO_ERR; } /** * Get a named parent node * * \param element Element to consider * \param name Node name to look for * \param parent Pointer to location to receive node pointer * \return DOM_NO_ERR. */ dom_exception dom_element_parent_node(dom_element *element, dom_element **parent) { dom_node_internal *node = (dom_node_internal *)element; *parent = NULL; for (node = node->parent; node != NULL; node = node->parent) { if (node->type != DOM_ELEMENT_NODE) continue; *parent = (dom_element *)node; break; } return DOM_NO_ERR; } /*------------- The overload virtual functions ------------------------*/ /* Overload function of Node, please refer src/core/node.c for detail */ dom_exception _dom_element_get_attributes(dom_node_internal *node, struct dom_namednodemap **result) { dom_exception err; dom_document *doc; doc = dom_node_get_owner(node); assert(doc != NULL); err = _dom_namednodemap_create(doc, node, &attributes_opt, result); if (err != DOM_NO_ERR) return err; dom_node_ref(node); return DOM_NO_ERR; } /* Overload function of Node, please refer src/core/node.c for detail */ dom_exception _dom_element_has_attributes(dom_node_internal *node, bool *result) { UNUSED(node); *result = true; return DOM_NO_ERR; } /* For the following namespace related algorithm take a look at: * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algorithms.html */ /** * Look up the prefix which matches the namespace. * * \param node The current Node in which we search for * \param namespace The namespace for which we search a prefix * \param result The returned prefix * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result) { struct dom_element *owner; dom_exception err; err = dom_attr_get_owner_element(node, &owner); if (err != DOM_NO_ERR) return err; if (owner == NULL) { *result = NULL; return DOM_NO_ERR; } return dom_node_lookup_prefix(owner, namespace, result); } /** * Test whether certain namespace is the default namespace of some node. * * \param node The Node to test * \param namespace The namespace to test * \param result true is the namespace is default namespace * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result) { struct dom_element *ele = (struct dom_element *) node; dom_string *value; dom_exception err; bool has; dom_string *xmlns; if (node->prefix == NULL) { *result = dom_string_isequal(node->namespace, namespace); return DOM_NO_ERR; } xmlns = _dom_namespace_get_xmlns_prefix(); err = dom_element_has_attribute(ele, xmlns, &has); if (err != DOM_NO_ERR) return err; if (has == true) { err = dom_element_get_attribute(ele, xmlns, &value); if (err != DOM_NO_ERR) return err; *result = dom_string_isequal(value, namespace); dom_string_unref(value); return DOM_NO_ERR; } return dom_node_is_default_namespace(node->parent, namespace, result); } /** * Look up the namespace with certain prefix. * * \param node The current node in which we search for the prefix * \param prefix The prefix to search * \param result The result namespace if found * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result) { dom_exception err; bool has; dom_string *xmlns; if (node->namespace != NULL && dom_string_isequal(node->prefix, prefix)) { *result = dom_string_ref(node->namespace); return DOM_NO_ERR; } xmlns = _dom_namespace_get_xmlns_prefix(); err = dom_element_has_attribute_ns(node, xmlns, prefix, &has); if (err != DOM_NO_ERR) return err; if (has == true) return dom_element_get_attribute_ns(node, dom_namespaces[DOM_NAMESPACE_XMLNS], prefix, result); err = dom_element_has_attribute(node, xmlns, &has); if (err != DOM_NO_ERR) return err; if (has == true) { return dom_element_get_attribute(node, xmlns, result); } return dom_node_lookup_namespace(node->parent, prefix, result); } /*----------------------------------------------------------------------*/ /* The protected virtual functions */ /** * The virtual function to parse some dom attribute * * \param ele The element object * \param name The name of the attribute * \param value The new value of the attribute * \param parsed The parsed value of the attribute * \return DOM_NO_ERR on success. * * @note: This virtual method is provided to serve as a template method. * When any attribute is set or added, the attribute's value should be * checked to make sure that it is a valid one. And the child class of * dom_element may to do some special stuff on the attribute is set. Take * some integer attribute as example: * * 1. The client call dom_element_set_attribute("size", "10.1"), but the * size attribute may only accept an integer, and only the specific * dom_element know this. And the dom_attr_set_value method, which is * called by dom_element_set_attribute should call the this virtual * template method. * 2. The overload virtual function of following one will truncate the * "10.1" to "10" to make sure it is a integer. And of course, the * overload method may also save the integer as a 'int' C type for * later easy accessing by any client. */ dom_exception _dom_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The destroy virtual function of dom_element */ void __dom_element_destroy(struct dom_node_internal *node) { _dom_element_destroy((struct dom_element *) node); } /* TODO: How to deal with default attribue: * * Ask a language binding for default attributes. * * So, when we copy a element we copy all its attributes because they * are all specified. For the methods like importNode and adoptNode, * this will make _dom_element_copy can be used in them. */ dom_exception _dom_element_copy(dom_node_internal *old, dom_node_internal **copy) { dom_element *olde = (dom_element *) old; dom_element *e; dom_exception err; uint32_t classnr; e = malloc(sizeof(dom_element)); if (e == NULL) return DOM_NO_MEM_ERR; err = dom_node_copy_internal(old, e); if (err != DOM_NO_ERR) { free(e); return err; } if (olde->attributes != NULL) { /* Copy the attribute list */ e->attributes = _dom_element_attr_list_clone(olde->attributes, e); } else { e->attributes = NULL; } if (olde->n_classes > 0) { e->n_classes = olde->n_classes; e->classes = malloc(sizeof(lwc_string *) * e->n_classes); for (classnr = 0; classnr < e->n_classes; ++classnr) e->classes[classnr] = lwc_string_ref(olde->classes[classnr]); } else { e->n_classes = 0; e->classes = NULL; } e->id_ns = NULL; e->id_name = NULL; /* TODO: deal with dom_type_info, it get no definition ! */ *copy = (dom_node_internal *) e; return DOM_NO_ERR; } /*--------------------------------------------------------------------------*/ /* Helper functions */ /** * The internal helper function for getAttribute/getAttributeNS. * * \param element The element * \param namespace The namespace to look for attribute in. May be NULL. * \param name The name of the attribute * \param value The value of the attribute * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_get_attr(struct dom_element *element, dom_string *namespace, dom_string *name, dom_string **value) { dom_attr_list *match; dom_exception err = DOM_NO_ERR; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); /* Fill in value */ if (match == NULL) { *value = NULL; } else { err = dom_attr_get_value(match->attr, value); } return err; } /** * The internal helper function for setAttribute and setAttributeNS. * * \param element The element * \param namespace The namespace to set attribute for. May be NULL. * \param name The name of the new attribute * \param value The value of the new attribute * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_set_attr(struct dom_element *element, dom_string *namespace, dom_string *name, dom_string *value) { dom_attr_list *match; dom_node_internal *e = (dom_node_internal *) element; dom_exception err; if (_dom_validate_name(name) == false) return DOM_INVALID_CHARACTER_ERR; /* Ensure element can be written */ if (_dom_node_readonly(e)) return DOM_NO_MODIFICATION_ALLOWED_ERR; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); if (match != NULL) { /* Found an existing attribute, so replace its value */ /* Dispatch a DOMAttrModified event */ dom_string *old = NULL; struct dom_document *doc = dom_node_get_owner(element); bool success = true; err = dom_attr_get_value(match->attr, &old); /* TODO: We did not support some node type such as entity * reference, in that case, we should ignore the error to * make sure the event model work as excepted. */ if (err != DOM_NO_ERR && err != DOM_NOT_SUPPORTED_ERR) return err; err = _dom_dispatch_attr_modified_event(doc, e, old, value, match->attr, name, DOM_MUTATION_MODIFICATION, &success); dom_string_unref(old); if (err != DOM_NO_ERR) return err; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) e, &success); if (err != DOM_NO_ERR) return err; err = dom_attr_set_value(match->attr, value); if (err != DOM_NO_ERR) return err; } else { /* No existing attribute, so create one */ struct dom_attr *attr; struct dom_attr_list *list_node; struct dom_document *doc; bool success = true; err = _dom_attr_create(e->owner, name, namespace, NULL, true, &attr); if (err != DOM_NO_ERR) return err; /* Set its parent, so that value parsing works */ dom_node_set_parent(attr, element); /* Set its value */ err = dom_attr_set_value(attr, value); if (err != DOM_NO_ERR) { dom_node_set_parent(attr, NULL); dom_node_unref(attr); return err; } /* Dispatch a DOMAttrModified event */ doc = dom_node_get_owner(element); err = _dom_dispatch_attr_modified_event(doc, e, NULL, value, (dom_event_target *) attr, name, DOM_MUTATION_ADDITION, &success); if (err != DOM_NO_ERR) { dom_node_set_parent(attr, NULL); dom_node_unref(attr); return err; } err = dom_node_dispatch_node_change_event(doc, attr, element, DOM_MUTATION_ADDITION, &success); if (err != DOM_NO_ERR) { dom_node_set_parent(attr, NULL); dom_node_unref(attr); return err; } /* Create attribute list node */ list_node = _dom_element_attr_list_node_create(attr, element, name, namespace); if (list_node == NULL) { /* If we failed at this step, there must be no memory */ dom_node_set_parent(attr, NULL); dom_node_unref(attr); return DOM_NO_MEM_ERR; } dom_string_ref(name); dom_string_ref(namespace); /* Link into element's attribute list */ if (element->attributes == NULL) element->attributes = list_node; else _dom_element_attr_list_insert(element->attributes, list_node); dom_node_unref(attr); dom_node_remove_pending(attr); success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) element, &success); if (err != DOM_NO_ERR) return err; } return DOM_NO_ERR; } /** * Remove an attribute from an element by name * * \param element The element to remove attribute from * \param name The name of the attribute to remove * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly. */ dom_exception _dom_element_remove_attr(struct dom_element *element, dom_string *namespace, dom_string *name) { dom_attr_list *match; dom_exception err; dom_node_internal *e = (dom_node_internal *) element; /* Ensure element can be written to */ if (_dom_node_readonly(e)) return DOM_NO_MODIFICATION_ALLOWED_ERR; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); /* Detach attr node from list */ if (match != NULL) { /* Disptach DOMNodeRemoval event */ bool success = true; dom_attr *a = match->attr; struct dom_document *doc = dom_node_get_owner(element); dom_string *old = NULL; err = dom_node_dispatch_node_change_event(doc, match->attr, element, DOM_MUTATION_REMOVAL, &success); if (err != DOM_NO_ERR) return err; /* Claim a reference for later event dispatch */ dom_node_ref(a); /* Delete the attribute node */ if (element->attributes == match) { element->attributes = _dom_element_attr_list_next(match); } if (element->attributes == match) { /* match must be sole attribute */ element->attributes = NULL; } _dom_element_attr_list_node_unlink(match); _dom_element_attr_list_node_destroy(match); /* Dispatch a DOMAttrModified event */ success = true; err = dom_attr_get_value(a, &old); /* TODO: We did not support some node type such as entity * reference, in that case, we should ignore the error to * make sure the event model work as excepted. */ if (err != DOM_NO_ERR && err != DOM_NOT_SUPPORTED_ERR) return err; err = _dom_dispatch_attr_modified_event(doc, e, old, NULL, a, name, DOM_MUTATION_REMOVAL, &success); dom_string_unref(old); /* Release the reference */ dom_node_unref(a); if (err != DOM_NO_ERR) return err; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) e, &success); if (err != DOM_NO_ERR) return err; } /** \todo defaulted attribute handling */ return DOM_NO_ERR; } /** * Retrieve an attribute node from an element by name * * \param element The element to retrieve attribute node from * \param name The attribute's name * \param result Pointer to location to receive attribute node * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_get_attr_node(struct dom_element *element, dom_string *namespace, dom_string *name, struct dom_attr **result) { dom_attr_list *match; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); /* Fill in value */ if (match == NULL) { *result = NULL; } else { *result = match->attr; dom_node_ref(*result); } return DOM_NO_ERR; } /** * Set an attribute node on an element, replacing existing node, if present * * \param element The element to add a node to * \param attr The attribute node to add * \param result Pointer to location to receive previous node * \return DOM_NO_ERR on success, * DOM_WRONG_DOCUMENT_ERR if ::attr does not belong to the * same document as ::element, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_INUSE_ATTRIBUTE_ERR if ::attr is already an attribute * of another Element node. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_set_attr_node(struct dom_element *element, dom_string *namespace, struct dom_attr *attr, struct dom_attr **result) { dom_attr_list *match; dom_exception err; dom_string *name = NULL; dom_node_internal *e = (dom_node_internal *) element; dom_node_internal *attr_node = (dom_node_internal *) attr; dom_attr *old_attr; dom_string *new = NULL; struct dom_document *doc; bool success = true; /** \todo validate name */ /* Ensure element and attribute belong to the same document */ if (e->owner != attr_node->owner) return DOM_WRONG_DOCUMENT_ERR; /* Ensure element can be written to */ if (_dom_node_readonly(e)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* Ensure attribute isn't attached to another element */ if (attr_node->parent != NULL && attr_node->parent != e) return DOM_INUSE_ATTRIBUTE_ERR; err = dom_node_get_local_name(attr, &name); if (err != DOM_NO_ERR) return err; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); *result = NULL; if (match != NULL) { /* Disptach DOMNodeRemoval event */ dom_string *old = NULL; doc = dom_node_get_owner(element); old_attr = match->attr; err = dom_node_dispatch_node_change_event(doc, old_attr, element, DOM_MUTATION_REMOVAL, &success); if (err != DOM_NO_ERR) { dom_string_unref(name); return err; } dom_node_ref(old_attr); _dom_element_attr_list_node_unlink(match); _dom_element_attr_list_node_destroy(match); /* Dispatch a DOMAttrModified event */ success = true; err = dom_attr_get_value(old_attr, &old); /* TODO: We did not support some node type such as entity * reference, in that case, we should ignore the error to * make sure the event model work as excepted. */ if (err != DOM_NO_ERR && err != DOM_NOT_SUPPORTED_ERR) { dom_node_unref(old_attr); dom_string_unref(name); return err; } err = _dom_dispatch_attr_modified_event(doc, e, old, NULL, (dom_event_target *) old_attr, name, DOM_MUTATION_REMOVAL, &success); dom_string_unref(old); *result = old_attr; if (err != DOM_NO_ERR) { dom_string_unref(name); return err; } success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) e, &success); if (err != DOM_NO_ERR) { dom_string_unref(name); return err; } } match = _dom_element_attr_list_node_create(attr, element, name, namespace); if (match == NULL) { dom_string_unref(name); /* If we failed at this step, there must be no memory */ return DOM_NO_MEM_ERR; } dom_string_ref(name); dom_string_ref(namespace); dom_node_set_parent(attr, element); dom_node_remove_pending(attr); /* Dispatch a DOMAttrModified event */ doc = dom_node_get_owner(element); success = true; err = dom_attr_get_value(attr, &new); /* TODO: We did not support some node type such as entity reference, in * that case, we should ignore the error to make sure the event model * work as excepted. */ if (err != DOM_NO_ERR && err != DOM_NOT_SUPPORTED_ERR) { _dom_element_attr_list_node_destroy(match); return err; } err = _dom_dispatch_attr_modified_event(doc, e, NULL, new, (dom_event_target *) attr, name, DOM_MUTATION_ADDITION, &success); /* Cleanup */ dom_string_unref(new); dom_string_unref(name); if (err != DOM_NO_ERR) { _dom_element_attr_list_node_destroy(match); return err; } err = dom_node_dispatch_node_change_event(doc, attr, element, DOM_MUTATION_ADDITION, &success); if (err != DOM_NO_ERR) { _dom_element_attr_list_node_destroy(match); return err; } success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) element, &success); if (err != DOM_NO_ERR) { _dom_element_attr_list_node_destroy(match); return err; } /* Link into element's attribute list */ if (element->attributes == NULL) element->attributes = match; else _dom_element_attr_list_insert(element->attributes, match); return DOM_NO_ERR; } /** * Remove an attribute node from an element * * \param element The element to remove attribute node from * \param attr The attribute node to remove * \param result Pointer to location to receive attribute node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly, * DOM_NOT_FOUND_ERR if ::attr is not an attribute of * ::element. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_element_remove_attr_node(struct dom_element *element, dom_string *namespace, struct dom_attr *attr, struct dom_attr **result) { dom_attr_list *match; dom_exception err; dom_string *name; dom_node_internal *e = (dom_node_internal *) element; dom_attr *a; bool success = true; struct dom_document *doc; dom_string *old = NULL; /* Ensure element can be written to */ if (_dom_node_readonly(e)) return DOM_NO_MODIFICATION_ALLOWED_ERR; err = dom_node_get_node_name(attr, &name); if (err != DOM_NO_ERR) return err; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); /** \todo defaulted attribute handling */ if (match == NULL || match->attr != attr) { dom_string_unref(name); return DOM_NOT_FOUND_ERR; } a = match->attr; /* Dispatch a DOMNodeRemoved event */ doc = dom_node_get_owner(element); err = dom_node_dispatch_node_change_event(doc, a, element, DOM_MUTATION_REMOVAL, &success); if (err != DOM_NO_ERR) { dom_string_unref(name); return err; } dom_node_ref(a); /* Delete the attribute node */ if (element->attributes == match) { element->attributes = _dom_element_attr_list_next(match); } if (element->attributes == match) { /* match must be sole attribute */ element->attributes = NULL; } _dom_element_attr_list_node_unlink(match); _dom_element_attr_list_node_destroy(match); /* Now, cleaup the dom_string */ dom_string_unref(name); /* Dispatch a DOMAttrModified event */ success = true; err = dom_attr_get_value(a, &old); /* TODO: We did not support some node type such as entity reference, in * that case, we should ignore the error to make sure the event model * work as excepted. */ if (err != DOM_NO_ERR && err != DOM_NOT_SUPPORTED_ERR) { dom_node_unref(a); return err; } err = _dom_dispatch_attr_modified_event(doc, e, old, NULL, (dom_event_target *) a, name, DOM_MUTATION_REMOVAL, &success); dom_string_unref(old); if (err != DOM_NO_ERR) return err; /* When a Node is removed, it should be destroy. When its refcnt is not * zero, it will be added to the document's deletion pending list. * When a Node is removed, its parent should be NULL, but its owner * should remain to be the document. */ *result = (dom_attr *) a; success = true; err = _dom_dispatch_subtree_modified_event(doc, (dom_event_target *) e, &success); if (err != DOM_NO_ERR) return err; return DOM_NO_ERR; } /** * Test whether certain attribute exists on the element * * \param element The element * \param namespace The namespace to look for attribute in. May be NULL. * \param name The attribute's name * \param result The return value * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_has_attr(struct dom_element *element, dom_string *namespace, dom_string *name, bool *result) { dom_attr_list *match; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); /* Fill in result */ if (match == NULL) { *result = false; } else { *result = true; } return DOM_NO_ERR; } /** * (Un)set an attribute Node as a ID. * * \param element The element contains the attribute * \param namespace The namespace of the attribute node * \param name The name of the attribute * \param is_id true for set the node as a ID attribute, false unset it * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_set_id_attr(struct dom_element *element, dom_string *namespace, dom_string *name, bool is_id) { dom_attr_list *match; match = _dom_element_attr_list_find_by_name(element->attributes, name, namespace); if (match == NULL) return DOM_NOT_FOUND_ERR; if (is_id == true) { /* Clear the previous id attribute if there is one */ dom_attr_list *old = _dom_element_attr_list_find_by_name( element->attributes, element->id_name, element->id_ns); if (old != NULL) { _dom_attr_set_isid(old->attr, false); } /* Set up the new id attr stuff */ element->id_name = dom_string_ref(name); element->id_ns = dom_string_ref(namespace); } _dom_attr_set_isid(match->attr, is_id); return DOM_NO_ERR; } /** * Get the ID string of the element * * \param ele The element * \param id The ID of this element * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_element_get_id(struct dom_element *ele, dom_string **id) { dom_exception err; dom_string *ret = NULL; dom_document *doc; dom_string *name; *id = NULL; if (ele->id_ns != NULL && ele->id_name != NULL) { /* There is user specific ID attribute */ err = _dom_element_get_attribute_ns(ele, ele->id_ns, ele->id_name, &ret); if (err != DOM_NO_ERR) { return err; } *id = ret; return err; } doc = dom_node_get_owner(ele); assert(doc != NULL); if (ele->id_name != NULL) { name = ele->id_name; } else { name = _dom_document_get_id_name(doc); if (name == NULL) { /* No ID attribute at all, just return NULL */ *id = NULL; return DOM_NO_ERR; } } err = _dom_element_get_attribute(ele, name, &ret); if (err != DOM_NO_ERR) { return err; } if (ret != NULL) { *id = ret; } else { *id = NULL; } return err; } /*-------------- The dom_namednodemap functions -------------------------*/ /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_get_length(void *priv, uint32_t *length) { dom_element *e = (dom_element *) priv; *length = _dom_element_attr_list_length(e->attributes); return DOM_NO_ERR; } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_get_named_item(void *priv, dom_string *name, struct dom_node **node) { dom_element *e = (dom_element *) priv; return _dom_element_get_attribute_node(e, name, (dom_attr **) node); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_set_named_item(void *priv, struct dom_node *arg, struct dom_node **node) { dom_element *e = (dom_element *) priv; dom_node_internal *n = (dom_node_internal *) arg; if (n->type != DOM_ATTRIBUTE_NODE) return DOM_HIERARCHY_REQUEST_ERR; return _dom_element_set_attribute_node(e, (dom_attr *) arg, (dom_attr **) node); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_remove_named_item( void *priv, dom_string *name, struct dom_node **node) { dom_element *e = (dom_element *) priv; dom_exception err; err = _dom_element_get_attribute_node(e, name, (dom_attr **) node); if (err != DOM_NO_ERR) return err; if (*node == NULL) { return DOM_NOT_FOUND_ERR; } return _dom_element_remove_attribute(e, name); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_item(void *priv, uint32_t index, struct dom_node **node) { dom_attr_list * match = NULL; unsigned int num = index + 1; dom_element *e = (dom_element *) priv; match = _dom_element_attr_list_get_by_index(e->attributes, num); if (match != NULL) { *node = (dom_node *) match->attr; dom_node_ref(*node); } else { *node = NULL; } return DOM_NO_ERR; } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_get_named_item_ns( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node) { dom_element *e = (dom_element *) priv; return _dom_element_get_attribute_node_ns(e, namespace, localname, (dom_attr **) node); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_set_named_item_ns( void *priv, struct dom_node *arg, struct dom_node **node) { dom_element *e = (dom_element *) priv; dom_node_internal *n = (dom_node_internal *) arg; if (n->type != DOM_ATTRIBUTE_NODE) return DOM_HIERARCHY_REQUEST_ERR; return _dom_element_set_attribute_node_ns(e, (dom_attr *) arg, (dom_attr **) node); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ dom_exception attributes_remove_named_item_ns( void *priv, dom_string *namespace, dom_string *localname, struct dom_node **node) { dom_element *e = (dom_element *) priv; dom_exception err; err = _dom_element_get_attribute_node_ns(e, namespace, localname, (dom_attr **) node); if (err != DOM_NO_ERR) return err; if (*node == NULL) { return DOM_NOT_FOUND_ERR; } return _dom_element_remove_attribute_ns(e, namespace, localname); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ void attributes_destroy(void *priv) { dom_element *e = (dom_element *) priv; dom_node_unref(e); } /* Implementation function for NamedNodeMap, see core/namednodemap.h for * details */ bool attributes_equal(void *p1, void *p2) { /* We have passed the pointer to this element as the private data, * and here we just need to compare whether the two elements are * equal */ return p1 == p2; } /*------------------ End of namednodemap functions -----------------------*/ netsurf-all-3.2/libdom/src/core/string.c0000644000175000017500000006146112377676745017303 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include "core/string.h" #include "core/document.h" #include "utils/utils.h" /** * Type of a DOM string */ enum dom_string_type { DOM_STRING_CDATA = 0, DOM_STRING_INTERNED = 1 }; /** * A DOM string * * Strings are reference counted so destruction is performed correctly. */ typedef struct dom_string_internal { dom_string base; union { struct { uint8_t *ptr; /**< Pointer to string data */ size_t len; /**< Byte length of string */ } cdata; lwc_string *intern; /**< Interned string */ } data; enum dom_string_type type; /**< String type */ } dom_string_internal; /** * Empty string, for comparisons against NULL */ static const dom_string_internal empty_string = { { 0 }, { { (uint8_t *) "", 0 } }, DOM_STRING_CDATA }; void dom_string_destroy(dom_string *str) { dom_string_internal *istr = (dom_string_internal *)str; if (str != NULL) { assert(istr->base.refcnt == 0); switch (istr->type) { case DOM_STRING_INTERNED: if (istr->data.intern != NULL) { lwc_string_unref(istr->data.intern); } break; case DOM_STRING_CDATA: free(istr->data.cdata.ptr); break; } free(str); } } /** * Create a DOM string from a string of characters * * \param ptr Pointer to string of characters * \param len Length, in bytes, of string of characters * \param str Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * The returned string will already be referenced, so there is no need * to explicitly reference it. * * The string of characters passed in will be copied for use by the * returned DOM string. */ dom_exception dom_string_create(const uint8_t *ptr, size_t len, dom_string **str) { dom_string_internal *ret; if (ptr == NULL || len == 0) { ptr = (const uint8_t *) ""; len = 0; } ret = malloc(sizeof(*ret)); if (ret == NULL) return DOM_NO_MEM_ERR; ret->data.cdata.ptr = malloc(len + 1); if (ret->data.cdata.ptr == NULL) { free(ret); return DOM_NO_MEM_ERR; } memcpy(ret->data.cdata.ptr, ptr, len); ret->data.cdata.ptr[len] = '\0'; ret->data.cdata.len = len; ret->base.refcnt = 1; ret->type = DOM_STRING_CDATA; *str = (dom_string *)ret; return DOM_NO_ERR; } /** * Create an interned DOM string from a string of characters * * \param ptr Pointer to string of characters * \param len Length, in bytes, of string of characters * \param str Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * The returned string will already be referenced, so there is no need * to explicitly reference it. * * The string of characters passed in will be copied for use by the * returned DOM string. */ dom_exception dom_string_create_interned(const uint8_t *ptr, size_t len, dom_string **str) { dom_string_internal *ret; if (ptr == NULL || len == 0) { ptr = (const uint8_t *) ""; len = 0; } ret = malloc(sizeof(*ret)); if (ret == NULL) return DOM_NO_MEM_ERR; if (lwc_intern_string((const char *) ptr, len, &ret->data.intern) != lwc_error_ok) { free(ret); return DOM_NO_MEM_ERR; } ret->base.refcnt = 1; ret->type = DOM_STRING_INTERNED; *str = (dom_string *)ret; return DOM_NO_ERR; } /** * Make the dom_string be interned * * \param str The dom_string to be interned * \param lwcstr The result lwc_string * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_string_intern(dom_string *str, struct lwc_string_s **lwcstr) { dom_string_internal *istr = (dom_string_internal *) str; /* If this string is already interned, do nothing */ if (istr->type != DOM_STRING_INTERNED) { lwc_string *ret; lwc_error lerr; lerr = lwc_intern_string((const char *) istr->data.cdata.ptr, istr->data.cdata.len, &ret); if (lerr != lwc_error_ok) { return _dom_exception_from_lwc_error(lerr); } free(istr->data.cdata.ptr); istr->data.intern = ret; istr->type = DOM_STRING_INTERNED; } *lwcstr = lwc_string_ref(istr->data.intern); return DOM_NO_ERR; } /** * Case sensitively compare two DOM strings * * \param s1 The first string to compare * \param s2 The second string to compare * \return true if strings match, false otherwise */ bool dom_string_isequal(const dom_string *s1, const dom_string *s2) { size_t len; const dom_string_internal *is1 = (dom_string_internal *) s1; const dom_string_internal *is2 = (dom_string_internal *) s2; if (s1 == NULL) is1 = &empty_string; if (s2 == NULL) is2 = &empty_string; if (is1->type == DOM_STRING_INTERNED && is2->type == DOM_STRING_INTERNED) { bool match; (void) lwc_string_isequal(is1->data.intern, is2->data.intern, &match); return match; } len = dom_string_byte_length((dom_string *) is1); if (len != dom_string_byte_length((dom_string *)is2)) return false; return 0 == memcmp(dom_string_data((dom_string *) is1), dom_string_data((dom_string *)is2), len); } /** * Trivial locale-agnostic lower case convertor */ static inline uint8_t dolower(const uint8_t c) { if ('A' <= c && c <= 'Z') return c + 'a' - 'A'; return c; } /** * Case insensitively compare two DOM strings * * \param s1 The first string to compare * \param s2 The second string to compare * \return true if strings match, false otherwise */ bool dom_string_caseless_isequal(const dom_string *s1, const dom_string *s2) { const uint8_t *d1 = NULL; const uint8_t *d2 = NULL; size_t len; const dom_string_internal *is1 = (dom_string_internal *) s1; const dom_string_internal *is2 = (dom_string_internal *) s2; if (s1 == NULL) is1 = &empty_string; if (s2 == NULL) is2 = &empty_string; if (is1->type == DOM_STRING_INTERNED && is2->type == DOM_STRING_INTERNED) { bool match; if (lwc_string_caseless_isequal(is1->data.intern, is2->data.intern, &match) != lwc_error_ok) return false; return match; } len = dom_string_byte_length((dom_string *) is1); if (len != dom_string_byte_length((dom_string *)is2)) return false; d1 = (const uint8_t *) dom_string_data((dom_string *) is1); d2 = (const uint8_t *) dom_string_data((dom_string *)is2); while (len > 0) { if (dolower(*d1) != dolower(*d2)) return false; d1++; d2++; len--; } return true; } /** * Case sensitively compare DOM string with lwc_string * * \param s1 The first string to compare * \param s2 The second string to compare * \return true if strings match, false otherwise * * Returns false if either are NULL. */ bool dom_string_lwc_isequal(const dom_string *s1, lwc_string *s2) { size_t len; dom_string_internal *is1 = (dom_string_internal *) s1; if (s1 == NULL || s2 == NULL) return false; if (is1->type == DOM_STRING_INTERNED) { bool match; (void) lwc_string_isequal(is1->data.intern, s2, &match); return match; } /* Handle non-interned case */ len = dom_string_byte_length(s1); if (len != lwc_string_length(s2)) return false; return 0 == memcmp(dom_string_data(s1), lwc_string_data(s2), len); } /** * Case insensitively compare DOM string with lwc_string * * \param s1 The first string to compare * \param s2 The second string to compare * \return true if strings match, false otherwise * * Returns false if either are NULL. */ bool dom_string_caseless_lwc_isequal(const dom_string *s1, lwc_string *s2) { size_t len; const uint8_t *d1 = NULL; const uint8_t *d2 = NULL; dom_string_internal *is1 = (dom_string_internal *) s1; if (s1 == NULL || s2 == NULL) return false; if (is1->type == DOM_STRING_INTERNED) { bool match; if (lwc_string_caseless_isequal(is1->data.intern, s2, &match) != lwc_error_ok) return false; return match; } len = dom_string_byte_length(s1); if (len != lwc_string_length(s2)) return false; d1 = (const uint8_t *) dom_string_data(s1); d2 = (const uint8_t *) lwc_string_data(s2); while (len > 0) { if (dolower(*d1) != dolower(*d2)) return false; d1++; d2++; len--; } return true; } /** * Get the index of the first occurrence of a character in a dom string * * \param str The string to search in * \param chr UCS4 value to look for * \return Character index of found character, or -1 if none found */ uint32_t dom_string_index(dom_string *str, uint32_t chr) { const uint8_t *s; size_t clen, slen; uint32_t c, index; parserutils_error err; s = (const uint8_t *) dom_string_data(str); slen = dom_string_byte_length(str); index = 0; while (slen > 0) { err = parserutils_charset_utf8_to_ucs4(s, slen, &c, &clen); if (err != PARSERUTILS_OK) { return (uint32_t) -1; } if (c == chr) { return index; } s += clen; slen -= clen; index++; } return (uint32_t) -1; } /** * Get the index of the last occurrence of a character in a dom string * * \param str The string to search in * \param chr UCS4 value to look for * \return Character index of found character, or -1 if none found */ uint32_t dom_string_rindex(dom_string *str, uint32_t chr) { const uint8_t *s; size_t clen = 0, slen; uint32_t c, coff, index; parserutils_error err; s = (const uint8_t *) dom_string_data(str); slen = dom_string_byte_length(str); index = dom_string_length(str); while (slen > 0) { err = parserutils_charset_utf8_prev(s, slen, (uint32_t *) &coff); if (err == PARSERUTILS_OK) { err = parserutils_charset_utf8_to_ucs4(s + coff, slen - clen, &c, &clen); } if (err != PARSERUTILS_OK) { return (uint32_t) -1; } if (c == chr) { return index; } slen -= clen; index--; } return (uint32_t) -1; } /** * Get the length, in characters, of a dom string * * \param str The string to measure the length of * \return The length of the string, in characters */ uint32_t dom_string_length(dom_string *str) { const uint8_t *s; size_t slen, clen; parserutils_error err; s = (const uint8_t *) dom_string_data(str); slen = dom_string_byte_length(str); err = parserutils_charset_utf8_length(s, slen, &clen); if (err != PARSERUTILS_OK) { return 0; } return clen; } /** * Get the UCS4 character at position index * * \param index The position of the charater * \param ch The UCS4 character * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_string_at(dom_string *str, uint32_t index, uint32_t *ch) { const uint8_t *s; size_t clen, slen; uint32_t c, i; parserutils_error err; s = (const uint8_t *) dom_string_data(str); slen = dom_string_byte_length(str); i = 0; while (slen > 0) { err = parserutils_charset_utf8_char_byte_length(s, &clen); if (err != PARSERUTILS_OK) { return (uint32_t) -1; } i++; if (i == index + 1) break; s += clen; slen -= clen; } if (i == index + 1) { err = parserutils_charset_utf8_to_ucs4(s, slen, &c, &clen); if (err != PARSERUTILS_OK) { return (uint32_t) -1; } *ch = c; return DOM_NO_ERR; } else { return DOM_DOMSTRING_SIZE_ERR; } } /** * Concatenate two dom strings * * \param s1 The first string * \param s2 The second string * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * The returned string will be referenced. The client * should dereference it once it has finished with it. */ dom_exception dom_string_concat(dom_string *s1, dom_string *s2, dom_string **result) { dom_string_internal *concat; const uint8_t *s1ptr, *s2ptr; size_t s1len, s2len; assert(s1 != NULL); assert(s2 != NULL); s1ptr = (const uint8_t *) dom_string_data(s1); s2ptr = (const uint8_t *) dom_string_data(s2); s1len = dom_string_byte_length(s1); s2len = dom_string_byte_length(s2); concat = malloc(sizeof(*concat)); if (concat == NULL) { return DOM_NO_MEM_ERR; } concat->data.cdata.ptr = malloc(s1len + s2len + 1); if (concat->data.cdata.ptr == NULL) { free(concat); return DOM_NO_MEM_ERR; } memcpy(concat->data.cdata.ptr, s1ptr, s1len); memcpy(concat->data.cdata.ptr + s1len, s2ptr, s2len); concat->data.cdata.ptr[s1len + s2len] = '\0'; concat->data.cdata.len = s1len + s2len; concat->base.refcnt = 1; concat->type = DOM_STRING_CDATA; *result = (dom_string *)concat; return DOM_NO_ERR; } /** * Extract a substring from a dom string * * \param str The string to extract from * \param i1 The character index of the start of the substring * \param i2 The character index of the end of the substring * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ dom_exception dom_string_substr(dom_string *str, uint32_t i1, uint32_t i2, dom_string **result) { const uint8_t *s; size_t slen; uint32_t b1, b2; parserutils_error err; /* target string is NULL equivalent to empty. */ if (str == NULL) str = (dom_string *)&empty_string; s = (const uint8_t *) dom_string_data(str); slen = dom_string_byte_length(str); /* Initialise the byte index of the start to 0 */ b1 = 0; /* Make the end a character offset from the start */ i2 -= i1; /* Calculate the byte index of the start */ while (i1 > 0) { err = parserutils_charset_utf8_next(s, slen, b1, &b1); if (err != PARSERUTILS_OK) { return DOM_NO_MEM_ERR; } i1--; } /* Initialise the byte index of the end to that of the start */ b2 = b1; /* Calculate the byte index of the end */ while (i2 > 0) { err = parserutils_charset_utf8_next(s, slen, b2, &b2); if (err != PARSERUTILS_OK) { return DOM_NO_MEM_ERR; } i2--; } /* Create a string from the specified byte range */ return dom_string_create(s + b1, b2 - b1, result); } /** * Insert data into a dom string at the given location * * \param target Pointer to string to insert into * \param source Pointer to string to insert * \param offset Character offset of location to insert at * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion, * DOM_INDEX_SIZE_ERR if ::offset > len(::target). * * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ dom_exception dom_string_insert(dom_string *target, dom_string *source, uint32_t offset, dom_string **result) { dom_string_internal *res; const uint8_t *t, *s; uint32_t tlen, slen, clen; uint32_t ins = 0; parserutils_error err; /* target string is NULL equivalent to empty. */ if (target == NULL) target = (dom_string *)&empty_string; t = (const uint8_t *) dom_string_data(target); tlen = dom_string_byte_length(target); s = (const uint8_t *) dom_string_data(source); slen = dom_string_byte_length(source); clen = dom_string_length(target); if (offset > clen) return DOM_INDEX_SIZE_ERR; /* Calculate the byte index of the insertion point */ if (offset == clen) { /* Optimisation for append */ ins = tlen; } else { while (offset > 0) { err = parserutils_charset_utf8_next(t, tlen, ins, &ins); if (err != PARSERUTILS_OK) { return DOM_NO_MEM_ERR; } offset--; } } /* Allocate result string */ res = malloc(sizeof(*res)); if (res == NULL) { return DOM_NO_MEM_ERR; } /* Allocate data buffer for result contents */ res->data.cdata.ptr = malloc(tlen + slen + 1); if (res->data.cdata.ptr == NULL) { free(res); return DOM_NO_MEM_ERR; } /* Copy initial portion of target, if any, into result */ if (ins > 0) { memcpy(res->data.cdata.ptr, t, ins); } /* Copy inserted data into result */ memcpy(res->data.cdata.ptr + ins, s, slen); /* Copy remainder of target, if any, into result */ if (tlen - ins > 0) { memcpy(res->data.cdata.ptr + ins + slen, t + ins, tlen - ins); } res->data.cdata.ptr[tlen + slen] = '\0'; res->data.cdata.len = tlen + slen; res->base.refcnt = 1; res->type = DOM_STRING_CDATA; *result = (dom_string *)res; return DOM_NO_ERR; } /** * Replace a section of a dom string * * \param target Pointer to string of which to replace a section * \param source Pointer to replacement string * \param i1 Character index of start of region to replace * \param i2 Character index of end of region to replace * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion. * * The returned string will have its reference count increased. The client * should dereference it once it has finished with it. */ dom_exception dom_string_replace(dom_string *target, dom_string *source, uint32_t i1, uint32_t i2, dom_string **result) { dom_string_internal *res; const uint8_t *t, *s; uint32_t tlen, slen; uint32_t b1, b2; parserutils_error err; /* target string is NULL equivalent to empty. */ if (target == NULL) target = (dom_string *)&empty_string; t = (const uint8_t *) dom_string_data(target); tlen = dom_string_byte_length(target); s = (const uint8_t *) dom_string_data(source); slen = dom_string_byte_length(source); /* Initialise the byte index of the start to 0 */ b1 = 0; /* Make the end a character offset from the start */ i2 -= i1; /* Calculate the byte index of the start */ while (i1 > 0) { err = parserutils_charset_utf8_next(t, tlen, b1, &b1); if (err != PARSERUTILS_OK) { return DOM_NO_MEM_ERR; } i1--; } /* Initialise the byte index of the end to that of the start */ b2 = b1; /* Calculate the byte index of the end */ while (i2 > 0) { err = parserutils_charset_utf8_next(t, tlen, b2, &b2); if (err != PARSERUTILS_OK) { return DOM_NO_MEM_ERR; } i2--; } /* Allocate result string */ res = malloc(sizeof(*res)); if (res == NULL) { return DOM_NO_MEM_ERR; } /* Allocate data buffer for result contents */ res->data.cdata.ptr = malloc(tlen + slen - (b2 - b1) + 1); if (res->data.cdata.ptr == NULL) { free(res); return DOM_NO_MEM_ERR; } /* Copy initial portion of target, if any, into result */ if (b1 > 0) { memcpy(res->data.cdata.ptr, t, b1); } /* Copy replacement data into result */ if (slen > 0) { memcpy(res->data.cdata.ptr + b1, s, slen); } /* Copy remainder of target, if any, into result */ if (tlen - b2 > 0) { memcpy(res->data.cdata.ptr + b1 + slen, t + b2, tlen - b2); } res->data.cdata.ptr[tlen + slen - (b2 - b1)] = '\0'; res->data.cdata.len = tlen + slen - (b2 - b1); res->base.refcnt = 1; res->type = DOM_STRING_CDATA; *result = (dom_string *)res; return DOM_NO_ERR; } /** * Calculate a hash value from a dom string * * \param str The string to calculate a hash of * \return The hash value associated with the string */ uint32_t dom_string_hash(dom_string *str) { const uint8_t *s = (const uint8_t *) dom_string_data(str); size_t slen = dom_string_byte_length(str); uint32_t hash = 0x811c9dc5; while (slen > 0) { hash *= 0x01000193; hash ^= *s; s++; slen--; } return hash; } /** * Convert a lwc_error to a dom_exception * * \param err The input lwc_error * \return the dom_exception */ dom_exception _dom_exception_from_lwc_error(lwc_error err) { switch (err) { case lwc_error_ok: return DOM_NO_ERR; case lwc_error_oom: return DOM_NO_MEM_ERR; case lwc_error_range: return DOM_INDEX_SIZE_ERR; } return DOM_NO_ERR; } /** * Get the raw character data of the dom_string. * * \param str The dom_string object * \return The C string pointer * * @note: This function is just provided for the convenience of accessing the * raw C string character, no change on the result string is allowed. */ const char *dom_string_data(const dom_string *str) { dom_string_internal *istr = (dom_string_internal *) str; if (istr->type == DOM_STRING_CDATA) { return (const char *) istr->data.cdata.ptr; } else { return lwc_string_data(istr->data.intern); } } /** Get the byte length of this dom_string * * \param str The dom_string object */ size_t dom_string_byte_length(const dom_string *str) { dom_string_internal *istr = (dom_string_internal *) str; if (istr->type == DOM_STRING_CDATA) { return istr->data.cdata.len; } else { return lwc_string_length(istr->data.intern); } } /** Convert the given string to uppercase * * \param source * \param ascii_only Whether to only convert [a-z] to [A-Z] * \param upper Result pointer for uppercase string. Caller owns ref * * \return DOM_NO_ERR on success. * * \note Right now, will return DOM_NOT_SUPPORTED_ERR if ascii_only is false. */ dom_exception dom_string_toupper(dom_string *source, bool ascii_only, dom_string **upper) { const uint8_t *orig_s = (const uint8_t *) dom_string_data(source); const size_t nbytes = dom_string_byte_length(source); uint8_t *copy_s; size_t index = 0, clen; parserutils_error err; dom_exception exc; if (ascii_only == false) return DOM_NOT_SUPPORTED_ERR; copy_s = malloc(nbytes); if (copy_s == NULL) return DOM_NO_MEM_ERR; memcpy(copy_s, orig_s, nbytes); while (index < nbytes) { err = parserutils_charset_utf8_char_byte_length(orig_s + index, &clen); if (err != PARSERUTILS_OK) { free(copy_s); /** \todo Find a better exception */ return DOM_NO_MEM_ERR; } if (clen == 1) { if (orig_s[index] >= 'a' && orig_s[index] <= 'z') copy_s[index] -= 'a' - 'A'; } index += clen; } if (((dom_string_internal*)source)->type == DOM_STRING_CDATA) { exc = dom_string_create(copy_s, nbytes, upper); } else { exc = dom_string_create_interned(copy_s, nbytes, upper); } free(copy_s); return exc; } /** Convert the given string to lowercase * * \param source * \param ascii_only Whether to only convert [a-z] to [A-Z] * \param lower Result pointer for lowercase string. Caller owns ref * * \return DOM_NO_ERR on success. * * \note Right now, will return DOM_NOT_SUPPORTED_ERR if ascii_only is false. */ dom_exception dom_string_tolower(dom_string *source, bool ascii_only, dom_string **lower) { const uint8_t *orig_s = (const uint8_t *) dom_string_data(source); const size_t nbytes = dom_string_byte_length(source); uint8_t *copy_s; size_t index = 0, clen; parserutils_error err; dom_exception exc; if (ascii_only == false) return DOM_NOT_SUPPORTED_ERR; copy_s = malloc(nbytes); if (copy_s == NULL) return DOM_NO_MEM_ERR; memcpy(copy_s, orig_s, nbytes); while (index < nbytes) { err = parserutils_charset_utf8_char_byte_length(orig_s + index, &clen); if (err != PARSERUTILS_OK) { free(copy_s); /** \todo Find a better exception */ return DOM_NO_MEM_ERR; } if (clen == 1) { if (orig_s[index] >= 'A' && orig_s[index] <= 'Z') copy_s[index] += 'a' - 'A'; } index += clen; } if (((dom_string_internal*)source)->type == DOM_STRING_CDATA) { exc = dom_string_create(copy_s, nbytes, lower); } else { exc = dom_string_create_interned(copy_s, nbytes, lower); } free(copy_s); return exc; } /* exported function documented in string.h */ dom_exception dom_string_whitespace_op(dom_string *s, enum dom_whitespace_op op, dom_string **ret) { const uint8_t *src_text = (const uint8_t *) dom_string_data(s); size_t len = dom_string_byte_length(s); const uint8_t *src_pos; const uint8_t *src_end; dom_exception exc; uint8_t *temp_pos; uint8_t *temp; if (len == 0) { *ret = dom_string_ref(s); } temp = malloc(len); if (temp == NULL) { return DOM_NO_MEM_ERR; } src_pos = src_text; src_end = src_text + len; temp_pos = temp; if (op & DOM_WHITESPACE_STRIP_LEADING) { while (src_pos < src_end) { if (*src_pos == ' ' || *src_pos == '\t' || *src_pos == '\n' || *src_pos == '\r' || *src_pos == '\f') src_pos++; else break; } } while (src_pos < src_end) { if ((op & DOM_WHITESPACE_COLLAPSE) && (*src_pos == ' ' || *src_pos == '\t' || *src_pos == '\n' || *src_pos == '\r' || *src_pos == '\f')) { /* Got a whitespace character */ do { /* Skip all adjacent whitespace */ src_pos++; } while (src_pos < src_end && (*src_pos == ' ' || *src_pos == '\t' || *src_pos == '\n' || *src_pos == '\r' || *src_pos == '\f')); /* Gets replaced with single space in output */ *temp_pos++ = ' '; } else { /* Otherwise, copy to output */ *temp_pos++ = *src_pos++; } } if (op & DOM_WHITESPACE_STRIP_TRAILING) { while (temp_pos > temp) { temp_pos--; if (*temp_pos != ' ' && *temp_pos != '\t' && *temp_pos != '\n' && *temp_pos != '\r' && *temp_pos != '\f') { temp_pos++; break; } } } /* New length */ len = temp_pos - temp; /* Make new string */ if (((dom_string_internal *) s)->type == DOM_STRING_CDATA) { exc = dom_string_create(temp, len, ret); } else { exc = dom_string_create_interned(temp, len, ret); } free(temp); return exc; } netsurf-all-3.2/libdom/src/core/cdatasection.c0000644000175000017500000000536212377676745020434 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include "core/cdatasection.h" #include "core/document.h" #include "core/text.h" #include "utils/utils.h" /** * A DOM CDATA section */ struct dom_cdata_section { dom_text base; /**< Base node */ }; static struct dom_node_protect_vtable cdata_section_protect_vtable = { DOM_CDATA_SECTION_PROTECT_VTABLE }; /** * Create a CDATA section * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_cdata_section_create(dom_document *doc, dom_string *name, dom_string *value, dom_cdata_section **result) { dom_cdata_section *c; dom_exception err; /* Allocate the comment node */ c = malloc(sizeof(dom_cdata_section)); if (c == NULL) return DOM_NO_MEM_ERR; /* Set up vtable */ ((dom_node_internal *) c)->base.vtable = &text_vtable; ((dom_node_internal *) c)->vtable = &cdata_section_protect_vtable; /* And initialise the node */ err = _dom_cdata_section_initialise(&c->base, doc, DOM_CDATA_SECTION_NODE, name, value); if (err != DOM_NO_ERR) { free(c); return err; } *result = c; return DOM_NO_ERR; } /** * Destroy a CDATA section * * \param cdata The cdata section to destroy * * The contents of ::cdata will be destroyed and ::cdata will be freed. */ void _dom_cdata_section_destroy(dom_cdata_section *cdata) { /* Clean up base node contents */ _dom_cdata_section_finalise(&cdata->base); /* Destroy the node */ free(cdata); } /*--------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual destroy function of this class */ void __dom_cdata_section_destroy(dom_node_internal *node) { _dom_cdata_section_destroy((dom_cdata_section *) node); } /* The copy constructor of this class */ dom_exception _dom_cdata_section_copy(dom_node_internal *old, dom_node_internal **copy) { dom_cdata_section *new_cdata; dom_exception err; new_cdata = malloc(sizeof(dom_cdata_section)); if (new_cdata == NULL) return DOM_NO_MEM_ERR; err = dom_text_copy_internal(old, new_cdata); if (err != DOM_NO_ERR) { free(new_cdata); return err; } *copy = (dom_node_internal *) new_cdata; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/document.c0000644000175000017500000012471612377676745017616 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include #include "core/string.h" #include "core/attr.h" #include "core/cdatasection.h" #include "core/comment.h" #include "core/document.h" #include "core/doc_fragment.h" #include "core/element.h" #include "core/entity_ref.h" #include "core/namednodemap.h" #include "core/nodelist.h" #include "core/pi.h" #include "core/text.h" #include "utils/validate.h" #include "utils/namespace.h" #include "utils/utils.h" /** * Item in list of active nodelists */ struct dom_doc_nl { dom_nodelist *list; /**< Nodelist */ struct dom_doc_nl *next; /**< Next item */ struct dom_doc_nl *prev; /**< Previous item */ }; /* The virtual functions of this dom_document */ static struct dom_document_vtable document_vtable = { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE_DOCUMENT }, DOM_DOCUMENT_VTABLE }; static struct dom_node_protect_vtable document_protect_vtable = { DOM_DOCUMENT_PROTECT_VTABLE }; /*----------------------------------------------------------------------*/ /* Internally used helper functions */ static dom_exception dom_document_dup_node(dom_document *doc, dom_node *node, bool deep, dom_node **result, dom_node_operation opt); /*----------------------------------------------------------------------*/ /* The constructors and destructors */ /** * Create a Document * * \param doc Pointer to location to receive created document * \param daf The default action fetcher * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion. * * The returned document will already be referenced. */ dom_exception _dom_document_create(dom_events_default_action_fetcher daf, void *daf_ctx, dom_document **doc) { dom_document *d; dom_exception err; /* Create document */ d = malloc(sizeof(dom_document)); if (d == NULL) return DOM_NO_MEM_ERR; /* Initialise the virtual table */ d->base.base.vtable = &document_vtable; d->base.vtable = &document_protect_vtable; /* Initialise base class -- the Document has no parent, so * destruction will be attempted as soon as its reference count * reaches zero. Documents own themselves (this simplifies the * rest of the code, as it doesn't need to special case Documents) */ err = _dom_document_initialise(d, daf, daf_ctx); if (err != DOM_NO_ERR) { /* Clean up document */ free(d); return err; } *doc = d; return DOM_NO_ERR; } /* Initialise the document */ dom_exception _dom_document_initialise(dom_document *doc, dom_events_default_action_fetcher daf, void *daf_ctx) { dom_exception err; dom_string *name; err = dom_string_create((const uint8_t *) "#document", SLEN("#document"), &name); if (err != DOM_NO_ERR) return err; doc->nodelists = NULL; err = _dom_node_initialise(&doc->base, doc, DOM_DOCUMENT_NODE, name, NULL, NULL, NULL); dom_string_unref(name); if (err != DOM_NO_ERR) return err; list_init(&doc->pending_nodes); err = dom_string_create_interned((const uint8_t *) "id", SLEN("id"), &doc->id_name); if (err != DOM_NO_ERR) return err; doc->quirks = DOM_DOCUMENT_QUIRKS_MODE_NONE; err = dom_string_create_interned((const uint8_t *) "class", SLEN("class"), &doc->class_string); if (err != DOM_NO_ERR) { dom_string_unref(doc->id_name); return err; } err = dom_string_create_interned((const uint8_t *) "script", SLEN("script"), &doc->script_string); if (err != DOM_NO_ERR) { dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); return err; } /* Intern the empty string. The use of a space in the constant * is to prevent the compiler warning about an empty string. */ err = dom_string_create_interned((const uint8_t *) " ", 0, &doc->_memo_empty); if (err != DOM_NO_ERR) { dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMNodeInserted", SLEN("DOMNodeInserted"), &doc->_memo_domnodeinserted); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMNodeRemoved", SLEN("DOMNodeRemoved"), &doc->_memo_domnoderemoved); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMNodeInsertedIntoDocument", SLEN("DOMNodeInsertedIntoDocument"), &doc->_memo_domnodeinsertedintodocument); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMNodeRemovedFromDocument", SLEN("DOMNodeRemovedFromDocument"), &doc->_memo_domnoderemovedfromdocument); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domnodeinsertedintodocument); dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMAttrModified", SLEN("DOMAttrModified"), &doc->_memo_domattrmodified); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domnoderemovedfromdocument); dom_string_unref(doc->_memo_domnodeinsertedintodocument); dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMCharacterDataModified", SLEN("DOMCharacterDataModified"), &doc->_memo_domcharacterdatamodified); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domattrmodified); dom_string_unref(doc->_memo_domnoderemovedfromdocument); dom_string_unref(doc->_memo_domnodeinsertedintodocument); dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } err = dom_string_create_interned((const uint8_t *) "DOMSubtreeModified", SLEN("DOMSubtreeModified"), &doc->_memo_domsubtreemodified); if (err != DOM_NO_ERR) { dom_string_unref(doc->_memo_domcharacterdatamodified); dom_string_unref(doc->_memo_domattrmodified); dom_string_unref(doc->_memo_domnoderemovedfromdocument); dom_string_unref(doc->_memo_domnodeinsertedintodocument); dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); return err; } /* We should not pass a NULL when all things hook up */ return _dom_document_event_internal_initialise(doc, &doc->dei, daf, daf_ctx); } /* Finalise the document */ bool _dom_document_finalise(dom_document *doc) { /* Finalise base class, delete the tree in force */ _dom_node_finalise(&doc->base); /* Now, the first_child and last_child should be null */ doc->base.first_child = NULL; doc->base.last_child = NULL; /* Ensure list of nodes pending deletion is empty. If not, * then we can't yet destroy the document (its destruction will * have to wait until the pending nodes are destroyed) */ if (doc->pending_nodes.next != &doc->pending_nodes) return false; /* Ok, the document tree is empty, as is the list of nodes pending * deletion. Therefore, it is safe to destroy the document. */ /* This is paranoia -- if there are any remaining nodelists, * then the document's reference count will be * non-zero as these data structures reference the document because * they are held by the client. */ doc->nodelists = NULL; if (doc->id_name != NULL) dom_string_unref(doc->id_name); dom_string_unref(doc->class_string); dom_string_unref(doc->script_string); dom_string_unref(doc->_memo_empty); dom_string_unref(doc->_memo_domnodeinserted); dom_string_unref(doc->_memo_domnoderemoved); dom_string_unref(doc->_memo_domnodeinsertedintodocument); dom_string_unref(doc->_memo_domnoderemovedfromdocument); dom_string_unref(doc->_memo_domattrmodified); dom_string_unref(doc->_memo_domcharacterdatamodified); dom_string_unref(doc->_memo_domsubtreemodified); _dom_document_event_internal_finalise(doc, &doc->dei); return true; } /*----------------------------------------------------------------------*/ /* Public virtual functions */ /** * Retrieve the doctype of a document * * \param doc The document to retrieve the doctype from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_get_doctype(dom_document *doc, dom_document_type **result) { dom_node_internal *c; for (c = doc->base.first_child; c != NULL; c = c->next) { if (c->type == DOM_DOCUMENT_TYPE_NODE) break; } if (c != NULL) dom_node_ref(c); *result = (dom_document_type *) c; return DOM_NO_ERR; } /** * Retrieve the DOM implementation that handles this document * * \param doc The document to retrieve the implementation from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned implementation will have its reference count increased. * It is the responsibility of the caller to unref the implementation once * it has finished with it. */ dom_exception _dom_document_get_implementation(dom_document *doc, dom_implementation **result) { UNUSED(doc); *result = (dom_implementation *) "libdom"; return DOM_NO_ERR; } /** * Retrieve the document element of a document * * \param doc The document to retrieve the document element from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_get_document_element(dom_document *doc, dom_element **result) { dom_node_internal *root; /* Find the first element node in child list */ for (root = doc->base.first_child; root != NULL; root = root->next) { if (root->type == DOM_ELEMENT_NODE) break; } if (root != NULL) dom_node_ref(root); *result = (dom_element *) root; return DOM_NO_ERR; } /** * Create an element * * \param doc The document owning the element * \param tag_name The name of the element * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid. * * ::doc and ::tag_name will have their reference counts increased. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_element(dom_document *doc, dom_string *tag_name, dom_element **result) { if (_dom_validate_name(tag_name) == false) return DOM_INVALID_CHARACTER_ERR; return _dom_element_create(doc, tag_name, NULL, NULL, result); } /** * Create a document fragment * * \param doc The document owning the fragment * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_document_fragment(dom_document *doc, dom_document_fragment **result) { dom_string *name; dom_exception err; err = dom_string_create((const uint8_t *) "#document-fragment", SLEN("#document-fragment"), &name); if (err != DOM_NO_ERR) return err; err = _dom_document_fragment_create(doc, name, NULL, result); dom_string_unref(name); return err; } /** * Create a text node * * \param doc The document owning the node * \param data The data for the node * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_text_node(dom_document *doc, dom_string *data, dom_text **result) { dom_string *name; dom_exception err; err = dom_string_create((const uint8_t *) "#text", SLEN("#text"), &name); if (err != DOM_NO_ERR) return err; err = _dom_text_create(doc, name, data, result); dom_string_unref(name); return err; } /** * Create a comment node * * \param doc The document owning the node * \param data The data for the node * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_comment(dom_document *doc, dom_string *data, dom_comment **result) { dom_string *name; dom_exception err; err = dom_string_create((const uint8_t *) "#comment", SLEN("#comment"), &name); if (err != DOM_NO_ERR) return err; err = _dom_comment_create(doc, name, data, result); dom_string_unref(name); return err; } /** * Create a CDATA section * * \param doc The document owning the section * \param data The data for the section contents * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if this is an HTML document. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_cdata_section(dom_document *doc, dom_string *data, dom_cdata_section **result) { dom_string *name; dom_exception err; err = dom_string_create((const uint8_t *) "#cdata-section", SLEN("#cdata-section"), &name); if (err != DOM_NO_ERR) return err; err = _dom_cdata_section_create(doc, name, data, result); dom_string_unref(name); return err; } /** * Create a processing instruction * * \param doc The document owning the instruction * \param target The instruction target * \param data The data for the node * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::target is invalid, * DOM_NOT_SUPPORTED_ERR if this is an HTML document. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_processing_instruction( dom_document *doc, dom_string *target, dom_string *data, dom_processing_instruction **result) { if (_dom_validate_name(target) == false) return DOM_INVALID_CHARACTER_ERR; return _dom_processing_instruction_create(doc, target, data, result); } /** * Create an attribute * * \param doc The document owning the attribute * \param name The name of the attribute * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::name is invalid. * * The constructed attribute will always be classified as 'specified'. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_attribute(dom_document *doc, dom_string *name, dom_attr **result) { if (_dom_validate_name(name) == false) return DOM_INVALID_CHARACTER_ERR; return _dom_attr_create(doc, name, NULL, NULL, true, result); } /** * Create an entity reference * * \param doc The document owning the reference * \param name The name of the entity to reference * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::name is invalid, * DOM_NOT_SUPPORTED_ERR if this is an HTML document. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_entity_reference(dom_document *doc, dom_string *name, dom_entity_reference **result) { if (_dom_validate_name(name) == false) return DOM_INVALID_CHARACTER_ERR; return _dom_entity_reference_create(doc, name, NULL, result); } /** * Retrieve a list of all elements with a given tag name * * \param doc The document to search in * \param tagname The tag name to search for ("*" for all) * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned list will have its reference count increased. It is * the responsibility of the caller to unref the list once it has * finished with it. */ dom_exception _dom_document_get_elements_by_tag_name(dom_document *doc, dom_string *tagname, dom_nodelist **result) { return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAME, (dom_node_internal *) doc, tagname, NULL, NULL, result); } /** * Import a node from another document into this one * * \param doc The document to import into * \param node The node to import * \param deep Whether to copy the node's subtree * \param result Pointer to location to receive imported node in this document. * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if any of the names are invalid, * DOM_NOT_SUPPORTED_ERR if the type of ::node is unsupported * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_import_node(dom_document *doc, dom_node *node, bool deep, dom_node **result) { /* TODO: The DOM_INVALID_CHARACTER_ERR exception */ return dom_document_dup_node(doc, node, deep, result, DOM_NODE_IMPORTED); } /** * Create an element from the qualified name and namespace URI * * \param doc The document owning the element * \param namespace The namespace URI to use, or NULL for none * \param qname The qualified name of the element * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::qname is invalid, * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a * prefix and ::namespace is NULL, or * ::qname has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" and * ::namespace is not * "http://www.w3.org/2000/xmlns", or * ::namespace is * "http://www.w3.org/2000/xmlns" and * ::qname is not (or is not prefixed by) * "xmlns", * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" * feature. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_element_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_element **result) { dom_string *prefix, *localname; dom_exception err; if (_dom_validate_name(qname) == false) return DOM_INVALID_CHARACTER_ERR; /* Validate qname */ err = _dom_namespace_validate_qname(qname, namespace); if (err != DOM_NO_ERR) { return err; } /* Divide QName into prefix/localname pair */ err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) { return err; } /* Attempt to create element */ err = _dom_element_create(doc, localname, namespace, prefix, result); /* Tidy up */ if (localname != NULL) { dom_string_unref(localname); } if (prefix != NULL) { dom_string_unref(prefix); } return err; } /** * Create an attribute from the qualified name and namespace URI * * \param doc The document owning the attribute * \param namespace The namespace URI to use * \param qname The qualified name of the attribute * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::qname is invalid, * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a * prefix and ::namespace is NULL, or * ::qname has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" and * ::namespace is not * "http://www.w3.org/2000/xmlns", or * ::namespace is * "http://www.w3.org/2000/xmlns" and * ::qname is not (or is not prefixed by) * "xmlns", * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" * feature. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_create_attribute_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_attr **result) { dom_string *prefix, *localname; dom_exception err; if (_dom_validate_name(qname) == false) return DOM_INVALID_CHARACTER_ERR; /* Validate qname */ err = _dom_namespace_validate_qname(qname, namespace); if (err != DOM_NO_ERR) { return err; } /* Divide QName into prefix/localname pair */ err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) { return err; } /* Attempt to create attribute */ err = _dom_attr_create(doc, localname, namespace, prefix, true, result); /* Tidy up */ if (localname != NULL) { dom_string_unref(localname); } if (prefix != NULL) { dom_string_unref(prefix); } return err; } /** * Retrieve a list of all elements with a given local name and namespace URI * * \param doc The document to search in * \param namespace The namespace URI * \param localname The local name * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * The returned list will have its reference count increased. It is * the responsibility of the caller to unref the list once it has * finished with it. */ dom_exception _dom_document_get_elements_by_tag_name_ns( dom_document *doc, dom_string *namespace, dom_string *localname, dom_nodelist **result) { return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAMESPACE, (dom_node_internal *) doc, NULL, namespace, localname, result); } /** * Retrieve the element that matches the specified ID * * \param doc The document to search in * \param id The ID to search for * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_document_get_element_by_id(dom_document *doc, dom_string *id, dom_element **result) { dom_node_internal *root; dom_exception err; *result = NULL; err = dom_document_get_document_element(doc, (void *) &root); if (err != DOM_NO_ERR) return err; err = _dom_find_element_by_id(root, id, result); dom_node_unref(root); if (*result != NULL) dom_node_ref(*result); return err; } /** * Retrieve the input encoding of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_get_input_encoding(dom_document *doc, dom_string **result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the XML encoding of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_get_xml_encoding(dom_document *doc, dom_string **result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the standalone status of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. */ dom_exception _dom_document_get_xml_standalone(dom_document *doc, bool *result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Set the standalone status of the document * * \param doc The document to query * \param standalone Standalone status to use * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the document does not support the "XML" * feature. * * We don't support this API now, so the return value is always * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_set_xml_standalone(dom_document *doc, bool standalone) { UNUSED(doc); UNUSED(standalone); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the XML version of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NO_ERR * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * We don't support this API now, so the return value is always * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_get_xml_version(dom_document *doc, dom_string **result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Set the XML version of the document * * \param doc The document to query * \param version XML version to use * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the document does not support the "XML" * feature. * * We don't support this API now, so the return value is always * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_set_xml_version(dom_document *doc, dom_string *version) { UNUSED(doc); UNUSED(version); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the error checking mode of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. */ dom_exception _dom_document_get_strict_error_checking( dom_document *doc, bool *result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Set the error checking mode of the document * * \param doc The document to query * \param strict Whether to use strict error checking * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. */ dom_exception _dom_document_set_strict_error_checking( dom_document *doc, bool strict) { UNUSED(doc); UNUSED(strict); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the URI of the document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_get_uri(dom_document *doc, dom_string **result) { *result = dom_string_ref(doc->uri); return DOM_NO_ERR; } /** * Set the URI of the document * * \param doc The document to query * \param uri The URI to use * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_set_uri(dom_document *doc, dom_string *uri) { dom_string_unref(doc->uri); doc->uri = dom_string_ref(uri); return DOM_NO_ERR; } /** * Attempt to adopt a node from another document into this document * * \param doc The document to adopt into * \param node The node to adopt * \param result Pointer to location to receive adopted node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, * DOM_NOT_SUPPORTED_ERR if ::node is of type Document or * DocumentType * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. * * @note: The spec said adoptNode may be light weight than the importNode * because the former need no Node creation. But in our implementation * this can't be ensured. Both adoptNode and importNode create new * nodes using the importing/adopting document's resource manager. So, * generally, the adoptNode and importNode call the same function * dom_document_dup_node. */ dom_exception _dom_document_adopt_node(dom_document *doc, dom_node *node, dom_node **result) { dom_node_internal *n = (dom_node_internal *) node; dom_exception err; dom_node_internal *parent; dom_node_internal *tmp; *result = NULL; if (n->type == DOM_DOCUMENT_NODE || n->type == DOM_DOCUMENT_TYPE_NODE) { return DOM_NOT_SUPPORTED_ERR; } if (n->type == DOM_ENTITY_NODE || n->type == DOM_NOTATION_NODE || n->type == DOM_PROCESSING_INSTRUCTION_NODE || n->type == DOM_TEXT_NODE || n->type == DOM_CDATA_SECTION_NODE || n->type == DOM_COMMENT_NODE) { *result = NULL; return DOM_NO_ERR; } /* Support XML when necessary */ if (n->type == DOM_ENTITY_REFERENCE_NODE) { return DOM_NOT_SUPPORTED_ERR; } err = dom_document_dup_node(doc, node, true, result, DOM_NODE_ADOPTED); if (err != DOM_NO_ERR) { *result = NULL; return err; } parent = n->parent; if (parent != NULL) { err = dom_node_remove_child(parent, node, (void *) &tmp); if (err != DOM_NO_ERR) { dom_node_unref(*result); *result = NULL; return err; } dom_node_unref(tmp); } return DOM_NO_ERR; } /** * Retrieve the DOM configuration associated with a document * * \param doc The document to query * \param result Pointer to location to receive result * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. * * The returned object will have its reference count increased. It is * the responsibility of the caller to unref the object once it has * finished with it. */ dom_exception _dom_document_get_dom_config(dom_document *doc, struct dom_configuration **result) { UNUSED(doc); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Normalize a document * * \param doc The document to normalize * \return DOM_NOT_SUPPORTED_ERR, we don't support this API now. */ dom_exception _dom_document_normalize(dom_document *doc) { UNUSED(doc); return DOM_NOT_SUPPORTED_ERR; } /** * Rename a node in a document * * \param doc The document containing the node * \param node The node to rename * \param namespace The new namespace for the node * \param qname The new qualified name for the node * \param result Pointer to location to receive renamed node * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::tag_name is invalid, * DOM_WRONG_DOCUMENT_ERR if ::node was created in a different * document * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a * prefix and ::namespace is NULL, or * ::qname has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" and * ::namespace is not * "http://www.w3.org/2000/xmlns", or * ::namespace is * "http://www.w3.org/2000/xmlns" and * ::qname is not (or is not prefixed by) * "xmlns", * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" * feature. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. * * We don't support this API now, so the return value is always * DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_rename_node(dom_document *doc, dom_node *node, dom_string *namespace, dom_string *qname, dom_node **result) { UNUSED(doc); UNUSED(node); UNUSED(namespace); UNUSED(qname); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_document_get_text_content(dom_node_internal *node, dom_string **result) { UNUSED(node); *result = NULL; return DOM_NO_ERR; } dom_exception _dom_document_set_text_content(dom_node_internal *node, dom_string *content) { UNUSED(node); UNUSED(content); return DOM_NO_ERR; } /*-----------------------------------------------------------------------*/ /* Overload protected virtual functions */ /* The virtual destroy function of this class */ void _dom_document_destroy(dom_node_internal *node) { dom_document *doc = (dom_document *) node; if (_dom_document_finalise(doc) == true) { free(doc); } } /* The copy constructor function of this class */ dom_exception _dom_document_copy(dom_node_internal *old, dom_node_internal **copy) { UNUSED(old); UNUSED(copy); return DOM_NOT_SUPPORTED_ERR; } /* ----------------------------------------------------------------------- */ /* Helper functions */ /** * Get a nodelist, creating one if necessary * * \param doc The document to get a nodelist for * \param type The type of the NodeList * \param root Root node of subtree that list applies to * \param tagname Name of nodes in list (or NULL) * \param namespace Namespace part of nodes in list (or NULL) * \param localname Local part of nodes in list (or NULL) * \param list Pointer to location to receive list * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * The returned list will have its reference count increased. It is * the responsibility of the caller to unref the list once it has * finished with it. */ dom_exception _dom_document_get_nodelist(dom_document *doc, nodelist_type type, dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname, dom_nodelist **list) { struct dom_doc_nl *l; dom_exception err; for (l = doc->nodelists; l; l = l->next) { if (_dom_nodelist_match(l->list, type, root, tagname, namespace, localname)) break; } if (l != NULL) { /* Found an existing list, so use it */ dom_nodelist_ref(l->list); } else { /* No existing list */ /* Create active list entry */ l = malloc(sizeof(struct dom_doc_nl)); if (l == NULL) return DOM_NO_MEM_ERR; /* Create nodelist */ err = _dom_nodelist_create(doc, type, root, tagname, namespace, localname, &l->list); if (err != DOM_NO_ERR) { free(l); return err; } /* Add to document's list of active nodelists */ l->prev = NULL; l->next = doc->nodelists; if (doc->nodelists) doc->nodelists->prev = l; doc->nodelists = l; } /* Note: the document does not claim a reference on the nodelist * If it did, the nodelist's reference count would never reach zero, * and the list would remain indefinitely. This is not a problem as * the list notifies the document of its destruction via * _dom_document_remove_nodelist. */ *list = l->list; return DOM_NO_ERR; } /** * Remove a nodelist from a document * * \param doc The document to remove the list from * \param list The list to remove */ void _dom_document_remove_nodelist(dom_document *doc, dom_nodelist *list) { struct dom_doc_nl *l; for (l = doc->nodelists; l; l = l->next) { if (l->list == list) break; } if (l == NULL) { /* This should never happen; we should probably abort here */ return; } /* Remove from list */ if (l->prev != NULL) l->prev->next = l->next; else doc->nodelists = l->next; if (l->next != NULL) l->next->prev = l->prev; /* And free item */ free(l); } /** * Find element with certain ID in the subtree rooted at root * * \param root The root element from where we start * \param id The ID of the target element * \param result The result element * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_find_element_by_id(dom_node_internal *root, dom_string *id, dom_element **result) { dom_node_internal *node = root; *result = NULL; while (node != NULL) { if (node->type == DOM_ELEMENT_NODE) { dom_string *real_id; _dom_element_get_id((dom_element *) node, &real_id); if (real_id != NULL) { if (dom_string_isequal(real_id, id)) { dom_string_unref(real_id); *result = (dom_element *) node; return DOM_NO_ERR; } dom_string_unref(real_id); } } if (node->first_child != NULL) { /* Has children */ node = node->first_child; } else if (node->next != NULL) { /* No children, but has siblings */ node = node->next; } else { /* No children or siblings. * Find first unvisited relation. */ dom_node_internal *parent = node->parent; while (parent != root && node == parent->last_child) { node = parent; parent = parent->parent; } node = node->next; } } return DOM_NO_ERR; } /** * Duplicate a Node * * \param doc The documen * \param node The node to duplicate * \param deep Whether to make a deep copy * \param result The returned node * \param opt Whether this is adopt or import operation * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_document_dup_node(dom_document *doc, dom_node *node, bool deep, dom_node **result, dom_node_operation opt) { dom_node_internal *n = (dom_node_internal *) node; dom_node_internal *ret; dom_exception err; dom_node_internal *child, *r; dom_user_data *ud; if (opt == DOM_NODE_ADOPTED && _dom_node_readonly(n)) return DOM_NO_MODIFICATION_ALLOWED_ERR; if (n->type == DOM_DOCUMENT_NODE || n->type == DOM_DOCUMENT_TYPE_NODE) return DOM_NOT_SUPPORTED_ERR; err = dom_node_copy(node, &ret); if (err != DOM_NO_ERR) return err; if (n->type == DOM_ATTRIBUTE_NODE) { _dom_attr_set_specified((dom_attr *) node, true); deep = true; } if (n->type == DOM_ENTITY_REFERENCE_NODE) { deep = false; } if (n->type == DOM_ELEMENT_NODE) { /* Specified attributes are copyied but not default attributes, * if the document object hold all the default attributes, we * have nothing to do here */ } if (opt == DOM_NODE_ADOPTED && (n->type == DOM_ENTITY_NODE || n->type == DOM_NOTATION_NODE)) { /* We did not support XML now */ return DOM_NOT_SUPPORTED_ERR; } if (deep == true) { child = ((dom_node_internal *) node)->first_child; while (child != NULL) { err = dom_document_import_node(doc, child, deep, (void *) &r); if (err != DOM_NO_ERR) { dom_node_unref(ret); return err; } err = dom_node_append_child(ret, r, (void *) &r); if (err != DOM_NO_ERR) { dom_node_unref(ret); dom_node_unref(r); return err; } dom_node_unref(r); child = child->next; } } /* Call the dom_user_data_handlers */ ud = n->user_data; while (ud != NULL) { if (ud->handler != NULL) { ud->handler(opt, ud->key, ud->data, node, (dom_node *) ret); } ud = ud->next; } *result = (dom_node *) ret; return DOM_NO_ERR; } /** * Try to destroy the document. * * \param doc The instance of Document * * Delete the document if: * 1. The refcnt reach zero * 2. The pending list is empty * * else, do nothing. */ void _dom_document_try_destroy(dom_document *doc) { if (doc->base.base.refcnt != 0 || doc->base.parent != NULL) return; _dom_document_destroy((dom_node_internal *) doc); } /** * Set the ID attribute name of this document * * \param doc The document object * \param name The ID name of the elements in this document */ void _dom_document_set_id_name(dom_document *doc, dom_string *name) { if (doc->id_name != NULL) dom_string_unref(doc->id_name); doc->id_name = dom_string_ref(name); } /*-----------------------------------------------------------------------*/ /* Semi-internal API extensions for NetSurf */ dom_exception _dom_document_get_quirks_mode(dom_document *doc, dom_document_quirks_mode *result) { *result = doc->quirks; return DOM_NO_ERR; } dom_exception _dom_document_set_quirks_mode(dom_document *doc, dom_document_quirks_mode quirks) { doc->quirks = quirks; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/comment.h0000644000175000017500000000167412377676745017444 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_comment_h_ #define dom_internal_core_comment_h_ #include #include struct dom_comment; struct dom_document; dom_exception _dom_comment_create(struct dom_document *doc, dom_string *name, dom_string *value, dom_comment **result); #define _dom_comment_initialise _dom_characterdata_initialise #define _dom_comment_finalise _dom_characterdata_finalise void _dom_comment_destroy(dom_comment *comment); /* Following comes the protected vtable */ void __dom_comment_destroy(dom_node_internal *node); dom_exception _dom_comment_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_COMMENT_PROTECT_VTABLE \ __dom_comment_destroy, \ _dom_comment_copy #endif netsurf-all-3.2/libdom/src/core/element.h0000644000175000017500000002026012377676745017423 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_element_h_ #define dom_internal_core_element_h_ #include #include #include "core/node.h" struct dom_document; struct dom_element; struct dom_namednodemap; struct dom_node; struct dom_attr; struct dom_attr_list; struct dom_type_info; struct dom_hash_table; /** * DOM element node */ struct dom_element { struct dom_node_internal base; /**< Base node */ struct dom_attr_list *attributes; /**< Element attributes */ dom_string *id_ns; /**< The id attribute's namespace */ dom_string *id_name; /**< The id attribute's name */ struct dom_type_info *schema_type_info; /**< Type information */ lwc_string **classes; uint32_t n_classes; }; dom_exception _dom_element_create(struct dom_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, struct dom_element **result); dom_exception _dom_element_initialise(struct dom_document *doc, struct dom_element *el, dom_string *name, dom_string *namespace, dom_string *prefix); void _dom_element_finalise(struct dom_element *ele); void _dom_element_destroy(struct dom_element *element); /* The virtual functions of dom_element */ dom_exception _dom_element_get_tag_name(struct dom_element *element, dom_string **name); dom_exception _dom_element_get_attribute(struct dom_element *element, dom_string *name, dom_string **value); dom_exception _dom_element_set_attribute(struct dom_element *element, dom_string *name, dom_string *value); dom_exception _dom_element_remove_attribute(struct dom_element *element, dom_string *name); dom_exception _dom_element_get_attribute_node(struct dom_element *element, dom_string *name, struct dom_attr **result); dom_exception _dom_element_set_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_remove_attribute_node(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_get_elements_by_tag_name( struct dom_element *element, dom_string *name, struct dom_nodelist **result); dom_exception _dom_element_get_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, dom_string **value); dom_exception _dom_element_set_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *qname, dom_string *value); dom_exception _dom_element_remove_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname); dom_exception _dom_element_get_attribute_node_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_attr **result); dom_exception _dom_element_set_attribute_node_ns(struct dom_element *element, struct dom_attr *attr, struct dom_attr **result); dom_exception _dom_element_get_elements_by_tag_name_ns( struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_nodelist **result); dom_exception _dom_element_has_attribute(struct dom_element *element, dom_string *name, bool *result); dom_exception _dom_element_has_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, bool *result); dom_exception _dom_element_get_schema_type_info(struct dom_element *element, struct dom_type_info **result); dom_exception _dom_element_set_id_attribute(struct dom_element *element, dom_string *name, bool is_id); dom_exception _dom_element_set_id_attribute_ns(struct dom_element *element, dom_string *namespace, dom_string *localname, bool is_id); dom_exception _dom_element_set_id_attribute_node(struct dom_element *element, struct dom_attr *id_attr, bool is_id); dom_exception _dom_element_get_classes(struct dom_element *element, lwc_string ***classes, uint32_t *n_classes); dom_exception _dom_element_has_class(struct dom_element *element, lwc_string *name, bool *match); #define DOM_ELEMENT_VTABLE \ _dom_element_get_tag_name, \ _dom_element_get_attribute, \ _dom_element_set_attribute, \ _dom_element_remove_attribute, \ _dom_element_get_attribute_node, \ _dom_element_set_attribute_node, \ _dom_element_remove_attribute_node, \ _dom_element_get_elements_by_tag_name, \ _dom_element_get_attribute_ns, \ _dom_element_set_attribute_ns, \ _dom_element_remove_attribute_ns, \ _dom_element_get_attribute_node_ns, \ _dom_element_set_attribute_node_ns, \ _dom_element_get_elements_by_tag_name_ns, \ _dom_element_has_attribute, \ _dom_element_has_attribute_ns, \ _dom_element_get_schema_type_info, \ _dom_element_set_id_attribute, \ _dom_element_set_id_attribute_ns, \ _dom_element_set_id_attribute_node, \ _dom_element_get_classes, \ _dom_element_has_class /* Overloading dom_node functions */ dom_exception _dom_element_get_attributes(dom_node_internal *node, struct dom_namednodemap **result); dom_exception _dom_element_has_attributes(dom_node_internal *node, bool *result); dom_exception _dom_element_normalize(dom_node_internal *node); dom_exception _dom_element_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result); dom_exception _dom_element_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result); dom_exception _dom_element_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result); #define DOM_NODE_VTABLE_ELEMENT \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_element_get_attributes, /*overload*/\ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_node_clone_node, \ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_node_set_prefix, \ _dom_node_get_local_name, \ _dom_element_has_attributes, /*overload*/\ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_node_get_text_content, \ _dom_node_set_text_content, \ _dom_node_is_same, \ _dom_element_lookup_prefix, /*overload*/\ _dom_element_is_default_namespace, /*overload*/\ _dom_element_lookup_namespace, /*overload*/\ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /** * The internal used vtable for element */ struct dom_element_protected_vtable { struct dom_node_protect_vtable base; dom_exception (*dom_element_parse_attribute)(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); /**< Called by dom_attr_set_value, and used to check * whether the new attribute value is valid and * return a valid on if it is not */ }; typedef struct dom_element_protected_vtable dom_element_protected_vtable; /* Parse the attribute's value */ static inline dom_exception dom_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { struct dom_node_internal *node = (struct dom_node_internal *) ele; return ((dom_element_protected_vtable *) node->vtable)-> dom_element_parse_attribute(ele, name, value, parsed); } #define dom_element_parse_attribute(e, n, v, p) dom_element_parse_attribute( \ (dom_element *) (e), (dom_string *) (n), \ (dom_string *) (v), (dom_string **) (p)) /* The protected virtual function */ dom_exception _dom_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void __dom_element_destroy(dom_node_internal *node); dom_exception _dom_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_ELEMENT_PROTECT_VTABLE \ _dom_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_ELEMENT \ __dom_element_destroy, \ _dom_element_copy /* Helper functions*/ dom_exception _dom_element_get_id(struct dom_element *ele, dom_string **id); extern struct dom_element_vtable _dom_element_vtable; #endif netsurf-all-3.2/libdom/src/core/nodelist.c0000644000175000017500000002732712377676745017621 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include "core/document.h" #include "core/node.h" #include "core/nodelist.h" #include "utils/utils.h" /** * DOM node list */ struct dom_nodelist { dom_document *owner; /**< Owning document */ dom_node_internal *root; /**< Root of applicable subtree */ nodelist_type type; /**< Type of this list */ union { struct { dom_string *name; /**< Tag name to match */ bool any_name; /**< The name is '*' */ } n; struct { bool any_namespace; /**< The namespace is '*' */ bool any_localname; /**< The localname is '*' */ dom_string *namespace; /**< Namespace */ dom_string *localname; /**< Localname */ } ns; /**< Data for namespace matching */ } data; uint32_t refcnt; /**< Reference count */ }; /** * Create a nodelist * * \param doc Owning document * \param type The type of the NodeList * \param root Root node of subtree that list applies to * \param tagname Name of nodes in list (or NULL) * \param namespace Namespace part of nodes in list (or NULL) * \param localname Local part of nodes in list (or NULL) * \param list Pointer to location to receive list * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion * * ::root must be a node owned by ::doc * * The returned list will already be referenced, so the client need not * do so explicitly. The client must unref the list once finished with it. */ dom_exception _dom_nodelist_create(dom_document *doc, nodelist_type type, dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname, dom_nodelist **list) { dom_nodelist *l; l = malloc(sizeof(dom_nodelist)); if (l == NULL) return DOM_NO_MEM_ERR; dom_node_ref(doc); l->owner = doc; dom_node_ref(root); l->root = root; l->type = type; if (type == DOM_NODELIST_BY_NAME || type == DOM_NODELIST_BY_NAME_CASELESS) { assert(tagname != NULL); l->data.n.any_name = false; if (dom_string_byte_length(tagname) == 1) { const char *ch = dom_string_data(tagname); if (*ch == '*') { l->data.n.any_name = true; } } l->data.n.name = dom_string_ref(tagname); } else if (type == DOM_NODELIST_BY_NAMESPACE || type == DOM_NODELIST_BY_NAMESPACE_CASELESS) { l->data.ns.any_localname = false; l->data.ns.any_namespace = false; if (localname != NULL) { if (dom_string_byte_length(localname) == 1) { const char *ch = dom_string_data(localname); if (*ch == '*') { l->data.ns.any_localname = true; } } dom_string_ref(localname); } if (namespace != NULL) { if (dom_string_byte_length(namespace) == 1) { const char *ch = dom_string_data(namespace); if (*ch == '*') { l->data.ns.any_namespace = true; } } dom_string_ref(namespace); } l->data.ns.namespace = namespace; l->data.ns.localname = localname; } l->refcnt = 1; *list = l; return DOM_NO_ERR; } /** * Claim a reference on a DOM node list * * \param list The list to claim a reference on */ void dom_nodelist_ref(dom_nodelist *list) { assert(list != NULL); list->refcnt++; } /** * Release a reference on a DOM node list * * \param list The list to release the reference from * * If the reference count reaches zero, any memory claimed by the * list will be released */ void dom_nodelist_unref(dom_nodelist *list) { if (list == NULL) return; if (--list->refcnt == 0) { dom_node_internal *owner = (dom_node_internal *) list->owner; switch (list->type) { case DOM_NODELIST_CHILDREN: /* Nothing to do */ break; case DOM_NODELIST_BY_NAMESPACE: case DOM_NODELIST_BY_NAMESPACE_CASELESS: if (list->data.ns.namespace != NULL) dom_string_unref(list->data.ns.namespace); if (list->data.ns.localname != NULL) dom_string_unref(list->data.ns.localname); break; case DOM_NODELIST_BY_NAME: case DOM_NODELIST_BY_NAME_CASELESS: assert(list->data.n.name != NULL); dom_string_unref(list->data.n.name); break; } dom_node_unref(list->root); /* Remove list from document */ _dom_document_remove_nodelist(list->owner, list); /* Destroy the list object */ free(list); /* And release our reference on the owning document * This must be last as, otherwise, it's possible that * the document is destroyed before we are */ dom_node_unref(owner); } } /** * Retrieve the length of a node list * * \param list List to retrieve length of * \param length Pointer to location to receive length * \return DOM_NO_ERR. */ dom_exception dom_nodelist_get_length(dom_nodelist *list, uint32_t *length) { dom_node_internal *cur = list->root->first_child; uint32_t len = 0; /* Traverse data structure */ while (cur != NULL) { /* Process current node */ if (list->type == DOM_NODELIST_CHILDREN) { len++; } else if (list->type == DOM_NODELIST_BY_NAME) { if (list->data.n.any_name == true || ( cur->name != NULL && dom_string_isequal(cur->name, list->data.n.name))) { if (cur->type == DOM_ELEMENT_NODE) len++; } } else if (list->type == DOM_NODELIST_BY_NAME_CASELESS) { if (list->data.n.any_name == true || ( cur->name != NULL && dom_string_caseless_isequal(cur->name, list->data.n.name))) { if (cur->type == DOM_ELEMENT_NODE) len++; } } else if (list->type == DOM_NODELIST_BY_NAMESPACE) { if (list->data.ns.any_namespace == true || dom_string_isequal(cur->namespace, list->data.ns.namespace)) { if (list->data.ns.any_localname == true || (cur->name != NULL && dom_string_isequal(cur->name, list->data.ns.localname))) { if (cur->type == DOM_ELEMENT_NODE) len++; } } } else if (list->type == DOM_NODELIST_BY_NAMESPACE_CASELESS) { if (list->data.ns.any_namespace == true || dom_string_caseless_isequal( cur->namespace, list->data.ns.namespace)) { if (list->data.ns.any_localname == true || (cur->name != NULL && dom_string_caseless_isequal( cur->name, list->data.ns.localname))) { if (cur->type == DOM_ELEMENT_NODE) len++; } } } else { assert("Unknown list type" == NULL); } /* Now, find next node */ if (list->type == DOM_NODELIST_CHILDREN) { /* Just interested in sibling list */ cur = cur->next; } else { /* Want a full in-order tree traversal */ if (cur->first_child != NULL) { /* Has children */ cur = cur->first_child; } else if (cur->next != NULL) { /* No children, but has siblings */ cur = cur->next; } else { /* No children or siblings. * Find first unvisited relation. */ dom_node_internal *parent = cur->parent; while (parent != list->root && cur == parent->last_child) { cur = parent; parent = parent->parent; } cur = cur->next; } } } *length = len; return DOM_NO_ERR; } /** * Retrieve an item from a node list * * \param list The list to retrieve the item from * \param index The list index to retrieve * \param node Pointer to location to receive item * \return DOM_NO_ERR. * * ::index is a zero-based index into ::list. * ::index lies in the range [0, length-1] * * The returned node will have had its reference count increased. The client * should unref the node once it has finished with it. */ dom_exception _dom_nodelist_item(dom_nodelist *list, uint32_t index, dom_node **node) { dom_node_internal *cur = list->root->first_child; uint32_t count = 0; /* Traverse data structure */ while (cur != NULL) { /* Process current node */ if (list->type == DOM_NODELIST_CHILDREN) { count++; } else if (list->type == DOM_NODELIST_BY_NAME) { if (list->data.n.any_name == true || ( cur->name != NULL && dom_string_isequal(cur->name, list->data.n.name))) { if (cur->type == DOM_ELEMENT_NODE) count++; } } else if (list->type == DOM_NODELIST_BY_NAME_CASELESS) { if (list->data.n.any_name == true || ( cur->name != NULL && dom_string_caseless_isequal(cur->name, list->data.n.name))) { if (cur->type == DOM_ELEMENT_NODE) count++; } } else if (list->type == DOM_NODELIST_BY_NAMESPACE) { if (list->data.ns.any_namespace == true || (cur->namespace != NULL && dom_string_isequal(cur->namespace, list->data.ns.namespace))) { if (list->data.ns.any_localname == true || (cur->name != NULL && dom_string_isequal(cur->name, list->data.ns.localname))) { if (cur->type == DOM_ELEMENT_NODE) count++; } } } else if (list->type == DOM_NODELIST_BY_NAMESPACE_CASELESS) { if (list->data.ns.any_namespace == true || (cur->namespace != NULL && dom_string_caseless_isequal( cur->namespace, list->data.ns.namespace))) { if (list->data.ns.any_localname == true || (cur->name != NULL && dom_string_caseless_isequal( cur->name, list->data.ns.localname))) { if (cur->type == DOM_ELEMENT_NODE) count++; } } } else { assert("Unknown list type" == NULL); } /* Stop if this is the requested index */ if ((index + 1) == count) { break; } /* Now, find next node */ if (list->type == DOM_NODELIST_CHILDREN) { /* Just interested in sibling list */ cur = cur->next; } else { /* Want a full in-order tree traversal */ if (cur->first_child != NULL) { /* Has children */ cur = cur->first_child; } else if (cur->next != NULL) { /* No children, but has siblings */ cur = cur->next; } else { /* No children or siblings. * Find first unvisited relation. */ dom_node_internal *parent = cur->parent; while (parent != list->root && cur == parent->last_child) { cur = parent; parent = parent->parent; } cur = cur->next; } } } if (cur != NULL) { dom_node_ref(cur); } *node = (dom_node *) cur; return DOM_NO_ERR; } /** * Match a nodelist instance against a set of nodelist creation parameters * * \param list List to match * \param type The type of the NodeList * \param root Root node of subtree that list applies to * \param tagname Name of nodes in list (or NULL) * \param namespace Namespace part of nodes in list (or NULL) * \param localname Local part of nodes in list (or NULL) * \return true if list matches, false otherwise */ bool _dom_nodelist_match(dom_nodelist *list, nodelist_type type, dom_node_internal *root, dom_string *tagname, dom_string *namespace, dom_string *localname) { if (list->root != root) return false; if (list->type != type) return false; switch (list->type) { case DOM_NODELIST_CHILDREN: return true; case DOM_NODELIST_BY_NAME: return dom_string_isequal(list->data.n.name, tagname); case DOM_NODELIST_BY_NAMESPACE: return dom_string_isequal(list->data.ns.namespace, namespace) && dom_string_isequal(list->data.ns.localname, localname); case DOM_NODELIST_BY_NAME_CASELESS: return dom_string_caseless_isequal(list->data.n.name, tagname); case DOM_NODELIST_BY_NAMESPACE_CASELESS: return dom_string_caseless_isequal(list->data.ns.namespace, namespace) && dom_string_caseless_isequal(list->data.ns.localname, localname); } return false; } /** * Test whether the two NodeList are equal * * \param l1 One list * \param l2 The other list * \reutrn true for equal, false otherwise. */ bool _dom_nodelist_equal(dom_nodelist *l1, dom_nodelist *l2) { return _dom_nodelist_match(l1, l1->type, l2->root, l2->data.n.name, l2->data.ns.namespace, l2->data.ns.localname); } netsurf-all-3.2/libdom/src/core/cdatasection.h0000644000175000017500000000206012377676745020431 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_cdatasection_h_ #define dom_internal_core_cdatasection_h_ #include #include #include struct dom_node_internal; struct dom_document; dom_exception _dom_cdata_section_create(struct dom_document *doc, dom_string *name, dom_string *value, dom_cdata_section **result); void _dom_cdata_section_destroy(dom_cdata_section *cdata); #define _dom_cdata_section_initialise _dom_text_initialise #define _dom_cdata_section_finalise _dom_text_finalise /* Following comes the protected vtable */ void __dom_cdata_section_destroy(struct dom_node_internal *node); dom_exception _dom_cdata_section_copy(struct dom_node_internal *old, struct dom_node_internal **copy); #define DOM_CDATA_SECTION_PROTECT_VTABLE \ __dom_cdata_section_destroy, \ _dom_cdata_section_copy #endif netsurf-all-3.2/libdom/src/core/node.c0000644000175000017500000021034712377676745016721 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include "core/string.h" #include "core/namednodemap.h" #include "core/attr.h" #include "core/cdatasection.h" #include "core/comment.h" #include "core/document.h" #include "core/document_type.h" #include "core/doc_fragment.h" #include "core/element.h" #include "core/entity_ref.h" #include "core/node.h" #include "core/pi.h" #include "core/text.h" #include "utils/utils.h" #include "utils/validate.h" #include "events/mutation_event.h" static bool _dom_node_permitted_child(const dom_node_internal *parent, const dom_node_internal *child); static inline dom_exception _dom_node_attach(dom_node_internal *node, dom_node_internal *parent, dom_node_internal *previous, dom_node_internal *next); static inline void _dom_node_detach(dom_node_internal *node); static inline dom_exception _dom_node_attach_range(dom_node_internal *first, dom_node_internal *last, dom_node_internal *parent, dom_node_internal *previous, dom_node_internal *next); static inline dom_exception _dom_node_detach_range(dom_node_internal *first, dom_node_internal *last); static inline void _dom_node_replace(dom_node_internal *old, dom_node_internal *replacement); static struct dom_node_vtable node_vtable = { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE }; static struct dom_node_protect_vtable node_protect_vtable = { DOM_NODE_PROTECT_VTABLE }; /*----------------------------------------------------------------------*/ /* The constructor and destructor of this object */ /* Create a DOM node and compose the vtable */ dom_node_internal * _dom_node_create(void) { dom_node_internal *node = malloc(sizeof(struct dom_node_internal)); if (node == NULL) return NULL; node->base.vtable = &node_vtable; node->vtable = &node_protect_vtable; return node; } /** * Destroy a DOM node * * \param node The node to destroy * * ::node's parent link must be NULL and its reference count must be 0. * * ::node will be freed. * * This function should only be called from dom_node_unref or type-specific * destructors (for destroying child nodes). Anything else should not * be attempting to destroy nodes -- they should simply be unreferencing * them (so destruction will occur at the appropriate time). */ void _dom_node_destroy(struct dom_node_internal *node) { struct dom_document *owner = node->owner; bool null_owner_permitted = (node->type == DOM_DOCUMENT_NODE || node->type == DOM_DOCUMENT_TYPE_NODE); assert(null_owner_permitted || owner != NULL); if (!null_owner_permitted) { /* Claim a reference upon the owning document during * destruction to ensure that the document doesn't get * destroyed before its contents. */ dom_node_ref(owner); } /* Finalise this node, this should also destroy all the child nodes. */ _dom_node_finalise(node); if (!null_owner_permitted) { /* Release the reference we claimed on the document. If this * is the last reference held on the document and the list * of nodes pending deletion is empty, then the document will * be destroyed. */ dom_node_unref(owner); } /* Release our memory */ free(node); } /** * Initialise a DOM node * * \param node The node to initialise * \param doc The document which owns the node * \param type The node type required * \param name The node (local) name, or NULL * \param value The node value, or NULL * \param namespace Namespace URI to use for node, or NULL * \param prefix Namespace prefix to use for node, or NULL * \return DOM_NO_ERR on success. * * ::name, ::value, ::namespace, and ::prefix will have their reference * counts increased. */ dom_exception _dom_node_initialise(dom_node_internal *node, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value, dom_string *namespace, dom_string *prefix) { node->owner = doc; if (name != NULL) node->name = dom_string_ref(name); else node->name = NULL; if (value != NULL) node->value = dom_string_ref(value); else node->value = NULL; node->type = type; node->parent = NULL; node->first_child = NULL; node->last_child = NULL; node->previous = NULL; node->next = NULL; /* Note: nodes do not reference the document to which they belong, * as this would result in the document never being destroyed once * the client has finished with it. The document will be aware of * any nodes that it owns through 2 mechanisms: * * either a) Membership of the document tree * or b) Membership of the list of nodes pending deletion * * It is not possible for any given node to be a member of both * data structures at the same time. * * The document will not be destroyed until both of these * structures are empty. It will forcibly attempt to empty * the document tree on document destruction. Any still-referenced * nodes at that time will be added to the list of nodes pending * deletion. This list will not be forcibly emptied, as it contains * those nodes (and their sub-trees) in use by client code. */ if (namespace != NULL) node->namespace = dom_string_ref(namespace); else node->namespace = NULL; if (prefix != NULL) node->prefix = dom_string_ref(prefix); else node->prefix = NULL; node->user_data = NULL; node->base.refcnt = 1; list_init(&node->pending_list); if (node->type != DOM_DOCUMENT_NODE) { /* A Node should be in the pending list when it is created */ dom_node_mark_pending(node); } return _dom_event_target_internal_initialise(&node->eti); } /** * Finalise a DOM node * * \param node The node to finalise * * The contents of ::node will be cleaned up. ::node will not be freed. * All children of ::node should have been removed prior to finalisation. */ void _dom_node_finalise(dom_node_internal *node) { struct dom_user_data *u, *v; struct dom_node_internal *p; struct dom_node_internal *n = NULL; /* Destroy user data */ for (u = node->user_data; u != NULL; u = v) { v = u->next; if (u->handler != NULL) u->handler(DOM_NODE_DELETED, u->key, u->data, NULL, NULL); dom_string_unref(u->key); free(u); } node->user_data = NULL; if (node->prefix != NULL) { dom_string_unref(node->prefix); node->prefix = NULL; } if (node->namespace != NULL) { dom_string_unref(node->namespace); node->namespace = NULL; } /* Destroy all the child nodes of this node */ p = node->first_child; while (p != NULL) { n = p->next; p->parent = NULL; dom_node_try_destroy(p); p = n; } /* Paranoia */ node->next = NULL; node->previous = NULL; node->last_child = NULL; node->first_child = NULL; node->parent = NULL; if (node->value != NULL) { dom_string_unref(node->value); node->value = NULL; } if (node->name != NULL) { dom_string_unref(node->name); node->name = NULL; } /* If the node has no owner document, we need not to finalise its * dom_event_target_internal structure. */ if (node->owner != NULL) _dom_event_target_internal_finalise(&node->eti); /* Detach from the pending list, if we are in it, * this part of code should always be the end of this function. */ if (node->pending_list.prev != &node->pending_list) { assert (node->pending_list.next != &node->pending_list); list_del(&node->pending_list); if (node->owner != NULL && node->type != DOM_DOCUMENT_NODE) { /* Deleting this node from the pending list may cause * the list to be null and we should try to destroy * the document. */ _dom_document_try_destroy(node->owner); } } } /* ---------------------------------------------------------------------*/ /* The public virtual function of this interface Node */ /** * Retrieve the name of a DOM node * * \param node The node to retrieve the name of * \param result Pointer to location to receive node name * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_get_node_name(dom_node_internal *node, dom_string **result) { dom_string *node_name, *temp; dom_exception err; /* Document Node and DocumentType Node can have no owner */ assert(node->type == DOM_DOCUMENT_TYPE_NODE || node->type == DOM_DOCUMENT_NODE || node->owner != NULL); assert(node->name != NULL); /* If this node was created using a namespace-aware method and * has a defined prefix, then nodeName is a QName comprised * of prefix:name. */ if (node->prefix != NULL) { dom_string *colon; err = dom_string_create((const uint8_t *) ":", SLEN(":"), &colon); if (err != DOM_NO_ERR) { return err; } /* Prefix + : */ err = dom_string_concat(node->prefix, colon, &temp); if (err != DOM_NO_ERR) { dom_string_unref(colon); return err; } /* Finished with colon */ dom_string_unref(colon); /* Prefix + : + Localname */ err = dom_string_concat(temp, node->name, &node_name); if (err != DOM_NO_ERR) { dom_string_unref(temp); return err; } /* Finished with temp */ dom_string_unref(temp); } else { node_name = dom_string_ref(node->name); } *result = node_name; return DOM_NO_ERR; } /** * Retrieve the value of a DOM node * * \param node The node to retrieve the value of * \param result Pointer to location to receive node value * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in * this implementation; dom_strings are unbounded. */ dom_exception _dom_node_get_node_value(dom_node_internal *node, dom_string **result) { if (node->value != NULL) dom_string_ref(node->value); *result = node->value; return DOM_NO_ERR; } /** * Set the value of a DOM node * * \param node Node to set the value of * \param value New value for node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if the node is readonly and the * value is not defined to be null. * * The new value will have its reference count increased, so the caller * should unref it after the call (as the caller should have already claimed * a reference on the string). The node's existing value will be unrefed. */ dom_exception _dom_node_set_node_value(dom_node_internal *node, dom_string *value) { /* TODO * Whether we should change this to a virtual function? */ /* This is a NOP if the value is defined to be null. */ if (node->type == DOM_DOCUMENT_NODE || node->type == DOM_DOCUMENT_FRAGMENT_NODE || node->type == DOM_DOCUMENT_TYPE_NODE || node->type == DOM_ELEMENT_NODE || node->type == DOM_ENTITY_NODE || node->type == DOM_ENTITY_REFERENCE_NODE || node->type == DOM_NOTATION_NODE) { return DOM_NO_ERR; } /* Ensure node is writable */ if (_dom_node_readonly(node)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* If it's an attribute node, then delegate setting to * the type-specific function */ if (node->type == DOM_ATTRIBUTE_NODE) return dom_attr_set_value((struct dom_attr *) node, value); if (node->value != NULL) dom_string_unref(node->value); if (value != NULL) dom_string_ref(value); node->value = value; return DOM_NO_ERR; } /** * Retrieve the type of a DOM node * * \param node The node to retrieve the type of * \param result Pointer to location to receive node type * \return DOM_NO_ERR. */ dom_exception _dom_node_get_node_type(dom_node_internal *node, dom_node_type *result) { *result = node->type; return DOM_NO_ERR; } /** * Retrieve the parent of a DOM node * * \param node The node to retrieve the parent of * \param result Pointer to location to receive node parent * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_parent_node(dom_node_internal *node, dom_node_internal **result) { /* Attr nodes have no parent */ if (node->type == DOM_ATTRIBUTE_NODE) { *result = NULL; return DOM_NO_ERR; } /* If there is a parent node, then increase its reference count */ if (node->parent != NULL) dom_node_ref(node->parent); *result = node->parent; return DOM_NO_ERR; } /** * Retrieve a list of children of a DOM node * * \param node The node to retrieve the children of * \param result Pointer to location to receive child list * \return DOM_NO_ERR. * * The returned NodeList will be referenced. It is the responsibility * of the caller to unref the list once it has finished with it. */ dom_exception _dom_node_get_child_nodes(dom_node_internal *node, struct dom_nodelist **result) { /* Can't do anything without an owning document. * This is only a problem for DocumentType nodes * which are not yet attached to a document. * DocumentType nodes have no children, anyway. */ if (node->owner == NULL) return DOM_NOT_SUPPORTED_ERR; return _dom_document_get_nodelist(node->owner, DOM_NODELIST_CHILDREN, node, NULL, NULL, NULL, result); } /** * Retrieve the first child of a DOM node * * \param node The node to retrieve the first child of * \param result Pointer to location to receive node's first child * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_first_child(dom_node_internal *node, dom_node_internal **result) { /* If there is a first child, increase its reference count */ if (node->first_child != NULL) dom_node_ref(node->first_child); *result = node->first_child; return DOM_NO_ERR; } /** * Retrieve the last child of a DOM node * * \param node The node to retrieve the last child of * \param result Pointer to location to receive node's last child * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_last_child(dom_node_internal *node, dom_node_internal **result) { /* If there is a last child, increase its reference count */ if (node->last_child != NULL) dom_node_ref(node->last_child); *result = node->last_child; return DOM_NO_ERR; } /** * Retrieve the previous sibling of a DOM node * * \param node The node to retrieve the previous sibling of * \param result Pointer to location to receive node's previous sibling * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_previous_sibling(dom_node_internal *node, dom_node_internal **result) { /* Attr nodes have no previous siblings */ if (node->type == DOM_ATTRIBUTE_NODE) { *result = NULL; return DOM_NO_ERR; } /* If there is a previous sibling, increase its reference count */ if (node->previous != NULL) dom_node_ref(node->previous); *result = node->previous; return DOM_NO_ERR; } /** * Retrieve the subsequent sibling of a DOM node * * \param node The node to retrieve the subsequent sibling of * \param result Pointer to location to receive node's subsequent sibling * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_next_sibling(dom_node_internal *node, dom_node_internal **result) { /* Attr nodes have no next siblings */ if (node->type == DOM_ATTRIBUTE_NODE) { *result = NULL; return DOM_NO_ERR; } /* If there is a subsequent sibling, increase its reference count */ if (node->next != NULL) dom_node_ref(node->next); *result = node->next; return DOM_NO_ERR; } /** * Retrieve a map of attributes associated with a DOM node * * \param node The node to retrieve the attributes of * \param result Pointer to location to receive attribute map * \return DOM_NO_ERR. * * The returned NamedNodeMap will be referenced. It is the responsibility * of the caller to unref the map once it has finished with it. * * If ::node is not an Element, then NULL will be returned. */ dom_exception _dom_node_get_attributes(dom_node_internal *node, struct dom_namednodemap **result) { UNUSED(node); *result = NULL; return DOM_NO_ERR; } /** * Retrieve the owning document of a DOM node * * \param node The node to retrieve the owner of * \param result Pointer to location to receive node's owner * \return DOM_NO_ERR. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_get_owner_document(dom_node_internal *node, struct dom_document **result) { /* Document nodes have no owner, as far as clients are concerned * In reality, they own themselves as this simplifies code elsewhere */ if (node->type == DOM_DOCUMENT_NODE) { *result = NULL; return DOM_NO_ERR; } /* If there is an owner, increase its reference count */ if (node->owner != NULL) dom_node_ref(node->owner); *result = node->owner; return DOM_NO_ERR; } /** * Insert a child into a node * * \param node Node to insert into * \param new_child Node to insert * \param ref_child Node to insert before, or NULL to insert as last child * \param result Pointer to location to receive node being inserted * \return DOM_NO_ERR on success, * DOM_HIERARCHY_REQUEST_ERR if ::new_child's type is not * permitted as a child of ::node, * or ::new_child is an ancestor of * ::node (or is ::node itself), or * ::node is of type Document and a * second DocumentType or Element is * being inserted, * DOM_WRONG_DOCUMENT_ERR if ::new_child was created from a * different document than ::node, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, or * ::new_child's parent is readonly, * DOM_NOT_FOUND_ERR if ::ref_child is not a child of * ::node. * * If ::new_child is a DocumentFragment, all of its children are inserted. * If ::new_child is already in the tree, it is first removed. * * Attempting to insert a node before itself is a NOP. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_insert_before(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal *ref_child, dom_node_internal **result) { dom_exception err; dom_node_internal *n; assert(node != NULL); /* Ensure that new_child and node are owned by the same document */ if ((new_child->type == DOM_DOCUMENT_TYPE_NODE && new_child->owner != NULL && new_child->owner != node->owner) || (new_child->type != DOM_DOCUMENT_TYPE_NODE && new_child->owner != node->owner)) return DOM_WRONG_DOCUMENT_ERR; /* Ensure node isn't read only */ if (_dom_node_readonly(node)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* Ensure that ref_child (if any) is a child of node */ if (ref_child != NULL && ref_child->parent != node) return DOM_NOT_FOUND_ERR; /* Ensure that new_child is not an ancestor of node, nor node itself */ for (n = node; n != NULL; n = n->parent) { if (n == new_child) return DOM_HIERARCHY_REQUEST_ERR; } /* Ensure that new_child is permitted as a child of node */ if (new_child->type != DOM_DOCUMENT_FRAGMENT_NODE && !_dom_node_permitted_child(node, new_child)) return DOM_HIERARCHY_REQUEST_ERR; /* Attempting to insert a node before itself is a NOP */ if (new_child == ref_child) { dom_node_ref(new_child); *result = new_child; return DOM_NO_ERR; } /* If new_child is already in the tree and * its parent isn't read only, remove it */ if (new_child->parent != NULL) { if (_dom_node_readonly(new_child->parent)) return DOM_NO_MODIFICATION_ALLOWED_ERR; _dom_node_detach(new_child); } /* When a Node is attached, it should be removed from the pending * list */ dom_node_remove_pending(new_child); /* If new_child is a DocumentFragment, insert its children. * Otherwise, insert new_child */ if (new_child->type == DOM_DOCUMENT_FRAGMENT_NODE) { /* Test the children of the docment fragment can be appended */ dom_node_internal *c = new_child->first_child; for (; c != NULL; c = c->next) if (!_dom_node_permitted_child(node, c)) return DOM_HIERARCHY_REQUEST_ERR; if (new_child->first_child != NULL) { err = _dom_node_attach_range(new_child->first_child, new_child->last_child, node, ref_child == NULL ? node->last_child : ref_child->previous, ref_child == NULL ? NULL : ref_child); if (err != DOM_NO_ERR) return err; new_child->first_child = NULL; new_child->last_child = NULL; } } else { err = _dom_node_attach(new_child, node, ref_child == NULL ? node->last_child : ref_child->previous, ref_child == NULL ? NULL : ref_child); if (err != DOM_NO_ERR) return err; } /* DocumentType nodes are created outside the Document so, * if we're trying to attach a DocumentType node, then we * also need to set its owner. */ if (node->type == DOM_DOCUMENT_NODE && new_child->type == DOM_DOCUMENT_TYPE_NODE) { /* See long comment in _dom_node_initialise as to why * we don't ref the document here */ new_child->owner = (struct dom_document *) node; } /** \todo Is it correct to return DocumentFragments? */ dom_node_ref(new_child); *result = new_child; return DOM_NO_ERR; } /** * Replace a node's child with a new one * * \param node Node whose child to replace * \param new_child Replacement node * \param old_child Child to replace * \param result Pointer to location to receive replaced node * \return DOM_NO_ERR on success, * DOM_HIERARCHY_REQUEST_ERR if ::new_child's type is not * permitted as a child of ::node, * or ::new_child is an ancestor of * ::node (or is ::node itself), or * ::node is of type Document and a * second DocumentType or Element is * being inserted, * DOM_WRONG_DOCUMENT_ERR if ::new_child was created from a * different document than ::node, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, or * ::new_child's parent is readonly, * DOM_NOT_FOUND_ERR if ::old_child is not a child of * ::node, * DOM_NOT_SUPPORTED_ERR if ::node is of type Document and * ::new_child is of type * DocumentType or Element. * * If ::new_child is a DocumentFragment, ::old_child is replaced by all of * ::new_child's children. * If ::new_child is already in the tree, it is first removed. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_replace_child(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal *old_child, dom_node_internal **result) { dom_node_internal *n; /* We don't support replacement of DocumentType or root Elements */ if (node->type == DOM_DOCUMENT_NODE && (new_child->type == DOM_DOCUMENT_TYPE_NODE || new_child->type == DOM_ELEMENT_NODE)) return DOM_NOT_SUPPORTED_ERR; /* Ensure that new_child and node are owned by the same document */ if (new_child->owner != node->owner) return DOM_WRONG_DOCUMENT_ERR; /* Ensure node isn't read only */ if (_dom_node_readonly(node)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* Ensure that old_child is a child of node */ if (old_child->parent != node) return DOM_NOT_FOUND_ERR; /* Ensure that new_child is not an ancestor of node, nor node itself */ for (n = node; n != NULL; n = n->parent) { if (n == new_child) return DOM_HIERARCHY_REQUEST_ERR; } /* Ensure that new_child is permitted as a child of node */ if (new_child->type == DOM_DOCUMENT_FRAGMENT_NODE) { /* If this node is a doc fragment, we should test all its * children nodes */ dom_node_internal *c; c = new_child->first_child; while (c != NULL) { if (!_dom_node_permitted_child(node, c)) return DOM_HIERARCHY_REQUEST_ERR; c = c->next; } } else { if (!_dom_node_permitted_child(node, new_child)) return DOM_HIERARCHY_REQUEST_ERR; } /* Attempting to replace a node with itself is a NOP */ if (new_child == old_child) { dom_node_ref(old_child); *result = old_child; return DOM_NO_ERR; } /* If new_child is already in the tree and * its parent isn't read only, remove it */ if (new_child->parent != NULL) { if (_dom_node_readonly(new_child->parent)) return DOM_NO_MODIFICATION_ALLOWED_ERR; _dom_node_detach(new_child); } /* When a Node is attached, it should be removed from the pending * list */ dom_node_remove_pending(new_child); /* Perform the replacement */ _dom_node_replace(old_child, new_child); /* Sort out the return value */ dom_node_ref(old_child); /* The replaced node should be marded pending */ dom_node_mark_pending(old_child); *result = old_child; return DOM_NO_ERR; } /** * Remove a child from a node * * \param node Node whose child to replace * \param old_child Child to remove * \param result Pointer to location to receive removed node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly * DOM_NOT_FOUND_ERR if ::old_child is not a child of * ::node, * DOM_NOT_SUPPORTED_ERR if ::node is of type Document and * ::new_child is of type * DocumentType or Element. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_remove_child(dom_node_internal *node, dom_node_internal *old_child, dom_node_internal **result) { dom_exception err; bool success = true; /* We don't support removal of DocumentType or root Element nodes */ if (node->type == DOM_DOCUMENT_NODE && (old_child->type == DOM_DOCUMENT_TYPE_NODE || old_child->type == DOM_ELEMENT_NODE)) return DOM_NOT_SUPPORTED_ERR; /* Ensure old_child is a child of node */ if (old_child->parent != node) return DOM_NOT_FOUND_ERR; /* Ensure node is writable */ if (_dom_node_readonly(node)) return DOM_NO_MODIFICATION_ALLOWED_ERR; /* Dispatch a DOMNodeRemoval event */ err = dom_node_dispatch_node_change_event(node->owner, old_child, node, DOM_MUTATION_REMOVAL, &success); if (err != DOM_NO_ERR) return err; /* Detach the node */ _dom_node_detach(old_child); /* When a Node is removed, it should be destroy. When its refcnt is not * zero, it will be added to the document's deletion pending list. * When a Node is removed, its parent should be NULL, but its owner * should remain to be the document. */ dom_node_ref(old_child); dom_node_try_destroy(old_child); *result = old_child; success = true; err = _dom_dispatch_subtree_modified_event(node->owner, node, &success); if (err != DOM_NO_ERR) return err; return DOM_NO_ERR; } /** * Append a child to the end of a node's child list * * \param node Node to insert into * \param new_child Node to append * \param result Pointer to location to receive node being inserted * \return DOM_NO_ERR on success, * DOM_HIERARCHY_REQUEST_ERR if ::new_child's type is not * permitted as a child of ::node, * or ::new_child is an ancestor of * ::node (or is ::node itself), or * ::node is of type Document and a * second DocumentType or Element is * being inserted, * DOM_WRONG_DOCUMENT_ERR if ::new_child was created from a * different document than ::node, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, or * ::new_child's parent is readonly. * * If ::new_child is a DocumentFragment, all of its children are inserted. * If ::new_child is already in the tree, it is first removed. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_node_append_child(dom_node_internal *node, dom_node_internal *new_child, dom_node_internal **result) { /* This is just a veneer over insert_before */ return dom_node_insert_before(node, new_child, NULL, result); } /** * Determine if a node has any children * * \param node Node to inspect * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_has_child_nodes(dom_node_internal *node, bool *result) { *result = node->first_child != NULL; return DOM_NO_ERR; } /** * Clone a DOM node * * \param node The node to clone * \param deep True to deep-clone the node's sub-tree * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NO_MEMORY_ERR on memory exhaustion. * * The returned node will already be referenced. * * The duplicate node will have no parent and no user data. * * If ::node has registered user_data_handlers, then they will be called. * * Cloning an Element copies all attributes & their values (including those * generated by the XML processor to represent defaulted attributes). It * does not copy any child nodes unless it is a deep copy (this includes * text contained within the Element, as the text is contained in a child * Text node). * * Cloning an Attr directly, as opposed to cloning as part of an Element, * returns a specified attribute. Cloning an Attr always clones its children, * since they represent its value, no matter whether this is a deep clone or * not. * * Cloning an EntityReference automatically constructs its subtree if a * corresponding Entity is available, no matter whether this is a deep clone * or not. * * Cloning any other type of node simply returns a copy. * * Note that cloning an immutable subtree results in a mutable copy, but * the children of an EntityReference clone are readonly. In addition, clones * of unspecified Attr nodes are specified. * * \todo work out what happens when cloning Document, DocumentType, Entity * and Notation nodes. * * Note: we adopt a OO paradigm, this clone_node just provide a basic operation * of clone. Special clones like Attr/EntitiReference stated above should * provide their overload of this interface in their implementation file. */ dom_exception _dom_node_clone_node(dom_node_internal *node, bool deep, dom_node_internal **result) { dom_node_internal *n, *child, *r; dom_exception err; dom_user_data *ud; assert(node->owner != NULL); err = dom_node_copy(node, &n); if (err != DOM_NO_ERR) { return err; } if (deep) { child = node->first_child; while (child != NULL) { err = dom_node_clone_node(child, deep, (void *) &r); if (err != DOM_NO_ERR) { dom_node_unref(n); return err; } err = dom_node_append_child(n, r, (void *) &r); if (err != DOM_NO_ERR) { dom_node_unref(n); return err; } /* Clean up the new node, we have reference it two * times */ dom_node_unref(r); dom_node_unref(r); child = child->next; } } *result = n; /* Call the dom_user_data_handlers */ ud = node->user_data; while (ud != NULL) { if (ud->handler != NULL) ud->handler(DOM_NODE_CLONED, ud->key, ud->data, (dom_node *) node, (dom_node *) n); ud = ud->next; } return DOM_NO_ERR; } /** * Normalize a DOM node * * \param node The node to normalize * \return DOM_NO_ERR. * * Puts all Text nodes in the full depth of the sub-tree beneath ::node, * including Attr nodes into "normal" form, where only structure separates * Text nodes. */ dom_exception _dom_node_normalize(dom_node_internal *node) { dom_node_internal *n, *p; dom_exception err; p = node->first_child; if (p == NULL) return DOM_NO_ERR; n = p->next; while (n != NULL) { if (n->type == DOM_TEXT_NODE && p->type == DOM_TEXT_NODE) { err = _dom_merge_adjacent_text(p, n); if (err != DOM_NO_ERR) return err; _dom_node_detach(n); dom_node_unref(n); n = p->next; continue; } if (n->type != DOM_TEXT_NODE) { err = dom_node_normalize(n); if (err != DOM_NO_ERR) return err; } p = n; n = n->next; } return DOM_NO_ERR; } /** * Test whether the DOM implementation implements a specific feature and * that feature is supported by the node. * * \param node The node to test * \param feature The name of the feature to test * \param version The version number of the feature to test * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_is_supported(dom_node_internal *node, dom_string *feature, dom_string *version, bool *result) { bool has; UNUSED(node); dom_implementation_has_feature(dom_string_data(feature), dom_string_data(version), &has); *result = has; return DOM_NO_ERR; } /** * Retrieve the namespace of a DOM node * * \param node The node to retrieve the namespace of * \param result Pointer to location to receive node's namespace * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_get_namespace(dom_node_internal *node, dom_string **result) { assert(node->owner != NULL); /* If there is a namespace, increase its reference count */ if (node->namespace != NULL) *result = dom_string_ref(node->namespace); else *result = NULL; return DOM_NO_ERR; } /** * Retrieve the prefix of a DOM node * * \param node The node to retrieve the prefix of * \param result Pointer to location to receive node's prefix * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_get_prefix(dom_node_internal *node, dom_string **result) { assert(node->owner != NULL); /* If there is a prefix, increase its reference count */ if (node->prefix != NULL) *result = dom_string_ref(node->prefix); else *result = NULL; return DOM_NO_ERR; } /** * Set the prefix of a DOM node * * \param node The node to set the prefix of * \param prefix Pointer to prefix string * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if the specified prefix contains * an illegal character, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly, * DOM_NAMESPACE_ERR if the specified prefix is * malformed, if the namespaceURI of * ::node is null, if the specified * prefix is "xml" and the * namespaceURI is different from * "http://www.w3.org/XML/1998/namespace", * if ::node is an attribute and the * specified prefix is "xmlns" and * the namespaceURI is different from * "http://www.w3.org/2000/xmlns", * or if this node is an attribute * and the qualifiedName of ::node * is "xmlns". */ dom_exception _dom_node_set_prefix(dom_node_internal *node, dom_string *prefix) { /* Only Element and Attribute nodes created using * namespace-aware methods may have a prefix */ if ((node->type != DOM_ELEMENT_NODE && node->type != DOM_ATTRIBUTE_NODE) || node->namespace == NULL) { return DOM_NO_ERR; } /** \todo validate prefix */ /* Ensure node is writable */ if (_dom_node_readonly(node)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } /* No longer want existing prefix */ if (node->prefix != NULL) { dom_string_unref(node->prefix); } /* Set the prefix */ if (prefix != NULL) { /* Empty string is treated as NULL */ if (dom_string_length(prefix) == 0) { node->prefix = NULL; } else { node->prefix = dom_string_ref(prefix); } } else { node->prefix = NULL; } return DOM_NO_ERR; } /** * Retrieve the local part of a node's qualified name * * \param node The node to retrieve the local name of * \param result Pointer to location to receive local name * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_get_local_name(dom_node_internal *node, dom_string **result) { assert(node->owner != NULL); /* Only Element and Attribute nodes may have a local name */ if (node->type != DOM_ELEMENT_NODE && node->type != DOM_ATTRIBUTE_NODE) { *result = NULL; return DOM_NO_ERR; } /* The node may have a local name, reference it if so */ if (node->name != NULL) *result = dom_string_ref(node->name); else *result = NULL; return DOM_NO_ERR; } /** * Determine if a node has any attributes * * \param node Node to inspect * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_has_attributes(dom_node_internal *node, bool *result) { UNUSED(node); *result = false; return DOM_NO_ERR; } /** * Retrieve the base URI of a DOM node * * \param node The node to retrieve the base URI of * \param result Pointer to location to receive base URI * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_node_get_base(dom_node_internal *node, dom_string **result) { struct dom_document *doc = node->owner; assert(doc != NULL); return dom_document_get_base(doc, result); } /** * Compare the positions of two nodes in a DOM tree * * \param node The reference node * \param other The node to compare * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR when the nodes are from different DOM * implementations. * * The result is a bitfield of dom_document_position values. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_node_compare_document_position(dom_node_internal *node, dom_node_internal *other, uint16_t *result) { UNUSED(node); UNUSED(other); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve the text content of a DOM node * * \param node The node to retrieve the text content of * \param result Pointer to location to receive text content * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * If there is no text content in the code, NULL will returned in \a result. * * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in * this implementation; dom_strings are unbounded. */ dom_exception _dom_node_get_text_content(dom_node_internal *node, dom_string **result) { dom_node_internal *n; dom_string *str = NULL; dom_string *ret = NULL; assert(node->owner != NULL); for (n = node->first_child; n != NULL; n = n->next) { if (n->type == DOM_COMMENT_NODE || n->type == DOM_PROCESSING_INSTRUCTION_NODE) continue; dom_node_get_text_content(n, (str == NULL) ? &str : &ret); if (ret != NULL) { dom_string *new_str; dom_string_concat(str, ret, &new_str); dom_string_unref(str); dom_string_unref(ret); str = new_str; } } *result = str; return DOM_NO_ERR; } /** * Set the text content of a DOM node * * \param node The node to set the text content of * \param content New text content for node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::node is readonly. * * Any child nodes ::node may have are removed and replaced with a single * Text node containing the new content. */ dom_exception _dom_node_set_text_content(dom_node_internal *node, dom_string *content) { dom_node_internal *n, *p, *r; dom_document *doc; dom_text *text; dom_exception err; n = node->first_child; while (n != NULL) { p = n; n = n->next; /* Add the (void *) casting to avoid gcc warning: * dereferencing type-punned pointer will break * strict-aliasing rules */ err = dom_node_remove_child(node, p, (void *) &r); if (err != DOM_NO_ERR) return err; } doc = node->owner; assert(doc != NULL); err = dom_document_create_text_node(doc, content, &text); if (err != DOM_NO_ERR) return err; err = dom_node_append_child(node, text, (void *) &r); if (err != DOM_NO_ERR) return err; return DOM_NO_ERR; } /** * Determine if two DOM nodes are the same * * \param node The node to compare * \param other The node to compare against * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * This tests if the two nodes reference the same object. */ dom_exception _dom_node_is_same(dom_node_internal *node, dom_node_internal *other, bool *result) { *result = (node == other); return DOM_NO_ERR; } /** * Lookup the prefix associated with the given namespace URI * * \param node The node to start prefix search from * \param namespace The namespace URI * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_lookup_prefix(dom_node_internal *node, dom_string *namespace, dom_string **result) { if (node->parent != NULL) return dom_node_lookup_prefix(node, namespace, result); else *result = NULL; return DOM_NO_ERR; } /** * Determine if the specified namespace is the default namespace * * \param node The node to query * \param namespace The namespace URI to test * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_is_default_namespace(dom_node_internal *node, dom_string *namespace, bool *result) { if (node->parent != NULL) return dom_node_is_default_namespace(node, namespace, result); else *result = false; return DOM_NO_ERR; } /** * Lookup the namespace URI associated with the given prefix * * \param node The node to start namespace search from * \param prefix The prefix to look for, or NULL to find default. * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_node_lookup_namespace(dom_node_internal *node, dom_string *prefix, dom_string **result) { if (node->parent != NULL) return dom_node_lookup_namespace(node->parent, prefix, result); else *result = NULL; return DOM_NO_ERR; } /** * Determine if two DOM nodes are equal * * \param node The node to compare * \param other The node to compare against * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * Two nodes are equal iff: * + They are of the same type * + nodeName, localName, namespaceURI, prefix, nodeValue are equal * + The node attributes are equal * + The child nodes are equal * * Two DocumentType nodes are equal iff: * + publicId, systemId, internalSubset are equal * + The node entities are equal * + The node notations are equal * TODO: in document_type, we should override this virtual function * TODO: actually handle DocumentType nodes differently */ dom_exception _dom_node_is_equal(dom_node_internal *node, dom_node_internal *other, bool *result) { dom_exception err = DOM_NO_ERR; dom_namednodemap *m1 = NULL, *m2 = NULL; dom_nodelist *l1 = NULL, *l2 = NULL; *result = false; /* Compare the node types */ if (node->type != other->type){ /* different */ err = DOM_NO_ERR; goto cleanup; } assert(node->owner != NULL); assert(other->owner != NULL); /* Compare node name */ if (dom_string_isequal(node->name, other->name) == false) { /* different */ goto cleanup; } /* Compare prefix */ if (dom_string_isequal(node->prefix, other->prefix) == false) { /* different */ goto cleanup; } /* Compare namespace URI */ if (dom_string_isequal(node->namespace, other->namespace) == false) { /* different */ goto cleanup; } /* Compare node value */ if (dom_string_isequal(node->value, other->value) == false) { /* different */ goto cleanup; } /* Compare the attributes */ err = dom_node_get_attributes(node, &m1); if (err != DOM_NO_ERR) { /* error */ goto cleanup; } err = dom_node_get_attributes(other, &m2); if (err != DOM_NO_ERR) { /* error */ goto cleanup; } if (dom_namednodemap_equal(m1, m2) == false) { /* different */ goto cleanup; } /* Compare the children */ err = dom_node_get_child_nodes(node, &l1); if (err != DOM_NO_ERR) { /* error */ goto cleanup; } err = dom_node_get_child_nodes(other, &l2); if (err != DOM_NO_ERR) { /* error */ goto cleanup; } if (dom_nodelist_equal(l1, l2) == false) { /* different */ goto cleanup; } *result = true; cleanup: if (m1 != NULL) dom_namednodemap_unref(m1); if (m2 != NULL) dom_namednodemap_unref(m2); if (l1 != NULL) dom_nodelist_unref(l1); if (l2 != NULL) dom_nodelist_unref(l2); return err; } /** * Retrieve an object which implements the specialized APIs of the specified * feature and version. * * \param node The node to query * \param feature The requested feature * \param version The version number of the feature * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_get_feature(dom_node_internal *node, dom_string *feature, dom_string *version, void **result) { bool has; dom_implementation_has_feature(dom_string_data(feature), dom_string_data(version), &has); if (has) { *result = node; } else { *result = NULL; } return DOM_NO_ERR; } /** * Associate an object to a key on this node * * \param node The node to insert object into * \param key The key associated with the object * \param data The object to associate with key, or NULL to remove * \param handler User handler function, or NULL if none * \param result Pointer to location to receive previously associated object * \return DOM_NO_ERR. */ dom_exception _dom_node_set_user_data(dom_node_internal *node, dom_string *key, void *data, dom_user_data_handler handler, void **result) { struct dom_user_data *ud = NULL; void *prevdata = NULL; /* Search for user data */ for (ud = node->user_data; ud != NULL; ud = ud->next) { if (dom_string_isequal(ud->key, key)) break; }; /* Remove it, if found and no new data */ if (data == NULL && ud != NULL) { dom_string_unref(ud->key); if (ud->next != NULL) ud->next->prev = ud->prev; if (ud->prev != NULL) ud->prev->next = ud->next; else node->user_data = ud->next; *result = ud->data; free(ud); return DOM_NO_ERR; } /* Otherwise, create a new user data object if one wasn't found */ if (ud == NULL) { ud = malloc(sizeof(struct dom_user_data)); if (ud == NULL) return DOM_NO_MEM_ERR; dom_string_ref(key); ud->key = key; ud->data = NULL; ud->handler = NULL; /* Insert into list */ ud->prev = NULL; ud->next = node->user_data; if (node->user_data) node->user_data->prev = ud; node->user_data = ud; } prevdata = ud->data; /* And associate data with it */ ud->data = data; ud->handler = handler; *result = prevdata; return DOM_NO_ERR; } /** * Retrieves the object associated to a key on this node * * \param node The node to retrieve object from * \param key The key to search for * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_node_get_user_data(dom_node_internal *node, dom_string *key, void **result) { struct dom_user_data *ud = NULL; /* Search for user data */ for (ud = node->user_data; ud != NULL; ud = ud->next) { if (dom_string_isequal(ud->key, key)) break; }; if (ud != NULL) *result = ud->data; else *result = NULL; return DOM_NO_ERR; } /*--------------------------------------------------------------------------*/ /* The protected virtual functions */ /* Copy the internal attributes of a Node from old to new */ dom_exception _dom_node_copy(dom_node_internal *old, dom_node_internal **copy) { dom_node_internal *new_node; dom_exception err; new_node = malloc(sizeof(dom_node_internal)); if (new_node == NULL) return DOM_NO_MEM_ERR; err = _dom_node_copy_internal(old, new_node); if (err != DOM_NO_ERR) { free(new_node); return err; } *copy = new_node; return DOM_NO_ERR; } dom_exception _dom_node_copy_internal(dom_node_internal *old, dom_node_internal *new) { new->base.vtable = old->base.vtable; new->vtable = old->vtable; new->name = dom_string_ref(old->name); /* Value - see below */ new->type = old->type; new->parent = NULL; new->first_child = NULL; new->last_child = NULL; new->previous = NULL; new->next = NULL; assert(old->owner != NULL); new->owner = old->owner; if (old->namespace != NULL) new->namespace = dom_string_ref(old->namespace); else new->namespace = NULL; if (old->prefix != NULL) new->prefix = dom_string_ref(old->prefix); else new->prefix = NULL; new->user_data = NULL; new->base.refcnt = 1; list_init(&new->pending_list); /* Value */ if (old->value != NULL) { dom_string_ref(old->value); new->value = old->value; } else { new->value = NULL; } /* The new copyed node has no parent, * so it should be put in the pending list. */ dom_node_mark_pending(new); /* Intialise the EventTarget interface */ return _dom_event_target_internal_initialise(&new->eti); } /*--------------------------------------------------------------------------*/ /* The helper functions */ /** * Determine if a node is permitted as a child of another node * * \param parent Prospective parent * \param child Prospective child * \return true if ::child is permitted as a child of ::parent, false otherwise. */ bool _dom_node_permitted_child(const dom_node_internal *parent, const dom_node_internal *child) { bool valid = false; /* See DOM3Core $1.1.1 for details */ switch (parent->type) { case DOM_ELEMENT_NODE: case DOM_ENTITY_REFERENCE_NODE: case DOM_ENTITY_NODE: case DOM_DOCUMENT_FRAGMENT_NODE: valid = (child->type == DOM_ELEMENT_NODE || child->type == DOM_TEXT_NODE || child->type == DOM_COMMENT_NODE || child->type == DOM_PROCESSING_INSTRUCTION_NODE || child->type == DOM_CDATA_SECTION_NODE || child->type == DOM_ENTITY_REFERENCE_NODE); break; case DOM_ATTRIBUTE_NODE: valid = (child->type == DOM_TEXT_NODE || child->type == DOM_ENTITY_REFERENCE_NODE); break; case DOM_TEXT_NODE: case DOM_CDATA_SECTION_NODE: case DOM_PROCESSING_INSTRUCTION_NODE: case DOM_COMMENT_NODE: case DOM_DOCUMENT_TYPE_NODE: case DOM_NOTATION_NODE: valid = false; break; case DOM_DOCUMENT_NODE: valid = (child->type == DOM_ELEMENT_NODE || child->type == DOM_PROCESSING_INSTRUCTION_NODE || child->type == DOM_COMMENT_NODE || child->type == DOM_DOCUMENT_TYPE_NODE); /* Ensure that the document doesn't already * have a root element */ if (child->type == DOM_ELEMENT_NODE) { dom_node_internal *n; for (n = parent->first_child; n != NULL; n = n->next) { if (n->type == DOM_ELEMENT_NODE) valid = false; } } /* Ensure that the document doesn't already * have a document type */ if (child->type == DOM_DOCUMENT_TYPE_NODE) { dom_node_internal *n; for (n = parent->first_child; n != NULL; n = n->next) { if (n->type == DOM_DOCUMENT_TYPE_NODE) valid = false; } } break; } return valid; } /** * Determine if a node is read only * * \param node The node to consider */ bool _dom_node_readonly(const dom_node_internal *node) { const dom_node_internal *n = node; /* DocumentType and Notation ns are read only */ if (n->type == DOM_DOCUMENT_TYPE_NODE || n->type == DOM_NOTATION_NODE) return true; /* Some Attr node are readonly */ if (n->type == DOM_ATTRIBUTE_NODE) return _dom_attr_readonly((const dom_attr *) n); /* Entity ns and their descendants are read only * EntityReference ns and their descendants are read only */ for (n = node; n != NULL; n = n->parent) { if (n->type == DOM_ENTITY_NODE || n->type == DOM_ENTITY_REFERENCE_NODE) return true; } /* Otherwise, it's writable */ return false; } /** * Attach a node to the tree * * \param node The node to attach * \param parent Node to attach ::node as child of * \param previous Previous node in sibling list, or NULL if none * \param next Next node in sibling list, or NULL if none * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_node_attach(dom_node_internal *node, dom_node_internal *parent, dom_node_internal *previous, dom_node_internal *next) { return _dom_node_attach_range(node, node, parent, previous, next); } /** * Detach a node from the tree * * \param node The node to detach */ void _dom_node_detach(dom_node_internal *node) { /* When a Node is not in the document tree, it must be in the * pending list */ dom_node_mark_pending(node); _dom_node_detach_range(node, node); } /** * Attach a range of nodes to the tree * * \param first First node in the range * \param last Last node in the range * \param parent Node to attach range to * \param previous Previous node in sibling list, or NULL if none * \param next Next node in sibling list, or NULL if none * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * The range is assumed to be a linked list of sibling nodes. */ dom_exception _dom_node_attach_range(dom_node_internal *first, dom_node_internal *last, dom_node_internal *parent, dom_node_internal *previous, dom_node_internal *next) { dom_exception err; bool success = true; dom_node_internal *n; first->previous = previous; last->next = next; if (previous != NULL) previous->next = first; else parent->first_child = first; if (next != NULL) next->previous = last; else parent->last_child = last; for (n = first; n != last->next; n = n->next) { n->parent = parent; /* Dispatch a DOMNodeInserted event */ err = dom_node_dispatch_node_change_event(parent->owner, n, parent, DOM_MUTATION_ADDITION, &success); if (err != DOM_NO_ERR) return err; } success = true; err = _dom_dispatch_subtree_modified_event(parent->owner, parent, &success); if (err != DOM_NO_ERR) return err; return DOM_NO_ERR; } /** * Detach a range of nodes from the tree * * \param first The first node in the range * \param last The last node in the range * * The range is assumed to be a linked list of sibling nodes. */ dom_exception _dom_node_detach_range(dom_node_internal *first, dom_node_internal *last) { bool success = true; dom_node_internal *parent; dom_node_internal *n; dom_exception err = DOM_NO_ERR; if (first->previous != NULL) first->previous->next = last->next; else first->parent->first_child = last->next; if (last->next != NULL) last->next->previous = first->previous; else last->parent->last_child = first->previous; parent = first->parent; for (n = first; n != last->next; n = n->next) { /* Dispatch a DOMNodeRemoval event */ err = dom_node_dispatch_node_change_event(n->owner, n, n->parent, DOM_MUTATION_REMOVAL, &success); n->parent = NULL; } success = true; _dom_dispatch_subtree_modified_event(parent->owner, parent, &success); first->previous = NULL; last->next = NULL; return err; } /** * Replace a node in the tree * * \param old Node to replace * \param replacement Replacement node * * This is not implemented in terms of attach/detach in case * we want to perform any special replacement-related behaviour * at a later date. */ void _dom_node_replace(dom_node_internal *old, dom_node_internal *replacement) { dom_node_internal *first, *last; dom_node_internal *n; if (replacement->type == DOM_DOCUMENT_FRAGMENT_NODE) { first = replacement->first_child; last = replacement->last_child; replacement->first_child = replacement->last_child = NULL; } else { first = replacement; last = replacement; } first->previous = old->previous; last->next = old->next; if (old->previous != NULL) old->previous->next = first; else old->parent->first_child = first; if (old->next != NULL) old->next->previous = last; else old->parent->last_child = last; for (n = first; n != last->next; n = n->next) { n->parent = old->parent; } old->previous = old->next = old->parent = NULL; } /** * Merge two adjacent text nodes into one text node. * * \param p The first text node * \param n The second text node * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_merge_adjacent_text(dom_node_internal *p, dom_node_internal *n) { dom_string *str; dom_exception err; assert(p->type == DOM_TEXT_NODE); assert(n->type == DOM_TEXT_NODE); err = dom_text_get_whole_text(n, &str); if (err != DOM_NO_ERR) return err; err = dom_characterdata_append_data(p, str); if (err != DOM_NO_ERR) return err; dom_string_unref(str); return DOM_NO_ERR; } /** * Try to destroy this node. * * \param node The node to destroy * * When some node owns this node, (such as an elment owns its attribute nodes) * when this node being not owned, the owner should call this function to try * to destroy this node. * * @note: Owning a node does not means this node's refcnt is above zero. */ dom_exception _dom_node_try_destroy(dom_node_internal *node) { if (node == NULL) return DOM_NO_ERR; if (node->parent == NULL) { if (node->base.refcnt == 0) { dom_node_destroy(node); } else if (node->pending_list.prev == &node->pending_list){ assert (node->pending_list.next == &node->pending_list); list_append(&node->owner->pending_nodes, &node->pending_list); } } return DOM_NO_ERR; } /** * To add some node to the pending list, when a node is removed from its parent * or an attribute is removed from its element * * \param node The Node instance */ void _dom_node_mark_pending(dom_node_internal *node) { struct dom_document *doc = node->owner; /* TODO: the pending_list is located at in dom_document, but some * nodes can be created without a document created, such as a * dom_document_type node. For this reason, we should test whether * the doc is NULL. */ if (doc != NULL) { /* The node must not be in the pending list */ assert(node->pending_list.prev == &node->pending_list); list_append(&doc->pending_nodes, &node->pending_list); } } /** * To remove the node from the pending list, this may happen when * a node is removed and then appended to another parent * * \param node The Node instance */ void _dom_node_remove_pending(dom_node_internal *node) { struct dom_document *doc = node->owner; if (doc != NULL) { /* The node must be in the pending list */ assert(node->pending_list.prev != &node->pending_list); list_del(&node->pending_list); } } /****************************************************************************** * Event Target API * ******************************************************************************/ dom_exception _dom_node_add_event_listener(dom_event_target *et, dom_string *type, struct dom_event_listener *listener, bool capture) { dom_node_internal *node = (dom_node_internal *) et; return _dom_event_target_add_event_listener(&node->eti, type, listener, capture); } dom_exception _dom_node_remove_event_listener(dom_event_target *et, dom_string *type, struct dom_event_listener *listener, bool capture) { dom_node_internal *node = (dom_node_internal *) et; return _dom_event_target_remove_event_listener(&node->eti, type, listener, capture); } dom_exception _dom_node_add_event_listener_ns(dom_event_target *et, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture) { dom_node_internal *node = (dom_node_internal *) et; return _dom_event_target_add_event_listener_ns(&node->eti, namespace, type, listener, capture); } dom_exception _dom_node_remove_event_listener_ns(dom_event_target *et, dom_string *namespace, dom_string *type, struct dom_event_listener *listener, bool capture) { dom_node_internal *node = (dom_node_internal *) et; return _dom_event_target_remove_event_listener_ns(&node->eti, namespace, type, listener, capture); } /** * Dispatch an event into the implementation's event model * * \param et The EventTarget object * \param eti Internal EventTarget * \param evt The event object * \param success Indicates whether any of the listeners which handled the * event called Event.preventDefault(). If * Event.preventDefault() was called the returned value is * false, else it is true. * \return DOM_NO_ERR on success * DOM_DISPATCH_REQUEST_ERR If the event is already in dispatch * DOM_UNSPECIFIED_EVENT_TYPE_ERR If the type of the event is Null or * empty string. * DOM_NOT_SUPPORTED_ERR If the event is not created by * Document.createEvent * DOM_INVALID_CHARACTER_ERR If the type of this event is not a * valid NCName. */ dom_exception _dom_node_dispatch_event(dom_event_target *et, struct dom_event *evt, bool *success) { dom_exception err, ret = DOM_NO_ERR; dom_node_internal *target = (dom_node_internal *) et; dom_document *doc; dom_document_event_internal *dei; dom_event_target **targets; uint32_t ntargets, ntargets_allocated, targetnr; void *pw; assert(et != NULL); assert(evt != NULL); /* To test whether this event is in dispatch */ if (evt->in_dispatch == true) { return DOM_DISPATCH_REQUEST_ERR; } else { evt->in_dispatch = true; } if (evt->type == NULL || dom_string_byte_length(evt->type) == 0) { return DOM_UNSPECIFIED_EVENT_TYPE_ERR; } if (evt->doc == NULL) return DOM_NOT_SUPPORTED_ERR; doc = dom_node_get_owner(et); if (doc == NULL) { /* TODO: In the progress of parsing, many Nodes in the DTD has * no document at all, do nothing for this kind of node */ return DOM_NO_ERR; } *success = true; /* Compose the event target list */ ntargets = 0; ntargets_allocated = 64; targets = calloc(sizeof(*targets), ntargets_allocated); if (targets == NULL) { /** \todo Report memory exhaustion? */ return DOM_NO_ERR; } targets[ntargets++] = (dom_event_target *)dom_node_ref(et); target = target->parent; while (target != NULL) { if (ntargets == ntargets_allocated) { dom_event_target **newtargets = realloc( targets, ntargets_allocated * 2 * sizeof(*targets)); if (newtargets == NULL) goto cleanup; memset(newtargets + ntargets_allocated, 0, ntargets_allocated * sizeof(*newtargets)); targets = newtargets; ntargets_allocated *= 2; } targets[ntargets++] = (dom_event_target *)dom_node_ref(target); target = target->parent; } /* Fill the target of the event */ evt->target = et; evt->phase = DOM_CAPTURING_PHASE; /* The started callback of default action */ dei = &doc->dei; pw = dei->actions_ctx; if (dei->actions != NULL) { dom_default_action_callback cb = dei->actions(evt->type, DOM_DEFAULT_ACTION_STARTED, &pw); if (cb != NULL) { cb(evt, pw); } } /* The capture phase */ for (targetnr = ntargets; targetnr > 0; --targetnr) { dom_node_internal *node = (dom_node_internal *) targets[targetnr - 1]; err = _dom_event_target_dispatch(targets[targetnr - 1], &node->eti, evt, DOM_CAPTURING_PHASE, success); if (err != DOM_NO_ERR) { ret = err; goto cleanup; } /* If the stopImmediatePropagation or stopPropagation is * called, we should break */ if (evt->stop_now == true || evt->stop == true) goto cleanup; } /* Target phase */ evt->phase = DOM_AT_TARGET; evt->current = et; err = _dom_event_target_dispatch(et, &((dom_node_internal *) et)->eti, evt, DOM_AT_TARGET, success); if (err != DOM_NO_ERR) { ret = err; goto cleanup; } if (evt->stop_now == true || evt->stop == true) goto cleanup; /* Bubbling phase */ evt->phase = DOM_BUBBLING_PHASE; for (targetnr = 0; targetnr < ntargets; ++targetnr) { dom_node_internal *node = (dom_node_internal *) targets[targetnr]; err = _dom_event_target_dispatch(targets[targetnr], &node->eti, evt, DOM_BUBBLING_PHASE, success); if (err != DOM_NO_ERR) { ret = err; goto cleanup; } /* If the stopImmediatePropagation or stopPropagation is * called, we should break */ if (evt->stop_now == true || evt->stop == true) goto cleanup; } if (dei->actions == NULL) goto cleanup; /* The end callback of default action */ if (evt->prevent_default != true) { dom_default_action_callback cb = dei->actions(evt->type, DOM_DEFAULT_ACTION_END, &pw); if (cb != NULL) { cb(evt, pw); } } /* The prevented callback of default action */ if (evt->prevent_default != true) { dom_default_action_callback cb = dei->actions(evt->type, DOM_DEFAULT_ACTION_PREVENTED, &pw); if (cb != NULL) { cb(evt, pw); } } cleanup: if (evt->prevent_default == true) { *success = false; } while (ntargets--) { dom_node_unref(targets[ntargets]); } free(targets); return ret; } dom_exception _dom_node_dispatch_node_change_event(dom_document *doc, dom_node_internal *node, dom_node_internal *related, dom_mutation_type change, bool *success) { dom_node_internal *target; dom_exception err; /* Fire change event at immediate target */ err = _dom_dispatch_node_change_event(doc, node, related, change, success); if (err != DOM_NO_ERR) return err; /* Fire document change event at subtree */ target = node->first_child; while (target != NULL) { err = _dom_dispatch_node_change_document_event(doc, target, change, success); if (err != DOM_NO_ERR) return err; if (target->first_child != NULL) { target = target->first_child; } else if (target->next != NULL) { target = target->next; } else { dom_node_internal *parent = target->parent; while (parent != node && target == parent->last_child) { target = parent; parent = target->parent; } target = target->next; } } return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/document_type.h0000644000175000017500000000657112377676745020662 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_document_type_h_ #define dom_internal_core_document_type_h_ #include struct dom_namednodemap; /* Create a DOM document type */ dom_exception _dom_document_type_create(dom_string *qname, dom_string *public_id, dom_string *system_id, dom_document_type **doctype); /* Destroy a document type */ void _dom_document_type_destroy(dom_node_internal *doctypenode); dom_exception _dom_document_type_initialise(dom_document_type *doctype, dom_string *qname, dom_string *public_id, dom_string *system_id); void _dom_document_type_finalise(dom_document_type *doctype); /* The virtual functions of DocumentType */ dom_exception _dom_document_type_get_name(dom_document_type *doc_type, dom_string **result); dom_exception _dom_document_type_get_entities( dom_document_type *doc_type, struct dom_namednodemap **result); dom_exception _dom_document_type_get_notations( dom_document_type *doc_type, struct dom_namednodemap **result); dom_exception _dom_document_type_get_public_id( dom_document_type *doc_type, dom_string **result); dom_exception _dom_document_type_get_system_id( dom_document_type *doc_type, dom_string **result); dom_exception _dom_document_type_get_internal_subset( dom_document_type *doc_type, dom_string **result); dom_exception _dom_document_type_get_text_content(dom_node_internal *node, dom_string **result); dom_exception _dom_document_type_set_text_content(dom_node_internal *node, dom_string *content); #define DOM_DOCUMENT_TYPE_VTABLE \ _dom_document_type_get_name, \ _dom_document_type_get_entities, \ _dom_document_type_get_notations, \ _dom_document_type_get_public_id, \ _dom_document_type_get_system_id, \ _dom_document_type_get_internal_subset #define DOM_NODE_VTABLE_DOCUMENT_TYPE \ _dom_node_try_destroy, \ _dom_node_get_node_name, \ _dom_node_get_node_value, \ _dom_node_set_node_value, \ _dom_node_get_node_type, \ _dom_node_get_parent_node, \ _dom_node_get_child_nodes, \ _dom_node_get_first_child, \ _dom_node_get_last_child, \ _dom_node_get_previous_sibling, \ _dom_node_get_next_sibling, \ _dom_node_get_attributes, \ _dom_node_get_owner_document, \ _dom_node_insert_before, \ _dom_node_replace_child, \ _dom_node_remove_child, \ _dom_node_append_child, \ _dom_node_has_child_nodes, \ _dom_node_clone_node, \ _dom_node_normalize, \ _dom_node_is_supported, \ _dom_node_get_namespace, \ _dom_node_get_prefix, \ _dom_node_set_prefix, \ _dom_node_get_local_name, \ _dom_node_has_attributes, \ _dom_node_get_base, \ _dom_node_compare_document_position, \ _dom_document_type_get_text_content, \ _dom_document_type_set_text_content, \ _dom_node_is_same, \ _dom_node_lookup_prefix, \ _dom_node_is_default_namespace, \ _dom_node_lookup_namespace, \ _dom_node_is_equal, \ _dom_node_get_feature, \ _dom_node_set_user_data, \ _dom_node_get_user_data /* Following comes the protected vtable */ void _dom_dt_destroy(dom_node_internal *node); dom_exception _dom_dt_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_DT_PROTECT_VTABLE \ _dom_dt_destroy, \ _dom_dt_copy #endif netsurf-all-3.2/libdom/src/core/text.h0000644000175000017500000000373112377676745016762 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_text_h_ #define dom_internal_core_text_h_ #include #include #include #include "core/characterdata.h" struct dom_document; /** * A DOM text node */ struct dom_text { dom_characterdata base; /**< Base node */ bool element_content_whitespace; /**< This node is element * content whitespace */ }; /* Constructor and Destructor */ dom_exception _dom_text_create(struct dom_document *doc, dom_string *name, dom_string *value, dom_text **result); void _dom_text_destroy(dom_text *text); dom_exception _dom_text_initialise(dom_text *text, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value); void _dom_text_finalise(dom_text *text); /* Virtual functions for dom_text */ dom_exception _dom_text_split_text(dom_text *text, uint32_t offset, dom_text **result); dom_exception _dom_text_get_is_element_content_whitespace( dom_text *text, bool *result); dom_exception _dom_text_get_whole_text(dom_text *text, dom_string **result); dom_exception _dom_text_replace_whole_text(dom_text *text, dom_string *content, dom_text **result); #define DOM_TEXT_VTABLE \ _dom_text_split_text, \ _dom_text_get_is_element_content_whitespace, \ _dom_text_get_whole_text, \ _dom_text_replace_whole_text /* Following comes the protected vtable */ void __dom_text_destroy(struct dom_node_internal *node); dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_TEXT_PROTECT_VTABLE \ __dom_text_destroy, \ _dom_text_copy extern struct dom_text_vtable text_vtable; dom_exception _dom_text_copy_internal(dom_text *old, dom_text *new); #define dom_text_copy_internal(o, n) \ _dom_text_copy_internal((dom_text *) (o), (dom_text *) (n)) #endif netsurf-all-3.2/libdom/src/core/typeinfo.c0000644000175000017500000000374012377676745017626 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "utils/utils.h" /* TypeInfo object */ struct dom_type_info { struct lwc_string_s *type; /**< Type name */ struct lwc_string_s *namespace; /**< Type namespace */ }; /** * Get the type name of this dom_type_info * * \param ti The dom_type_info * \param ret The name * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so this function call always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_get_type_name(dom_type_info *ti, dom_string **ret) { UNUSED(ti); UNUSED(ret); return DOM_NOT_SUPPORTED_ERR; } /** * Get the namespace of this type info * * \param ti The dom_type_info * \param ret The namespace * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so this function call always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_get_type_namespace(dom_type_info *ti, dom_string **ret) { UNUSED(ti); UNUSED(ret); return DOM_NOT_SUPPORTED_ERR; } /** * Whether this type info is derived from another one * * \param ti The dom_type_info * \param namespace The namespace of name * \param name The name of the base typeinfo * \param method The deriving method * \param ret The return value * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * We don't support this API now, so this function call always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_type_info_is_derived(dom_type_info *ti, dom_string *namespace, dom_string *name, dom_type_info_derivation_method method, bool *ret) { UNUSED(ti); UNUSED(namespace); UNUSED(name); UNUSED(method); UNUSED(ret); return DOM_NOT_SUPPORTED_ERR; } netsurf-all-3.2/libdom/src/core/pi.h0000644000175000017500000000170612377676745016406 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_processinginstruction_h_ #define dom_internal_core_processinginstruction_h_ #include #include dom_exception _dom_processing_instruction_create(dom_document *doc, dom_string *name, dom_string *value, dom_processing_instruction **result); void _dom_processing_instruction_destroy(dom_processing_instruction *pi); #define _dom_processing_instruction_initialise _dom_node_initialise #define _dom_processing_instruction_finalise _dom_node_finalise /* Following comes the protected vtable */ void _dom_pi_destroy(dom_node_internal *node); dom_exception _dom_pi_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_PI_PROTECT_VTABLE \ _dom_pi_destroy, \ _dom_pi_copy #endif netsurf-all-3.2/libdom/src/core/string.h0000644000175000017500000000222012377676745017274 0ustar vincevince /* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_core_string_h_ #define dom_internal_core_string_h_ #include /* Map the lwc_error to dom_exception */ dom_exception _dom_exception_from_lwc_error(lwc_error err); enum dom_whitespace_op { DOM_WHITESPACE_STRIP_LEADING = (1 << 0), DOM_WHITESPACE_STRIP_TRAILING = (1 << 1), DOM_WHITESPACE_STRIP = DOM_WHITESPACE_STRIP_LEADING | DOM_WHITESPACE_STRIP_TRAILING, DOM_WHITESPACE_COLLAPSE = (1 << 2), DOM_WHITESPACE_STRIP_COLLAPSE = DOM_WHITESPACE_STRIP | DOM_WHITESPACE_COLLAPSE }; /** Perform whitespace operations on given string * * \param s Given string * \param op Whitespace operation(s) to perform * \param ret New string with whitespace ops performed. Caller owns ref * * \return DOM_NO_ERR on success. * * \note Right now, will return DOM_NOT_SUPPORTED_ERR if ascii_only is false. */ dom_exception dom_string_whitespace_op(dom_string *s, enum dom_whitespace_op op, dom_string **ret); #endif netsurf-all-3.2/libdom/src/core/entity_ref.h0000644000175000017500000000206112377676745020141 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #ifndef dom_internal_core_entityrererence_h_ #define dom_internal_core_entityrererence_h_ #include #include dom_exception _dom_entity_reference_create(dom_document *doc, dom_string *name, dom_string *value, dom_entity_reference **result); void _dom_entity_reference_destroy(dom_entity_reference *entity); #define _dom_entity_reference_initialise _dom_node_initialise #define _dom_entity_reference_finalise _dom_node_finalise /* Following comes the protected vtable */ void _dom_er_destroy(dom_node_internal *node); dom_exception _dom_er_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_ER_PROTECT_VTABLE \ _dom_er_destroy, \ _dom_er_copy /* Helper functions */ dom_exception _dom_entity_reference_get_textual_representation( dom_entity_reference *entity, dom_string **result); #endif netsurf-all-3.2/libdom/src/core/document_type.c0000644000175000017500000002105412377676745020646 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2007 James Shaw * Copyright 2009 Bo Yang */ #include #include #include "core/string.h" #include "core/document_type.h" #include "core/namednodemap.h" #include "core/node.h" #include "utils/utils.h" #include "utils/namespace.h" /** * DOM DocumentType node */ struct dom_document_type { dom_node_internal base; /**< Base node */ dom_string *public_id; /**< Doctype public ID */ dom_string *system_id; /**< Doctype system ID */ }; static struct dom_document_type_vtable document_type_vtable = { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE_DOCUMENT_TYPE }, DOM_DOCUMENT_TYPE_VTABLE }; static struct dom_node_protect_vtable dt_protect_vtable = { DOM_DT_PROTECT_VTABLE }; /*----------------------------------------------------------------------*/ /* Constructors and destructors */ /** * Create a document type node * * \param qname The qualified name of the document type * \param public_id The external subset public identifier * \param system_id The external subset system identifier * \param alloc Memory (de)allocation function * \param pw Pointer to client-specific private data * \param doctype Pointer to location to receive result * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion. * * The doctype will be referenced, so the client need not do so * explicitly. The client must unref the doctype once it has * finished with it. */ dom_exception _dom_document_type_create(dom_string *qname, dom_string *public_id, dom_string *system_id, dom_document_type **doctype) { dom_document_type *result; dom_exception err; /* Create node */ result = malloc(sizeof(dom_document_type)); if (result == NULL) return DOM_NO_MEM_ERR; /* Initialise the vtable */ result->base.base.vtable = &document_type_vtable; result->base.vtable = &dt_protect_vtable; err = _dom_document_type_initialise(result, qname, public_id, system_id); if (err != DOM_NO_ERR) { free(result); return err; } *doctype = result; return DOM_NO_ERR; } /** * Destroy a DocumentType node * * \param doctype The DocumentType node to destroy * * The contents of ::doctype will be destroyed and ::doctype will be freed. */ void _dom_document_type_destroy(dom_node_internal *doctypenode) { dom_document_type *doctype = (dom_document_type *) doctypenode; /* Finalise base class */ _dom_document_type_finalise(doctype); /* Free doctype */ free(doctype); } /* Initialise this document_type */ dom_exception _dom_document_type_initialise(dom_document_type *doctype, dom_string *qname, dom_string *public_id, dom_string *system_id) { dom_string *prefix, *localname; dom_exception err; err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) return err; /* TODO: I should figure out how the namespaceURI can be got */ /* Initialise base node */ err = _dom_node_initialise(&doctype->base, NULL, DOM_DOCUMENT_TYPE_NODE, localname, NULL, NULL, prefix); if (err != DOM_NO_ERR) { dom_string_unref(prefix); dom_string_unref(localname); return err; } /* Get public and system IDs */ if (public_id != NULL) dom_string_ref(public_id); doctype->public_id = public_id; if (system_id != NULL) dom_string_ref(system_id); doctype->system_id = system_id; if (prefix != NULL) dom_string_unref(prefix); if (localname != NULL) dom_string_unref(localname); return DOM_NO_ERR; } /* The destructor function of dom_document_type */ void _dom_document_type_finalise(dom_document_type *doctype) { if (doctype->public_id != NULL) dom_string_unref(doctype->public_id); if (doctype->system_id != NULL) dom_string_unref(doctype->system_id); assert(doctype->base.owner != NULL || doctype->base.user_data == NULL); _dom_node_finalise(&doctype->base); } /*----------------------------------------------------------------------*/ /* Virtual functions */ /** * Retrieve a document type's name * * \param doc_type Document type to retrieve name from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_type_get_name(dom_document_type *doc_type, dom_string **result) { return dom_node_get_node_name(doc_type, result); } /** * Retrieve a document type's entities * * \param doc_type Document type to retrieve entities from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned map will have its reference count increased. It is * the responsibility of the caller to unref the map once it has * finished with it. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_type_get_entities( dom_document_type *doc_type, dom_namednodemap **result) { UNUSED(doc_type); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve a document type's notations * * \param doc_type Document type to retrieve notations from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned map will have its reference count increased. It is * the responsibility of the caller to unref the map once it has * finished with it. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_type_get_notations( dom_document_type *doc_type, dom_namednodemap **result) { UNUSED(doc_type); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Retrieve a document type's public id * * \param doc_type Document type to retrieve public id from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_type_get_public_id( dom_document_type *doc_type, dom_string **result) { if (doc_type->public_id != NULL) *result = dom_string_ref(doc_type->public_id); else *result = NULL; return DOM_NO_ERR; } /** * Retrieve a document type's system id * * \param doc_type Document type to retrieve system id from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. */ dom_exception _dom_document_type_get_system_id( dom_document_type *doc_type, dom_string **result) { if (doc_type->system_id != NULL) *result = dom_string_ref(doc_type->system_id); else *result = NULL; return DOM_NO_ERR; } /** * Retrieve a document type's internal subset * * \param doc_type Document type to retrieve internal subset from * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * We don't support this API now, so this function call should always * return DOM_NOT_SUPPORTED_ERR. */ dom_exception _dom_document_type_get_internal_subset( dom_document_type *doc_type, dom_string **result) { UNUSED(doc_type); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_document_type_get_text_content(dom_node_internal *node, dom_string **result) { UNUSED(node); *result = NULL; return DOM_NO_ERR; } dom_exception _dom_document_type_set_text_content(dom_node_internal *node, dom_string *content) { UNUSED(node); UNUSED(content); return DOM_NO_ERR; } /*-----------------------------------------------------------------------*/ /* Overload protected virtual functions */ /* The virtual destroy function of this class */ void _dom_dt_destroy(dom_node_internal *node) { _dom_document_type_destroy(node); } /* The copy constructor of this class */ dom_exception _dom_dt_copy(dom_node_internal *old, dom_node_internal **copy) { UNUSED(old); UNUSED(copy); return DOM_NOT_SUPPORTED_ERR; } netsurf-all-3.2/libdom/src/core/Makefile0000644000175000017500000000042612377676745017263 0ustar vincevince# Sources DIR_SOURCES := \ string.c node.c \ attr.c characterdata.c element.c \ implementation.c \ text.c typeinfo.c comment.c \ namednodemap.c nodelist.c \ cdatasection.c document_type.c entity_ref.c pi.c \ doc_fragment.c document.c include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libdom/src/core/characterdata.c0000644000175000017500000003236712377676745020566 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include "core/characterdata.h" #include "core/document.h" #include "core/node.h" #include "utils/utils.h" #include "events/mutation_event.h" /* The virtual functions for dom_characterdata, we make this vtable * public to each child class */ struct dom_characterdata_vtable characterdata_vtable = { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE_CHARACTERDATA }, DOM_CHARACTERDATA_VTABLE }; /* Create a DOM characterdata node and compose the vtable */ dom_characterdata *_dom_characterdata_create(void) { dom_characterdata *cdata = malloc(sizeof(struct dom_characterdata)); if (cdata == NULL) return NULL; cdata->base.base.vtable = &characterdata_vtable; cdata->base.vtable = NULL; return cdata; } /** * Initialise a character data node * * \param node The node to initialise * \param doc The document which owns the node * \param type The node type required * \param name The node name, or NULL * \param value The node value, or NULL * \return DOM_NO_ERR on success. * * ::doc, ::name and ::value will have their reference counts increased. */ dom_exception _dom_characterdata_initialise(struct dom_characterdata *cdata, struct dom_document *doc, dom_node_type type, dom_string *name, dom_string *value) { return _dom_node_initialise(&cdata->base, doc, type, name, value, NULL, NULL); } /** * Finalise a character data node * * \param cdata The node to finalise * * The contents of ::cdata will be cleaned up. ::cdata will not be freed. */ void _dom_characterdata_finalise(struct dom_characterdata *cdata) { _dom_node_finalise(&cdata->base); } /*----------------------------------------------------------------------*/ /* The public virtual functions */ /** * Retrieve data from a character data node * * \param cdata Character data node to retrieve data from * \param data Pointer to location to receive data * \return DOM_NO_ERR. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in * this implementation; dom_strings are unbounded. */ dom_exception _dom_characterdata_get_data(struct dom_characterdata *cdata, dom_string **data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; if (c->value != NULL) { dom_string_ref(c->value); } *data = c->value; return DOM_NO_ERR; } /** * Set the content of a character data node * * \param cdata Node to set the content of * \param data New value for node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. * * The new content will have its reference count increased, so the caller * should unref it after the call (as the caller should have already claimed * a reference on the string). The node's existing content will be unrefed. */ dom_exception _dom_characterdata_set_data(struct dom_characterdata *cdata, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_exception err; struct dom_document *doc; bool success = true; if (_dom_node_readonly(c)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } /* Dispatch a DOMCharacterDataModified event */ doc = dom_node_get_owner(cdata); err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, data, &success); if (err != DOM_NO_ERR) return err; if (c->value != NULL) { dom_string_unref(c->value); } dom_string_ref(data); c->value = data; success = true; return _dom_dispatch_subtree_modified_event(doc, c->parent, &success); } /** * Get the length (in characters) of a character data node's content * * \param cdata Node to read content length of * \param length Pointer to location to receive character length of content * \return DOM_NO_ERR. */ dom_exception _dom_characterdata_get_length(struct dom_characterdata *cdata, uint32_t *length) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; if (c->value != NULL) { *length = dom_string_length(c->value); } else { *length = 0; } return DOM_NO_ERR; } /** * Extract a range of data from a character data node * * \param cdata The node to extract data from * \param offset The character offset of substring to extract * \param count The number of characters to extract * \param data Pointer to location to receive substring * \return DOM_NO_ERR on success, * DOM_INDEX_SIZE_ERR if ::offset is negative or greater than the * number of characters in ::cdata or * ::count is negative. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unref the string once it has * finished with it. * * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in * this implementation; dom_strings are unbounded. */ dom_exception _dom_characterdata_substring_data( struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string **data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; uint32_t len, end; if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } if (c->value != NULL) { len = dom_string_length(c->value); } else { len = 0; } if (offset > len) { return DOM_INDEX_SIZE_ERR; } end = (offset + count) >= len ? len : offset + count; return dom_string_substr(c->value, offset, end, data); } /** * Append data to the end of a character data node's content * * \param cdata The node to append data to * \param data The data to append * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_append_data(struct dom_characterdata *cdata, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; dom_exception err; struct dom_document *doc; bool success = true; if (_dom_node_readonly(c)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } err = dom_string_concat(c->value, data, &temp); if (err != DOM_NO_ERR) { return err; } /* Dispatch a DOMCharacterDataModified event */ doc = dom_node_get_owner(cdata); err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, temp, &success); if (err != DOM_NO_ERR) { dom_string_unref(temp); return err; } if (c->value != NULL) { dom_string_unref(c->value); } c->value = temp; success = true; return _dom_dispatch_subtree_modified_event(doc, c->parent, &success); } /** * Insert data into a character data node's content * * \param cdata The node to insert into * \param offset The character offset to insert at * \param data The data to insert * \return DOM_NO_ERR on success, * DOM_INDEX_SIZE_ERR if ::offset is negative or greater * than the number of characters in * ::cdata, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_insert_data(struct dom_characterdata *cdata, uint32_t offset, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; uint32_t len; dom_exception err; struct dom_document *doc; bool success = true; if (_dom_node_readonly(c)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } if ((int32_t) offset < 0) { return DOM_INDEX_SIZE_ERR; } if (c->value != NULL) { len = dom_string_length(c->value); } else { len = 0; } if (offset > len) { return DOM_INDEX_SIZE_ERR; } err = dom_string_insert(c->value, data, offset, &temp); if (err != DOM_NO_ERR) { return err; } /* Dispatch a DOMCharacterDataModified event */ doc = dom_node_get_owner(cdata); err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, temp, &success); if (err != DOM_NO_ERR) return err; if (c->value != NULL) { dom_string_unref(c->value); } c->value = temp; success = true; return _dom_dispatch_subtree_modified_event(doc, c->parent, &success); } /** * Delete data from a character data node's content * * \param cdata The node to delete from * \param offset The character offset to start deletion from * \param count The number of characters to delete * \return DOM_NO_ERR on success, * DOM_INDEX_SIZE_ERR if ::offset is negative or greater * than the number of characters in * ::cdata or ::count is negative, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_delete_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; uint32_t len, end; dom_exception err; struct dom_document *doc; bool success = true; dom_string *empty; if (_dom_node_readonly(c)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } if (c->value != NULL) { len = dom_string_length(c->value); } else { len = 0; } if (offset > len) { return DOM_INDEX_SIZE_ERR; } end = (offset + count) >= len ? len : offset + count; empty = ((struct dom_document *) ((struct dom_node_internal *)c)->owner)->_memo_empty; err = dom_string_replace(c->value, empty, offset, end, &temp); if (err != DOM_NO_ERR) { return err; } /* Dispatch a DOMCharacterDataModified event */ doc = dom_node_get_owner(cdata); err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, temp, &success); if (err != DOM_NO_ERR) return err; if (c->value != NULL) { dom_string_unref(c->value); } c->value = temp; success = true; return _dom_dispatch_subtree_modified_event(doc, c->parent, &success); } /** * Replace a section of a character data node's content * * \param cdata The node to modify * \param offset The character offset of the sequence to replace * \param count The number of characters to replace * \param data The replacement data * \return DOM_NO_ERR on success, * DOM_INDEX_SIZE_ERR if ::offset is negative or greater * than the number of characters in * ::cdata or ::count is negative, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly. */ dom_exception _dom_characterdata_replace_data(struct dom_characterdata *cdata, uint32_t offset, uint32_t count, dom_string *data) { struct dom_node_internal *c = (struct dom_node_internal *) cdata; dom_string *temp; uint32_t len, end; dom_exception err; struct dom_document *doc; bool success = true; if (_dom_node_readonly(c)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } if ((int32_t) offset < 0 || (int32_t) count < 0) { return DOM_INDEX_SIZE_ERR; } if (c->value != NULL) { len = dom_string_length(c->value); } else { len = 0; } if (offset > len) { return DOM_INDEX_SIZE_ERR; } end = (offset + count) >= len ? len : offset + count; err = dom_string_replace(c->value, data, offset, end, &temp); if (err != DOM_NO_ERR) { return err; } /* Dispatch a DOMCharacterDataModified event */ doc = dom_node_get_owner(cdata); err = _dom_dispatch_characterdata_modified_event(doc, c, c->value, temp, &success); if (err != DOM_NO_ERR) return err; if (c->value != NULL) { dom_string_unref(c->value); } c->value = temp; success = true; return _dom_dispatch_subtree_modified_event(doc, c->parent, &success); } dom_exception _dom_characterdata_get_text_content(dom_node_internal *node, dom_string **result) { dom_characterdata *cdata = (dom_characterdata *)node; return dom_characterdata_get_data(cdata, result); } dom_exception _dom_characterdata_set_text_content(dom_node_internal *node, dom_string *content) { dom_characterdata *cdata = (dom_characterdata *)node; return dom_characterdata_set_data(cdata, content); } /*----------------------------------------------------------------------*/ /* The protected virtual functions of Node, see core/node.h for details */ void _dom_characterdata_destroy(struct dom_node_internal *node) { assert("Should never be here" == NULL); UNUSED(node); } /* The copy constructor of this class */ dom_exception _dom_characterdata_copy(dom_node_internal *old, dom_node_internal **copy) { dom_characterdata *new_node; dom_exception err; new_node = malloc(sizeof(dom_characterdata)); if (new_node == NULL) return DOM_NO_MEM_ERR; err = dom_characterdata_copy_internal(old, new_node); if (err != DOM_NO_ERR) { free(new_node); return err; } *copy = (dom_node_internal *) new_node; return DOM_NO_ERR; } dom_exception _dom_characterdata_copy_internal(dom_characterdata *old, dom_characterdata *new) { return dom_node_copy_internal(old, new); } netsurf-all-3.2/libdom/src/core/text.c0000644000175000017500000003060212377676745016752 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include #include #include #include #include "core/characterdata.h" #include "core/document.h" #include "core/text.h" #include "utils/utils.h" /* The virtual table for dom_text */ struct dom_text_vtable text_vtable = { { { { DOM_NODE_EVENT_TARGET_VTABLE, }, DOM_NODE_VTABLE_CHARACTERDATA }, DOM_CHARACTERDATA_VTABLE }, DOM_TEXT_VTABLE }; static struct dom_node_protect_vtable text_protect_vtable = { DOM_TEXT_PROTECT_VTABLE }; /* Following comes helper functions */ typedef enum walk_operation { COLLECT, DELETE } walk_operation; typedef enum walk_order { LEFT, RIGHT } walk_order; /* Walk the logic-adjacent text in document order */ static dom_exception walk_logic_adjacent_text_in_order( dom_node_internal *node, walk_operation opt, walk_order order, dom_string **ret, bool *cont); /* Walk the logic-adjacent text */ static dom_exception walk_logic_adjacent_text(dom_text *text, walk_operation opt, dom_string **ret); /*----------------------------------------------------------------------*/ /* Constructor and Destructor */ /** * Create a text node * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_text_create(dom_document *doc, dom_string *name, dom_string *value, dom_text **result) { dom_text *t; dom_exception err; /* Allocate the text node */ t = malloc(sizeof(dom_text)); if (t == NULL) return DOM_NO_MEM_ERR; /* And initialise the node */ err = _dom_text_initialise(t, doc, DOM_TEXT_NODE, name, value); if (err != DOM_NO_ERR) { free(t); return err; } /* Compose the vtable */ ((dom_node *) t)->vtable = &text_vtable; ((dom_node_internal *) t)->vtable = &text_protect_vtable; *result = t; return DOM_NO_ERR; } /** * Destroy a text node * * \param doc The owning document * \param text The text node to destroy * * The contents of ::text will be destroyed and ::text will be freed. */ void _dom_text_destroy(dom_text *text) { /* Finalise node */ _dom_text_finalise(text); /* Free node */ free(text); } /** * Initialise a text node * * \param text The node to initialise * \param doc The owning document * \param type The type of the node * \param name The name of the node to create * \param value The text content of the node * \return DOM_NO_ERR on success. * * ::doc, ::name and ::value will have their reference counts increased. */ dom_exception _dom_text_initialise(dom_text *text, dom_document *doc, dom_node_type type, dom_string *name, dom_string *value) { dom_exception err; /* Initialise the base class */ err = _dom_characterdata_initialise(&text->base, doc, type, name, value); if (err != DOM_NO_ERR) return err; /* Perform our type-specific initialisation */ text->element_content_whitespace = false; return DOM_NO_ERR; } /** * Finalise a text node * * \param doc The owning document * \param text The text node to finalise * * The contents of ::text will be cleaned up. ::text will not be freed. */ void _dom_text_finalise(dom_text *text) { _dom_characterdata_finalise(&text->base); } /*----------------------------------------------------------------------*/ /* The public virtual functions */ /** * Split a text node at a given character offset * * \param text The node to split * \param offset Character offset to split at * \param result Pointer to location to receive new node * \return DOM_NO_ERR on success, * DOM_INDEX_SIZE_ERR if ::offset is greater than the * number of characters in ::text, * DOM_NO_MODIFICATION_ALLOWED_ERR if ::text is readonly. * * The returned node will be referenced. The client should unref the node * once it has finished with it. */ dom_exception _dom_text_split_text(dom_text *text, uint32_t offset, dom_text **result) { dom_node_internal *t = (dom_node_internal *) text; dom_string *value; dom_text *res; uint32_t len; dom_exception err; if (_dom_node_readonly(t)) { return DOM_NO_MODIFICATION_ALLOWED_ERR; } err = dom_characterdata_get_length(&text->base, &len); if (err != DOM_NO_ERR) { return err; } if (offset >= len) { return DOM_INDEX_SIZE_ERR; } /* Retrieve the data after the split point -- * this will be the new node's value. */ err = dom_characterdata_substring_data(&text->base, offset, len - offset, &value); if (err != DOM_NO_ERR) { return err; } /* Create new node */ err = _dom_text_create(t->owner, t->name, value, &res); if (err != DOM_NO_ERR) { dom_string_unref(value); return err; } /* Release our reference on the value (the new node has its own) */ dom_string_unref(value); /* Delete the data after the split point */ err = dom_characterdata_delete_data(&text->base, offset, len - offset); if (err != DOM_NO_ERR) { dom_node_unref(res); return err; } *result = res; return DOM_NO_ERR; } /** * Determine if a text node contains element content whitespace * * \param text The node to consider * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_text_get_is_element_content_whitespace( dom_text *text, bool *result) { *result = text->element_content_whitespace; return DOM_NO_ERR; } /** * Retrieve all text in Text nodes logically adjacent to a Text node * * \param text Text node to consider * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception _dom_text_get_whole_text(dom_text *text, dom_string **result) { return walk_logic_adjacent_text(text, COLLECT, result); } /** * Replace the text of a Text node and all logically adjacent Text nodes * * \param text Text node to consider * \param content Replacement content * \param result Pointer to location to receive Text node * \return DOM_NO_ERR on success, * DOM_NO_MODIFICATION_ALLOWED_ERR if one of the Text nodes being * replaced is readonly. * * The returned node will be referenced. The client should unref the node * once it has finished with it. */ dom_exception _dom_text_replace_whole_text(dom_text *text, dom_string *content, dom_text **result) { dom_exception err; dom_string *ret; err = walk_logic_adjacent_text(text, DELETE, &ret); if (err != DOM_NO_ERR) return err; err = dom_characterdata_set_data(text, content); if (err != DOM_NO_ERR) return err; *result = text; dom_node_ref(text); return DOM_NO_ERR; } /*-----------------------------------------------------------------------*/ /* The protected virtual functions */ /* The destroy function of this class */ void __dom_text_destroy(dom_node_internal *node) { _dom_text_destroy((dom_text *) node); } /* The copy constructor of this class */ dom_exception _dom_text_copy(dom_node_internal *old, dom_node_internal **copy) { dom_text *new_text; dom_exception err; new_text = malloc(sizeof(dom_text)); if (new_text == NULL) return DOM_NO_MEM_ERR; err = dom_text_copy_internal(old, new_text); if (err != DOM_NO_ERR) { free(new_text); return err; } *copy = (dom_node_internal *) new_text; return DOM_NO_ERR; } dom_exception _dom_text_copy_internal(dom_text *old, dom_text *new) { dom_exception err; err = dom_characterdata_copy_internal(old, new); if (err != DOM_NO_ERR) return err; new->element_content_whitespace = old->element_content_whitespace; return DOM_NO_ERR; } /*----------------------------------------------------------------------*/ /* Helper functions */ /** * Walk the logic adjacent text in certain order * * \param node The start Text node * \param opt The operation on each Text Node * \param order The order * \param ret The string of the logic adjacent text * \param cont Whether the logic adjacent text is interrupt here * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception walk_logic_adjacent_text_in_order( dom_node_internal *node, walk_operation opt, walk_order order, dom_string **ret, bool *cont) { dom_exception err; dom_string *data, *tmp; dom_node_internal *parent; /* If we reach the leaf of the DOM tree, just return to continue * to next sibling of our parent */ if (node == NULL) { *cont = true; return DOM_NO_ERR; } parent = dom_node_get_parent(node); while (node != NULL) { dom_node_internal *p; /* If we reach the boundary of logical-adjacent text, we stop */ if (node->type == DOM_ELEMENT_NODE || node->type == DOM_COMMENT_NODE || node->type == DOM_PROCESSING_INSTRUCTION_NODE) { *cont = false; return DOM_NO_ERR; } if (node->type == DOM_TEXT_NODE) { /* According the DOM spec, text node never have child */ assert(node->first_child == NULL); assert(node->last_child == NULL); if (opt == COLLECT) { err = dom_characterdata_get_data(node, &data); if (err == DOM_NO_ERR) return err; tmp = *ret; if (order == LEFT) { err = dom_string_concat(data, tmp, ret); if (err == DOM_NO_ERR) return err; } else if (order == RIGHT) { err = dom_string_concat(tmp, data, ret); if (err == DOM_NO_ERR) return err; } dom_string_unref(tmp); dom_string_unref(data); *cont = true; return DOM_NO_ERR; } if (opt == DELETE) { dom_node_internal *tn; err = dom_node_remove_child(node->parent, node, (void *) &tn); if (err != DOM_NO_ERR) return err; *cont = true; dom_node_unref(tn); return DOM_NO_ERR; } } p = dom_node_get_parent(node); if (order == LEFT) { if (node->last_child != NULL) { node = node->last_child; } else if (node->previous != NULL) { node = node->previous; } else { while (p != parent && node == p->last_child) { node = p; p = dom_node_get_parent(p); } node = node->previous; } } else { if (node->first_child != NULL) { node = node->first_child; } else if (node->next != NULL) { node = node->next; } else { while (p != parent && node == p->first_child) { node = p; p = dom_node_get_parent(p); } node = node->next; } } } return DOM_NO_ERR; } /** * Traverse the logic adjacent text. * * \param text The Text Node from which we start traversal * \param opt The operation code * \param ret The returned string if the opt is COLLECT * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception walk_logic_adjacent_text(dom_text *text, walk_operation opt, dom_string **ret) { dom_node_internal *node = (dom_node_internal *) text; dom_node_internal *parent = node->parent; dom_node_internal *left = node->previous; dom_node_internal *right = node->next; dom_exception err; bool cont; if (parent->type == DOM_ENTITY_NODE) { return DOM_NOT_SUPPORTED_ERR; } *ret = NULL; /* Firstly, we look our left */ err = walk_logic_adjacent_text_in_order(left, opt, LEFT, ret, &cont); if (err != DOM_NO_ERR) { if (opt == COLLECT) { dom_string_unref(*ret); *ret = NULL; } return err; } /* Ourself */ if (opt == COLLECT) { dom_string *data = NULL, *tmp = NULL; err = dom_characterdata_get_data(text, &data); if (err != DOM_NO_ERR) { dom_string_unref(*ret); return err; } if (*ret != NULL) { err = dom_string_concat(*ret, data, &tmp); dom_string_unref(data); dom_string_unref(*ret); if (err != DOM_NO_ERR) { return err; } *ret = tmp; } else { *ret = data; } } else { dom_node_internal *tn; err = dom_node_remove_child(node->parent, node, (void *) &tn); if (err != DOM_NO_ERR) return err; dom_node_unref(tn); } /* Now, look right */ err = walk_logic_adjacent_text_in_order(right, opt, RIGHT, ret, &cont); if (err != DOM_NO_ERR) { if (opt == COLLECT) { dom_string_unref(*ret); *ret = NULL; } return err; } return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/entity_ref.c0000644000175000017500000000654012377676745020142 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell * Copyright 2009 Bo Yang */ #include #include "core/document.h" #include "core/entity_ref.h" #include "core/node.h" #include "utils/utils.h" /** * A DOM entity reference */ struct dom_entity_reference { dom_node_internal base; /**< Base node */ }; static struct dom_node_vtable er_vtable = { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE }; static struct dom_node_protect_vtable er_protect_vtable = { DOM_ER_PROTECT_VTABLE }; /** * Create an entity reference * * \param doc The owning document * \param name The name of the node to create * \param value The text content of the node * \param result Pointer to location to receive created node * \return DOM_NO_ERR on success, * DOM_NO_MEM_ERR on memory exhaustion. * * ::doc, ::name and ::value will have their reference counts increased. * * The returned node will already be referenced. */ dom_exception _dom_entity_reference_create(dom_document *doc, dom_string *name, dom_string *value, dom_entity_reference **result) { dom_entity_reference *e; dom_exception err; /* Allocate the comment node */ e = malloc(sizeof(dom_entity_reference)); if (e == NULL) return DOM_NO_MEM_ERR; e->base.base.vtable = &er_vtable; e->base.vtable = &er_protect_vtable; /* And initialise the node */ err = _dom_entity_reference_initialise(&e->base, doc, DOM_ENTITY_REFERENCE_NODE, name, value, NULL, NULL); if (err != DOM_NO_ERR) { free(e); return err; } *result = e; return DOM_NO_ERR; } /** * Destroy an entity reference * * \param entity The entity reference to destroy * * The contents of ::entity will be destroyed and ::entity will be freed. */ void _dom_entity_reference_destroy(dom_entity_reference *entity) { /* Finalise base class */ _dom_entity_reference_finalise(&entity->base); /* Destroy fragment */ free(entity); } /** * Get the textual representation of an EntityRererence * * \param entity The entity reference to get the textual representation of * \param result Pointer to location to receive result * \return DOM_NO_ERR on success. * * The returned string will have its reference count increased. It is * the responsibility of the caller to unrer the string once it has * finished with it. */ dom_exception _dom_entity_reference_get_textual_representation( dom_entity_reference *entity, dom_string **result) { UNUSED(entity); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /*-----------------------------------------------------------------------*/ /* Following comes the protected vtable */ /* The virtual destroy function of this class */ void _dom_er_destroy(dom_node_internal *node) { _dom_entity_reference_destroy((dom_entity_reference *) node); } /* The copy constructor of this class */ dom_exception _dom_er_copy(dom_node_internal *old, dom_node_internal **copy) { dom_entity_reference *new_er; dom_exception err; new_er = malloc(sizeof(dom_entity_reference)); if (new_er == NULL) return DOM_NO_MEM_ERR; err = dom_node_copy_internal(old, new_er); if (err != DOM_NO_ERR) { free(new_er); return err; } *copy = (dom_node_internal *) new_er; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/core/implementation.c0000644000175000017500000002042712377676745021017 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell */ #include #include #include "core/document.h" #include "core/document_type.h" #include "html/html_document.h" #include "utils/namespace.h" #include "utils/utils.h" #include "utils/validate.h" /** * Test whether a DOM implementation implements a specific feature * and version * * \param feature The feature to test for * \param version The version number of the feature to test for * \param result Pointer to location to receive result * \return DOM_NO_ERR. */ dom_exception dom_implementation_has_feature( const char *feature, const char *version, bool *result) { UNUSED(feature); UNUSED(version); UNUSED(result); return DOM_NOT_SUPPORTED_ERR; } /** * Create a document type node * * \param qname The qualified name of the document type * \param public_id The external subset public identifier * \param system_id The external subset system identifier * \param doctype Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::qname is invalid, * DOM_NAMESPACE_ERR if ::qname is malformed, * DOM_NOT_SUPPORTED_ERR if ::impl does not support the feature * "XML" and the language exposed through * Document does not support XML * namespaces. * * The doctype will be referenced, so the client need not do this * explicitly. The client must unref the doctype once it has * finished with it. */ dom_exception dom_implementation_create_document_type( const char *qname, const char *public_id, const char *system_id, struct dom_document_type **doctype) { struct dom_document_type *d; dom_string *qname_s = NULL, *prefix = NULL, *lname = NULL; dom_string *public_id_s = NULL, *system_id_s = NULL; dom_exception err; if (qname == NULL) { return DOM_INVALID_CHARACTER_ERR; } err = dom_string_create((const uint8_t *) qname, strlen(qname), &qname_s); if (err != DOM_NO_ERR) return err; err = _dom_namespace_split_qname(qname_s, &prefix, &lname); if (err != DOM_NO_ERR) { dom_string_unref(qname_s); return err; } if (public_id != NULL) { err = dom_string_create((const uint8_t *) public_id, strlen(public_id), &public_id_s); if (err != DOM_NO_ERR) { dom_string_unref(lname); dom_string_unref(prefix); dom_string_unref(qname_s); return err; } } if (system_id != NULL) { err = dom_string_create((const uint8_t *) system_id, strlen(system_id), &system_id_s); if (err != DOM_NO_ERR) { dom_string_unref(public_id_s); dom_string_unref(lname); dom_string_unref(prefix); dom_string_unref(qname_s); return err; } } /* Create the doctype */ err = _dom_document_type_create(qname_s, public_id_s, system_id_s, &d); if (err == DOM_NO_ERR) *doctype = d; dom_string_unref(system_id_s); dom_string_unref(public_id_s); dom_string_unref(prefix); dom_string_unref(lname); dom_string_unref(qname_s); return err; } /** * Create a document node * * \param impl_type The type of document object to create * \param namespace The namespace URI of the document element * \param qname The qualified name of the document element * \param doctype The type of document to create * \param doc Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_INVALID_CHARACTER_ERR if ::qname is invalid, * DOM_NAMESPACE_ERR if ::qname is malformed, or if ::qname * has a prefix and ::namespace is NULL, * or if ::qname is NULL and ::namespace * is non-NULL, or if ::qname has a prefix * "xml" and ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or if ::impl does not support the "XML" * feature and ::namespace is non-NULL, * DOM_WRONG_DOCUMENT_ERR if ::doctype is already being used by a * document, or if it was not created by * ::impl, * DOM_NOT_SUPPORTED_ERR if ::impl does not support the feature * "XML" and the language exposed through * Document does not support XML * namespaces. * * The document will be referenced, so the client need not do this * explicitly. The client must unref the document once it has * finished with it. */ dom_exception dom_implementation_create_document( uint32_t impl_type, const char *namespace, const char *qname, struct dom_document_type *doctype, dom_events_default_action_fetcher daf, void *daf_ctx, struct dom_document **doc) { struct dom_document *d; dom_string *namespace_s = NULL, *qname_s = NULL; dom_exception err; if (namespace != NULL) { err = dom_string_create((const uint8_t *) namespace, strlen(namespace), &namespace_s); if (err != DOM_NO_ERR) return err; } if (qname != NULL) { err = dom_string_create((const uint8_t *) qname, strlen(qname), &qname_s); if (err != DOM_NO_ERR) { dom_string_unref(namespace_s); return err; } } if (qname_s != NULL && _dom_validate_name(qname_s) == false) { dom_string_unref(qname_s); dom_string_unref(namespace_s); return DOM_INVALID_CHARACTER_ERR; } err = _dom_namespace_validate_qname(qname_s, namespace_s); if (err != DOM_NO_ERR) { dom_string_unref(qname_s); dom_string_unref(namespace_s); return DOM_NAMESPACE_ERR; } if (doctype != NULL && dom_node_get_parent(doctype) != NULL) { dom_string_unref(qname_s); dom_string_unref(namespace_s); return DOM_WRONG_DOCUMENT_ERR; } /* Create document object that reflects the required APIs */ if (impl_type == DOM_IMPLEMENTATION_HTML) { dom_html_document *html_doc; err = _dom_html_document_create(daf, daf_ctx, &html_doc); d = (dom_document *) html_doc; } else { err = _dom_document_create(daf, daf_ctx, &d); } if (err != DOM_NO_ERR) { dom_string_unref(qname_s); dom_string_unref(namespace_s); return err; } /* Set its doctype, if necessary */ if (doctype != NULL) { struct dom_node *ins_doctype = NULL; err = dom_node_append_child((struct dom_node *) d, (struct dom_node *) doctype, &ins_doctype); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) d); dom_string_unref(qname_s); dom_string_unref(namespace_s); return err; } /* Not interested in inserted doctype */ if (ins_doctype != NULL) dom_node_unref(ins_doctype); } /* Create root element and attach it to document */ if (qname_s != NULL) { struct dom_element *e; struct dom_node *inserted; err = dom_document_create_element_ns(d, namespace_s, qname_s, &e); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) d); dom_string_unref(qname_s); dom_string_unref(namespace_s); return err; } err = dom_node_append_child((struct dom_node *) d, (struct dom_node *) e, &inserted); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) e); dom_node_unref((struct dom_node *) d); dom_string_unref(qname_s); dom_string_unref(namespace_s); return err; } /* No longer interested in inserted node */ dom_node_unref(inserted); /* Done with element */ dom_node_unref((struct dom_node *) e); } /* Clean up strings we created */ dom_string_unref(qname_s); dom_string_unref(namespace_s); *doc = d; return DOM_NO_ERR; } /** * Retrieve a specialized object which implements the specified * feature and version * * \param feature The requested feature * \param version The version number of the feature * \param object Pointer to location to receive object * \return DOM_NO_ERR. * * Any memory allocated by this call should be allocated using * the provided memory (de)allocation function. */ dom_exception dom_implementation_get_feature( const char *feature, const char *version, void **object) { UNUSED(feature); UNUSED(version); UNUSED(object); return DOM_NOT_SUPPORTED_ERR; } netsurf-all-3.2/libdom/src/html/0000755000175000017500000000000012377713347015623 5ustar vincevincenetsurf-all-3.2/libdom/src/html/html_script_element.c0000644000175000017500000001373212377676745022050 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_script_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_SCRIPT_ELEMENT }, DOM_HTML_SCRIPT_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_script_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_script_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_script_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_script_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_script_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_script_element object * * \param doc The document object * \param ele The dom_html_script_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_script_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_script_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_SCRIPT], namespace, prefix); } /** * Finalise a dom_html_script_element object * * \param ele The dom_html_script_element object */ void _dom_html_script_element_finalise(struct dom_html_script_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_script_element object * * \param ele The dom_html_script_element object */ void _dom_html_script_element_destroy(struct dom_html_script_element *ele) { _dom_html_script_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_script_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_script_element_destroy(dom_node_internal *node) { _dom_html_script_element_destroy((struct dom_html_script_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_script_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_script_element_get_##attr( \ dom_html_script_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_script_element_set_##attr( \ dom_html_script_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(html_for); SIMPLE_GET_SET(event); SIMPLE_GET_SET(charset); SIMPLE_GET_SET(src); SIMPLE_GET_SET(type); /** * Get the defer property * * \param ele The dom_html_script_element object * \param defer The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_script_element_get_defer(dom_html_script_element *ele, bool *defer) { return dom_html_element_get_bool_property(&ele->base, "defer", SLEN("defer"), defer); } /** * Set the defer property * * \param ele The dom_html_script_element object * \param defer The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_script_element_set_defer(dom_html_script_element *ele, bool defer) { return dom_html_element_set_bool_property(&ele->base, "defer", SLEN("defer"), defer); } /** * Get the text property * * \param ele The dom_html_script_element object * \param text The returned dom_string object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_script_element_get_text( dom_html_script_element *ele, dom_string **text) { return _dom_node_get_text_content((dom_node_internal *)ele, text); } /** * Set the text property * * \param ele The dom_html_script_element object * \param text The dom_string value to be set * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_script_element_set_text( dom_html_script_element *ele, dom_string *text) { return _dom_node_set_text_content((dom_node_internal *)ele, text); } netsurf-all-3.2/libdom/src/html/html_html_element.c0000644000175000017500000000744312377676745021512 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "html/html_document.h" #include "html/html_html_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_HTML_ELEMENT }, DOM_HTML_HTML_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_html_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_html_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_html_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_html_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_html_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_html_element object * * \param doc The document object * \param ele The dom_html_html_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_html_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_html_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_HTML], namespace, prefix); } /** * Finalise a dom_html_html_element object * * \param ele The dom_html_html_element object */ void _dom_html_html_element_finalise(struct dom_html_html_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_html_element object * * \param ele The dom_html_html_element object */ void _dom_html_html_element_destroy(struct dom_html_html_element *ele) { _dom_html_html_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_html_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_html_element_destroy(dom_node_internal *node) { _dom_html_html_element_destroy((struct dom_html_html_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_html_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ dom_exception dom_html_html_element_get_version(dom_html_html_element *element, dom_string **version) { dom_exception ret; dom_string *_memo_version; _memo_version = ((struct dom_html_document *) ((struct dom_node_internal *)element)->owner)->memoised[hds_version]; ret = dom_element_get_attribute(element, _memo_version, version); return ret; } dom_exception dom_html_html_element_set_version(dom_html_html_element *element, dom_string *version) { dom_exception ret; dom_string *_memo_version; _memo_version = ((struct dom_html_document *) ((struct dom_node_internal *)element)->owner)->memoised[hds_version]; ret = dom_element_set_attribute(element, _memo_version, version); return ret; } netsurf-all-3.2/libdom/src/html/html_base_element.c0000644000175000017500000001020612377676745021447 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "html/html_document.h" #include "html/html_base_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_BASE_ELEMENT }, DOM_HTML_BASE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_base_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_base_element_create(struct dom_html_document *doc, struct dom_html_base_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_base_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_base_element_initialise(doc, *ele); } /** * Initialise a dom_html_base_element object * * \param doc The document object * \param ele The dom_html_base_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_base_element_initialise(struct dom_html_document *doc, struct dom_html_base_element *ele) { dom_string *name = NULL; dom_exception err; err = dom_string_create((const uint8_t *) "BASE", SLEN("BASE"), &name); if (err != DOM_NO_ERR) return err; err = _dom_html_element_initialise(doc, &ele->base, name, NULL, NULL); dom_string_unref(name); return err; } /** * Finalise a dom_html_base_element object * * \param ele The dom_html_base_element object */ void _dom_html_base_element_finalise(struct dom_html_base_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_base_element object * * \param ele The dom_html_base_element object */ void _dom_html_base_element_destroy(struct dom_html_base_element *ele) { _dom_html_base_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_base_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_base_element_destroy(dom_node_internal *node) { _dom_html_base_element_destroy((struct dom_html_base_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_base_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_base_element_get_##attr( \ dom_html_base_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_base_element_set_##attr( \ dom_html_base_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(href); SIMPLE_GET_SET(target); netsurf-all-3.2/libdom/src/html/html_div_element.h0000644000175000017500000000326312377676745021331 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_div_element_h_ #define dom_internal_html_div_element_h_ #include #include "html/html_element.h" struct dom_html_div_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_div_element object */ dom_exception _dom_html_div_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_div_element **ele); /* Initialise a dom_html_div_element object */ dom_exception _dom_html_div_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_div_element *ele); /* Finalise a dom_html_div_element object */ void _dom_html_div_element_finalise(struct dom_html_div_element *ele); /* Destroy a dom_html_div_element object */ void _dom_html_div_element_destroy(struct dom_html_div_element *ele); /* The protected virtual functions */ dom_exception _dom_html_div_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_div_element_destroy(dom_node_internal *node); dom_exception _dom_html_div_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_DIV_ELEMENT_PROTECT_VTABLE \ _dom_html_div_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_DIV_ELEMENT \ _dom_virtual_html_div_element_destroy, \ _dom_html_div_element_copy #endif netsurf-all-3.2/libdom/src/html/html_font_element.h0000644000175000017500000000331312377676745021511 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_font_element_h_ #define dom_internal_html_font_element_h_ #include #include "html/html_element.h" struct dom_html_font_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_font_element object */ dom_exception _dom_html_font_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_font_element **ele); /* Initialise a dom_html_font_element object */ dom_exception _dom_html_font_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_font_element *ele); /* Finalise a dom_html_font_element object */ void _dom_html_font_element_finalise(struct dom_html_font_element *ele); /* Destroy a dom_html_font_element object */ void _dom_html_font_element_destroy(struct dom_html_font_element *ele); /* The protected virtual functions */ dom_exception _dom_html_font_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_font_element_destroy(dom_node_internal *node); dom_exception _dom_html_font_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_FONT_ELEMENT_PROTECT_VTABLE \ _dom_html_font_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_FONT_ELEMENT \ _dom_virtual_html_font_element_destroy, \ _dom_html_font_element_copy #endif netsurf-all-3.2/libdom/src/html/html_li_element.h0000644000175000017500000000323112377676745021146 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_li_element_h_ #define dom_internal_html_li_element_h_ #include #include "html/html_element.h" struct dom_html_li_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_li_element object */ dom_exception _dom_html_li_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *lifix, struct dom_html_li_element **ele); /* Initialise a dom_html_li_element object */ dom_exception _dom_html_li_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *lifix, struct dom_html_li_element *ele); /* Finalise a dom_html_li_element object */ void _dom_html_li_element_finalise(struct dom_html_li_element *ele); /* Destroy a dom_html_li_element object */ void _dom_html_li_element_destroy(struct dom_html_li_element *ele); /* The protected virtual functions */ dom_exception _dom_html_li_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_li_element_destroy(dom_node_internal *node); dom_exception _dom_html_li_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_LI_ELEMENT_PROTECT_VTABLE \ _dom_html_li_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_LI_ELEMENT \ _dom_virtual_html_li_element_destroy, \ _dom_html_li_element_copy #endif netsurf-all-3.2/libdom/src/html/html_param_element.c0000644000175000017500000001063312377676745021641 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_param_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_PARAM_ELEMENT }, DOM_HTML_PARAM_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_param_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_param_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_param_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_param_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_param_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_param_element object * * \param doc The document object * \param ele The dom_html_param_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_param_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_param_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_PARAM], namespace, prefix); } /** * Finalise a dom_html_param_element object * * \param ele The dom_html_param_element object */ void _dom_html_param_element_finalise(struct dom_html_param_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_param_element object * * \param ele The dom_html_param_element object */ void _dom_html_param_element_destroy(struct dom_html_param_element *ele) { _dom_html_param_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_param_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_param_element_destroy(dom_node_internal *node) { _dom_html_param_element_destroy((struct dom_html_param_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_param_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_param_element_get_##attr( \ dom_html_param_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_param_element_set_##attr( \ dom_html_param_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(name); SIMPLE_GET_SET(type); SIMPLE_GET_SET(value); SIMPLE_GET_SET(value_type); netsurf-all-3.2/libdom/src/html/html_heading_element.h0000644000175000017500000000350112377676745022141 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_heading_element_h_ #define dom_internal_html_heading_element_h_ #include #include "html/html_element.h" struct dom_html_heading_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_heading_element object */ dom_exception _dom_html_heading_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_heading_element **ele); /* Initialise a dom_html_heading_element object */ dom_exception _dom_html_heading_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_heading_element *ele); /* Finalise a dom_html_heading_element object */ void _dom_html_heading_element_finalise(struct dom_html_heading_element *ele); /* Destroy a dom_html_heading_element object */ void _dom_html_heading_element_destroy(struct dom_html_heading_element *ele); /* The protected virtual functions */ dom_exception _dom_html_heading_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_heading_element_destroy(dom_node_internal *node); dom_exception _dom_html_heading_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_HEADING_ELEMENT_PROTECT_VTABLE \ _dom_html_heading_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_HEADING_ELEMENT \ _dom_virtual_html_heading_element_destroy, \ _dom_html_heading_element_copy #endif netsurf-all-3.2/libdom/src/html/html_iframe_element.c0000644000175000017500000001202212377676745021776 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_iframe_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_IFRAME_ELEMENT }, DOM_HTML_IFRAME_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_iframe_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_iframe_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_iframe_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_iframe_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_iframe_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_iframe_element object * * \param doc The document object * \param ele The dom_html_iframe_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_iframe_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_iframe_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_IFRAME], namespace, prefix); } /** * Finalise a dom_html_iframe_element object * * \param ele The dom_html_iframe_element object */ void _dom_html_iframe_element_finalise(struct dom_html_iframe_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_iframe_element object * * \param ele The dom_html_iframe_element object */ void _dom_html_iframe_element_destroy(struct dom_html_iframe_element *ele) { _dom_html_iframe_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_iframe_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_iframe_element_destroy(dom_node_internal *node) { _dom_html_iframe_element_destroy((struct dom_html_iframe_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_iframe_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_iframe_element_get_##attr( \ dom_html_iframe_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_iframe_element_set_##attr( \ dom_html_iframe_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(long_desc); SIMPLE_GET_SET(align); SIMPLE_GET_SET(name); SIMPLE_GET_SET(src); SIMPLE_GET_SET(margin_width); SIMPLE_GET_SET(margin_height); SIMPLE_GET_SET(scrolling); SIMPLE_GET_SET(frame_border); SIMPLE_GET_SET(width); SIMPLE_GET_SET(height); /** * Get the content_document property * * \param ele The dom_html_iframe_element object * \param content_document The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_iframe_element_get_content_document( dom_html_iframe_element *ele, dom_document **content_document) { /* We don't support creating documents from within here */ UNUSED(ele); UNUSED(content_document); return DOM_NOT_SUPPORTED_ERR; } netsurf-all-3.2/libdom/src/html/html_anchor_element.h0000644000175000017500000000335312377676745022021 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_anchor_element_h_ #define dom_internal_html_anchor_element_h_ #include #include "html/html_element.h" struct dom_html_anchor_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_anchor_element object */ dom_exception _dom_html_anchor_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_anchor_element **ele); /* Initialise a dom_html_anchor_element object */ dom_exception _dom_html_anchor_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_anchor_element *ele); /* Finalise a dom_html_anchor_element object */ void _dom_html_anchor_element_finalise(struct dom_html_anchor_element *ele); /* Destroy a dom_html_anchor_element object */ void _dom_html_anchor_element_destroy(struct dom_html_anchor_element *ele); /* The protected virtual functions */ dom_exception _dom_html_anchor_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_anchor_element_destroy(dom_node_internal *node); dom_exception _dom_html_anchor_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_ANCHOR_ELEMENT_PROTECT_VTABLE \ _dom_html_anchor_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_ANCHOR_ELEMENT \ _dom_virtual_html_anchor_element_destroy, \ _dom_html_anchor_element_copy #endif netsurf-all-3.2/libdom/src/html/html_tablecol_element.c0000644000175000017500000001227612377676746022334 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_tablecol_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_COL_ELEMENT }, DOM_HTML_TABLE_COL_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_col_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_col_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_col_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_col_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_col_element_initialise(doc, tag_name, namespace, prefix, *ele); } /** * Initialise a dom_html_table_col_element object * * \param doc The document object * \param ele The dom_html_table_col_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_col_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_col_element *ele) { return _dom_html_element_initialise(doc, &ele->base, tag_name, namespace, prefix); } /** * Finalise a dom_html_table_col_element object * * \param ele The dom_html_table_col_element object */ void _dom_html_table_col_element_finalise(struct dom_html_table_col_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_col_element object * * \param ele The dom_html_table_col_element object */ void _dom_html_table_col_element_destroy(struct dom_html_table_col_element *ele) { _dom_html_table_col_element_finalise(ele); free(ele); } /** * Get the width Property * * \param table_col The dom_html_table_col_element object */ dom_exception dom_html_table_col_element_get_span( dom_html_table_col_element *table_col, int32_t *span) { return dom_html_element_get_int32_t_property(&table_col->base, "span", SLEN("span"), span); } /** * Set the width Property * * \param table_col The dom_html_table_col_element object */ dom_exception dom_html_table_col_element_set_span( dom_html_table_col_element *table_col, uint32_t span) { return dom_html_element_set_int32_t_property(&table_col->base, "span", SLEN("span"), span); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_col_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_col_element_destroy(dom_node_internal *node) { _dom_html_table_col_element_destroy((struct dom_html_table_col_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_col_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_col_element_get_##attr( \ dom_html_table_col_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_col_element_set_##attr( \ dom_html_table_col_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); SIMPLE_GET_SET(ch); SIMPLE_GET_SET(ch_off); SIMPLE_GET_SET(v_align); SIMPLE_GET_SET(width); netsurf-all-3.2/libdom/src/html/html_document_strings.h0000644000175000017500000002027212377676745022424 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ /* Note, this file deliberately lacks guards since it's included many times * in many places in order to correctly handle the loading of the strings. */ #ifndef HTML_DOCUMENT_STRINGS_ACTION #define HTML_DOCUMENT_STRINGS_INTERNAL_ACTION 1 #define HTML_DOCUMENT_STRINGS_PREFIX \ typedef enum { #define HTML_DOCUMENT_STRINGS_SUFFIX \ hds_COUNT \ } html_document_memo_string_e; #define HTML_DOCUMENT_STRINGS_ACTION(tag,str) \ hds_##tag, #endif #define HTML_DOCUMENT_STRINGS_ACTION1(x) HTML_DOCUMENT_STRINGS_ACTION(x,x) #ifdef HTML_DOCUMENT_STRINGS_PREFIX HTML_DOCUMENT_STRINGS_PREFIX #endif /* Useful attributes for HTMLElement */ HTML_DOCUMENT_STRINGS_ACTION1(id) HTML_DOCUMENT_STRINGS_ACTION1(title) HTML_DOCUMENT_STRINGS_ACTION1(lang) HTML_DOCUMENT_STRINGS_ACTION1(dir) HTML_DOCUMENT_STRINGS_ACTION1(class) /* Useful attributes used by HTMLHtmlElement */ HTML_DOCUMENT_STRINGS_ACTION1(version) /* Useful attributes used by HTMLHeadElement */ HTML_DOCUMENT_STRINGS_ACTION1(profile) /* Useful attributes used by HTMLLinkElement */ HTML_DOCUMENT_STRINGS_ACTION1(charset) HTML_DOCUMENT_STRINGS_ACTION1(href) HTML_DOCUMENT_STRINGS_ACTION1(hreflang) HTML_DOCUMENT_STRINGS_ACTION1(media) HTML_DOCUMENT_STRINGS_ACTION1(rel) HTML_DOCUMENT_STRINGS_ACTION1(rev) HTML_DOCUMENT_STRINGS_ACTION1(target) HTML_DOCUMENT_STRINGS_ACTION1(type) /* Useful attributes used by HTMLMetaElement */ HTML_DOCUMENT_STRINGS_ACTION1(content) HTML_DOCUMENT_STRINGS_ACTION(http_equiv,http-equiv) HTML_DOCUMENT_STRINGS_ACTION1(name) HTML_DOCUMENT_STRINGS_ACTION1(scheme) /* HTMLBodyElement attributes */ HTML_DOCUMENT_STRINGS_ACTION(a_link,alink) HTML_DOCUMENT_STRINGS_ACTION(v_link,vlink) HTML_DOCUMENT_STRINGS_ACTION(bg_color,bgcolor) HTML_DOCUMENT_STRINGS_ACTION1(background) HTML_DOCUMENT_STRINGS_ACTION1(link) HTML_DOCUMENT_STRINGS_ACTION1(text) /* Useful attributes used by HTMLFormElement */ HTML_DOCUMENT_STRINGS_ACTION(accept_charset,accept-charset) HTML_DOCUMENT_STRINGS_ACTION1(action) HTML_DOCUMENT_STRINGS_ACTION1(enctype) HTML_DOCUMENT_STRINGS_ACTION1(method) /* HTML_DOCUMENT_STRINGS_ACTION1(target) */ /* Useful attributes used by HTMLButtonElement */ HTML_DOCUMENT_STRINGS_ACTION(access_key,accesskey) /* Useful attributes used by HTMLBrElement */ HTML_DOCUMENT_STRINGS_ACTION1(clear) /* HTML_DOCUMENT_STRINGS_ACTION1(name) */ /* HTML_DOCUMENT_STRINGS_ACTION1(type) */ HTML_DOCUMENT_STRINGS_ACTION1(value) /* Useful attributes used by HTMLInputElement */ HTML_DOCUMENT_STRINGS_ACTION1(accept) /* HTML_DOCUMENT_STRINGS_ACTION(access_key,accesskey) */ HTML_DOCUMENT_STRINGS_ACTION1(align) HTML_DOCUMENT_STRINGS_ACTION1(alt) HTML_DOCUMENT_STRINGS_ACTION1(checked) HTML_DOCUMENT_STRINGS_ACTION1(disabled) HTML_DOCUMENT_STRINGS_ACTION(max_length,maxlength) /* HTML_DOCUMENT_STRINGS_ACTION1(name) */ HTML_DOCUMENT_STRINGS_ACTION(read_only,readonly) HTML_DOCUMENT_STRINGS_ACTION1(size) HTML_DOCUMENT_STRINGS_ACTION1(src) HTML_DOCUMENT_STRINGS_ACTION1(width) HTML_DOCUMENT_STRINGS_ACTION1(compact) HTML_DOCUMENT_STRINGS_ACTION1(cite) HTML_DOCUMENT_STRINGS_ACTION1(color) HTML_DOCUMENT_STRINGS_ACTION1(face) HTML_DOCUMENT_STRINGS_ACTION1(coords) HTML_DOCUMENT_STRINGS_ACTION1(shape) HTML_DOCUMENT_STRINGS_ACTION1(border) HTML_DOCUMENT_STRINGS_ACTION1(code) HTML_DOCUMENT_STRINGS_ACTION1(archive) HTML_DOCUMENT_STRINGS_ACTION1(data) HTML_DOCUMENT_STRINGS_ACTION1(height) HTML_DOCUMENT_STRINGS_ACTION1(standby) HTML_DOCUMENT_STRINGS_ACTION1(object) HTML_DOCUMENT_STRINGS_ACTION1(event) HTML_DOCUMENT_STRINGS_ACTION1(defer) HTML_DOCUMENT_STRINGS_ACTION1(abbr) HTML_DOCUMENT_STRINGS_ACTION1(axis) HTML_DOCUMENT_STRINGS_ACTION1(headers) HTML_DOCUMENT_STRINGS_ACTION1(scope) HTML_DOCUMENT_STRINGS_ACTION1(frame) HTML_DOCUMENT_STRINGS_ACTION1(rules) HTML_DOCUMENT_STRINGS_ACTION1(summary) HTML_DOCUMENT_STRINGS_ACTION1(prompt) HTML_DOCUMENT_STRINGS_ACTION1(rows) HTML_DOCUMENT_STRINGS_ACTION1(cols) HTML_DOCUMENT_STRINGS_ACTION1(scrolling) HTML_DOCUMENT_STRINGS_ACTION(tab_index,tabindex) HTML_DOCUMENT_STRINGS_ACTION(html_for,for) HTML_DOCUMENT_STRINGS_ACTION(date_time,datetime) HTML_DOCUMENT_STRINGS_ACTION(long_desc,longdesc) HTML_DOCUMENT_STRINGS_ACTION(code_base,codebase) HTML_DOCUMENT_STRINGS_ACTION(code_type,codetype) HTML_DOCUMENT_STRINGS_ACTION(value_type,valuetype) HTML_DOCUMENT_STRINGS_ACTION(v_align,valign) HTML_DOCUMENT_STRINGS_ACTION(ch,char) HTML_DOCUMENT_STRINGS_ACTION(ch_off,charoff) HTML_DOCUMENT_STRINGS_ACTION(cell_padding,cellpadding) HTML_DOCUMENT_STRINGS_ACTION(cell_spacing,cellspacing) HTML_DOCUMENT_STRINGS_ACTION(frame_border,frameborder) HTML_DOCUMENT_STRINGS_ACTION(margin_height,marginheight) HTML_DOCUMENT_STRINGS_ACTION(margin_width,marginwidth) /* HTML_DOCUMENT_STRINGS_ACTION1(type) */ HTML_DOCUMENT_STRINGS_ACTION(use_map,usemap) /* HTML_DOCUMENT_STRINGS_ACTION1(value) */ /* HTMLTextAreaElement type */ HTML_DOCUMENT_STRINGS_ACTION1(textarea) /* HTMLOptGroupElement attributes */ HTML_DOCUMENT_STRINGS_ACTION1(label) /* HTMLOptionElement attributes */ /* HTML_DOCUMENT_STRINGS_ACTION1(label) */ HTML_DOCUMENT_STRINGS_ACTION1(selected) /* HTML_DOCUMENT_STRINGS_ACTION1(value) */ /* HTMLSelectElement strings */ HTML_DOCUMENT_STRINGS_ACTION(select_multiple,select-multiple) HTML_DOCUMENT_STRINGS_ACTION(select_one,select-one) /* Some event strings for later */ HTML_DOCUMENT_STRINGS_ACTION1(blur) HTML_DOCUMENT_STRINGS_ACTION1(focus) HTML_DOCUMENT_STRINGS_ACTION1(select) HTML_DOCUMENT_STRINGS_ACTION1(click) HTML_DOCUMENT_STRINGS_ACTION1(submit) HTML_DOCUMENT_STRINGS_ACTION1(reset) /* Names for elements which get specialised. */ HTML_DOCUMENT_STRINGS_ACTION1(HTML) HTML_DOCUMENT_STRINGS_ACTION1(HEAD) HTML_DOCUMENT_STRINGS_ACTION1(LINK) HTML_DOCUMENT_STRINGS_ACTION1(TITLE) HTML_DOCUMENT_STRINGS_ACTION1(META) HTML_DOCUMENT_STRINGS_ACTION1(BASE) HTML_DOCUMENT_STRINGS_ACTION1(ISINDEX) HTML_DOCUMENT_STRINGS_ACTION1(STYLE) HTML_DOCUMENT_STRINGS_ACTION1(BODY) HTML_DOCUMENT_STRINGS_ACTION1(FORM) HTML_DOCUMENT_STRINGS_ACTION1(SELECT) HTML_DOCUMENT_STRINGS_ACTION1(OPTGROUP) HTML_DOCUMENT_STRINGS_ACTION1(OPTION) HTML_DOCUMENT_STRINGS_ACTION1(INPUT) HTML_DOCUMENT_STRINGS_ACTION1(TEXTAREA) HTML_DOCUMENT_STRINGS_ACTION1(BUTTON) HTML_DOCUMENT_STRINGS_ACTION1(LABEL) HTML_DOCUMENT_STRINGS_ACTION1(FIELDSET) HTML_DOCUMENT_STRINGS_ACTION1(LEGEND) HTML_DOCUMENT_STRINGS_ACTION1(UL) HTML_DOCUMENT_STRINGS_ACTION1(OL) HTML_DOCUMENT_STRINGS_ACTION1(DL) HTML_DOCUMENT_STRINGS_ACTION1(DIRECTORY) HTML_DOCUMENT_STRINGS_ACTION1(MENU) HTML_DOCUMENT_STRINGS_ACTION1(LI) HTML_DOCUMENT_STRINGS_ACTION1(BLOCKQUOTE) HTML_DOCUMENT_STRINGS_ACTION1(DIV) HTML_DOCUMENT_STRINGS_ACTION1(P) HTML_DOCUMENT_STRINGS_ACTION1(H1) HTML_DOCUMENT_STRINGS_ACTION1(H2) HTML_DOCUMENT_STRINGS_ACTION1(H3) HTML_DOCUMENT_STRINGS_ACTION1(H4) HTML_DOCUMENT_STRINGS_ACTION1(H5) HTML_DOCUMENT_STRINGS_ACTION1(H6) HTML_DOCUMENT_STRINGS_ACTION1(Q) HTML_DOCUMENT_STRINGS_ACTION1(PRE) HTML_DOCUMENT_STRINGS_ACTION1(BR) HTML_DOCUMENT_STRINGS_ACTION1(BASEFONT) HTML_DOCUMENT_STRINGS_ACTION1(FONT) HTML_DOCUMENT_STRINGS_ACTION1(HR) HTML_DOCUMENT_STRINGS_ACTION1(INS) HTML_DOCUMENT_STRINGS_ACTION1(DEL) HTML_DOCUMENT_STRINGS_ACTION1(A) HTML_DOCUMENT_STRINGS_ACTION1(IMG) HTML_DOCUMENT_STRINGS_ACTION1(OBJECT) HTML_DOCUMENT_STRINGS_ACTION1(PARAM) HTML_DOCUMENT_STRINGS_ACTION1(APPLET) HTML_DOCUMENT_STRINGS_ACTION1(MAP) HTML_DOCUMENT_STRINGS_ACTION1(AREA) HTML_DOCUMENT_STRINGS_ACTION1(SCRIPT) HTML_DOCUMENT_STRINGS_ACTION1(TABLE) HTML_DOCUMENT_STRINGS_ACTION1(CAPTION) HTML_DOCUMENT_STRINGS_ACTION1(COL) HTML_DOCUMENT_STRINGS_ACTION1(COLGROUP) HTML_DOCUMENT_STRINGS_ACTION1(THEAD) HTML_DOCUMENT_STRINGS_ACTION1(TFOOT) HTML_DOCUMENT_STRINGS_ACTION1(TBODY) HTML_DOCUMENT_STRINGS_ACTION1(TR) HTML_DOCUMENT_STRINGS_ACTION1(TH) HTML_DOCUMENT_STRINGS_ACTION1(TD) HTML_DOCUMENT_STRINGS_ACTION1(FRAMESET) HTML_DOCUMENT_STRINGS_ACTION1(FRAME) HTML_DOCUMENT_STRINGS_ACTION1(IFRAME) #ifdef HTML_DOCUMENT_STRINGS_SUFFIX HTML_DOCUMENT_STRINGS_SUFFIX #endif #undef HTML_DOCUMENT_STRINGS_ACTION1 #ifdef HTML_DOCUMENT_STRINGS_INTERNAL_ACTION #undef HTML_DOCUMENT_STRINGS_INTERNAL_ACTION #undef HTML_DOCUMENT_STRINGS_PREFIX #undef HTML_DOCUMENT_STRINGS_SUFFIX #undef HTML_DOCUMENT_STRINGS_ACTION #endif netsurf-all-3.2/libdom/src/html/html_head_element.h0000644000175000017500000000316512377676745021451 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_head_element_h_ #define dom_internal_html_head_element_h_ #include #include "html/html_element.h" struct dom_html_head_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_head_element object */ dom_exception _dom_html_head_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_head_element **ele); /* Initialise a dom_html_head_element object */ dom_exception _dom_html_head_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_head_element *ele); /* Finalise a dom_html_head_element object */ void _dom_html_head_element_finalise(struct dom_html_head_element *ele); /* Destroy a dom_html_head_element object */ void _dom_html_head_element_destroy(struct dom_html_head_element *ele); /* The protected virtual functions */ dom_exception _dom_html_head_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_head_element_destroy(dom_node_internal *node); dom_exception _dom_html_head_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_HEAD_ELEMENT_PROTECT_VTABLE \ _dom_html_head_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_HEAD_ELEMENT \ _dom_virtual_html_head_element_destroy, \ _dom_html_head_element_copy #endif netsurf-all-3.2/libdom/src/html/html_image_element.c0000644000175000017500000001533412377676745021626 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_image_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_IMAGE_ELEMENT }, DOM_HTML_IMAGE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_image_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_image_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_image_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_image_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_image_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_image_element object * * \param doc The document object * \param ele The dom_html_image_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_image_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_image_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_IMG], namespace, prefix); } /** * Finalise a dom_html_image_element object * * \param ele The dom_html_image_element object */ void _dom_html_image_element_finalise(struct dom_html_image_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_image_element object * * \param ele The dom_html_image_element object */ void _dom_html_image_element_destroy(struct dom_html_image_element *ele) { _dom_html_image_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_image_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_image_element_destroy(dom_node_internal *node) { _dom_html_image_element_destroy((struct dom_html_image_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_image_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_image_element_get_##attr( \ dom_html_image_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_image_element_set_##attr( \ dom_html_image_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(name); SIMPLE_GET_SET(align); SIMPLE_GET_SET(alt); SIMPLE_GET_SET(border); SIMPLE_GET_SET(long_desc); SIMPLE_GET_SET(src); SIMPLE_GET_SET(use_map); dom_exception dom_html_image_element_get_height( dom_html_image_element *image, int32_t *height) { return dom_html_element_get_int32_t_property(&image->base, "height", SLEN("height"), height); } dom_exception dom_html_image_element_set_height( dom_html_image_element *image, uint32_t height) { return dom_html_element_set_int32_t_property(&image->base, "height", SLEN("height"), height); } dom_exception dom_html_image_element_get_hspace( dom_html_image_element *image, int32_t *hspace) { return dom_html_element_get_int32_t_property(&image->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_image_element_set_hspace( dom_html_image_element *image, uint32_t hspace) { return dom_html_element_set_int32_t_property(&image->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_image_element_get_vspace( dom_html_image_element *image, int32_t *vspace) { return dom_html_element_get_int32_t_property(&image->base, "vspace", SLEN("cspace"), vspace); } dom_exception dom_html_image_element_set_vspace( dom_html_image_element *image, uint32_t vspace) { return dom_html_element_set_int32_t_property(&image->base, "vspace", SLEN("vsapce"), vspace); } dom_exception dom_html_image_element_get_width( dom_html_image_element *image, int32_t *width) { return dom_html_element_get_int32_t_property(&image->base, "width", SLEN("width"), width); } dom_exception dom_html_image_element_set_width( dom_html_image_element *image, uint32_t width) { return dom_html_element_set_int32_t_property(&image->base, "width", SLEN("width"), width); } /** * Get the is_map property * * \param ele The dom_html_image_element object * \param is_map The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_image_element_get_is_map(dom_html_image_element *ele, bool *is_map) { return dom_html_element_get_bool_property(&ele->base, "ismap", SLEN("ismap"), is_map); } /** * Set the is_map property * * \param ele The dom_html_image_element object * \param is_map The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_image_element_set_is_map(dom_html_image_element *ele, bool is_map) { return dom_html_element_set_bool_property(&ele->base, "ismap", SLEN("ismap"), is_map); } netsurf-all-3.2/libdom/src/html/html_paragraph_element.c0000644000175000017500000001057312377676745022511 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_paragraph_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_P_ELEMENT }, DOM_HTML_P_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_paragraph_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_paragraph_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_paragraph_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_paragraph_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_paragraph_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_paragraph_element object * * \param doc The document object * \param ele The dom_html_paragraph_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_paragraph_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_paragraph_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_P], namespace, prefix); } /** * Finalise a dom_html_paragraph_element object * * \param ele The dom_html_paragraph_element object */ void _dom_html_paragraph_element_finalise(struct dom_html_paragraph_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_paragraph_element object * * \param ele The dom_html_paragraph_element object */ void _dom_html_paragraph_element_destroy(struct dom_html_paragraph_element *ele) { _dom_html_paragraph_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_paragraph_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_paragraph_element_destroy(dom_node_internal *node) { _dom_html_paragraph_element_destroy((struct dom_html_paragraph_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_paragraph_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_paragraph_element_get_##attr( \ dom_html_paragraph_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_paragraph_element_set_##attr( \ dom_html_paragraph_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); netsurf-all-3.2/libdom/src/html/html_pre_element.h0000644000175000017500000000326312377676745021335 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_pre_element_h_ #define dom_internal_html_pre_element_h_ #include #include "html/html_element.h" struct dom_html_pre_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_pre_element object */ dom_exception _dom_html_pre_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_pre_element **ele); /* Initialise a dom_html_pre_element object */ dom_exception _dom_html_pre_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_pre_element *ele); /* Finalise a dom_html_pre_element object */ void _dom_html_pre_element_finalise(struct dom_html_pre_element *ele); /* Destroy a dom_html_pre_element object */ void _dom_html_pre_element_destroy(struct dom_html_pre_element *ele); /* The protected virtual functions */ dom_exception _dom_html_pre_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_pre_element_destroy(dom_node_internal *node); dom_exception _dom_html_pre_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_PRE_ELEMENT_PROTECT_VTABLE \ _dom_html_pre_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_PRE_ELEMENT \ _dom_virtual_html_pre_element_destroy, \ _dom_html_pre_element_copy #endif netsurf-all-3.2/libdom/src/html/html_param_element.h0000644000175000017500000000332312377676745021644 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_param_element_h_ #define dom_internal_html_param_element_h_ #include #include "html/html_element.h" struct dom_html_param_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_param_element object */ dom_exception _dom_html_param_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_param_element **ele); /* Initialise a dom_html_param_element object */ dom_exception _dom_html_param_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_param_element *ele); /* Finalise a dom_html_param_element object */ void _dom_html_param_element_finalise(struct dom_html_param_element *ele); /* Destroy a dom_html_param_element object */ void _dom_html_param_element_destroy(struct dom_html_param_element *ele); /* The protected virtual functions */ dom_exception _dom_html_param_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_param_element_destroy(dom_node_internal *node); dom_exception _dom_html_param_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_PARAM_ELEMENT_PROTECT_VTABLE \ _dom_html_param_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_PARAM_ELEMENT \ _dom_virtual_html_param_element_destroy, \ _dom_html_param_element_copy #endif netsurf-all-3.2/libdom/src/html/html_script_element.h0000644000175000017500000000337312377676745022055 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_script_element_h_ #define dom_internal_html_script_element_h_ #include #include "html/html_element.h" struct dom_html_script_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_script_element object */ dom_exception _dom_html_script_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_script_element **ele); /* Initialise a dom_html_script_element object */ dom_exception _dom_html_script_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_script_element *ele); /* Finalise a dom_html_script_element object */ void _dom_html_script_element_finalise(struct dom_html_script_element *ele); /* Destroy a dom_html_script_element object */ void _dom_html_script_element_destroy(struct dom_html_script_element *ele); /* The protected virtual functions */ dom_exception _dom_html_script_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_script_element_destroy(dom_node_internal *node); dom_exception _dom_html_script_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_SCRIPT_ELEMENT_PROTECT_VTABLE \ _dom_html_script_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_SCRIPT_ELEMENT \ _dom_virtual_html_script_element_destroy, \ _dom_html_script_element_copy #endif netsurf-all-3.2/libdom/src/html/html_image_element.h0000644000175000017500000000332312377676745021626 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_image_element_h_ #define dom_internal_html_image_element_h_ #include #include "html/html_element.h" struct dom_html_image_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_image_element object */ dom_exception _dom_html_image_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_image_element **ele); /* Initialise a dom_html_image_element object */ dom_exception _dom_html_image_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_image_element *ele); /* Finalise a dom_html_image_element object */ void _dom_html_image_element_finalise(struct dom_html_image_element *ele); /* Destroy a dom_html_image_element object */ void _dom_html_image_element_destroy(struct dom_html_image_element *ele); /* The protected virtual functions */ dom_exception _dom_html_image_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_image_element_destroy(dom_node_internal *node); dom_exception _dom_html_image_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_IMAGE_ELEMENT_PROTECT_VTABLE \ _dom_html_image_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_IMAGE_ELEMENT \ _dom_virtual_html_image_element_destroy, \ _dom_html_image_element_copy #endif netsurf-all-3.2/libdom/src/html/html_options_collection.c0000644000175000017500000001367712377676745022751 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include "html/html_options_collection.h" #include "core/node.h" #include "core/element.h" #include "core/string.h" #include "utils/utils.h" /*-----------------------------------------------------------------------*/ /* Constructor and destructor */ /** * Create a dom_html_options_collection * * \param doc The document * \param root The root element of the collection * \param ic The callback function used to determin whether certain node * beint32_ts to the collection * \param col The result collection object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_options_collection_create(struct dom_html_document *doc, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx, struct dom_html_options_collection **col) { *col = malloc(sizeof(dom_html_options_collection)); if (*col == NULL) return DOM_NO_MEM_ERR; return _dom_html_options_collection_initialise(doc, *col, root, ic, ctx); } /** * Intialiase a dom_html_options_collection * * \param doc The document * \param col The collection object to be initialised * \param root The root element of the collection * \param ic The callback function used to determin whether certain node * beint32_ts to the collection * \return DOM_NO_ERR on success. */ dom_exception _dom_html_options_collection_initialise(struct dom_html_document *doc, struct dom_html_options_collection *col, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx) { return _dom_html_collection_initialise(doc, &col->base, root, ic, ctx); } /** * Finalise a dom_html_options_collection object * * \param col The dom_html_options_collection object */ void _dom_html_options_collection_finalise(struct dom_html_options_collection *col) { _dom_html_collection_finalise(&col->base); } /** * Destroy a dom_html_options_collection object * \param col The dom_html_options_collection object */ void _dom_html_options_collection_destroy(struct dom_html_options_collection *col) { _dom_html_options_collection_finalise(col); free(col); } /*-----------------------------------------------------------------------*/ /* Public API */ /** * Get the length of this dom_html_options_collection * * \param col The dom_html_options_collection object * \param len The returned length of this collection * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_get_length(dom_html_options_collection *col, uint32_t *len) { return dom_html_collection_get_length(&col->base, len); } /** * Set the length of this dom_html_options_collection * * \param col The dom_html_options_collection object * \param len The length of this collection to be set * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_set_length( dom_html_options_collection *col, uint32_t len) { UNUSED(col); UNUSED(len); /* TODO: how to deal with this */ return DOM_NOT_SUPPORTED_ERR; } /** * Get the node with certain index * * \param col The dom_html_options_collection object * \param index The index number based on zero * \param node The returned node object * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_item(dom_html_options_collection *col, uint32_t index, struct dom_node **node) { return dom_html_collection_item(&col->base, index, node); } /** * Get the node in the collection according name * * \param col The collection * \param name The name of target node * \param node The returned node object * \return DOM_NO_ERR on success. */ dom_exception dom_html_options_collection_named_item(dom_html_options_collection *col, dom_string *name, struct dom_node **node) { struct dom_node_internal *n = col->base.root; dom_string *kname; dom_exception err; /* Search for an element with an appropriate ID */ err = dom_html_collection_named_item(&col->base, name, node); if (err == DOM_NO_ERR && *node != NULL) return err; /* Didn't find one, so consider name attribute */ err = dom_string_create_interned((const uint8_t *) "name", SLEN("name"), &kname); if (err != DOM_NO_ERR) return err; while (n != NULL) { if (n->type == DOM_ELEMENT_NODE && col->base.ic(n, col->base.ctx) == true) { dom_string *nval = NULL; err = dom_element_get_attribute(n, kname, &nval); if (err != DOM_NO_ERR) { dom_string_unref(kname); return err; } if (nval != NULL && dom_string_isequal(name, nval)) { *node = (struct dom_node *) n; dom_node_ref(n); dom_string_unref(nval); dom_string_unref(kname); return DOM_NO_ERR; } if (nval != NULL) dom_string_unref(nval); } /* Depth first iterating */ if (n->first_child != NULL) { n = n->first_child; } else if (n->next != NULL) { n = n->next; } else { /* No children and siblings */ struct dom_node_internal *parent = n->parent; while (n != col->base.root && n == parent->last_child) { n = parent; parent = parent->parent; } if (n == col->base.root) n = NULL; else n = n->next; } } dom_string_unref(kname); /* Not found the target node */ *node = NULL; return DOM_NO_ERR; } /** * Claim a reference on this collection * * \pram col The collection object */ void dom_html_options_collection_ref(dom_html_options_collection *col) { if (col == NULL) return; col->base.refcnt ++; } /** * Relese a reference on this collection * * \pram col The collection object */ void dom_html_options_collection_unref(dom_html_options_collection *col) { if (col == NULL) return; if (col->base.refcnt > 0) col->base.refcnt --; if (col->base.refcnt == 0) _dom_html_options_collection_destroy(col); } netsurf-all-3.2/libdom/src/html/html_tablecaption_element.c0000644000175000017500000001117412377676746023210 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_tablecaption_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_CAPTION_ELEMENT }, DOM_HTML_TABLE_CAPTION_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_caption_element object * * \table_caption doc The document object * \table_caption ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_caption_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_caption_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_caption_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_caption_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_table_caption_element object * * \table_caption doc The document object * \table_caption ele The dom_html_table_caption_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_caption_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_caption_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_CAPTION], namespace, prefix); } /** * Finalise a dom_html_table_caption_element object * * \table_caption ele The dom_html_table_caption_element object */ void _dom_html_table_caption_element_finalise(struct dom_html_table_caption_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_caption_element object * * \table_caption ele The dom_html_table_caption_element object */ void _dom_html_table_caption_element_destroy(struct dom_html_table_caption_element *ele) { _dom_html_table_caption_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_caption_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_caption_element_destroy(dom_node_internal *node) { _dom_html_table_caption_element_destroy((struct dom_html_table_caption_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_caption_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_caption_element_get_##attr( \ dom_html_table_caption_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_caption_element_set_##attr( \ dom_html_table_caption_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); netsurf-all-3.2/libdom/src/html/html_frame_element.h0000644000175000017500000000334312377676745021640 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_frame_element_h_ #define dom_internal_html_frame_element_h_ #include #include "html/html_element.h" struct dom_html_frame_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_frame_element object */ dom_exception _dom_html_frame_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_element **ele); /* Initialise a dom_html_frame_element object */ dom_exception _dom_html_frame_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_element *ele); /* Finalise a dom_html_frame_element object */ void _dom_html_frame_element_finalise(struct dom_html_frame_element *ele); /* Destroy a dom_html_frame_element object */ void _dom_html_frame_element_destroy(struct dom_html_frame_element *ele); /* The protected virtual functions */ dom_exception _dom_html_frame_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_frame_element_destroy(dom_node_internal *node); dom_exception _dom_html_frame_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_FRAME_ELEMENT_PROTECT_VTABLE \ _dom_html_frame_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_FRAME_ELEMENT \ _dom_virtual_html_frame_element_destroy, \ _dom_html_frame_element_copy #endif netsurf-all-3.2/libdom/src/html/html_tablecell_element.h0000644000175000017500000000360612377676746022500 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_table_cell_element_h_ #define dom_internal_html_table_cell_element_h_ #include #include "html/html_element.h" struct dom_html_table_cell_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_cell_element object */ dom_exception _dom_html_table_cell_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_cell_element **ele); /* Initialise a dom_html_table_cell_element object */ dom_exception _dom_html_table_cell_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_cell_element *ele); /* Finalise a dom_html_table_cell_element object */ void _dom_html_table_cell_element_finalise(struct dom_html_table_cell_element *ele); /* Destroy a dom_html_table_cell_element object */ void _dom_html_table_cell_element_destroy(struct dom_html_table_cell_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_cell_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_cell_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_cell_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_CELL_ELEMENT_PROTECT_VTABLE \ _dom_html_table_cell_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_CELL_ELEMENT \ _dom_virtual_html_table_cell_element_destroy, \ _dom_html_table_cell_element_copy #endif netsurf-all-3.2/libdom/src/html/html_isindex_element.h0000644000175000017500000000327512377676745022215 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_isindex_element_h_ #define dom_internal_html_isindex_element_h_ #include #include "html/html_element.h" struct dom_html_isindex_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_isindex_element object */ dom_exception _dom_html_isindex_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_isindex_element **ele); /* Initialise a dom_html_isindex_element object */ dom_exception _dom_html_isindex_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_isindex_element *ele); /* Finalise a dom_html_isindex_element object */ void _dom_html_isindex_element_finalise(struct dom_html_isindex_element *ele); /* Destroy a dom_html_isindex_element object */ void _dom_html_isindex_element_destroy(struct dom_html_isindex_element *ele); /* The protected virtual functions */ dom_exception _dom_html_isindex_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_isindex_element_destroy(dom_node_internal *node); dom_exception _dom_html_isindex_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_ISINDEX_ELEMENT_PROTECT_VTABLE \ _dom_html_isindex_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_ISINDEX_ELEMENT \ _dom_virtual_html_isindex_element_destroy, \ _dom_html_isindex_element_copy #endif netsurf-all-3.2/libdom/src/html/html_opt_group_element.c0000644000175000017500000001234412377676745022560 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #include #include #include #include "html/html_document.h" #include "html/html_opt_group_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_OPT_GROUP_ELEMENT }, DOM_HTML_OPT_GROUP_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_opt_group_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_opt_group_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_opt_group_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_opt_group_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_opt_group_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_opt_group_element object * * \param doc The document object * \param ele The dom_html_opt_group_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_opt_group_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_opt_group_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_OPTGROUP], namespace, prefix); } /** * Finalise a dom_html_opt_group_element object * * \param ele The dom_html_opt_group_element object */ void _dom_html_opt_group_element_finalise(struct dom_html_opt_group_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_opt_group_element object * * \param ele The dom_html_opt_group_element object */ void _dom_html_opt_group_element_destroy(struct dom_html_opt_group_element *ele) { _dom_html_opt_group_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the disabled property * * \param ele The dom_html_opt_group_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_opt_group_element_get_disabled(dom_html_opt_group_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_opt_group_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_opt_group_element_set_disabled(dom_html_opt_group_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_opt_group_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_opt_group_element_destroy(dom_node_internal *node) { _dom_html_opt_group_element_destroy((struct dom_html_opt_group_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_opt_group_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_opt_group_element_get_##attr( \ dom_html_opt_group_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_opt_group_element_set_##attr( \ dom_html_opt_group_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(label); netsurf-all-3.2/libdom/src/html/html_iframe_element.h0000644000175000017500000000337412377676745022015 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_iframe_element_h_ #define dom_internal_html_iframe_element_h_ #include #include "html/html_element.h" struct dom_html_iframe_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_iframe_element object */ dom_exception _dom_html_iframe_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_iframe_element **ele); /* Initialise a dom_html_iframe_element object */ dom_exception _dom_html_iframe_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_iframe_element *ele); /* Finalise a dom_html_iframe_element object */ void _dom_html_iframe_element_finalise(struct dom_html_iframe_element *ele); /* Destroy a dom_html_iframe_element object */ void _dom_html_iframe_element_destroy(struct dom_html_iframe_element *ele); /* The protected virtual functions */ dom_exception _dom_html_iframe_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_iframe_element_destroy(dom_node_internal *node); dom_exception _dom_html_iframe_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_IFRAME_ELEMENT_PROTECT_VTABLE \ _dom_html_iframe_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_IFRAME_ELEMENT \ _dom_virtual_html_iframe_element_destroy, \ _dom_html_iframe_element_copy #endif netsurf-all-3.2/libdom/src/html/html_table_element.c0000644000175000017500000005767612377676745021652 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_table_element.h" #include "html/html_tablecaption_element.h" #include "html/html_tablesection_element.h" #include "html/html_tablerow_element.h" #include "html/html_collection.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ELEMENT }, DOM_HTML_TABLE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_table_element object * * \param doc The document object * \param ele The dom_html_table_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_TABLE], namespace, prefix); } /** * Finalise a dom_html_table_element object * * \param ele The dom_html_table_element object */ void _dom_html_table_element_finalise(struct dom_html_table_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_element object * * \param ele The dom_html_table_element object */ void _dom_html_table_element_destroy(struct dom_html_table_element *ele) { _dom_html_table_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_element_destroy(dom_node_internal *node) { _dom_html_table_element_destroy((struct dom_html_table_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_element_get_##attr( \ dom_html_table_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_element_set_##attr( \ dom_html_table_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); SIMPLE_GET_SET(bg_color); SIMPLE_GET_SET(border); SIMPLE_GET_SET(cell_padding); SIMPLE_GET_SET(cell_spacing); SIMPLE_GET_SET(frame); SIMPLE_GET_SET(rules); SIMPLE_GET_SET(summary); SIMPLE_GET_SET(width); /** * Get the caption Attribute * * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_get_caption( dom_html_table_element *table, dom_html_table_caption_element **caption) { dom_node_internal *node_tmp = ((dom_node_internal *)table); dom_html_document *doc = (dom_html_document *)(node_tmp->owner); for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) { if((node_tmp->type == DOM_ELEMENT_NODE) && dom_string_caseless_isequal(doc->memoised[hds_CAPTION],node_tmp->name)) { break; } } *caption = (dom_html_table_caption_element *)node_tmp; if(*caption != NULL) dom_node_ref(*caption); return DOM_NO_ERR; } /** * Set the caption Attribute * * \param table The dom_html_table_element object * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_set_caption( dom_html_table_element *table, dom_html_table_caption_element *caption) { dom_node_internal *check_node = ((dom_node_internal *)caption); dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner); dom_exception exp; if(check_node == NULL) { return DOM_HIERARCHY_REQUEST_ERR; } if(!dom_string_caseless_isequal(doc->memoised[hds_CAPTION], check_node->name)) { return DOM_HIERARCHY_REQUEST_ERR; } exp = dom_html_table_element_delete_caption(table); if(exp != DOM_NO_ERR) return exp; /* Create a new caption */ dom_node *new_caption; return dom_node_append_child(table, caption, &new_caption); } /** * Get the t_head Attribute * * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_get_t_head( dom_html_table_element *table, dom_html_table_section_element **t_head) { dom_node_internal *node_tmp = ((dom_node_internal *)table); dom_html_document *doc = (dom_html_document *)(node_tmp->owner); for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) { if((node_tmp->type == DOM_ELEMENT_NODE) && dom_string_caseless_isequal(doc->memoised[hds_THEAD],node_tmp->name)) { break; } } *t_head = (dom_html_table_section_element *)node_tmp; if (*t_head != NULL) dom_node_ref(*t_head); return DOM_NO_ERR; } /** * Set the t_head Attribute * * \param table The dom_html_table_element object * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_set_t_head( dom_html_table_element *table, dom_html_table_section_element *t_head) { dom_node_internal *check_node = ((dom_node_internal *)t_head); dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner); dom_exception exp; if (check_node == NULL) { return DOM_HIERARCHY_REQUEST_ERR; } if (!dom_string_caseless_isequal(doc->memoised[hds_CAPTION],check_node->name)) { return DOM_HIERARCHY_REQUEST_ERR; } exp = dom_html_table_element_delete_t_head(table); if(exp != DOM_NO_ERR) return exp; dom_node *new_t_head; return dom_node_append_child(table, t_head, &new_t_head); } /** * Get the t_foot Attribute * * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_get_t_foot( dom_html_table_element *table, dom_html_table_section_element **t_foot) { dom_node_internal *node_tmp = ((dom_node_internal *)table); dom_html_document *doc = (dom_html_document *)(node_tmp->owner); for (node_tmp = node_tmp->first_child; node_tmp != NULL; node_tmp = node_tmp->next) { if ((node_tmp->type == DOM_ELEMENT_NODE) && dom_string_caseless_isequal(doc->memoised[hds_TFOOT], node_tmp->name)) { break; } } *t_foot = (dom_html_table_section_element *)node_tmp; if (*t_foot != NULL) dom_node_ref(*t_foot); return DOM_NO_ERR; } /** * Set the t_foot Attribute * * \param table The dom_html_table_element object */ dom_exception dom_html_table_element_set_t_foot( dom_html_table_element *table, dom_html_table_section_element *t_foot) { dom_node_internal *check_node = ((dom_node_internal *)t_foot); /*< temporary node to check for raised exceptions */ dom_html_document *doc = (dom_html_document *)(((dom_node_internal *)table)->owner); dom_exception exp; if(check_node == NULL) { return DOM_HIERARCHY_REQUEST_ERR; } if(!dom_string_caseless_isequal(doc->memoised[hds_TFOOT],check_node->name)) { return DOM_HIERARCHY_REQUEST_ERR; } exp = dom_html_table_element_delete_t_foot(table); if(exp != DOM_NO_ERR) return exp; dom_node *new_t_foot; return dom_node_append_child(table, t_foot, &new_t_foot); } /** * Callback for creating the rows collection * * \param node The dom_html_table_element object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool table_rows_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_TR])) { return true; } return false; } /** * Get the rows collection * * \param element The dom_html_table_element object * \param rows The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_get_rows( dom_html_table_element *element, dom_html_collection **rows) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; return _dom_html_collection_create(doc, (dom_node_internal *)element, table_rows_callback, (void *)doc, rows); } /** * Callback for creating the tbodies collection * * \param node The dom_html_table_element object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_TBODY])) { return true; } return false; } /** * Get the tBodies collection * * \param element The dom_html_table_element object * \param t_bodies The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_get_t_bodies( dom_html_table_element *element, dom_html_collection **t_bodies) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; return _dom_html_collection_create(doc, (dom_node_internal *)element, table_t_bodies_callback, (void *)doc, t_bodies); } /** * Get or Create the table caption * * \param element The dom_html_table_element object * \param caption The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_create_caption( dom_html_table_element *element, dom_html_element **caption) { dom_exception exp; if((exp = dom_html_table_element_get_caption(element, (dom_html_table_caption_element **)caption)) != DOM_NO_ERR) { dom_node_unref(*caption); return exp; } if((*caption) == NULL) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *new_caption; exp = _dom_html_table_caption_element_create(doc, ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, (dom_html_table_caption_element **)caption); if(exp != DOM_NO_ERR) { dom_node_unref(*caption); return exp; } exp = dom_node_append_child(element, *caption, &new_caption); dom_node_unref(*caption); if(exp == DOM_NO_ERR) *caption = (dom_html_element *)new_caption; } return exp; } /** * Delete the table caption, if one exists * * \param element The dom_html_table_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_delete_caption( dom_html_table_element *element) { dom_html_table_caption_element *caption; dom_node *old_caption; dom_exception err; err = dom_html_table_element_get_caption(element, &caption); if (err != DOM_NO_ERR || caption == NULL) return err; err = dom_node_remove_child(element, caption, &old_caption); if (err == DOM_NO_ERR) { dom_node_unref(old_caption); } dom_node_unref(caption); return err; } /** * Get or Create the table Foot * * \param element The dom_html_table_element object * \param t_foot The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_create_t_foot( dom_html_table_element *element, dom_html_element **t_foot) { dom_exception exp; exp = dom_html_table_element_get_t_foot(element, (dom_html_table_section_element **)t_foot); if (exp !=DOM_NO_ERR) return exp; if ((*t_foot) == NULL) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *new_t_foot; exp = _dom_html_table_section_element_create(doc, doc->memoised[hds_TFOOT], ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, (dom_html_table_section_element **)t_foot); if (exp != DOM_NO_ERR) { dom_node_unref(*t_foot); return exp; } exp = dom_node_append_child(element, *t_foot, &new_t_foot); dom_node_unref(*t_foot); if (exp == DOM_NO_ERR) *t_foot = (dom_html_element *)new_t_foot; return exp; } return DOM_NO_ERR; } /** * Delete the table Foot, if one exists * * \param element The dom_html_table_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_delete_t_foot( dom_html_table_element *element) { dom_html_table_section_element *t_foot; dom_node *old_t_foot; dom_exception err; err = dom_html_table_element_get_t_foot(element, &t_foot); if (err != DOM_NO_ERR || t_foot == NULL) return err; err = dom_node_remove_child(element, t_foot, &old_t_foot); if (err == DOM_NO_ERR) { dom_node_unref(old_t_foot); } dom_node_unref(t_foot); return err; } /** * Get or Create the table Head * * \param element The dom_html_table_element object * \param t_head The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_create_t_head( dom_html_table_element *element, dom_html_element **t_head) { dom_exception exp; exp = dom_html_table_element_get_t_head(element, (dom_html_table_section_element **)t_head); if(exp != DOM_NO_ERR) { dom_node_unref(*t_head); return exp; } if((*t_head) == NULL) { dom_exception exp; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *new_t_head; exp = _dom_html_table_section_element_create(doc, doc->memoised[hds_THEAD], ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, (dom_html_table_section_element **)t_head); if(exp != DOM_NO_ERR) { dom_node_unref(*t_head); return exp; } exp = dom_node_append_child(element, *t_head, &new_t_head); if(exp == DOM_NO_ERR) { dom_node_unref(*t_head); *t_head = (dom_html_element *)new_t_head; } return exp; } return DOM_NO_ERR; } /** * Delete the table Head, if one exists * * \param element The dom_html_table_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_delete_t_head( dom_html_table_element *element) { dom_html_table_section_element *t_head; dom_node *old_t_head; dom_exception err; err = dom_html_table_element_get_t_head(element, &t_head); if (err != DOM_NO_ERR || t_head == NULL) return err; err = dom_node_remove_child(element, t_head, &old_t_head); if (err == DOM_NO_ERR) { dom_node_unref(old_t_head); } dom_node_unref(t_head); return err; } /** * Get or Create the table Body * * \param element The dom_html_table_element object * \param t_head The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_create_t_body( dom_html_table_element *element, dom_html_table_section_element **t_body) { dom_html_collection *t_bodies; uint32_t len; dom_exception exp; exp = dom_html_table_element_get_t_bodies(element, &t_bodies); if(exp != DOM_NO_ERR) { dom_html_collection_unref(t_bodies); return exp; } exp = dom_html_collection_get_length(t_bodies, &len); if(exp != DOM_NO_ERR) { dom_html_collection_unref(t_bodies); return exp; } if(len == 0) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *new_t_body; exp = _dom_html_table_section_element_create(doc, doc->memoised[hds_TBODY], ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, t_body); if(exp != DOM_NO_ERR) { dom_node_unref(*t_body); return exp; } exp = dom_node_append_child(element, *t_body, &new_t_body); if(exp == DOM_NO_ERR) { dom_node_unref(*t_body); *t_body = (dom_html_table_section_element *)new_t_body; } } else { exp = dom_html_collection_item(t_bodies, 0, (dom_node **)t_body); } dom_html_collection_unref(t_bodies); return exp; } /** * Insert a new Row into the table * * \param element The dom_html_table_element object * \param index The Index to insert the Row * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_insert_row( dom_html_table_element *element, int32_t index, dom_html_element **row) { dom_exception exp; dom_html_collection* rows; uint32_t len; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; exp = dom_html_table_element_get_rows(element, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = dom_html_collection_get_length(rows, &len); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = _dom_html_table_row_element_create(doc, ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, (dom_html_table_row_element **)row); if(exp != DOM_NO_ERR) { dom_node_unref(*row); dom_html_collection_unref(rows); return exp; } if(index > (int32_t)len || index < -1) { exp = DOM_INDEX_SIZE_ERR; } else if(len == 0) { dom_html_table_section_element *new_body; dom_node *new_row; exp = dom_html_table_element_create_t_body(element, &new_body); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); dom_node_unref(new_body); return exp; } exp = dom_node_append_child(new_body, *row, &new_row); if(exp == DOM_NO_ERR) { dom_node_unref(*row); *row = (dom_html_element *)new_row; } } else { if(index ==-1) { index = (int32_t)len; } dom_html_table_section_element *t_head; dom_html_table_section_element *t_foot; uint32_t window_len = 0, section_len; exp = dom_html_table_element_get_t_head(element, &t_head); if (exp != DOM_NO_ERR) return exp; dom_html_collection_unref(rows); exp = dom_html_table_section_element_get_rows(t_head, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } dom_html_collection_get_length(rows, §ion_len); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } if(window_len + section_len > (uint32_t)index || window_len + section_len == len) { dom_html_collection_unref(rows); return dom_html_table_section_element_insert_row(t_head, index-window_len, row); } window_len += section_len; dom_node_internal *n = (dom_node_internal *)element; dom_html_collection_unref(rows); for (n = n->first_child; n != NULL; n = n->next) { if((n->type == DOM_ELEMENT_NODE) && dom_string_caseless_isequal(doc->memoised[hds_TBODY],n->name)) { exp = dom_html_table_section_element_get_rows((dom_html_table_section_element *)n, &rows); exp = dom_html_collection_get_length(rows, §ion_len); dom_html_collection_unref(rows); if(window_len + section_len > (uint32_t)index || window_len + section_len == len) { return dom_html_table_section_element_insert_row( (dom_html_table_section_element *)n, index-window_len, row); } window_len += section_len; } } exp = dom_html_table_element_get_t_foot(element, &t_foot); if(exp != DOM_NO_ERR) return exp; exp = dom_html_table_section_element_get_rows(t_foot, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = dom_html_collection_get_length(rows, §ion_len); dom_html_collection_unref(rows); if(exp != DOM_NO_ERR) return exp; if(window_len + section_len > (uint32_t)index || window_len +section_len == len) { return dom_html_table_section_element_insert_row(t_foot, index-window_len, row); } exp = DOM_INDEX_SIZE_ERR; } dom_html_collection_unref(rows); return exp; } /** * Delete the table Head, if one exists * * \param element The dom_html_table_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_element_delete_row( dom_html_table_element *element, int32_t index) { dom_exception exp; dom_html_collection* rows; uint32_t len; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; exp = dom_html_table_element_get_rows(element, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = dom_html_collection_get_length(rows, &len); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } if(index >= (int32_t)len || index < -1 || len ==0) { dom_html_collection_unref(rows); return DOM_INDEX_SIZE_ERR; } else { if(index ==-1) { index = (int32_t)len-1; } dom_html_collection_unref(rows); dom_html_table_section_element *t_head; dom_html_table_section_element *t_foot; uint32_t window_len = 0, section_len; exp = dom_html_table_element_get_t_head(element, &t_head); if(exp != DOM_NO_ERR) return exp; exp = dom_html_table_section_element_get_rows(t_head, &rows); if (exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return DOM_NO_ERR; } exp = dom_html_collection_get_length(rows, §ion_len); dom_html_collection_unref(rows); if(exp != DOM_NO_ERR) return exp; if(window_len + section_len > (uint32_t)index) { return dom_html_table_section_element_delete_row(t_head, index-window_len); } window_len += section_len; dom_node_internal *n = (dom_node_internal *)element; for (n = n->first_child; n != NULL; n = n->next) { if((n->type == DOM_ELEMENT_NODE) && dom_string_caseless_isequal(doc->memoised[hds_TBODY],n->name)) { exp = dom_html_table_section_element_get_rows ((dom_html_table_section_element *)n, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } dom_html_collection_get_length(rows, §ion_len); dom_html_collection_unref(rows); if(exp != DOM_NO_ERR) return exp; if(window_len + section_len > (uint32_t)index) { return dom_html_table_section_element_delete_row( (dom_html_table_section_element *)n, index-window_len); } window_len += section_len; } } exp = dom_html_table_element_get_t_foot(element, &t_foot); exp = dom_html_table_section_element_get_rows(t_foot, &rows); if(exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = dom_html_collection_get_length(rows, §ion_len); dom_html_collection_unref(rows); if (exp != DOM_NO_ERR) return exp; if(window_len + section_len > (uint32_t)index) { return dom_html_table_section_element_delete_row(t_foot, index-window_len); } return DOM_INDEX_SIZE_ERR; } } netsurf-all-3.2/libdom/src/html/html_paragraph_element.h0000644000175000017500000000346312377676745022516 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_paragraph_element_h_ #define dom_internal_html_paragraph_element_h_ #include #include "html/html_element.h" struct dom_html_paragraph_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_paragraph_element object */ dom_exception _dom_html_paragraph_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_paragraph_element **ele); /* Initialise a dom_html_paragraph_element object */ dom_exception _dom_html_paragraph_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_paragraph_element *ele); /* Finalise a dom_html_paragraph_element object */ void _dom_html_paragraph_element_finalise(struct dom_html_paragraph_element *ele); /* Destroy a dom_html_paragraph_element object */ void _dom_html_paragraph_element_destroy(struct dom_html_paragraph_element *ele); /* The protected virtual functions */ dom_exception _dom_html_paragraph_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_paragraph_element_destroy(dom_node_internal *node); dom_exception _dom_html_paragraph_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_P_ELEMENT_PROTECT_VTABLE \ _dom_html_paragraph_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_P_ELEMENT \ _dom_virtual_html_paragraph_element_destroy, \ _dom_html_paragraph_element_copy #endif netsurf-all-3.2/libdom/src/html/html_mod_element.c0000644000175000017500000001042012377676745021312 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_mod_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_MOD_ELEMENT }, DOM_HTML_MOD_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_mod_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_mod_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_mod_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_mod_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_mod_element_initialise(doc, tag_name, namespace, prefix, *ele); } /** * Initialise a dom_html_mod_element object * * \param doc The document object * \param ele The dom_html_mod_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_mod_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_mod_element *ele) { return _dom_html_element_initialise(doc, &ele->base, tag_name, namespace, prefix); } /** * Finalise a dom_html_mod_element object * * \param ele The dom_html_mod_element object */ void _dom_html_mod_element_finalise(struct dom_html_mod_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_mod_element object * * \param ele The dom_html_mod_element object */ void _dom_html_mod_element_destroy(struct dom_html_mod_element *ele) { _dom_html_mod_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_mod_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_mod_element_destroy(dom_node_internal *node) { _dom_html_mod_element_destroy((struct dom_html_mod_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_mod_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_mod_element_get_##attr( \ dom_html_mod_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_mod_element_set_##attr( \ dom_html_mod_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(cite); SIMPLE_GET_SET(date_time); netsurf-all-3.2/libdom/src/html/html_directory_element.h0000644000175000017500000000350312377676745022550 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_directory_element_h_ #define dom_internal_html_directory_element_h_ #include #include "html/html_element.h" struct dom_html_directory_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_directory_element object */ dom_exception _dom_html_directory_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_directory_element **ele); /* Initialise a dom_html_directory_element object */ dom_exception _dom_html_directory_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_directory_element *ele); /* Finalise a dom_html_directory_element object */ void _dom_html_directory_element_finalise(struct dom_html_directory_element *ele); /* Destroy a dom_html_directory_element object */ void _dom_html_directory_element_destroy(struct dom_html_directory_element *ele); /* The protected virtual functions */ dom_exception _dom_html_directory_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_directory_element_destroy(dom_node_internal *node); dom_exception _dom_html_directory_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_DIRECTORY_ELEMENT_PROTECT_VTABLE \ _dom_html_directory_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_DIRECTORY_ELEMENT \ _dom_virtual_html_directory_element_destroy, \ _dom_html_directory_element_copy #endif netsurf-all-3.2/libdom/src/html/html_body_element.h0000644000175000017500000000325512377676745021505 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_body_element_h_ #define dom_internal_html_body_element_h_ #include #include "html/html_element.h" struct dom_html_body_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_body_element object */ dom_exception _dom_html_body_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_body_element **ele); /* Initialise a dom_html_body_element object */ dom_exception _dom_html_body_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_body_element *ele); /* Finalise a dom_html_body_element object */ void _dom_html_body_element_finalise(struct dom_html_body_element *ele); /* Destroy a dom_html_body_element object */ void _dom_html_body_element_destroy(struct dom_html_body_element *ele); /* The protected virtual functions */ dom_exception _dom_html_body_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_body_element_destroy(dom_node_internal *node); dom_exception _dom_html_body_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_BODY_ELEMENT_PROTECT_VTABLE \ _dom_html_body_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_BODY_ELEMENT \ _dom_virtual_html_body_element_destroy, \ _dom_html_body_element_copy #endif netsurf-all-3.2/libdom/src/html/html_quote_element.c0000644000175000017500000001041612377676745021675 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_quote_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_QUOTE_ELEMENT }, DOM_HTML_QUOTE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_quote_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_quote_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_quote_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_quote_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_quote_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_quote_element object * * \param doc The document object * \param ele The dom_html_quote_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_quote_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_quote_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_Q], namespace, prefix); } /** * Finalise a dom_html_quote_element object * * \param ele The dom_html_quote_element object */ void _dom_html_quote_element_finalise(struct dom_html_quote_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_quote_element object * * \param ele The dom_html_quote_element object */ void _dom_html_quote_element_destroy(struct dom_html_quote_element *ele) { _dom_html_quote_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_quote_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_quote_element_destroy(dom_node_internal *node) { _dom_html_quote_element_destroy((struct dom_html_quote_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_quote_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_quote_element_get_##attr( \ dom_html_quote_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_quote_element_set_##attr( \ dom_html_quote_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(cite); netsurf-all-3.2/libdom/src/html/html_select_element.c0000644000175000017500000004210512377676745022017 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include #include "html/html_document.h" #include "html/html_select_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_SELECT_ELEMENT }, DOM_HTML_SELECT_ELEMENT_PROTECT_VTABLE }; static bool is_option(struct dom_node_internal *node, void *ctx); /** * Create a dom_html_select_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_select_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_select_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_select_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_select_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_select_element object * * \param doc The document object * \param ele The dom_html_select_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_select_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_select_element *ele) { ele->form = NULL; return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_SELECT], namespace, prefix); } /** * Finalise a dom_html_select_element object * * \param ele The dom_html_select_element object */ void _dom_html_select_element_finalise(struct dom_html_select_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_select_element object * * \param ele The dom_html_select_element object */ void _dom_html_select_element_destroy(struct dom_html_select_element *ele) { _dom_html_select_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_select_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_select_element_destroy(dom_node_internal *node) { _dom_html_select_element_destroy((struct dom_html_select_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_select_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* Public APIs */ static dom_exception _dom_html_select_element_make_collection( dom_html_select_element *ele, dom_html_options_collection **col) { dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); assert(doc != NULL); return _dom_html_options_collection_create(doc, (dom_node_internal *) ele, is_option, ele, col); } /** * Get the type of selection control * * \param ele The Select element * \param type Pointer to location to receive type * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_type( dom_html_select_element *ele, dom_string **type) { dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); dom_exception err; bool multiple; err = dom_html_select_element_get_multiple(ele, &multiple); if (err != DOM_NO_ERR) return err; if (multiple) *type = dom_string_ref(doc->memoised[hds_select_multiple]); else *type = dom_string_ref(doc->memoised[hds_select_one]); return DOM_NO_ERR; } /** * Get the ordinal index of the selected option * * \param ele The element object * \param index The returned index * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_selected_index( dom_html_select_element *ele, int32_t *index) { dom_exception err; uint32_t idx,len; dom_node *option; bool selected; dom_html_options_collection *col; err = _dom_html_select_element_make_collection(ele, &col); err = dom_html_options_collection_get_length(col, &len); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } for (idx = 0; idx < len; idx++) { err = dom_html_options_collection_item(col, idx, &option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } err = dom_html_option_element_get_selected( (dom_html_option_element *) option, &selected); dom_node_unref(option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } if (selected) { *index = idx; dom_html_options_collection_unref(col); return DOM_NO_ERR; } } *index = -1; dom_html_options_collection_unref(col); return DOM_NO_ERR; } /** * Set the ordinal index of the selected option * * \param ele The element object * \param index The new index * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_set_selected_index( dom_html_select_element *ele, int32_t index) { dom_exception err; dom_node *option; dom_html_options_collection *col; err = _dom_html_select_element_make_collection(ele, &col); err = dom_html_options_collection_item(col, index, &option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } err = dom_html_option_element_set_selected( (dom_html_option_element *) option, true); dom_node_unref(option); dom_html_options_collection_unref(col); if (err != DOM_NO_ERR) { return err; } return DOM_NO_ERR; } /** * Get the value of this form control * * \param ele The select element * \param value Pointer to location to receive value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_value( dom_html_select_element *ele, dom_string **value) { dom_exception err; uint32_t idx, len; dom_node *option; bool selected; dom_html_options_collection *col; err = _dom_html_select_element_make_collection(ele, &col); if (err != DOM_NO_ERR) return err; err = dom_html_select_element_get_length(ele, &len); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } for (idx = 0; idx < len; idx++) { err = dom_html_options_collection_item(col, idx, &option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } err = dom_html_option_element_get_selected( (dom_html_option_element *) option, &selected); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); dom_node_unref(option); return err; } if (selected) { err = dom_html_option_element_get_value( (dom_html_option_element *) option, value); dom_html_options_collection_unref(col); dom_node_unref(option); return err; } } *value = NULL; dom_html_options_collection_unref(col); return DOM_NO_ERR; } /** * Set the value of this form control * * \param ele The select element * \param value New value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_value( dom_html_select_element *ele, dom_string *value) { dom_exception err; uint32_t idx, len; dom_node *option; bool selected; dom_html_options_collection *col; err = _dom_html_select_element_make_collection(ele, &col); if (err != DOM_NO_ERR) return err; err = dom_html_select_element_get_length(ele, &len); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } for (idx = 0; idx < len; idx++) { err = dom_html_options_collection_item(col, idx, &option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } err = dom_html_option_element_get_selected( (dom_html_option_element *) option, &selected); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); dom_node_unref(option); return err; } if (selected) { err = dom_html_option_element_set_value( (dom_html_option_element *) option, value); dom_html_options_collection_unref(col); dom_node_unref(option); return err; } } dom_html_options_collection_unref(col); return DOM_NO_ERR; } /** * Get the number of options in this select element * * \param ele The element object * \param len The returned len * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_length( dom_html_select_element *ele, uint32_t *len) { dom_exception err; dom_html_options_collection *col; err = _dom_html_select_element_make_collection(ele, &col); if (err != DOM_NO_ERR) return err; err = dom_html_options_collection_get_length(col, len); dom_html_options_collection_unref(col); return err; } /** * Set the number of options in this select element * * \param ele The element object * \param len The new len * \return DOM_NOT_SUPPORTED_ERR. * * todo: how to deal with set the len of the children option objects? */ dom_exception dom_html_select_element_set_length( dom_html_select_element *ele, uint32_t len) { UNUSED(ele); UNUSED(len); return DOM_NOT_SUPPORTED_ERR; } /** * Get the form associated with a select * * \param select The dom_html_select_element object * \param form Pointer to location to receive form * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_form( dom_html_select_element *select, dom_html_form_element **form) { *form = select->form; if (*form != NULL) dom_node_ref(*form); return DOM_NO_ERR; } /** * The collection of OPTION elements of this element * * \param ele The element object * \param col THe returned collection object * \return DOM_NO_ERR on success. */ dom_exception dom__html_select_element_get_options( dom_html_select_element *ele, struct dom_html_options_collection **col) { return _dom_html_select_element_make_collection(ele, col); } /** * Whether this element is disabled * * \param ele The element object * \param disabled The returned status * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_disabled( dom_html_select_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled status of this element * * \param ele The element object * \param disabled The disabled status * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_set_disabled( dom_html_select_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Whether this element can be multiple selected * * \param ele The element object * \param multiple The returned status * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_get_multiple( dom_html_select_element *ele, bool *multiple) { return dom_html_element_get_bool_property(&ele->base, "multiple", SLEN("multiple"), multiple); } /** * Set whether this element can be multiple selected * * \param ele The element object * \param multiple The status * \return DOM_NO_ERR on success. */ dom_exception dom_html_select_element_set_multiple( dom_html_select_element *ele, bool multiple) { return dom_html_element_set_bool_property(&ele->base, "multiple", SLEN("multiple"), multiple); } /** * Get the name property * * \param ele The select element * \param name Pointer to location to receive name * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_name( dom_html_select_element *ele, dom_string **name) { dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); return dom_element_get_attribute(ele, doc->memoised[hds_name], name); } /** * Set the name property * * \param ele The select element * \param name New name * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_name( dom_html_select_element *ele, dom_string *name) { dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); return dom_element_set_attribute(ele, doc->memoised[hds_name], name); } /** * Get the size property * * \param ele The select element * \param size Pointer to location to receive size * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_size( dom_html_select_element *ele, int32_t *size) { return dom_html_element_get_int32_t_property(&ele->base, "size", SLEN("size"), size); } /** * Set the size property * * \param ele The select element * \param size New size * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_size( dom_html_select_element *ele, int32_t size) { return dom_html_element_set_int32_t_property(&ele->base, "size", SLEN("size"), size); } /** * Get the tabindex property * * \param ele The select element * \param tab_index Pointer to location to receive tab index * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_get_tab_index( dom_html_select_element *ele, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&ele->base, "tabindex", SLEN("tabindex"), tab_index); } /** * Set the tabindex property * * \param ele The select element * \param tab_index New tab index * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_select_element_set_tab_index( dom_html_select_element *ele, int32_t tab_index) { return dom_html_element_set_int32_t_property(&ele->base, "tabindex", SLEN("tabindex"), tab_index); } /* Functions */ dom_exception dom__html_select_element_add(dom_html_select_element *select, struct dom_html_element *ele, struct dom_html_element *before) { dom_exception err; dom_node *inserted; err = dom_node_insert_before(select, ele, before, &inserted); if (err == DOM_NO_ERR) dom_node_unref(inserted); return err; } dom_exception dom_html_select_element_remove(dom_html_select_element *ele, int32_t index) { dom_exception err; uint32_t len; dom_node *option, *old_option; dom_html_options_collection *col; err = dom_html_select_element_get_length(ele, &len); if (err != DOM_NO_ERR) return err; /* Ensure index is in range */ if (index < 0 || index >= (int32_t)len) return DOM_NO_ERR; err = _dom_html_select_element_make_collection(ele, &col); if (err != DOM_NO_ERR) return err; err = dom_html_options_collection_item(col, index, &option); if (err != DOM_NO_ERR) { dom_html_options_collection_unref(col); return err; } err = dom_node_remove_child(dom_node_get_parent(option), option, &old_option); if (err == DOM_NO_ERR) dom_node_unref(old_option); dom_node_unref(option); dom_html_options_collection_unref(col); return err; } /** * Blur this control * * \param ele Element to blur * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_select_element_blur(struct dom_html_select_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /** \todo Is this event (a) default (b) bubbling and (c) cancelable? */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_blur], true, true, &success); } /** * Focus this control * * \param ele Element to focus * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_select_element_focus(struct dom_html_select_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /** \todo Is this event (a) default (b) bubbling and (c) cancelable? */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_focus], true, true, &success); } /*-----------------------------------------------------------------------*/ /* Helper functions */ /* Test whether certain node is an option node */ bool is_option(struct dom_node_internal *node, void *ctx) { dom_html_select_element *ele = ctx; dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); if (dom_string_isequal(node->name, doc->memoised[hds_OPTION])) return true; return false; } dom_exception _dom_html_select_element_set_form( dom_html_select_element *select, dom_html_form_element *form) { select->form = form; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/html/html_title_element.c0000644000175000017500000001046512377676746021666 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include #include "html/html_document.h" #include "html/html_title_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TITLE_ELEMENT }, DOM_HTML_TITLE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_title_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_title_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_title_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_title_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_title_element object * * \param doc The document object * \param ele The dom_html_title_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_title_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_title_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_TITLE], namespace, prefix); } /** * Finalise a dom_html_title_element object * * \param ele The dom_html_title_element object */ void _dom_html_title_element_finalise(struct dom_html_title_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_title_element object * * \param ele The dom_html_title_element object */ void _dom_html_title_element_destroy(struct dom_html_title_element *ele) { _dom_html_title_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_title_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_title_element_destroy(dom_node_internal *node) { _dom_html_title_element_destroy((struct dom_html_title_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_title_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the text of title * * \param ele The title element * \param text The returned text * \return DOM_NO_ERR on success, appropriated dom_exception on failure. */ dom_exception dom_html_title_element_get_text(dom_html_title_element *ele, dom_string **text) { dom_node_internal *node = (dom_node_internal *) ele; dom_node_internal *n = node->first_child; /* There should be only one child of title element */ assert(node->first_child == node->last_child); /* And it should be a text node */ assert(n->type == DOM_TEXT_NODE); return dom_characterdata_get_data(n, text); } /** * Set the text of title * * \param ele The title element * \param text The text data to be set * \return DOM_NO_ERR on success, appropriated dom_exception on failure. */ dom_exception dom_html_title_element_set_text(dom_html_title_element *ele, dom_string *text) { dom_node_internal *node = (dom_node_internal *) ele; dom_node_internal *n = node->first_child; /* There should be only one child of title element */ assert(node->first_child == node->last_child); /* And it should be a text node */ assert(n->type == DOM_TEXT_NODE); return dom_characterdata_set_data(n, text); } netsurf-all-3.2/libdom/src/html/html_applet_element.h0000644000175000017500000000337312377676745022036 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_applet_element_h_ #define dom_internal_html_applet_element_h_ #include #include "html/html_element.h" struct dom_html_applet_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_applet_element object */ dom_exception _dom_html_applet_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_applet_element **ele); /* Initialise a dom_html_applet_element object */ dom_exception _dom_html_applet_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_applet_element *ele); /* Finalise a dom_html_applet_element object */ void _dom_html_applet_element_finalise(struct dom_html_applet_element *ele); /* Destroy a dom_html_applet_element object */ void _dom_html_applet_element_destroy(struct dom_html_applet_element *ele); /* The protected virtual functions */ dom_exception _dom_html_applet_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_applet_element_destroy(dom_node_internal *node); dom_exception _dom_html_applet_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_APPLET_ELEMENT_PROTECT_VTABLE \ _dom_html_applet_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_APPLET_ELEMENT \ _dom_virtual_html_applet_element_destroy, \ _dom_html_applet_element_copy #endif netsurf-all-3.2/libdom/src/html/html_select_element.h0000644000175000017500000000376112377676745022031 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_select_element_h_ #define dom_internal_html_select_element_h_ #include #include "html/html_element.h" #include "html/html_options_collection.h" struct dom_html_select_element { struct dom_html_element base; /**< The base class */ int32_t selected; /**< The selected element's index */ dom_html_form_element *form; /**< The form associated with select */ }; /* Create a dom_html_select_element object */ dom_exception _dom_html_select_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_select_element **ele); /* Initialise a dom_html_select_element object */ dom_exception _dom_html_select_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_select_element *ele); /* Finalise a dom_html_select_element object */ void _dom_html_select_element_finalise(struct dom_html_select_element *ele); /* Destroy a dom_html_select_element object */ void _dom_html_select_element_destroy(struct dom_html_select_element *ele); /* The protected virtual functions */ dom_exception _dom_html_select_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_select_element_destroy(dom_node_internal *node); dom_exception _dom_html_select_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_SELECT_ELEMENT_PROTECT_VTABLE \ _dom_html_select_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_SELECT_ELEMENT \ _dom_virtual_html_select_element_destroy, \ _dom_html_select_element_copy /* Internal function for bindings */ dom_exception _dom_html_select_element_set_form( dom_html_select_element *select, dom_html_form_element *form); #endif netsurf-all-3.2/libdom/src/html/html_div_element.c0000644000175000017500000001032312377676745021317 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_div_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_DIV_ELEMENT }, DOM_HTML_DIV_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_div_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_div_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_div_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_div_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_div_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_div_element object * * \param doc The document object * \param ele The dom_html_div_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_div_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_div_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_DIV], namespace, prefix); } /** * Finalise a dom_html_div_element object * * \param ele The dom_html_div_element object */ void _dom_html_div_element_finalise(struct dom_html_div_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_div_element object * * \param ele The dom_html_div_element object */ void _dom_html_div_element_destroy(struct dom_html_div_element *ele) { _dom_html_div_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_div_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_div_element_destroy(dom_node_internal *node) { _dom_html_div_element_destroy((struct dom_html_div_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_div_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_div_element_get_##attr( \ dom_html_div_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_div_element_set_##attr( \ dom_html_div_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); netsurf-all-3.2/libdom/src/html/html_map_element.c0000644000175000017500000001214412377676745021315 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_map_element.h" #include "html/html_collection.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_MAP_ELEMENT }, DOM_HTML_MAP_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_map_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_map_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_map_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_map_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_map_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_map_element object * * \param doc The document object * \param ele The dom_html_map_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_map_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_map_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_MAP], namespace, prefix); } /** * Finalise a dom_html_map_element object * * \param ele The dom_html_map_element object */ void _dom_html_map_element_finalise(struct dom_html_map_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_map_element object * * \param ele The dom_html_map_element object */ void _dom_html_map_element_destroy(struct dom_html_map_element *ele) { _dom_html_map_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_map_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_map_element_destroy(dom_node_internal *node) { _dom_html_map_element_destroy((struct dom_html_map_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_map_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_map_element_get_##attr( \ dom_html_map_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_map_element_set_##attr( \ dom_html_map_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(name); /* The callback function for _dom_html_collection_create*/ bool callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_AREA])) { return true; } return false; } /** * Get the areas property * * \param ele The dom_html_map_element object * \param areas The returned dom_html_collection object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_map_element_get_areas( dom_html_map_element *ele, dom_html_collection **areas) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) ele)->owner; /*doc is passed as a parameter to callback to avoid repeated calculations */ return _dom_html_collection_create(doc, (dom_node_internal *) ele, callback, (void *) doc, areas); } netsurf-all-3.2/libdom/src/html/html_meta_element.h0000644000175000017500000000316512377676745021476 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_meta_element_h_ #define dom_internal_html_meta_element_h_ #include #include "html/html_element.h" struct dom_html_meta_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_meta_element object */ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_meta_element **ele); /* Initialise a dom_html_meta_element object */ dom_exception _dom_html_meta_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_meta_element *ele); /* Finalise a dom_html_meta_element object */ void _dom_html_meta_element_finalise(struct dom_html_meta_element *ele); /* Destroy a dom_html_meta_element object */ void _dom_html_meta_element_destroy(struct dom_html_meta_element *ele); /* The protected virtual functions */ dom_exception _dom_html_meta_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_meta_element_destroy(dom_node_internal *node); dom_exception _dom_html_meta_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_META_ELEMENT_PROTECT_VTABLE \ _dom_html_meta_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_META_ELEMENT \ _dom_virtual_html_meta_element_destroy, \ _dom_html_meta_element_copy #endif netsurf-all-3.2/libdom/src/html/html_ulist_element.c0000644000175000017500000001173612377676746021707 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_ulist_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_U_LIST_ELEMENT }, DOM_HTML_U_LIST_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_u_list_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_u_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *u_listfix, struct dom_html_u_list_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_u_list_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_u_list_element_initialise(doc, namespace, u_listfix, *ele); } /** * Initialise a dom_html_u_list_element object * * \param doc The document object * \param ele The dom_html_u_list_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_u_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *u_listfix, struct dom_html_u_list_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_UL], namespace, u_listfix); } /** * Finalise a dom_html_u_list_element object * * \param ele The dom_html_u_list_element object */ void _dom_html_u_list_element_finalise(struct dom_html_u_list_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_u_list_element object * * \param ele The dom_html_u_list_element object */ void _dom_html_u_list_element_destroy(struct dom_html_u_list_element *ele) { _dom_html_u_list_element_finalise(ele); free(ele); } /** * Get the compact Property * * \param u_list The dom_html_u_list_element object */ dom_exception dom_html_u_list_element_get_compact( dom_html_u_list_element *u_list, bool *compact) { return dom_html_element_get_bool_property(&u_list->base, "compact", SLEN("compact"), compact); } /** * Set the compact Property * * \param u_list The dom_html_u_list_element object */ dom_exception dom_html_u_list_element_set_compact( dom_html_u_list_element *u_list, bool compact) { return dom_html_element_set_bool_property(&u_list->base, "compact", SLEN("compact"), compact); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_u_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_u_list_element_destroy(dom_node_internal *node) { _dom_html_u_list_element_destroy((struct dom_html_u_list_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_u_list_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_u_list_element_get_##attr( \ dom_html_u_list_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_u_list_element_set_##attr( \ dom_html_u_list_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(type); netsurf-all-3.2/libdom/src/html/html_head_element.c0000644000175000017500000000737312377676745021451 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "html/html_document.h" #include "html/html_head_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_HEAD_ELEMENT }, DOM_HTML_HEAD_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_head_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_head_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_head_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_head_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_head_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_head_element object * * \param doc The document object * \param ele The dom_html_head_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_head_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_head_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_HEAD], namespace, prefix); } /** * Finalise a dom_html_head_element object * * \param ele The dom_html_head_element object */ void _dom_html_head_element_finalise(struct dom_html_head_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_head_element object * * \param ele The dom_html_head_element object */ void _dom_html_head_element_destroy(struct dom_html_head_element *ele) { _dom_html_head_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_head_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_head_element_destroy(dom_node_internal *node) { _dom_html_head_element_destroy((struct dom_html_head_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_head_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ dom_exception dom_html_head_element_get_profile(dom_html_head_element *element, dom_string **profile) { dom_exception ret; dom_string *_memo_profile; _memo_profile = ((struct dom_html_document *) ((struct dom_node_internal *)element)->owner)->memoised[hds_profile]; ret = dom_element_get_attribute(element, _memo_profile, profile); return ret; } dom_exception dom_html_head_element_set_profile(dom_html_head_element *element, dom_string *profile) { dom_exception ret; dom_string *_memo_profile; _memo_profile = ((struct dom_html_document *) ((struct dom_node_internal *)element)->owner)->memoised[hds_profile]; ret = dom_element_set_attribute(element, _memo_profile, profile); return ret; } netsurf-all-3.2/libdom/src/html/html_tablecol_element.h0000644000175000017500000000355612377676746022342 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_table_col_element_h_ #define dom_internal_html_table_col_element_h_ #include #include "html/html_element.h" struct dom_html_table_col_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_col_element object */ dom_exception _dom_html_table_col_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_col_element **ele); /* Initialise a dom_html_table_col_element object */ dom_exception _dom_html_table_col_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_col_element *ele); /* Finalise a dom_html_table_col_element object */ void _dom_html_table_col_element_finalise(struct dom_html_table_col_element *ele); /* Destroy a dom_html_table_col_element object */ void _dom_html_table_col_element_destroy(struct dom_html_table_col_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_col_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_col_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_col_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_COL_ELEMENT_PROTECT_VTABLE \ _dom_html_table_col_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_COL_ELEMENT \ _dom_virtual_html_table_col_element_destroy, \ _dom_html_table_col_element_copy #endif netsurf-all-3.2/libdom/src/html/html_font_element.c0000644000175000017500000001043012377676745021502 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_font_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_FONT_ELEMENT }, DOM_HTML_FONT_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_font_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_font_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_font_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_font_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_font_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_font_element object * * \param doc The document object * \param ele The dom_html_font_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_font_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_font_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_FONT], namespace, prefix); } /** * Finalise a dom_html_font_element object * * \param ele The dom_html_font_element object */ void _dom_html_font_element_finalise(struct dom_html_font_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_font_element object * * \param ele The dom_html_font_element object */ void _dom_html_font_element_destroy(struct dom_html_font_element *ele) { _dom_html_font_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_font_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_font_element_destroy(dom_node_internal *node) { _dom_html_font_element_destroy((struct dom_html_font_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_font_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_font_element_get_##attr( \ dom_html_font_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_font_element_set_##attr( \ dom_html_font_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(color); SIMPLE_GET_SET(face); SIMPLE_GET_SET(size); netsurf-all-3.2/libdom/src/html/html_body_element.c0000644000175000017500000001041112377676745021470 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "html/html_body_element.h" #include "html/html_document.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_BODY_ELEMENT }, DOM_HTML_BODY_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_body_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_body_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_body_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_body_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_body_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_body_element object * * \param doc The document object * \param ele The dom_html_body_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_body_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_body_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_BODY], namespace, prefix); } /** * Finalise a dom_html_body_element object * * \param ele The dom_html_body_element object */ void _dom_html_body_element_finalise(struct dom_html_body_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_body_element object * * \param ele The dom_html_body_element object */ void _dom_html_body_element_destroy(struct dom_html_body_element *ele) { _dom_html_body_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_body_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_body_element_destroy(dom_node_internal *node) { _dom_html_body_element_destroy((struct dom_html_body_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_body_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_body_element_get_##attr( \ dom_html_body_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_body_element_set_##attr( \ dom_html_body_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(a_link) SIMPLE_GET_SET(background) SIMPLE_GET_SET(bg_color) SIMPLE_GET_SET(link) SIMPLE_GET_SET(text) SIMPLE_GET_SET(v_link) netsurf-all-3.2/libdom/src/html/html_li_element.c0000644000175000017500000001143112377676745021142 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_li_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_LI_ELEMENT }, DOM_HTML_LI_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_li_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_li_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *lifix, struct dom_html_li_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_li_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_li_element_initialise(doc, namespace, lifix, *ele); } /** * Initialise a dom_html_li_element object * * \param doc The document object * \param ele The dom_html_li_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_li_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *lifix, struct dom_html_li_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_LI], namespace, lifix); } /** * Finalise a dom_html_li_element object * * \param ele The dom_html_li_element object */ void _dom_html_li_element_finalise(struct dom_html_li_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_li_element object * * \param ele The dom_html_li_element object */ void _dom_html_li_element_destroy(struct dom_html_li_element *ele) { _dom_html_li_element_finalise(ele); free(ele); } /** * Get the value Property * * \param li The dom_html_li_element object */ dom_exception dom_html_li_element_get_value( dom_html_li_element *li, int32_t *value) { return dom_html_element_get_int32_t_property(&li->base, "value", SLEN("value"), value); } /** * Set the value Property * * \param li The dom_html_li_element object */ dom_exception dom_html_li_element_set_value( dom_html_li_element *li, uint32_t value) { return dom_html_element_set_int32_t_property(&li->base, "value", SLEN("value"), value); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_li_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_li_element_destroy(dom_node_internal *node) { _dom_html_li_element_destroy((struct dom_html_li_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_li_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_li_element_get_##attr( \ dom_html_li_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_li_element_set_##attr( \ dom_html_li_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(type); netsurf-all-3.2/libdom/src/html/html_form_element.h0000644000175000017500000000322212377676745021505 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_form_element_h_ #define dom_internal_html_form_element_h_ #include #include "html/html_element.h" struct dom_html_collection; struct dom_html_form_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_form_element object */ dom_exception _dom_html_form_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_form_element **ele); /* Initialise a dom_html_form_element object */ dom_exception _dom_html_form_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_form_element *ele); /* Finalise a dom_html_form_element object */ void _dom_html_form_element_finalise(struct dom_html_form_element *ele); /* Destroy a dom_html_form_element object */ void _dom_html_form_element_destroy(struct dom_html_form_element *ele); /* The protected virtual functions */ dom_exception _dom_html_form_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_form_element_destroy(dom_node_internal *node); dom_exception _dom_html_form_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_FORM_ELEMENT_PROTECT_VTABLE \ _dom_html_form_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_FORM_ELEMENT \ _dom_virtual_html_form_element_destroy, \ _dom_html_form_element_copy #endif netsurf-all-3.2/libdom/src/html/html_frameset_element.c0000644000175000017500000001064712377676745022354 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_frameset_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_FRAME_SET_ELEMENT }, DOM_HTML_FRAME_SET_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_frame_set_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_frame_set_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_set_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_frame_set_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_frame_set_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_frame_set_element object * * \param doc The document object * \param ele The dom_html_frame_set_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_frame_set_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_set_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_FRAMESET], namespace, prefix); } /** * Finalise a dom_html_frame_set_element object * * \param ele The dom_html_frame_set_element object */ void _dom_html_frame_set_element_finalise(struct dom_html_frame_set_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_frame_set_element object * * \param ele The dom_html_frame_set_element object */ void _dom_html_frame_set_element_destroy(struct dom_html_frame_set_element *ele) { _dom_html_frame_set_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_frame_set_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_frame_set_element_destroy(dom_node_internal *node) { _dom_html_frame_set_element_destroy((struct dom_html_frame_set_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_frame_set_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_frame_set_element_get_##attr( \ dom_html_frame_set_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_frame_set_element_set_##attr( \ dom_html_frame_set_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET (rows); SIMPLE_GET_SET (cols); netsurf-all-3.2/libdom/src/html/html_text_area_element.c0000644000175000017500000003147512377676746022525 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #include #include #include #include "html/html_document.h" #include "html/html_text_area_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TEXT_AREA_ELEMENT }, DOM_HTML_TEXT_AREA_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_text_area_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_text_area_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_text_area_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_text_area_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_text_area_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_text_area_element object * * \param doc The document object * \param ele The dom_html_text_area_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_text_area_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_text_area_element *ele) { ele->form = NULL; ele->default_value = NULL; ele->default_value_set = false; ele->value = NULL; ele->value_set = false; return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_TEXTAREA], namespace, prefix); } /** * Finalise a dom_html_text_area_element object * * \param ele The dom_html_text_area_element object */ void _dom_html_text_area_element_finalise(struct dom_html_text_area_element *ele) { if (ele->default_value != NULL) { dom_string_unref(ele->default_value); ele->default_value = NULL; ele->default_value_set = false; } if (ele->value != NULL) { dom_string_unref(ele->value); ele->value = NULL; ele->value_set = false; } _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_text_area_element object * * \param ele The dom_html_text_area_element object */ void _dom_html_text_area_element_destroy(struct dom_html_text_area_element *ele) { _dom_html_text_area_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the disabled property * * \param ele The dom_html_text_area_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_get_disabled(dom_html_text_area_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_text_area_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_set_disabled(dom_html_text_area_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Get the readOnly property * * \param ele The dom_html_text_area_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_get_read_only(dom_html_text_area_element *ele, bool *read_only) { return dom_html_element_get_bool_property(&ele->base, "readonly", SLEN("readonly"), read_only); } /** * Set the readOnly property * * \param ele The dom_html_text_area_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_set_read_only(dom_html_text_area_element *ele, bool read_only) { return dom_html_element_set_bool_property(&ele->base, "readonly", SLEN("readonly"), read_only); } /** * Get the defaultValue property * * \param ele The dom_html_text_area_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_get_default_value( dom_html_text_area_element *ele, dom_string **default_value) { dom_exception err; if (ele->default_value_set == false) { err = dom_node_get_text_content((dom_node *)ele, &ele->default_value); if (err == DOM_NO_ERR) { ele->default_value_set = true; } } *default_value = ele->default_value; if (*default_value != NULL) dom_string_ref(*default_value); return DOM_NO_ERR; } /** * Set the defaultValue property * * \param ele The dom_html_text_area_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_set_default_value( dom_html_text_area_element *ele, dom_string *default_value) { if (ele->default_value != NULL) dom_string_unref(ele->default_value); ele->default_value = default_value; ele->default_value_set = true; if (ele->default_value != NULL) dom_string_ref(ele->default_value); return DOM_NO_ERR; } /** * Get the value property * * \param ele The dom_html_text_area_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_get_value( dom_html_text_area_element *ele, dom_string **value) { dom_exception err; if (ele->value_set == false) { err = dom_node_get_text_content((dom_node *)ele, &ele->value); if (err == DOM_NO_ERR) { ele->default_value_set = true; if (ele->default_value_set == false) { ele->default_value_set = true; ele->default_value = ele->value; dom_string_ref(ele->default_value); } } } *value = ele->value; if (*value != NULL) dom_string_ref(*value); return DOM_NO_ERR; } /** * Set the value property * * \param ele The dom_html_text_area_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_set_value( dom_html_text_area_element *ele, dom_string *value) { dom_exception err; if (ele->default_value_set == false) { err = dom_node_get_text_content((dom_node *)ele, &ele->default_value); if (err == DOM_NO_ERR) { ele->default_value_set = true; } } if (ele->value != NULL) dom_string_unref(ele->value); ele->value = value; ele->value_set = true; if (ele->value != NULL) dom_string_ref(ele->value); return DOM_NO_ERR; } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_text_area_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_text_area_element_destroy(dom_node_internal *node) { _dom_html_text_area_element_destroy((struct dom_html_text_area_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_text_area_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_text_area_element_get_##attr( \ dom_html_text_area_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_text_area_element_set_##attr( \ dom_html_text_area_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(name); dom_exception dom_html_text_area_element_get_type( dom_html_text_area_element *text_area, dom_string **type) { dom_html_document *html = (dom_html_document *) ((dom_node_internal *)text_area)->owner; *type = html->memoised[hds_textarea]; dom_string_ref(*type); return DOM_NO_ERR; } dom_exception dom_html_text_area_element_get_tab_index( dom_html_text_area_element *text_area, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&text_area->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_text_area_element_set_tab_index( dom_html_text_area_element *text_area, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&text_area->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_text_area_element_get_cols( dom_html_text_area_element *text_area, int32_t *cols) { return dom_html_element_get_int32_t_property(&text_area->base, "cols", SLEN("cols"), cols); } dom_exception dom_html_text_area_element_set_cols( dom_html_text_area_element *text_area, uint32_t cols) { return dom_html_element_set_int32_t_property(&text_area->base, "cols", SLEN("cols"), cols); } dom_exception dom_html_text_area_element_get_rows( dom_html_text_area_element *text_area, int32_t *rows) { return dom_html_element_get_int32_t_property(&text_area->base, "rows", SLEN("rows"), rows); } dom_exception dom_html_text_area_element_set_rows( dom_html_text_area_element *text_area, uint32_t rows) { return dom_html_element_set_int32_t_property(&text_area->base, "rows", SLEN("rows"), rows); } dom_exception dom_html_text_area_element_get_form( dom_html_text_area_element *text_area, dom_html_form_element **form) { *form = text_area->form; if (*form != NULL) dom_node_ref(*form); return DOM_NO_ERR; } dom_exception _dom_html_text_area_element_set_form( dom_html_text_area_element *text_area, dom_html_form_element *form) { text_area->form = form; return DOM_NO_ERR; } /** * Blur this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_blur(dom_html_text_area_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* This event does not bubble & is Non-cancellable. Mentioned in w3 specs. More research is needed to prove why. */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_blur], false, false, &success); } /** * Focus this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_focus(dom_html_text_area_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* This event does not bubble & is Non-cancellable. Mentioned in w3 specs. More research is needed to prove why. */ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_focus], false, false, &success); } /** * Select this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_text_area_element_select(dom_html_text_area_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* This event bubbles & is non-cancelable. Mentioned in w3 specs. More research is needed to prove why. */ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_select], true, false, &success); } netsurf-all-3.2/libdom/src/html/html_basefont_element.h0000644000175000017500000000350012377676745022342 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_basefont_element_h_ #define dom_internal_html_basefont_element_h_ #include #include "html/html_element.h" struct dom_html_base_font_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_base_font_element object */ dom_exception _dom_html_base_font_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_base_font_element **ele); /* Initialise a dom_html_base_font_element object */ dom_exception _dom_html_base_font_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_base_font_element *ele); /* Finalise a dom_html_base_font_element object */ void _dom_html_base_font_element_finalise(struct dom_html_base_font_element *ele); /* Destroy a dom_html_base_font_element object */ void _dom_html_base_font_element_destroy(struct dom_html_base_font_element *ele); /* The protected virtual functions */ dom_exception _dom_html_base_font_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_base_font_element_destroy(dom_node_internal *node); dom_exception _dom_html_base_font_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_BASE_FONT_ELEMENT_PROTECT_VTABLE \ _dom_html_base_font_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_BASE_FONT_ELEMENT \ _dom_virtual_html_base_font_element_destroy, \ _dom_html_base_font_element_copy #endif netsurf-all-3.2/libdom/src/html/html_opt_group_element.h0000644000175000017500000000340112377676745022557 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #ifndef dom_internal_html_opt_group_element_h_ #define dom_internal_html_opt_group_element_h_ #include #include "html/html_element.h" struct dom_html_opt_group_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_opt_group_element object */ dom_exception _dom_html_opt_group_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_opt_group_element **ele); /* Initialise a dom_html_opt_group_element object */ dom_exception _dom_html_opt_group_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_opt_group_element *ele); /* Finalise a dom_html_opt_group_element object */ void _dom_html_opt_group_element_finalise(struct dom_html_opt_group_element *ele); /* Destroy a dom_html_opt_group_element object */ void _dom_html_opt_group_element_destroy(struct dom_html_opt_group_element *ele); /* The protected virtual functions */ dom_exception _dom_html_opt_group_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_opt_group_element_destroy(dom_node_internal *node); dom_exception _dom_html_opt_group_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_OPT_GROUP_ELEMENT_PROTECT_VTABLE \ _dom_html_opt_group_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_OPT_GROUP_ELEMENT \ _dom_virtual_html_opt_group_element_destroy, \ _dom_html_opt_group_element_copy #endif netsurf-all-3.2/libdom/src/html/html_heading_element.c0000644000175000017500000001060012377676745022132 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_heading_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_HEADING_ELEMENT }, DOM_HTML_HEADING_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_heading_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_heading_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_heading_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_heading_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_heading_element_initialise(doc, tag_name, namespace, prefix, *ele); } /** * Initialise a dom_html_heading_element object * * \param doc The document object * \param ele The dom_html_heading_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_heading_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_heading_element *ele) { return _dom_html_element_initialise(doc, &ele->base, tag_name, namespace, prefix); } /** * Finalise a dom_html_heading_element object * * \param ele The dom_html_heading_element object */ void _dom_html_heading_element_finalise(struct dom_html_heading_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_heading_element object * * \param ele The dom_html_heading_element object */ void _dom_html_heading_element_destroy(struct dom_html_heading_element *ele) { _dom_html_heading_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_heading_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_heading_element_destroy(dom_node_internal *node) { _dom_html_heading_element_destroy((struct dom_html_heading_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_heading_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_heading_element_get_##attr( \ dom_html_heading_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_heading_element_set_##attr( \ dom_html_heading_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); netsurf-all-3.2/libdom/src/html/html_directory_element.c0000644000175000017500000001017712377676745022550 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_directory_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_DIRECTORY_ELEMENT }, DOM_HTML_DIRECTORY_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_directory_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_directory_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_directory_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_directory_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_directory_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_directory_element object * * \param doc The document object * \param ele The dom_html_directory_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_directory_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_directory_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_DIRECTORY], namespace, prefix); } /** * Finalise a dom_html_directory_element object * * \param ele The dom_html_directory_element object */ void _dom_html_directory_element_finalise(struct dom_html_directory_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_directory_element object * * \param ele The dom_html_directory_element object */ void _dom_html_directory_element_destroy(struct dom_html_directory_element *ele) { _dom_html_directory_element_finalise(ele); free(ele); } /** * Get the compact property * * \param ele The dom_html_directory_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_directory_element_get_compact(dom_html_directory_element *ele, bool *compact) { return dom_html_element_get_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /** * Set the compact property * * \param ele The dom_html_directory_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_directory_element_set_compact(dom_html_directory_element *ele, bool compact) { return dom_html_element_set_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_directory_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_directory_element_destroy(dom_node_internal *node) { _dom_html_directory_element_destroy((struct dom_html_directory_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_directory_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } netsurf-all-3.2/libdom/src/html/html_element.h0000644000175000017500000001077412377676745020474 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_element_h_ #define dom_internal_html_element_h_ #include #include "core/element.h" struct dom_html_document; /** * The dom_html_element class * */ struct dom_html_element { struct dom_element base; /**< The base class */ }; dom_exception _dom_html_element_create(struct dom_html_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, dom_html_element **result); dom_exception _dom_html_element_initialise(struct dom_html_document *doc, struct dom_html_element *el, dom_string *name, dom_string *namespace, dom_string *prefix); void _dom_html_element_finalise(struct dom_html_element *ele); /* Virtual functions */ dom_exception _dom_html_element_get_elements_by_tag_name( struct dom_element *element, dom_string *name, struct dom_nodelist **result); dom_exception _dom_html_element_get_elements_by_tag_name_ns( struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_nodelist **result); /* The protected virtual functions */ void _dom_html_element_destroy(dom_node_internal *node); dom_exception _dom_html_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_ELEMENT_VTABLE_HTML_ELEMENT \ _dom_element_get_tag_name, \ _dom_element_get_attribute, \ _dom_element_set_attribute, \ _dom_element_remove_attribute, \ _dom_element_get_attribute_node, \ _dom_element_set_attribute_node, \ _dom_element_remove_attribute_node, \ _dom_html_element_get_elements_by_tag_name, \ _dom_element_get_attribute_ns, \ _dom_element_set_attribute_ns, \ _dom_element_remove_attribute_ns, \ _dom_element_get_attribute_node_ns, \ _dom_element_set_attribute_node_ns, \ _dom_html_element_get_elements_by_tag_name_ns, \ _dom_element_has_attribute, \ _dom_element_has_attribute_ns, \ _dom_element_get_schema_type_info, \ _dom_element_set_id_attribute, \ _dom_element_set_id_attribute_ns, \ _dom_element_set_id_attribute_node, \ _dom_element_get_classes, \ _dom_element_has_class #define DOM_HTML_ELEMENT_PROTECT_VTABLE \ _dom_html_element_destroy, \ _dom_html_element_copy /* The API functions */ dom_exception _dom_html_element_get_id(dom_html_element *element, dom_string **id); dom_exception _dom_html_element_set_id(dom_html_element *element, dom_string *id); dom_exception _dom_html_element_get_title(dom_html_element *element, dom_string **title); dom_exception _dom_html_element_set_title(dom_html_element *element, dom_string *title); dom_exception _dom_html_element_get_lang(dom_html_element *element, dom_string **lang); dom_exception _dom_html_element_set_lang(dom_html_element *element, dom_string *lang); dom_exception _dom_html_element_get_dir(dom_html_element *element, dom_string **dir); dom_exception _dom_html_element_set_dir(dom_html_element *element, dom_string *dir); dom_exception _dom_html_element_get_class_name(dom_html_element *element, dom_string **class_name); dom_exception _dom_html_element_set_class_name(dom_html_element *element, dom_string *class_name); #define DOM_HTML_ELEMENT_VTABLE \ _dom_html_element_get_id, \ _dom_html_element_set_id, \ _dom_html_element_get_title, \ _dom_html_element_set_title, \ _dom_html_element_get_lang, \ _dom_html_element_set_lang, \ _dom_html_element_get_dir, \ _dom_html_element_set_dir, \ _dom_html_element_get_class_name, \ _dom_html_element_set_class_name /* Some common functions used by all child classes */ dom_exception dom_html_element_get_bool_property(dom_html_element *ele, const char *name, uint32_t len, bool *has); dom_exception dom_html_element_set_bool_property(dom_html_element *ele, const char *name, uint32_t len, bool has); dom_exception dom_html_element_get_int32_t_property(dom_html_element *ele, const char *name, uint32_t len, int32_t *value); dom_exception dom_html_element_set_int32_t_property(dom_html_element *ele, const char *name, uint32_t len, uint32_t value); extern struct dom_html_element_vtable _dom_html_element_vtable; #endif netsurf-all-3.2/libdom/src/html/html_tablesection_element.c0000644000175000017500000002125212377676746023215 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_tablesection_element.h" #include "html/html_tablerow_element.h" #include "html/html_collection.h" #include "html/html_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_SECTION_ELEMENT }, DOM_HTML_TABLE_SECTION_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_section_element object * * \table_section doc The document object * \table_section ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_section_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_section_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_section_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_section_element_initialise(doc, tag_name, namespace, prefix, *ele); } /** * Initialise a dom_html_table_section_element object * * \table_section doc The document object * \table_section ele The dom_html_table_section_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_section_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_section_element *ele) { return _dom_html_element_initialise(doc, &ele->base, tag_name, namespace, prefix); } /** * Finalise a dom_html_table_section_element object * * \table_section ele The dom_html_table_section_element object */ void _dom_html_table_section_element_finalise(struct dom_html_table_section_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_section_element object * * \table_section ele The dom_html_table_section_element object */ void _dom_html_table_section_element_destroy(struct dom_html_table_section_element *ele) { _dom_html_table_section_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_section_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node) { _dom_html_table_section_element_destroy((struct dom_html_table_section_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_section_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_section_element_get_##attr( \ dom_html_table_section_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_section_element_set_##attr( \ dom_html_table_section_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); SIMPLE_GET_SET(ch); SIMPLE_GET_SET(ch_off); SIMPLE_GET_SET(v_align); /* The callback function for _dom_html_collection_create*/ bool table_section_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_TR])) { return true; } return false; } /** * Get the rows collection * * \param element The dom_html_table_section_element object * \param rows The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_section_element_get_rows( dom_html_table_section_element *element, dom_html_collection **rows) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; return _dom_html_collection_create(doc, (dom_node_internal *)element, table_section_callback, (void *)doc, rows); } /** * Insert Row before the given Index * * \param element The dom_html_table_section_element object * \param index The Index of the Row node to be inserted * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_section_element_insert_row( dom_html_table_section_element *element, int32_t index, dom_html_element **new_row) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *node; /*< The node at the (index)th position*/ dom_html_collection *rows; /*< The collection of rows in input table_section_element*/ uint32_t len; /*< The size of the row collection */ dom_exception exp; /*< Variable for getting the exceptions*/ exp = _dom_html_table_row_element_create(doc, ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, (dom_html_table_row_element **)new_row); if(exp != DOM_NO_ERR) return exp; exp = dom_html_table_section_element_get_rows(element, &rows); if(exp != DOM_NO_ERR) { dom_node_unref(new_row); new_row = NULL; return exp; } exp = dom_html_collection_get_length(rows, &len); if(exp != DOM_NO_ERR) { dom_node_unref(new_row); new_row = NULL; dom_html_collection_unref(rows); return exp; } if(index < -1 || index > (int32_t)len) { /* Check for index validity */ dom_html_collection_unref(rows); return DOM_INDEX_SIZE_ERR; } else if(index == -1 || index == (int32_t)len) { dom_node *new_node; dom_html_collection_unref(rows); return dom_node_append_child(element, *new_row, &new_node); } else { dom_node *new_node; dom_html_collection_item(rows, index, &node); dom_html_collection_unref(rows); return dom_node_insert_before(element, *new_row, node, &new_node); } } /** * Delete Row at given Index * * \param element The dom_html_table_section_element object * \param index The Index of the Row node to be deleted * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_section_element_delete_row( dom_html_table_section_element *element, int32_t index) { dom_node *node, *old_node; /*< The node at the (index)th position*/ dom_html_collection *rows; /*< The collection of rows in input table_section_element*/ uint32_t len; /*< The size of the row collection */ dom_exception exp; /*< Temporary variable to store & check the exceptions*/ exp = dom_html_table_section_element_get_rows(element, &rows); if (exp != DOM_NO_ERR) { return exp; } exp = dom_html_collection_get_length(rows, &len); if (exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } if (index < -1 || index >= (int32_t) len || (index == -1 && len == 0)) { /* Check for index validity */ dom_html_collection_unref(rows); return DOM_INDEX_SIZE_ERR; } if (index == -1) index = len - 1; exp = dom_html_collection_item(rows, index, &node); if (exp != DOM_NO_ERR) { dom_html_collection_unref(rows); return exp; } exp = dom_node_remove_child(element, node, &old_node); if (exp == DOM_NO_ERR) dom_node_unref(old_node); dom_node_unref(node); dom_html_collection_unref(rows); return exp; } netsurf-all-3.2/libdom/src/html/html_tablerow_element.c0000644000175000017500000002702112377676746022360 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include #include "html/html_document.h" #include "html/html_tablerow_element.h" #include "html/html_collection.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ROW_ELEMENT }, DOM_HTML_TABLE_ROW_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_row_element table_row * * \param doc The document table_row * \param ele The returned element table_row * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_row_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_row_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_row_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_row_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_table_row_element table_row * * \param doc The document table_row * \param ele The dom_html_table_row_element table_row * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_row_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_row_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_TR], namespace, prefix); } /** * Finalise a dom_html_table_row_element table_row * * \param ele The dom_html_table_row_element table_row */ void _dom_html_table_row_element_finalise(struct dom_html_table_row_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_row_element table_row * * \param ele The dom_html_table_row_element table_row */ void _dom_html_table_row_element_destroy(struct dom_html_table_row_element *ele) { _dom_html_table_row_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_row_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_row_element_destroy(dom_node_internal *node) { _dom_html_table_row_element_destroy((struct dom_html_table_row_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_row_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_row_element_get_##attr( \ dom_html_table_row_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_row_element_set_##attr( \ dom_html_table_row_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); SIMPLE_GET_SET(bg_color); SIMPLE_GET_SET(ch); SIMPLE_GET_SET(ch_off); SIMPLE_GET_SET(v_align); /** * Get the index of the Row in logical order * * \param element The dom_html_table_row_element object * \param index The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_row_element_get_row_index( dom_html_table_row_element *table_row, int32_t *row_index) { dom_exception exp; dom_node_internal *n = ((dom_node_internal *)table_row)->parent; dom_node_internal *parent = n; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) table_row)->owner; uint32_t count = 0; for(n = n->first_child; n != (dom_node_internal *)table_row; n = n->next) { if(n->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(n->name,doc->memoised[hds_TR])) { count += 1; } } if(dom_string_caseless_isequal((parent->parent)->name, doc->memoised[hds_TABLE]) && dom_string_caseless_isequal(parent->name, doc->memoised[hds_THEAD]) ) { *row_index = count; }else if(dom_string_caseless_isequal((parent->parent)->name, doc->memoised[hds_TABLE]) && (dom_string_caseless_isequal(parent->name, doc->memoised[hds_TBODY]) || dom_string_caseless_isequal(parent->name, doc->memoised[hds_TFOOT]))) { uint32_t len; n = parent->parent; dom_html_table_section_element *t_head; dom_html_collection *rows; exp = dom_html_table_element_get_t_head( (dom_html_table_element *)(parent->parent), &t_head); if (exp != DOM_NO_ERR) { return exp; } exp = dom_html_table_section_element_get_rows(t_head, &rows); if (exp != DOM_NO_ERR) { dom_node_unref(t_head); return exp; } dom_html_collection_get_length(rows, &len); dom_html_collection_unref(rows); count += len; for (n = n->first_child;n != parent && n != NULL; n = n->next) { if (dom_string_caseless_isequal(n->name, doc->memoised[hds_TBODY])) { exp = dom_html_table_section_element_get_rows( (dom_html_table_section_element *)n, &rows); if (exp != DOM_NO_ERR) { return exp; } exp = dom_html_collection_get_length(rows, &len); dom_html_collection_unref(rows); if (exp != DOM_NO_ERR) { return exp; } count += len; } } *row_index = (int32_t)count; } else { return DOM_HIERARCHY_REQUEST_ERR; } return DOM_NO_ERR; } /** * Get the index of a row within its Section * * \param element The dom_html_table_row_element object * \param index The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_row_element_get_section_row_index( dom_html_table_row_element *table_row, int32_t *section_row_index) { dom_node_internal *n = ((dom_node_internal *)table_row)->parent; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) table_row)->owner; int32_t count = 0; for(n = n->first_child; n != (dom_node_internal *)table_row; n = n->next) { if(n->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(n->name, doc->memoised[hds_TR])) { count += 1; } } *section_row_index = count; return DOM_NO_ERR; } /** * Callback for creating the Cells collection * * \param node The dom_node_internal object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool table_cells_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_TD])) { return true; } return false; } /** * Get the Cells collection * * \param element The dom_html_table_element object * \param t_bodies The Status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_row_element_get_cells( dom_html_table_row_element *element, dom_html_collection **cells) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; return _dom_html_collection_create(doc, (dom_node_internal *)element, table_cells_callback, (void *)doc, cells); } /** * Insert Cell before the given Index * * \param element The dom_html_table_row_element object * \param index The Index of the Cell node to be inserted * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_row_element_insert_cell( dom_html_table_row_element *element, int32_t index, dom_html_element **cell) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) element)->owner; dom_node *node; /*< The node at the (index)th position*/ dom_html_collection *cells; /*< The collection of cells in input table_row_element*/ uint32_t len; /*< The size of the cell collection */ dom_exception exp; /*< Variable for getting the exceptions*/ exp = _dom_html_element_create(doc, doc->memoised[hds_TD], ((dom_node_internal *)element)->namespace, ((dom_node_internal *)element)->prefix, cell); if(exp != DOM_NO_ERR) return exp; exp = dom_html_table_row_element_get_cells(element, &cells); if(exp != DOM_NO_ERR) { dom_node_unref(*cell); return exp; } exp = dom_html_collection_get_length(cells, &len); if(exp != DOM_NO_ERR) { dom_node_unref(*cell); return exp; } if(index < -1 || index > (int32_t)len) { /* Check for index validity */ dom_html_collection_unref (cells); return DOM_INDEX_SIZE_ERR; } else if(index == -1 || index == (int32_t)len) { dom_node *new_cell; dom_html_collection_unref(cells); return dom_node_append_child(element, *cell, &new_cell); } else { dom_node *new_cell; dom_html_collection_item(cells, index, &node); dom_html_collection_unref(cells); return dom_node_insert_before(element, *cell, node, &new_cell); } } /** * Delete Cell at given Index * * \param element The dom_html_table_row_element object * \param index The Index of the Cell node to be deleted * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_row_element_delete_cell( dom_html_table_row_element *element, int32_t index) { dom_node *node, *old_node; /*< The node at the (index)th position*/ dom_html_collection *cells; /*< The collection of rows in input table_row_element*/ uint32_t len; /*< The size of the row collection */ dom_exception exp; /*< Temporary variable to store & check the exceptions*/ exp = dom_html_table_row_element_get_cells(element, &cells); if (exp != DOM_NO_ERR) { return exp; } exp = dom_html_collection_get_length(cells, &len); if (exp != DOM_NO_ERR) { dom_html_collection_unref(cells); return exp; } if (index < -1 || index >= (int32_t) len || len == 0) { /* Check for index validity */ dom_html_collection_unref(cells); return DOM_INDEX_SIZE_ERR; } if (index == -1) index = len - 1; exp = dom_html_collection_item(cells, index, &node); if (exp != DOM_NO_ERR) { dom_html_collection_unref(cells); return exp; } exp = dom_node_remove_child(element, node, &old_node); if (exp == DOM_NO_ERR) dom_node_unref(old_node); dom_node_unref(node); dom_html_collection_unref(cells); return exp; } netsurf-all-3.2/libdom/src/html/html_hr_element.h0000644000175000017500000000323312377676745021155 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_hr_element_h_ #define dom_internal_html_hr_element_h_ #include #include "html/html_element.h" struct dom_html_hr_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_hr_element object */ dom_exception _dom_html_hr_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_hr_element **ele); /* Initialise a dom_html_hr_element object */ dom_exception _dom_html_hr_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_hr_element *ele); /* Finalise a dom_html_hr_element object */ void _dom_html_hr_element_finalise(struct dom_html_hr_element *ele); /* Destroy a dom_html_hr_element object */ void _dom_html_hr_element_destroy(struct dom_html_hr_element *ele); /* The protected virtual functions */ dom_exception _dom_html_hr_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_hr_element_destroy(dom_node_internal *node); dom_exception _dom_html_hr_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_HR_ELEMENT_PROTECT_VTABLE \ _dom_html_hr_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_HR_ELEMENT \ _dom_virtual_html_hr_element_destroy, \ _dom_html_hr_element_copy #endif netsurf-all-3.2/libdom/src/html/html_dlist_element.h0000644000175000017500000000336212377676745021666 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_d_list_element_h_ #define dom_internal_html_d_list_element_h_ #include #include "html/html_element.h" struct dom_html_d_list_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_d_list_element object */ dom_exception _dom_html_d_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_d_list_element **ele); /* Initialise a dom_html_d_list_element object */ dom_exception _dom_html_d_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_d_list_element *ele); /* Finalise a dom_html_d_list_element object */ void _dom_html_d_list_element_finalise(struct dom_html_d_list_element *ele); /* Destroy a dom_html_d_list_element object */ void _dom_html_d_list_element_destroy(struct dom_html_d_list_element *ele); /* The protected virtual functions */ dom_exception _dom_html_d_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_d_list_element_destroy(dom_node_internal *node); dom_exception _dom_html_d_list_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_DL_ELEMENT_PROTECT_VTABLE \ _dom_html_d_list_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_DL_ELEMENT \ _dom_virtual_html_d_list_element_destroy, \ _dom_html_d_list_element_copy #endif netsurf-all-3.2/libdom/src/html/html_pre_element.c0000644000175000017500000000717612377676745021337 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_pre_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_PRE_ELEMENT }, DOM_HTML_PRE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_pre_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_pre_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_pre_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_pre_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_pre_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_pre_element object * * \param doc The document object * \param ele The dom_html_pre_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_pre_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_pre_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_PRE], namespace, prefix); } /** * Finalise a dom_html_pre_element object * * \param ele The dom_html_pre_element object */ void _dom_html_pre_element_finalise(struct dom_html_pre_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_pre_element object * * \param ele The dom_html_pre_element object */ void _dom_html_pre_element_destroy(struct dom_html_pre_element *ele) { _dom_html_pre_element_finalise(ele); free(ele); } /** * Get the width Property * * \param pre The dom_html_pre_element object */ dom_exception dom_html_pre_element_get_width( dom_html_pre_element *pre, int32_t *width) { return dom_html_element_get_int32_t_property(&pre->base, "width", SLEN("width"), width); } /** * Set the width Property * * \param pre The dom_html_pre_element object */ dom_exception dom_html_pre_element_set_width( dom_html_pre_element *pre, uint32_t width) { return dom_html_element_set_int32_t_property(&pre->base, "width", SLEN("width"), width); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_pre_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_pre_element_destroy(dom_node_internal *node) { _dom_html_pre_element_destroy((struct dom_html_pre_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_pre_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } netsurf-all-3.2/libdom/src/html/html_applet_element.c0000644000175000017500000001230012377676745022017 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_applet_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_APPLET_ELEMENT }, DOM_HTML_APPLET_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_applet_element applet * * \param doc The document applet * \param ele The returned element applet * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_applet_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_applet_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_applet_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_applet_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_applet_element applet * * \param doc The document applet * \param ele The dom_html_applet_element applet * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_applet_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_applet_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_APPLET], namespace, prefix); } /** * Finalise a dom_html_applet_element applet * * \param ele The dom_html_applet_element applet */ void _dom_html_applet_element_finalise(struct dom_html_applet_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_applet_element applet * * \param ele The dom_html_applet_element applet */ void _dom_html_applet_element_destroy(struct dom_html_applet_element *ele) { _dom_html_applet_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_applet_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_applet_element_destroy(dom_node_internal *node) { _dom_html_applet_element_destroy((struct dom_html_applet_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_applet_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_applet_element_get_##attr( \ dom_html_applet_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_applet_element_set_##attr( \ dom_html_applet_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(align); SIMPLE_GET_SET(alt); SIMPLE_GET_SET(archive); SIMPLE_GET_SET(code); SIMPLE_GET_SET(code_base); SIMPLE_GET_SET(height); SIMPLE_GET_SET(name); SIMPLE_GET_SET(object); SIMPLE_GET_SET(width); dom_exception dom_html_applet_element_get_hspace( dom_html_applet_element *applet, int32_t *hspace) { return dom_html_element_get_int32_t_property(&applet->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_applet_element_set_hspace( dom_html_applet_element *applet, uint32_t hspace) { return dom_html_element_set_int32_t_property(&applet->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_applet_element_get_vspace( dom_html_applet_element *applet, int32_t *vspace) { return dom_html_element_get_int32_t_property(&applet->base, "vspace", SLEN("vspace"), vspace); } dom_exception dom_html_applet_element_set_vspace( dom_html_applet_element *applet, uint32_t vspace) { return dom_html_element_set_int32_t_property(&applet->base, "vspace", SLEN("vspace"), vspace); } netsurf-all-3.2/libdom/src/html/html_title_element.h0000644000175000017500000000321512377676746021666 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_title_element_h_ #define dom_internal_html_title_element_h_ #include #include "html/html_element.h" struct dom_html_title_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_title_element object */ dom_exception _dom_html_title_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_title_element **ele); /* Initialise a dom_html_title_element object */ dom_exception _dom_html_title_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_title_element *ele); /* Finalise a dom_html_title_element object */ void _dom_html_title_element_finalise(struct dom_html_title_element *ele); /* Destroy a dom_html_title_element object */ void _dom_html_title_element_destroy(struct dom_html_title_element *ele); /* The protected virtual functions */ dom_exception _dom_html_title_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_title_element_destroy(dom_node_internal *node); dom_exception _dom_html_title_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TITLE_ELEMENT_PROTECT_VTABLE \ _dom_html_title_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TITLE_ELEMENT \ _dom_virtual_html_title_element_destroy, \ _dom_html_title_element_copy #endif netsurf-all-3.2/libdom/src/html/html_dlist_element.c0000644000175000017500000001001312377676745021650 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_dlist_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_DL_ELEMENT }, DOM_HTML_DL_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_d_list_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_d_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_d_list_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_d_list_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_d_list_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_d_list_element object * * \param doc The document object * \param ele The dom_html_d_list_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_d_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_d_list_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_DL], namespace, prefix); } /** * Finalise a dom_html_d_list_element object * * \param ele The dom_html_d_list_element object */ void _dom_html_d_list_element_finalise(struct dom_html_d_list_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_d_list_element object * * \param ele The dom_html_d_list_element object */ void _dom_html_d_list_element_destroy(struct dom_html_d_list_element *ele) { _dom_html_d_list_element_finalise(ele); free(ele); } /** * Get the compact property * * \param ele The dom_html_d_list_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_d_list_element_get_compact(dom_html_d_list_element *ele, bool *compact) { return dom_html_element_get_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /** * Set the compact property * * \param ele The dom_html_d_list_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_d_list_element_set_compact(dom_html_d_list_element *ele, bool compact) { return dom_html_element_set_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_d_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_d_list_element_destroy(dom_node_internal *node) { _dom_html_d_list_element_destroy((struct dom_html_d_list_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_d_list_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } netsurf-all-3.2/libdom/src/html/html_input_element.h0000644000175000017500000000432712377676745021710 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #ifndef dom_internal_html_input_element_h_ #define dom_internal_html_input_element_h_ #include #include "html/html_element.h" struct dom_html_input_element { struct dom_html_element base; /**< The base class */ struct dom_html_form_element *form; /**< The form associated with the input */ bool default_checked; /**< Initial checked value */ bool default_checked_set; /**< Whether default_checked has been set */ dom_string *default_value; /**< Initial value */ bool default_value_set; /**< Whether default_value has been set */ bool checked; /**< Whether the element has been checked by a click */ bool checked_set; }; /* Create a dom_html_input_element object */ dom_exception _dom_html_input_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_input_element **ele); /* Initialise a dom_html_input_element object */ dom_exception _dom_html_input_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_input_element *ele); /* Finalise a dom_html_input_element object */ void _dom_html_input_element_finalise(struct dom_html_input_element *ele); /* Destroy a dom_html_input_element object */ void _dom_html_input_element_destroy(struct dom_html_input_element *ele); /* The protected virtual functions */ dom_exception _dom_html_input_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_input_element_destroy(dom_node_internal *node); dom_exception _dom_html_input_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_INPUT_ELEMENT_PROTECT_VTABLE \ _dom_html_input_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_INPUT_ELEMENT \ _dom_virtual_html_input_element_destroy, \ _dom_html_input_element_copy /* Internal function for bindings */ dom_exception _dom_html_input_element_set_form( dom_html_input_element *input, dom_html_form_element *form); #endif netsurf-all-3.2/libdom/src/html/html_label_element.h0000644000175000017500000000334312377676745021625 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_label_element_h_ #define dom_internal_html_label_element_h_ #include #include "html/html_element.h" struct dom_html_label_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_label_element object */ dom_exception _dom_html_label_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_label_element **ele); /* Initialise a dom_html_label_element object */ dom_exception _dom_html_label_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_label_element *ele); /* Finalise a dom_html_label_element object */ void _dom_html_label_element_finalise(struct dom_html_label_element *ele); /* Destroy a dom_html_label_element object */ void _dom_html_label_element_destroy(struct dom_html_label_element *ele); /* The protected virtual functions */ dom_exception _dom_html_label_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_label_element_destroy(dom_node_internal *node); dom_exception _dom_html_label_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_LABEL_ELEMENT_PROTECT_VTABLE \ _dom_html_label_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_LABEL_ELEMENT \ _dom_virtual_html_label_element_destroy, \ _dom_html_label_element_copy #endif netsurf-all-3.2/libdom/src/html/html_style_element.c0000644000175000017500000001171112377676745021677 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "html/html_style_element.h" #include "html/html_document.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_STYLE_ELEMENT }, DOM_HTML_STYLE_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_style_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_style_element_create(struct dom_html_document *doc, struct dom_html_style_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_style_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_style_element_initialise(doc, *ele); } /** * Initialise a dom_html_style_element object * * \param doc The document object * \param ele The dom_html_style_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_style_element_initialise(struct dom_html_document *doc, struct dom_html_style_element *ele) { dom_string *name = NULL; dom_exception err; err = dom_string_create((const uint8_t *) "STYLE", SLEN("STYLE"), &name); if (err != DOM_NO_ERR) return err; err = _dom_html_element_initialise(doc, &ele->base, name, NULL, NULL); dom_string_unref(name); return err; } /** * Finalise a dom_html_style_element object * * \param ele The dom_html_style_element object */ void _dom_html_style_element_finalise(struct dom_html_style_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_style_element object * * \param ele The dom_html_style_element object */ void _dom_html_style_element_destroy(struct dom_html_style_element *ele) { _dom_html_style_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_style_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_style_element_destroy(dom_node_internal *node) { _dom_html_style_element_destroy((struct dom_html_style_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_style_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* Public APIs */ #define SIMPLE_GET(attr) \ dom_exception dom_html_style_element_get_##attr( \ dom_html_style_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_style_element_set_##attr( \ dom_html_style_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(type); SIMPLE_GET_SET(media); /** * Get the disabled property * * \param ele The dom_html_style_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_style_element_get_disabled(dom_html_style_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_style_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_style_element_set_disabled(dom_html_style_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } netsurf-all-3.2/libdom/src/html/html_option_element.h0000644000175000017500000000346212377676745022060 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 John-Mark Bell */ #ifndef dom_internal_html_option_element_h_ #define dom_internal_html_option_element_h_ #include #include "html/html_element.h" struct dom_html_option_element { struct dom_html_element base; /**< The base class */ bool default_selected; /**< Initial selected value */ bool default_selected_set; /**< Whether default_selected has been set */ }; /* Create a dom_html_option_element object */ dom_exception _dom_html_option_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_option_element **ele); /* Initialise a dom_html_option_element object */ dom_exception _dom_html_option_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_option_element *ele); /* Finalise a dom_html_option_element object */ void _dom_html_option_element_finalise(struct dom_html_option_element *ele); /* Destroy a dom_html_option_element object */ void _dom_html_option_element_destroy(struct dom_html_option_element *ele); /* The protected virtual functions */ dom_exception _dom_html_option_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_option_element_destroy(dom_node_internal *node); dom_exception _dom_html_option_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_OPTION_ELEMENT_PROTECT_VTABLE \ _dom_html_option_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_OPTION_ELEMENT \ _dom_virtual_html_option_element_destroy, \ _dom_html_option_element_copy #endif netsurf-all-3.2/libdom/src/html/html_object_element.c0000644000175000017500000001570112377676745022010 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_object_element.h" #include "html/html_form_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_OBJECT_ELEMENT }, DOM_HTML_OBJECT_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_object_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_object_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_object_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_object_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_object_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_object_element object * * \param doc The document object * \param ele The dom_html_object_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_object_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_object_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_OBJECT], namespace, prefix); } /** * Finalise a dom_html_object_element object * * \param ele The dom_html_object_element object */ void _dom_html_object_element_finalise(struct dom_html_object_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_object_element object * * \param ele The dom_html_object_element object */ void _dom_html_object_element_destroy(struct dom_html_object_element *ele) { _dom_html_object_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_object_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_object_element_destroy(dom_node_internal *node) { _dom_html_object_element_destroy((struct dom_html_object_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_object_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_object_element_get_##attr( \ dom_html_object_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_object_element_set_##attr( \ dom_html_object_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(code); SIMPLE_GET_SET(align); SIMPLE_GET_SET(archive); SIMPLE_GET_SET(border); SIMPLE_GET_SET(code_base); SIMPLE_GET_SET(code_type); SIMPLE_GET_SET(data); SIMPLE_GET_SET(height); SIMPLE_GET_SET(name); SIMPLE_GET_SET(standby); SIMPLE_GET_SET(type); SIMPLE_GET_SET(use_map); SIMPLE_GET_SET(width); dom_exception dom_html_object_element_get_hspace( dom_html_object_element *object, int32_t *hspace) { return dom_html_element_get_int32_t_property(&object->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_object_element_set_hspace( dom_html_object_element *object, uint32_t hspace) { return dom_html_element_set_int32_t_property(&object->base, "hspace", SLEN("hspace"), hspace); } dom_exception dom_html_object_element_get_vspace( dom_html_object_element *object, int32_t *vspace) { return dom_html_element_get_int32_t_property(&object->base, "vspace", SLEN("vspace"), vspace); } dom_exception dom_html_object_element_set_vspace( dom_html_object_element *object, uint32_t vspace) { return dom_html_element_set_int32_t_property(&object->base, "vspace", SLEN("vspace"), vspace); } dom_exception dom_html_object_element_get_tab_index( dom_html_object_element *object, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&object->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_object_element_set_tab_index( dom_html_object_element *object, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&object->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_object_element_get_declare(dom_html_object_element *ele, bool *declare) { return dom_html_element_get_bool_property(&ele->base, "declare", SLEN("declare"), declare); } dom_exception dom_html_object_element_set_declare(dom_html_object_element *ele, bool declare) { return dom_html_element_set_bool_property(&ele->base, "declare", SLEN("declare"), declare); } dom_exception dom_html_object_element_get_form( dom_html_object_element *object, dom_html_form_element **form) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) object)->owner; dom_node_internal *form_tmp = ((dom_node_internal *) object)->parent; while (form_tmp != NULL) { if (form_tmp->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(form_tmp->name, doc->memoised[hds_FORM])) break; form_tmp = form_tmp->parent; } if (form_tmp != NULL) { *form = (dom_html_form_element *) form_tmp; return DOM_NO_ERR; } *form = NULL; return DOM_NO_ERR; } dom_exception dom_html_object_element_get_content_document( dom_html_object_element *object, dom_document **content_document) { *content_document = (((dom_node_internal *) object)->owner); return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/html/html_collection.h0000644000175000017500000000265712377676745021177 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_collection_h_ #define dom_internal_html_collection_h_ #include struct dom_node_internal; typedef bool (*dom_callback_is_in_collection)( struct dom_node_internal *node, void *ctx); /** * The html_collection structure */ struct dom_html_collection { dom_callback_is_in_collection ic; /**< The function pointer used to test * whether some node is an element of * this collection */ void *ctx; /**< Context for the callback */ struct dom_html_document *doc; /**< The document created this * collection */ struct dom_node_internal *root; /**< The root node of this collection */ uint32_t refcnt; /**< Reference counting */ }; dom_exception _dom_html_collection_create(struct dom_html_document *doc, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx, struct dom_html_collection **col); dom_exception _dom_html_collection_initialise(struct dom_html_document *doc, struct dom_html_collection *col, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx); void _dom_html_collection_finalise(struct dom_html_collection *col); void _dom_html_collection_destroy(struct dom_html_collection *col); #endif netsurf-all-3.2/libdom/src/html/html_legend_element.c0000644000175000017500000001340212377676745021774 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include #include "html/html_document.h" #include "html/html_legend_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_LEGEND_ELEMENT }, DOM_HTML_LEGEND_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_legend_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_legend_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_legend_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_legend_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_legend_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_legend_element object * * \param doc The document object * \param ele The dom_html_legend_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_legend_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_legend_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_LEGEND], namespace, prefix); } /** * Finalise a dom_html_legend_element object * * \param ele The dom_html_legend_element object */ void _dom_html_legend_element_finalise(struct dom_html_legend_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_legend_element object * * \param ele The dom_html_legend_element object */ void _dom_html_legend_element_destroy(struct dom_html_legend_element *ele) { _dom_html_legend_element_finalise(ele); free(ele); } /** * Get the dom_html_form_element object * * \param legend The dom_html_legend_element object * \param form The returned dom_html_form_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_legend_element_get_form( dom_html_legend_element *legend, dom_html_form_element **form) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) legend)->owner; dom_node_internal *field_set = ((dom_node_internal *) legend)->parent; /* Search ancestor chain for FIELDSET element */ while (field_set != NULL) { if (field_set->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(field_set->name, doc->memoised[hds_FIELDSET])) break; field_set = field_set->parent; } if (field_set != NULL) { return dom_html_field_set_element_get_form((dom_html_field_set_element *) field_set, form); } *form = NULL; return DOM_NO_ERR; } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_legend_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_legend_element_destroy(dom_node_internal *node) { _dom_html_legend_element_destroy((struct dom_html_legend_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_legend_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_legend_element_get_##attr( \ dom_html_legend_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_legend_element_set_##attr( \ dom_html_legend_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_SET(align); dom_exception dom_html_legend_element_get_align( dom_html_legend_element *legend, dom_string **align) { dom_exception err; dom_html_document *doc = (dom_html_document *) ((dom_node_internal *)legend)->owner; err = dom_element_get_attribute(legend, doc->memoised[hds_align], align); if (err != DOM_NO_ERR) return err; if (*align == NULL) { err = dom_string_create((const uint8_t *) "none", SLEN("none"), align); } return err; } netsurf-all-3.2/libdom/src/html/html_br_element.h0000644000175000017500000000323312377676745021147 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_br_element_h_ #define dom_internal_html_br_element_h_ #include #include "html/html_element.h" struct dom_html_br_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_br_element object */ dom_exception _dom_html_br_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_br_element **ele); /* Initialise a dom_html_br_element object */ dom_exception _dom_html_br_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_br_element *ele); /* Finalise a dom_html_br_element object */ void _dom_html_br_element_finalise(struct dom_html_br_element *ele); /* Destroy a dom_html_br_element object */ void _dom_html_br_element_destroy(struct dom_html_br_element *ele); /* The protected virtual functions */ dom_exception _dom_html_br_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_br_element_destroy(dom_node_internal *node); dom_exception _dom_html_br_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_BR_ELEMENT_PROTECT_VTABLE \ _dom_html_br_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_BR_ELEMENT \ _dom_virtual_html_br_element_destroy, \ _dom_html_br_element_copy #endif netsurf-all-3.2/libdom/src/html/html_button_element.h0000644000175000017500000000364612377676745022067 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #ifndef dom_internal_html_button_element_h_ #define dom_internal_html_button_element_h_ #include #include "html/html_element.h" struct dom_html_button_element { struct dom_html_element base; /**< The base class */ struct dom_html_form_element *form; /**< The form associated with the button */ }; /* Create a dom_html_button_element object */ dom_exception _dom_html_button_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_button_element **ele); /* Initialise a dom_html_button_element object */ dom_exception _dom_html_button_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_button_element *ele); /* Finalise a dom_html_button_element object */ void _dom_html_button_element_finalise(struct dom_html_button_element *ele); /* Destroy a dom_html_button_element object */ void _dom_html_button_element_destroy(struct dom_html_button_element *ele); /* The protected virtual functions */ dom_exception _dom_html_button_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_button_element_destroy(dom_node_internal *node); dom_exception _dom_html_button_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_BUTTON_ELEMENT_PROTECT_VTABLE \ _dom_html_button_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_BUTTON_ELEMENT \ _dom_virtual_html_button_element_destroy, \ _dom_html_button_element_copy /* Internal function for bindings */ dom_exception _dom_html_button_element_set_form( dom_html_button_element *button, dom_html_form_element *form); #endif netsurf-all-3.2/libdom/src/html/html_fieldset_element.h0000644000175000017500000000346112377676745022346 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_field_set_element_h_ #define dom_internal_html_field_set_element_h_ #include #include "html/html_element.h" struct dom_html_field_set_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_field_set_element object */ dom_exception _dom_html_field_set_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_field_set_element **ele); /* Initialise a dom_html_field_set_element object */ dom_exception _dom_html_field_set_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_field_set_element *ele); /* Finalise a dom_html_field_set_element object */ void _dom_html_field_set_element_finalise(struct dom_html_field_set_element *ele); /* Destroy a dom_html_field_set_element object */ void _dom_html_field_set_element_destroy(struct dom_html_field_set_element *ele); /* The protected virtual functions */ dom_exception _dom_html_field_set_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_field_set_element_destroy(dom_node_internal *node); dom_exception _dom_html_field_set_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_FIELDSET_ELEMENT_PROTECT_VTABLE \ _dom_html_field_set_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_FIELDSET_ELEMENT \ _dom_virtual_html_field_set_element_destroy, \ _dom_html_field_set_element_copy #endif netsurf-all-3.2/libdom/src/html/html_menu_element.h0000644000175000017500000000331312377676745021507 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_menu_element_h_ #define dom_internal_html_menu_element_h_ #include #include "html/html_element.h" struct dom_html_menu_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_menu_element object */ dom_exception _dom_html_menu_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_menu_element **ele); /* Initialise a dom_html_menu_element object */ dom_exception _dom_html_menu_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_menu_element *ele); /* Finalise a dom_html_menu_element object */ void _dom_html_menu_element_finalise(struct dom_html_menu_element *ele); /* Destroy a dom_html_menu_element object */ void _dom_html_menu_element_destroy(struct dom_html_menu_element *ele); /* The protected virtual functions */ dom_exception _dom_html_menu_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_menu_element_destroy(dom_node_internal *node); dom_exception _dom_html_menu_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_MENU_ELEMENT_PROTECT_VTABLE \ _dom_html_menu_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_MENU_ELEMENT \ _dom_virtual_html_menu_element_destroy, \ _dom_html_menu_element_copy #endif netsurf-all-3.2/libdom/src/html/html_document.h0000644000175000017500000001434512377676745020657 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_document_h_ #define dom_internal_html_document_h_ #include #include #include "core/document.h" /** * The dom_html_document class */ struct dom_html_document { struct dom_document base; /**< The base class */ dom_string *title; /**< HTML document title */ dom_string *referrer; /**< HTML document referrer */ dom_string *domain; /**< HTML document domain */ dom_string *url; /**< HTML document URL */ dom_string *cookie; /**< HTML document cookie */ dom_html_element *body; /**< HTML BodyElement */ /** Cached strings for html objects to use */ dom_string **memoised; }; #include "html_document_strings.h" /* Create a HTMLDocument */ dom_exception _dom_html_document_create( dom_events_default_action_fetcher daf, void *daf_ctx, dom_html_document **doc); /* Initialise a HTMLDocument */ dom_exception _dom_html_document_initialise( dom_html_document *doc, dom_events_default_action_fetcher daf, void *daf_ctx); /* Finalise a HTMLDocument */ bool _dom_html_document_finalise(dom_html_document *doc); void _dom_html_document_destroy(dom_node_internal *node); dom_exception _dom_html_document_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_DOCUMENT_PROTECT_VTABLE \ _dom_html_document_destroy, \ _dom_html_document_copy dom_exception _dom_html_document_get_title(dom_html_document *doc, dom_string **title); dom_exception _dom_html_document_set_title(dom_html_document *doc, dom_string *title); dom_exception _dom_html_document_get_referrer(dom_html_document *doc, dom_string **referrer); dom_exception _dom_html_document_get_domain(dom_html_document *doc, dom_string **domain); dom_exception _dom_html_document_get_url(dom_html_document *doc, dom_string **url); dom_exception _dom_html_document_get_body(dom_html_document *doc, struct dom_html_element **body); dom_exception _dom_html_document_set_body(dom_html_document *doc, struct dom_html_element *body); dom_exception _dom_html_document_get_images(dom_html_document *doc, struct dom_html_collection **col); dom_exception _dom_html_document_get_applets(dom_html_document *doc, struct dom_html_collection **col); dom_exception _dom_html_document_get_links(dom_html_document *doc, struct dom_html_collection **col); dom_exception _dom_html_document_get_forms(dom_html_document *doc, struct dom_html_collection **col); dom_exception _dom_html_document_get_anchors(dom_html_document *doc, struct dom_html_collection **col); dom_exception _dom_html_document_get_cookie(dom_html_document *doc, dom_string **cookie); dom_exception _dom_html_document_set_cookie(dom_html_document *doc, dom_string *cookie); dom_exception _dom_html_document_open(dom_html_document *doc); dom_exception _dom_html_document_close(dom_html_document *doc); dom_exception _dom_html_document_write(dom_html_document *doc, dom_string *text); dom_exception _dom_html_document_writeln(dom_html_document *doc, dom_string *text); dom_exception _dom_html_document_get_elements_by_name(dom_html_document *doc, dom_string *name, struct dom_nodelist **list); #define DOM_HTML_DOCUMENT_VTABLE \ _dom_html_document_get_title, \ _dom_html_document_set_title, \ _dom_html_document_get_referrer, \ _dom_html_document_get_domain, \ _dom_html_document_get_url, \ _dom_html_document_get_body, \ _dom_html_document_set_body, \ _dom_html_document_get_images, \ _dom_html_document_get_applets, \ _dom_html_document_get_links, \ _dom_html_document_get_forms, \ _dom_html_document_get_anchors, \ _dom_html_document_get_cookie, \ _dom_html_document_set_cookie, \ _dom_html_document_open, \ _dom_html_document_close, \ _dom_html_document_write, \ _dom_html_document_writeln, \ _dom_html_document_get_elements_by_name dom_exception _dom_html_document_create_element(dom_document *doc, dom_string *tag_name, dom_element **result); dom_exception _dom_html_document_create_element_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_element **result); dom_exception _dom_html_document_get_elements_by_tag_name(dom_document *doc, dom_string *tagname, dom_nodelist **result); dom_exception _dom_html_document_get_elements_by_tag_name_ns( dom_document *doc, dom_string *namespace, dom_string *localname, dom_nodelist **result); dom_exception _dom_html_document_create_attribute(dom_document *doc, dom_string *name, dom_attr **result); dom_exception _dom_html_document_create_attribute_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_attr **result); bool images_callback(struct dom_node_internal *node, void *ctx); bool applets_callback(struct dom_node_internal *node, void *ctx); bool applet_callback(struct dom_node_internal *node, void *ctx); bool links_callback(struct dom_node_internal *node, void *ctx); bool anchors_callback(struct dom_node_internal *node, void *ctx); #define DOM_DOCUMENT_VTABLE_HTML \ _dom_document_get_doctype, \ _dom_document_get_implementation, \ _dom_document_get_document_element, \ _dom_html_document_create_element, \ _dom_document_create_document_fragment, \ _dom_document_create_text_node, \ _dom_document_create_comment, \ _dom_document_create_cdata_section, \ _dom_document_create_processing_instruction, \ _dom_html_document_create_attribute, \ _dom_document_create_entity_reference, \ _dom_html_document_get_elements_by_tag_name, \ _dom_document_import_node, \ _dom_html_document_create_element_ns, \ _dom_html_document_create_attribute_ns, \ _dom_html_document_get_elements_by_tag_name_ns, \ _dom_document_get_element_by_id, \ _dom_document_get_input_encoding, \ _dom_document_get_xml_encoding, \ _dom_document_get_xml_standalone, \ _dom_document_set_xml_standalone, \ _dom_document_get_xml_version, \ _dom_document_set_xml_version, \ _dom_document_get_strict_error_checking, \ _dom_document_set_strict_error_checking, \ _dom_document_get_uri, \ _dom_document_set_uri, \ _dom_document_adopt_node, \ _dom_document_get_dom_config, \ _dom_document_normalize, \ _dom_document_rename_node, \ _dom_document_get_quirks_mode, \ _dom_document_set_quirks_mode #endif netsurf-all-3.2/libdom/src/html/html_button_element.c0000644000175000017500000001377112377676745022062 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #include #include #include #include "html/html_document.h" #include "html/html_button_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_BUTTON_ELEMENT }, DOM_HTML_BUTTON_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_button_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_button_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_button_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_button_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_button_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_button_element object * * \param doc The document object * \param ele The dom_html_button_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_button_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_button_element *ele) { ele->form = NULL; return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_BUTTON], namespace, prefix); } /** * Finalise a dom_html_button_element object * * \param ele The dom_html_button_element object */ void _dom_html_button_element_finalise(struct dom_html_button_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_button_element object * * \param ele The dom_html_button_element object */ void _dom_html_button_element_destroy(struct dom_html_button_element *ele) { _dom_html_button_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the disabled property * * \param ele The dom_html_button_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_button_element_get_disabled(dom_html_button_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_button_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_button_element_set_disabled(dom_html_button_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_button_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_button_element_destroy(dom_node_internal *node) { _dom_html_button_element_destroy((struct dom_html_button_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_button_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_button_element_get_##attr( \ dom_html_button_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_button_element_set_##attr( \ dom_html_button_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(name); SIMPLE_GET(type); SIMPLE_GET_SET(value); dom_exception dom_html_button_element_get_tab_index( dom_html_button_element *button, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&button->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_button_element_set_tab_index( dom_html_button_element *button, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&button->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_button_element_get_form( dom_html_button_element *button, dom_html_form_element **form) { *form = button->form; if (*form != NULL) dom_node_ref(*form); return DOM_NO_ERR; } dom_exception _dom_html_button_element_set_form( dom_html_button_element *button, dom_html_form_element *form) { button->form = form; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/html/html_ulist_element.h0000644000175000017500000000337212377676746021711 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_u_list_element_h_ #define dom_internal_html_u_list_element_h_ #include #include "html/html_element.h" struct dom_html_u_list_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_u_list_element object */ dom_exception _dom_html_u_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_u_list_element **ele); /* Initialise a dom_html_u_list_element object */ dom_exception _dom_html_u_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_u_list_element *ele); /* Finalise a dom_html_u_list_element object */ void _dom_html_u_list_element_finalise(struct dom_html_u_list_element *ele); /* Destroy a dom_html_u_list_element object */ void _dom_html_u_list_element_destroy(struct dom_html_u_list_element *ele); /* The protected virtual functions */ dom_exception _dom_html_u_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_u_list_element_destroy(dom_node_internal *node); dom_exception _dom_html_u_list_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_U_LIST_ELEMENT_PROTECT_VTABLE \ _dom_html_u_list_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_U_LIST_ELEMENT \ _dom_virtual_html_u_list_element_destroy, \ _dom_html_u_list_element_copy #endif netsurf-all-3.2/libdom/src/html/html_object_element.h0000644000175000017500000000335512377676745022017 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_object_element_h_ #define dom_internal_html_object_element_h_ #include #include "html/html_element.h" struct dom_html_object_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_object_element object */ dom_exception _dom_html_object_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_object_element **ele); /* Initialise a dom_html_object_element object */ dom_exception _dom_html_object_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_object_element *ele); /* Finalise a dom_html_object_element object */ void _dom_html_object_element_finalise(struct dom_html_object_element *ele); /* Destroy a dom_html_object_element object */ void _dom_html_object_element_destroy(struct dom_html_object_element *ele); /* The protected virtual functions */ dom_exception _dom_html_object_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_object_element_destroy(dom_node_internal *node); dom_exception _dom_html_object_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_OBJECT_ELEMENT_PROTECT_VTABLE \ _dom_html_object_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_OBJECT_ELEMENT \ _dom_virtual_html_object_element_destroy, \ _dom_html_object_element_copy #endif netsurf-all-3.2/libdom/src/html/html_olist_element.h0000644000175000017500000000340012377676745021672 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_o_list_element_h_ #define dom_internal_html_o_list_element_h_ #include #include "html/html_element.h" struct dom_html_o_list_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_o_list_element object */ dom_exception _dom_html_o_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *o_listfix, struct dom_html_o_list_element **ele); /* Initialise a dom_html_o_list_element object */ dom_exception _dom_html_o_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *o_listfix, struct dom_html_o_list_element *ele); /* Finalise a dom_html_o_list_element object */ void _dom_html_o_list_element_finalise(struct dom_html_o_list_element *ele); /* Destroy a dom_html_o_list_element object */ void _dom_html_o_list_element_destroy(struct dom_html_o_list_element *ele); /* The protected virtual functions */ dom_exception _dom_html_o_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_o_list_element_destroy(dom_node_internal *node); dom_exception _dom_html_o_list_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_O_LIST_ELEMENT_PROTECT_VTABLE \ _dom_html_o_list_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_O_LIST_ELEMENT \ _dom_virtual_html_o_list_element_destroy, \ _dom_html_o_list_element_copy #endif netsurf-all-3.2/libdom/src/html/html_collection.c0000644000175000017500000001534112377676745021164 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include "html/html_collection.h" #include "html/html_document.h" #include "core/node.h" #include "core/element.h" #include "core/string.h" /*-----------------------------------------------------------------------*/ /* Constructor and destructor */ /** * Create a dom_html_collection * * \param doc The document * \param root The root element of the collection * \param ic The callback function used to determin whether certain node * belongs to the collection * \param col The result collection object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_collection_create(struct dom_html_document *doc, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx, struct dom_html_collection **col) { *col = malloc(sizeof(dom_html_collection)); if (*col == NULL) return DOM_NO_MEM_ERR; return _dom_html_collection_initialise(doc, *col, root, ic, ctx); } /** * Intialiase a dom_html_collection * * \param doc The document * \param col The collection object to be initialised * \param root The root element of the collection * \param ic The callback function used to determin whether certain node * beint32_ts to the collection * \return DOM_NO_ERR on success. */ dom_exception _dom_html_collection_initialise(struct dom_html_document *doc, struct dom_html_collection *col, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx) { assert(doc != NULL); assert(ic != NULL); assert(root != NULL); col->doc = doc; dom_node_ref(doc); col->root = root; dom_node_ref(root); col->ic = ic; col->ctx = ctx; col->refcnt = 1; return DOM_NO_ERR; } /** * Finalise a dom_html_collection object * * \param col The dom_html_collection object */ void _dom_html_collection_finalise(struct dom_html_collection *col) { dom_node_unref(col->doc); col->doc = NULL; dom_node_unref(col->root); col->root = NULL; col->ic = NULL; } /** * Destroy a dom_html_collection object * \param col The dom_html_collection object */ void _dom_html_collection_destroy(struct dom_html_collection *col) { _dom_html_collection_finalise(col); free(col); } /*-----------------------------------------------------------------------*/ /* Public API */ /** * Get the length of this dom_html_collection * * \param col The dom_html_collection object * \param len The returned length of this collection * \return DOM_NO_ERR on success. */ dom_exception dom_html_collection_get_length(dom_html_collection *col, uint32_t *len) { struct dom_node_internal *node = col->root; *len = 0; while (node != NULL) { if (node->type == DOM_ELEMENT_NODE && col->ic(node, col->ctx) == true) (*len)++; /* Depth first iterating */ if (node->first_child != NULL) { node = node->first_child; } else if (node->next != NULL) { node = node->next; } else { /* No children and siblings */ struct dom_node_internal *parent = node->parent; while (node != col->root && node == parent->last_child) { node = parent; parent = parent->parent; } if (node == col->root) node = NULL; else node = node->next; } } return DOM_NO_ERR; } /** * Get the node with certain index * * \param col The dom_html_collection object * \param index The index number based on zero * \param node The returned node object * \return DOM_NO_ERR on success. */ dom_exception dom_html_collection_item(dom_html_collection *col, uint32_t index, struct dom_node **node) { struct dom_node_internal *n = col->root; uint32_t len = 0; while (n != NULL) { if (n->type == DOM_ELEMENT_NODE && col->ic(n, col->ctx) == true) len++; if (len == index + 1) { dom_node_ref(n); *node = (struct dom_node *) n; return DOM_NO_ERR; } /* Depth first iterating */ if (n->first_child != NULL) { n = n->first_child; } else if (n->next != NULL) { n = n->next; } else { /* No children and siblings */ struct dom_node_internal *parent = n->parent; while (n != col->root && n == parent->last_child) { n = parent; parent = parent->parent; } if (n == col->root) n = NULL; else n = n->next; } } /* Not find the node */ *node = NULL; return DOM_NO_ERR; } /** * Get the node in the collection according name * * \param col The collection * \param name The name of target node * \param node The returned node object * \return DOM_NO_ERR on success. */ dom_exception dom_html_collection_named_item(dom_html_collection *col, dom_string *name, struct dom_node **node) { struct dom_node_internal *n = col->root; dom_html_document *doc = (dom_html_document *)dom_node_get_owner(n); dom_exception err; while (n != NULL) { if (n->type == DOM_ELEMENT_NODE && col->ic(n, col->ctx) == true) { dom_string *id = NULL; err = _dom_element_get_id((struct dom_element *) n, &id); if (err != DOM_NO_ERR) { return err; } if (id != NULL && dom_string_isequal(name, id)) { *node = (struct dom_node *) n; dom_node_ref(n); dom_string_unref(id); return DOM_NO_ERR; } if (id != NULL) dom_string_unref(id); /* Check for Name attr if id not matched/found */ dom_string *id_name = NULL; err = _dom_element_get_attribute((dom_element *)n, doc->memoised[hds_name], &id_name); if(err != DOM_NO_ERR) { return err; } if (id_name != NULL && dom_string_isequal(name, id_name)) { *node = (struct dom_node *) n; dom_node_ref(n); dom_string_unref(id_name); return DOM_NO_ERR; } } /* Depth first iterating */ if (n->first_child != NULL) { n = n->first_child; } else if (n->next != NULL) { n = n->next; } else { /* No children and siblings */ struct dom_node_internal *parent = n->parent; while (n != col->root && n == parent->last_child) { n = parent; parent = parent->parent; } if (n == col->root) n = NULL; else n = n->next; } } /* Not found the target node */ *node = NULL; return DOM_NO_ERR; } /** * Claim a reference on this collection * * \pram col The collection object */ void dom_html_collection_ref(dom_html_collection *col) { if (col == NULL) return; col->refcnt ++; } /** * Relese a reference on this collection * * \pram col The collection object */ void dom_html_collection_unref(dom_html_collection *col) { if (col == NULL) return; if (col->refcnt > 0) col->refcnt --; if (col->refcnt == 0) _dom_html_collection_destroy(col); } netsurf-all-3.2/libdom/src/html/html_form_element.c0000644000175000017500000002003512377676745021501 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include "html/html_form_element.h" #include "html/html_input_element.h" #include "html/html_select_element.h" #include "html/html_text_area_element.h" #include "html/html_button_element.h" #include "html/html_collection.h" #include "html/html_document.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_FORM_ELEMENT }, DOM_HTML_FORM_ELEMENT_PROTECT_VTABLE }; static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx); /** * Create a dom_html_form_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_form_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_form_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_form_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_form_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_form_element object * * \param doc The document object * \param ele The dom_html_form_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_form_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_form_element *ele) { dom_exception err; err = _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_FORM], namespace, prefix); return err; } /** * Finalise a dom_html_form_element object * * \param ele The dom_html_form_element object */ void _dom_html_form_element_finalise(struct dom_html_form_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_form_element object * * \param ele The dom_html_form_element object */ void _dom_html_form_element_destroy(struct dom_html_form_element *ele) { _dom_html_form_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_form_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_form_element_destroy(dom_node_internal *node) { _dom_html_form_element_destroy((struct dom_html_form_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_form_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the form controls under this form element * * \param ele The form object * \param col The collection of form controls * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele, struct dom_html_collection **col) { dom_exception err; dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); assert(doc != NULL); err = _dom_html_collection_create(doc, (dom_node_internal *) doc, _dom_is_form_control, ele, col); return err; } /** * Get the number of form controls under this form element * * \param ele The form object * \param len The number of controls * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_form_element_get_length(dom_html_form_element *ele, uint32_t *len) { dom_exception err; dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); dom_html_collection *col; assert(doc != NULL); err = _dom_html_collection_create(doc, (dom_node_internal *) doc, _dom_is_form_control, ele, &col); if (err != DOM_NO_ERR) return err; err = dom_html_collection_get_length(col, len); dom_html_collection_unref(col); return err; } #define SIMPLE_GET_SET(attr) \ dom_exception dom_html_form_element_get_##attr( \ dom_html_form_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } \ \ dom_exception dom_html_form_element_set_##attr( \ dom_html_form_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } SIMPLE_GET_SET(accept_charset) SIMPLE_GET_SET(action) SIMPLE_GET_SET(enctype) SIMPLE_GET_SET(method) SIMPLE_GET_SET(target) /** * Submit this form * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_form_element_submit(dom_html_form_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* Dispatch an event and let the default action handler to deal with * the submit action, and a 'submit' event is bubbling and cancelable */ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_submit], true, true, &success); } /** * Reset this form * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_form_element_reset(dom_html_form_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* Dispatch an event and let the default action handler to deal with * the reset action, and a 'reset' event is bubbling and cancelable */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_reset], true, true, &success); } /*-----------------------------------------------------------------------*/ /* Internal functions */ /* Callback function to test whether certain node is a form control, see * src/html/html_collection.h for detail. */ static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx) { struct dom_html_document *doc = (struct dom_html_document *)(node->owner); struct dom_html_form_element *form = ctx; assert(node->type == DOM_ELEMENT_NODE); /* Form controls are INPUT TEXTAREA SELECT and BUTTON*/ if (dom_string_caseless_isequal(node->name, doc->memoised[hds_INPUT])) return ((dom_html_input_element *)node)->form == form; if (dom_string_caseless_isequal(node->name, doc->memoised[hds_TEXTAREA])) return ((dom_html_text_area_element *)node)->form == form; if (dom_string_caseless_isequal(node->name, doc->memoised[hds_SELECT])) return ((dom_html_select_element *)node)->form == form; if (dom_string_caseless_isequal(node->name, doc->memoised[hds_BUTTON])) { return ((dom_html_button_element *)node)->form == form; } return false; } netsurf-all-3.2/libdom/src/html/html_label_element.c0000644000175000017500000001211512377676745021615 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include "html/html_document.h" #include "html/html_label_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_LABEL_ELEMENT }, DOM_HTML_LABEL_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_label_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_label_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_label_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_label_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_label_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_label_element object * * \param doc The document object * \param ele The dom_html_label_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_label_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_label_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_LABEL], namespace, prefix); } /** * Finalise a dom_html_label_element object * * \param ele The dom_html_label_element object */ void _dom_html_label_element_finalise(struct dom_html_label_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_label_element object * * \param ele The dom_html_label_element object */ void _dom_html_label_element_destroy(struct dom_html_label_element *ele) { _dom_html_label_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_label_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_label_element_destroy(dom_node_internal *node) { _dom_html_label_element_destroy((struct dom_html_label_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_label_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /** * Get the dom_html_form_element object * * \param label The dom_html_label_element object * \param form The returned dom_htmlform_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_label_element_get_form( dom_html_label_element *label, dom_html_form_element **form) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) label)->owner; dom_node_internal *form_tmp = ((dom_node_internal *) label)->parent; /* Search ancestor chain for FIELDSET element */ while (form_tmp != NULL) { if (form_tmp->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(form_tmp->name, doc->memoised[hds_FORM])) break; form_tmp = form_tmp->parent; } if (form_tmp != NULL) { *form = (dom_html_form_element *) form_tmp; return DOM_NO_ERR; } *form = NULL; return DOM_NO_ERR; } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_label_element_get_##attr( \ dom_html_label_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_label_element_set_##attr( \ dom_html_label_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(html_for); netsurf-all-3.2/libdom/src/html/html_area_element.c0000644000175000017500000001410412377676745021446 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_area_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_AREA_ELEMENT }, DOM_HTML_AREA_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_area_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_area_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_area_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_area_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_area_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_area_element object * * \param doc The document object * \param ele The dom_html_area_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_area_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_area_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_AREA], namespace, prefix); } /** * Finalise a dom_html_area_element object * * \param ele The dom_html_area_element object */ void _dom_html_area_element_finalise(struct dom_html_area_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_area_element object * * \param ele The dom_html_area_element object */ void _dom_html_area_element_destroy(struct dom_html_area_element *ele) { _dom_html_area_element_finalise(ele); free(ele); } /** * Get the no_href property * * \param ele The dom_html_area_element object * \param no_href The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_area_element_get_no_href(dom_html_area_element *ele, bool *no_href) { return dom_html_element_get_bool_property(&ele->base, "nohref", SLEN("nohref"), no_href); } /** * Set the no_href property * * \param ele The dom_html_area_element object * \param no_href The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_area_element_set_no_href(dom_html_area_element *ele, bool no_href) { return dom_html_element_set_bool_property(&ele->base, "nohref", SLEN("nohref"), no_href); } /** * Set the tab_index property * * \param ele The dom_html_area_element object * \param no_href The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_area_element_get_tab_index( dom_html_area_element *area, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&area->base, "tabindex", SLEN("tabindex"), tab_index); } /** * Set the tab_index property * * \param ele The dom_html_area_element object * \param no_href The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_area_element_set_tab_index( dom_html_area_element *area, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&area->base, "tabindex", SLEN("tabindex"), tab_index); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_area_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_area_element_destroy(dom_node_internal *node) { _dom_html_area_element_destroy((struct dom_html_area_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_area_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_area_element_get_##attr( \ dom_html_area_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_area_element_set_##attr( \ dom_html_area_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(alt); SIMPLE_GET_SET(coords); SIMPLE_GET_SET(href); SIMPLE_GET_SET(shape); SIMPLE_GET_SET(target); netsurf-all-3.2/libdom/src/html/html_frameset_element.h0000644000175000017500000000350212377676745022351 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_frame_set_element_h_ #define dom_internal_html_frame_set_element_h_ #include #include "html/html_element.h" struct dom_html_frame_set_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_frame_set_element object */ dom_exception _dom_html_frame_set_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_set_element **ele); /* Initialise a dom_html_frame_set_element object */ dom_exception _dom_html_frame_set_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_set_element *ele); /* Finalise a dom_html_frame_set_element object */ void _dom_html_frame_set_element_finalise(struct dom_html_frame_set_element *ele); /* Destroy a dom_html_frame_set_element object */ void _dom_html_frame_set_element_destroy(struct dom_html_frame_set_element *ele); /* The protected virtual functions */ dom_exception _dom_html_frame_set_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_frame_set_element_destroy(dom_node_internal *node); dom_exception _dom_html_frame_set_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_FRAME_SET_ELEMENT_PROTECT_VTABLE \ _dom_html_frame_set_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_FRAME_SET_ELEMENT \ _dom_virtual_html_frame_set_element_destroy, \ _dom_html_frame_set_element_copy #endif netsurf-all-3.2/libdom/src/html/html_element.c0000644000175000017500000002371112377676745020462 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include #include #include "html/html_document.h" #include "html/html_element.h" #include "core/node.h" #include "core/attr.h" #include "core/document.h" #include "utils/utils.h" struct dom_html_element_vtable _dom_html_element_vtable = { { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE_ELEMENT, }, DOM_ELEMENT_VTABLE_HTML_ELEMENT, }, DOM_HTML_ELEMENT_VTABLE }; static struct dom_element_protected_vtable _dom_html_element_protect_vtable = { { DOM_HTML_ELEMENT_PROTECT_VTABLE }, DOM_ELEMENT_PROTECT_VTABLE }; dom_exception _dom_html_element_create(struct dom_html_document *doc, dom_string *name, dom_string *namespace, dom_string *prefix, struct dom_html_element **result) { dom_exception error; dom_html_element *el; el = malloc(sizeof(struct dom_html_element)); if (el == NULL) return DOM_NO_MEM_ERR; el->base.base.base.vtable = &_dom_html_element_vtable; el->base.base.vtable = &_dom_html_element_protect_vtable; error = _dom_html_element_initialise(doc, el, name, namespace, prefix); if (error != DOM_NO_ERR) { free(el); return error; } *result = el; return DOM_NO_ERR; } dom_exception _dom_html_element_initialise(struct dom_html_document *doc, struct dom_html_element *el, dom_string *name, dom_string *namespace, dom_string *prefix) { dom_exception err; err = _dom_element_initialise(&doc->base, &el->base, name, namespace, prefix); if (err != DOM_NO_ERR) return err; return err; } void _dom_html_element_finalise(struct dom_html_element *ele) { _dom_element_finalise(&ele->base); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual destroy function, see src/core/node.c for detail */ void _dom_html_element_destroy(dom_node_internal *node) { dom_html_element *html = (dom_html_element *) node; _dom_html_element_finalise(html); free(html); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET_SET(fattr,attr) \ dom_exception _dom_html_element_get_##fattr(dom_html_element *element, \ dom_string **fattr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, fattr); \ \ return ret; \ } \ \ dom_exception _dom_html_element_set_##fattr(dom_html_element *element, \ dom_string *fattr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, fattr); \ \ return ret; \ } SIMPLE_GET_SET(id,id) SIMPLE_GET_SET(title,title) SIMPLE_GET_SET(lang,lang) SIMPLE_GET_SET(dir,dir) SIMPLE_GET_SET(class_name,class) /** * Retrieve a list of descendant elements of an element which match a given * tag name (caselessly) * * \param element The root of the subtree to search * \param name The tag name to match (or "*" for all tags) * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned nodelist will have its reference count increased. It is * the responsibility of the caller to unref the nodelist once it has * finished with it. */ dom_exception _dom_html_element_get_elements_by_tag_name( struct dom_element *element, dom_string *name, struct dom_nodelist **result) { dom_exception err; dom_node_internal *base = (dom_node_internal *) element; assert(base->owner != NULL); err = _dom_document_get_nodelist(base->owner, DOM_NODELIST_BY_NAME_CASELESS, (struct dom_node_internal *) element, name, NULL, NULL, result); return err; } /** * Retrieve a list of descendant elements of an element which match a given * namespace/localname pair, caselessly. * * \param element The root of the subtree to search * \param namespace The namespace URI to match (or "*" for all) * \param localname The local name to match (or "*" for all) * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NOT_SUPPORTED_ERR if the implementation does not support * the feature "XML" and the language exposed * through the Document does not support * Namespaces. * * The returned nodelist will have its reference count increased. It is * the responsibility of the caller to unref the nodelist once it has * finished with it. */ dom_exception _dom_html_element_get_elements_by_tag_name_ns( struct dom_element *element, dom_string *namespace, dom_string *localname, struct dom_nodelist **result) { dom_exception err; /** \todo ensure XML feature is supported */ err = _dom_document_get_nodelist(element->base.owner, DOM_NODELIST_BY_NAMESPACE_CASELESS, (struct dom_node_internal *) element, NULL, namespace, localname, result); return err; } /*-----------------------------------------------------------------------*/ /* Common functions */ /** * Get the a bool property * * \param ele The dom_html_element object * \param name The name of the attribute * \param len The length of ::name * \param has The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_get_bool_property(dom_html_element *ele, const char *name, uint32_t len, bool *has) { dom_string *str = NULL; dom_attr *a = NULL; dom_exception err; err = dom_string_create((const uint8_t *) name, len, &str); if (err != DOM_NO_ERR) goto fail; err = dom_element_get_attribute_node(ele, str, &a); if (err != DOM_NO_ERR) goto cleanup1; if (a != NULL) { *has = true; } else { *has = false; } dom_node_unref(a); cleanup1: dom_string_unref(str); fail: return err; } /** * Set a bool property * * \param ele The dom_html_element object * \param name The name of the attribute * \param len The length of ::name * \param has The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_set_bool_property(dom_html_element *ele, const char *name, uint32_t len, bool has) { dom_string *str = NULL; dom_attr *a = NULL; dom_exception err; err = dom_string_create((const uint8_t *) name, len, &str); if (err != DOM_NO_ERR) goto fail; err = dom_element_get_attribute_node(ele, str, &a); if (err != DOM_NO_ERR) goto cleanup1; if (a != NULL && has == false) { dom_attr *res = NULL; err = dom_element_remove_attribute_node(ele, a, &res); if (err != DOM_NO_ERR) goto cleanup2; dom_node_unref(res); } else if (a == NULL && has == true) { dom_document *doc = dom_node_get_owner(ele); dom_attr *res = NULL; err = _dom_attr_create(doc, str, NULL, NULL, true, &a); if (err != DOM_NO_ERR) { goto cleanup1; } err = dom_element_set_attribute_node(ele, a, &res); if (err != DOM_NO_ERR) goto cleanup2; dom_node_unref(res); } cleanup2: dom_node_unref(a); cleanup1: dom_string_unref(str); fail: return err; } static char *_strndup(const char *s, size_t n) { size_t len; char *s2; for (len = 0; len != n && s[len] != '\0'; len++) continue; s2 = malloc(len + 1); if (s2 == NULL) return NULL; memcpy(s2, s, len); s2[len] = '\0'; return s2; } /** * Get the a int32_t property * * \param ele The dom_html_element object * \param name The name of the attribute * \param len The length of ::name * \param value The returned value, or -1 if prop. not set * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_get_int32_t_property(dom_html_element *ele, const char *name, uint32_t len, int32_t *value) { dom_string *str = NULL, *s2 = NULL; dom_attr *a = NULL; dom_exception err; err = dom_string_create((const uint8_t *) name, len, &str); if (err != DOM_NO_ERR) goto fail; err = dom_element_get_attribute_node(ele, str, &a); if (err != DOM_NO_ERR) goto cleanup1; if (a != NULL) { err = dom_node_get_text_content(a, &s2); if (err == DOM_NO_ERR) { char *s3 = _strndup(dom_string_data(s2), dom_string_byte_length(s2)); if (s3 != NULL) { *value = strtoul(s3, NULL, 0); free(s3); } else { err = DOM_NO_MEM_ERR; } dom_string_unref(s2); } } else { /* Property is not set on this node */ *value = -1; } dom_node_unref(a); cleanup1: dom_string_unref(str); fail: return err; } /** * Set a int32_t property * * \param ele The dom_html_element object * \param name The name of the attribute * \param len The length of ::name * \param value The value * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_element_set_int32_t_property(dom_html_element *ele, const char *name, uint32_t len, uint32_t value) { dom_string *str = NULL, *svalue = NULL; dom_exception err; char numbuffer[32]; err = dom_string_create((const uint8_t *) name, len, &str); if (err != DOM_NO_ERR) goto fail; if (snprintf(numbuffer, 32, "%u", value) == 32) numbuffer[31] = '\0'; err = dom_string_create((const uint8_t *) numbuffer, strlen(numbuffer), &svalue); if (err != DOM_NO_ERR) goto cleanup; err = dom_element_set_attribute(ele, svalue, str); dom_string_unref(svalue); cleanup: dom_string_unref(str); fail: return err; } netsurf-all-3.2/libdom/src/html/html_options_collection.h0000644000175000017500000000220712377676745022741 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_options_collection_h_ #define dom_internal_html_options_collection_h_ #include #include "html/html_collection.h" struct dom_node_internal; /** * The html_options_collection structure */ struct dom_html_options_collection { struct dom_html_collection base; /**< The base class */ }; dom_exception _dom_html_options_collection_create(struct dom_html_document *doc, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx, struct dom_html_options_collection **col); dom_exception _dom_html_options_collection_initialise(struct dom_html_document *doc, struct dom_html_options_collection *col, struct dom_node_internal *root, dom_callback_is_in_collection ic, void *ctx); void _dom_html_options_collection_finalise( struct dom_html_options_collection *col); void _dom_html_options_collection_destroy( struct dom_html_options_collection *col); #endif netsurf-all-3.2/libdom/src/html/html_hr_element.c0000644000175000017500000001210712377676745021150 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_hr_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_HR_ELEMENT }, DOM_HTML_HR_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_hr_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_hr_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_hr_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_hr_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_hr_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_hr_element object * * \param doc The document object * \param ele The dom_html_hr_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_hr_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_hr_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_HR], namespace, prefix); } /** * Finalise a dom_html_hr_element object * * \param ele The dom_html_hr_element object */ void _dom_html_hr_element_finalise(struct dom_html_hr_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_hr_element object * * \param ele The dom_html_hr_element object */ void _dom_html_hr_element_destroy(struct dom_html_hr_element *ele) { _dom_html_hr_element_finalise(ele); free(ele); } /** * Get the no_shade property * * \param ele The dom_html_hr_element object * \param no_shade The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_hr_element_get_no_shade(dom_html_hr_element *ele, bool *no_shade) { return dom_html_element_get_bool_property(&ele->base, "noshade", SLEN("noshade"), no_shade); } /** * Set the no_shade property * * \param ele The dom_html_hr_element object * \param no_shade The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_hr_element_set_no_shade(dom_html_hr_element *ele, bool no_shade) { return dom_html_element_set_bool_property(&ele->base, "noshade", SLEN("noshade"), no_shade); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_hr_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_hr_element_destroy(dom_node_internal *node) { _dom_html_hr_element_destroy((struct dom_html_hr_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_hr_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_hr_element_get_##attr( \ dom_html_hr_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_hr_element_set_##attr( \ dom_html_hr_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(size); SIMPLE_GET_SET(align); SIMPLE_GET_SET(width); netsurf-all-3.2/libdom/src/html/html_option_element.c0000644000175000017500000003002012377676745022041 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 John-Mark Bell */ #include #include #include #include #include #include "html/html_document.h" #include "html/html_option_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_OPTION_ELEMENT }, DOM_HTML_OPTION_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_option_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_option_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_option_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_option_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_option_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_option_element object * * \param doc The document object * \param ele The dom_html_option_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_option_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_option_element *ele) { ele->default_selected = false; ele->default_selected_set = false; return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_OPTION], namespace, prefix); } /** * Finalise a dom_html_option_element object * * \param ele The dom_html_option_element object */ void _dom_html_option_element_finalise(struct dom_html_option_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_option_element object * * \param ele The dom_html_option_element object */ void _dom_html_option_element_destroy(struct dom_html_option_element *ele) { _dom_html_option_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ dom_exception dom_html_option_element_get_form( dom_html_option_element *option, dom_html_form_element **form) { dom_html_document *doc; dom_node_internal *select = ((dom_node_internal *) option)->parent; doc = (dom_html_document *) ((dom_node_internal *) option)->owner; /* Search ancestor chain for SELECT element */ while (select != NULL) { if (select->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(select->name, doc->memoised[hds_SELECT])) break; select = select->parent; } if (select != NULL) { return dom_html_select_element_get_form((dom_html_select_element *) select, form); } *form = NULL; return DOM_NO_ERR; } /** * Get the defaultSelected property * * \param option The dom_html_option_element object * \param default_selected Pointer to location to receive value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_get_default_selected( dom_html_option_element *option, bool *default_selected) { *default_selected = option->default_selected; return DOM_NO_ERR; } /** * Set the defaultSelected property * * \param option The dom_html_option_element object * \param default_selected New value for property * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_set_default_selected( dom_html_option_element *option, bool default_selected) { option->default_selected = default_selected; option->default_selected_set = true; return DOM_NO_ERR; } /** * Helper for dom_html_option_element_get_text */ static dom_exception dom_html_option_element_get_text_node( dom_node_internal *n, dom_string **text) { dom_string *node_name = NULL; dom_string *node_ns = NULL; dom_document *owner = NULL; dom_string *str = NULL; dom_string *ret = NULL; dom_exception exc; *text = NULL; assert(n->owner != NULL); owner = n->owner; for (n = n->first_child; n != NULL; n = n->next) { /* Skip irrelevent node types */ if (n->type == DOM_COMMENT_NODE || n->type == DOM_PROCESSING_INSTRUCTION_NODE) continue; if (n->type == DOM_ELEMENT_NODE) { /* Skip script elements with html or svg namespace */ exc = dom_node_get_local_name(n, &node_name); if (exc != DOM_NO_ERR) return exc; if (dom_string_caseless_isequal(node_name, owner->script_string)) { exc = dom_node_get_namespace(n, &node_ns); if (exc != DOM_NO_ERR) { dom_string_unref(node_name); return exc; } if (dom_string_caseless_isequal(node_ns, dom_namespaces[ DOM_NAMESPACE_HTML]) || dom_string_caseless_isequal(node_ns, dom_namespaces[ DOM_NAMESPACE_SVG])) { dom_string_unref(node_name); dom_string_unref(node_ns); continue; } dom_string_unref(node_ns); } dom_string_unref(node_name); /* Get text inside child node 'n' */ dom_html_option_element_get_text_node(n, (str == NULL) ? &str : &ret); } else { /* Handle other nodes with their get_text_content * specialisation */ dom_node_get_text_content(n, (str == NULL) ? &str : &ret); } /* If we already have text, concatenate it */ if (ret != NULL) { dom_string *new_str; dom_string_concat(str, ret, &new_str); dom_string_unref(str); dom_string_unref(ret); str = new_str; } } /* Strip and collapse whitespace */ if (str != NULL) { dom_string_whitespace_op(str, DOM_WHITESPACE_STRIP_COLLAPSE, text); dom_string_unref(str); } return DOM_NO_ERR; } /** * Get the text contained in the option * * \param option The dom_html_option_element object * \param text Pointer to location to receive text * \return DOM_NO_ERR on success, appropriate error otherwise */ dom_exception dom_html_option_element_get_text( dom_html_option_element *option, dom_string **text) { return dom_html_option_element_get_text_node( (dom_node_internal *) option, text); } /** * Obtain the index of this option in its parent * * \param option The dom_html_option_element object * \param index Pointer to receive zero-based index * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_get_index( dom_html_option_element *option, int32_t *index) { dom_html_document *doc = (dom_html_document *) dom_node_get_owner(option); int32_t idx = 0; dom_node_internal *n = ((dom_node_internal *)option)->parent; for(n = n->first_child;n != NULL; n = n->next) { if((dom_node_internal *)option == n) { *index = idx; break; } else if(dom_string_caseless_isequal(n->name,doc->memoised[hds_OPTION])) { idx += 1; } } return DOM_NO_ERR; } /** * Get the disabled property * * \param ele The dom_html_option_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_option_element_get_disabled(dom_html_option_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_option_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_option_element_set_disabled(dom_html_option_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Get the label property * * \param option The dom_html_option_element object * \param label Pointer to location to receive label * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_get_label( dom_html_option_element *option, dom_string **label) { dom_html_document *doc; doc = (dom_html_document *) ((dom_node_internal *) option)->owner; return dom_element_get_attribute(option, doc->memoised[hds_label], label); } /** * Set the label property * * \param option The dom_html_option_element object * \param label Label value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_set_label( dom_html_option_element *option, dom_string *label) { dom_html_document *doc; doc = (dom_html_document *) ((dom_node_internal *) option)->owner; return dom_element_set_attribute(option, doc->memoised[hds_label], label); } /** * Get the selected property * * \param ele The dom_html_option_element object * \param selected The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_option_element_get_selected(dom_html_option_element *ele, bool *selected) { return dom_html_element_get_bool_property(&ele->base, "selected", SLEN("selected"), selected); } /** * Set the selected property * * \param ele The dom_html_option_element object * \param selected The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_option_element_set_selected(dom_html_option_element *ele, bool selected) { return dom_html_element_set_bool_property(&ele->base, "selected", SLEN("selected"), selected); } /** * Get the value property * * \param option The dom_html_option_element object * \param value Pointer to location to receive property value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_get_value( dom_html_option_element *option, dom_string **value) { dom_html_document *doc; bool has_value = false; dom_exception err; doc = (dom_html_document *) ((dom_node_internal *) option)->owner; err = dom_element_has_attribute(option, doc->memoised[hds_value], &has_value); if (err != DOM_NO_ERR) return err; if (has_value) { return dom_element_get_attribute(option, doc->memoised[hds_value], value); } return dom_html_option_element_get_text(option, value); } /** * Set the value property * * \param option The dom_html_option_element object * \param value Property value * \return DOM_NO_ERR on success, appropriate error otherwise. */ dom_exception dom_html_option_element_set_value( dom_html_option_element *option, dom_string *value) { dom_html_document *doc; doc = (dom_html_document *) ((dom_node_internal *) option)->owner; return dom_element_set_attribute(option, doc->memoised[hds_value], value); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_option_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { dom_html_option_element *option = (dom_html_option_element *)ele; dom_html_document *html = (dom_html_document *)(ele->base.owner); /** \todo Find some way to do the equiv for default_selected to be * false instead of true. Some end-tag hook in the binding perhaps? */ if (dom_string_caseless_isequal(name, html->memoised[hds_selected])) { if (option->default_selected_set == false) { option->default_selected = true; option->default_selected_set = true; } } dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_option_element_destroy(dom_node_internal *node) { _dom_html_option_element_destroy((struct dom_html_option_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_option_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } netsurf-all-3.2/libdom/src/html/html_anchor_element.c0000644000175000017500000001421012377676745022006 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_anchor_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_ANCHOR_ELEMENT }, DOM_HTML_ANCHOR_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_anchor_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_anchor_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_anchor_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_anchor_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_anchor_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_anchor_element object * * \param doc The document object * \param ele The dom_html_anchor_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_anchor_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_anchor_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_A], namespace, prefix); } /** * Finalise a dom_html_anchor_element object * * \param ele The dom_html_anchor_element object */ void _dom_html_anchor_element_finalise(struct dom_html_anchor_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_anchor_element object * * \param ele The dom_html_anchor_element object */ void _dom_html_anchor_element_destroy(struct dom_html_anchor_element *ele) { _dom_html_anchor_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_anchor_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_anchor_element_destroy(dom_node_internal *node) { _dom_html_anchor_element_destroy((struct dom_html_anchor_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_anchor_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_anchor_element_get_##attr( \ dom_html_anchor_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_anchor_element_set_##attr( \ dom_html_anchor_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(charset); SIMPLE_GET_SET(coords); SIMPLE_GET_SET(href); SIMPLE_GET_SET(hreflang); SIMPLE_GET_SET(name); SIMPLE_GET_SET(rel); SIMPLE_GET_SET(rev); SIMPLE_GET_SET(shape); SIMPLE_GET_SET(target); SIMPLE_GET_SET(type); dom_exception dom_html_anchor_element_get_tab_index( dom_html_anchor_element *anchor, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&anchor->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_anchor_element_set_tab_index( dom_html_anchor_element *anchor, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&anchor->base, "tabindex", SLEN("tabindex"), tab_index); } /** * Blur this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_anchor_element_blur(dom_html_anchor_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* This event does not bubble & is non-cancelable. Mentioned in w3 specs. More research is needed to prove why. */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_blur], false, false, &success); } /** * Focus this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_anchor_element_focus(dom_html_anchor_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /* This event does not bubble & is non-cancelable. Mentioned in w3 specs. More research is needed to prove why. */ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_focus], false, false, &success); } netsurf-all-3.2/libdom/src/html/html_table_element.h0000644000175000017500000000376412377676745021644 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_table_element_h_ #define dom_internal_html_table_element_h_ #include #include "html/html_element.h" struct dom_html_table_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_element object */ dom_exception _dom_html_table_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_element **ele); /* Initialise a dom_html_table_element object */ dom_exception _dom_html_table_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_element *ele); /* Finalise a dom_html_table_element object */ void _dom_html_table_element_finalise(struct dom_html_table_element *ele); /* Destroy a dom_html_table_element object */ void _dom_html_table_element_destroy(struct dom_html_table_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_ELEMENT_PROTECT_VTABLE \ _dom_html_table_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ELEMENT \ _dom_virtual_html_table_element_destroy, \ _dom_html_table_element_copy #endif bool table_rows_callback(struct dom_node_internal *node, void *ctx); bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx); dom_exception dom_html_table_element_create_t_body( dom_html_table_element *element, dom_html_table_section_element **t_body); netsurf-all-3.2/libdom/src/html/html_meta_element.c0000644000175000017500000001010612377676745021462 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include "html/html_document.h" #include "html/html_meta_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_META_ELEMENT }, DOM_HTML_META_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_meta_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_meta_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_meta_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_meta_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_meta_element object * * \param doc The document object * \param ele The dom_html_meta_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_meta_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_meta_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_META], namespace, prefix); } /** * Finalise a dom_html_meta_element object * * \param ele The dom_html_meta_element object */ void _dom_html_meta_element_finalise(struct dom_html_meta_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_meta_element object * * \param ele The dom_html_meta_element object */ void _dom_html_meta_element_destroy(struct dom_html_meta_element *ele) { _dom_html_meta_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_meta_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_meta_element_destroy(dom_node_internal *node) { _dom_html_meta_element_destroy((struct dom_html_meta_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_meta_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET_SET(attr) \ dom_exception dom_html_meta_element_get_##attr( \ dom_html_meta_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } \ \ dom_exception dom_html_meta_element_set_##attr( \ dom_html_meta_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } SIMPLE_GET_SET(content) SIMPLE_GET_SET(http_equiv) SIMPLE_GET_SET(name) SIMPLE_GET_SET(scheme) netsurf-all-3.2/libdom/src/html/html_base_element.h0000644000175000017500000000303312377676745021454 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_base_element_h_ #define dom_internal_html_base_element_h_ #include #include "html/html_element.h" struct dom_html_base_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_base_element object */ dom_exception _dom_html_base_element_create(struct dom_html_document *doc, struct dom_html_base_element **ele); /* Initialise a dom_html_base_element object */ dom_exception _dom_html_base_element_initialise(struct dom_html_document *doc, struct dom_html_base_element *ele); /* Finalise a dom_html_base_element object */ void _dom_html_base_element_finalise(struct dom_html_base_element *ele); /* Destroy a dom_html_base_element object */ void _dom_html_base_element_destroy(struct dom_html_base_element *ele); /* The protected virtual functions */ dom_exception _dom_html_base_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_base_element_destroy(dom_node_internal *node); dom_exception _dom_html_base_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_BASE_ELEMENT_PROTECT_VTABLE \ _dom_html_base_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_BASE_ELEMENT \ _dom_virtual_html_base_element_destroy, \ _dom_html_base_element_copy #endif netsurf-all-3.2/libdom/src/html/html_legend_element.h0000644000175000017500000000337412377676745022010 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_legend_element_h_ #define dom_internal_html_legend_element_h_ #include #include "html/html_element.h" struct dom_html_legend_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_legend_element object */ dom_exception _dom_html_legend_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_legend_element **ele); /* Initialise a dom_html_legend_element object */ dom_exception _dom_html_legend_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_legend_element *ele); /* Finalise a dom_html_legend_element object */ void _dom_html_legend_element_finalise(struct dom_html_legend_element *ele); /* Destroy a dom_html_legend_element object */ void _dom_html_legend_element_destroy(struct dom_html_legend_element *ele); /* The protected virtual functions */ dom_exception _dom_html_legend_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_legend_element_destroy(dom_node_internal *node); dom_exception _dom_html_legend_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_LEGEND_ELEMENT_PROTECT_VTABLE \ _dom_html_legend_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_LEGEND_ELEMENT \ _dom_virtual_html_legend_element_destroy, \ _dom_html_legend_element_copy #endif netsurf-all-3.2/libdom/src/html/html_map_element.h0000644000175000017500000000335612377676745021327 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_map_element_h_ #define dom_internal_html_map_element_h_ #include #include "html/html_element.h" struct dom_html_map_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_map_element object */ dom_exception _dom_html_map_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_map_element **ele); /* Initialise a dom_html_map_element object */ dom_exception _dom_html_map_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_map_element *ele); /* Finalise a dom_html_map_element object */ void _dom_html_map_element_finalise(struct dom_html_map_element *ele); /* Destroy a dom_html_map_element object */ void _dom_html_map_element_destroy(struct dom_html_map_element *ele); /* The protected virtual functions */ dom_exception _dom_html_map_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_map_element_destroy(dom_node_internal *node); dom_exception _dom_html_map_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_MAP_ELEMENT_PROTECT_VTABLE \ _dom_html_map_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_MAP_ELEMENT \ _dom_virtual_html_map_element_destroy, \ _dom_html_map_element_copy #endif bool callback(struct dom_node_internal *node, void *ctx); netsurf-all-3.2/libdom/src/html/html_area_element.h0000644000175000017500000000331312377676745021453 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #ifndef dom_internal_html_area_element_h_ #define dom_internal_html_area_element_h_ #include #include "html/html_element.h" struct dom_html_area_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_area_element object */ dom_exception _dom_html_area_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_area_element **ele); /* Initialise a dom_html_area_element object */ dom_exception _dom_html_area_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_area_element *ele); /* Finalise a dom_html_area_element object */ void _dom_html_area_element_finalise(struct dom_html_area_element *ele); /* Destroy a dom_html_area_element object */ void _dom_html_area_element_destroy(struct dom_html_area_element *ele); /* The protected virtual functions */ dom_exception _dom_html_area_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_area_element_destroy(dom_node_internal *node); dom_exception _dom_html_area_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_AREA_ELEMENT_PROTECT_VTABLE \ _dom_html_area_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_AREA_ELEMENT \ _dom_virtual_html_area_element_destroy, \ _dom_html_area_element_copy #endif netsurf-all-3.2/libdom/src/html/html_basefont_element.c0000644000175000017500000001212412377676745022337 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_basefont_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_BASE_FONT_ELEMENT }, DOM_HTML_BASE_FONT_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_base_font_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_base_font_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_base_font_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_base_font_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_base_font_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_base_font_element object * * \param doc The document object * \param ele The dom_html_base_font_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_base_font_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_base_font_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_BASEFONT], namespace, prefix); } /** * Finalise a dom_html_base_font_element object * * \param ele The dom_html_base_font_element object */ void _dom_html_base_font_element_finalise(struct dom_html_base_font_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_base_font_element object * * \param ele The dom_html_base_font_element object */ void _dom_html_base_font_element_destroy(struct dom_html_base_font_element *ele) { _dom_html_base_font_element_finalise(ele); free(ele); } /** * Get the width Property * * \param base_font The dom_html_base_font_element object */ dom_exception dom_html_base_font_element_get_size( dom_html_base_font_element *base_font, int32_t *size) { return dom_html_element_get_int32_t_property(&base_font->base, "size", SLEN("size"), size); } /** * Set the width Property * * \param base_font The dom_html_base_font_element object */ dom_exception dom_html_base_font_element_set_size( dom_html_base_font_element *base_font, uint32_t size) { return dom_html_element_set_int32_t_property(&base_font->base, "size", SLEN("size"), size); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_base_font_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_base_font_element_destroy(dom_node_internal *node) { _dom_html_base_font_element_destroy((struct dom_html_base_font_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_base_font_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_base_font_element_get_##attr( \ dom_html_base_font_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_base_font_element_set_##attr( \ dom_html_base_font_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)-> \ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(color); SIMPLE_GET_SET(face); netsurf-all-3.2/libdom/src/html/html_fieldset_element.c0000644000175000017500000001012312377676745022332 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_fieldset_element.h" #include "core/node.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_FIELDSET_ELEMENT }, DOM_HTML_FIELDSET_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_field_set_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_field_set_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_field_set_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_field_set_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_field_set_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_field_set_element object * * \param doc The document object * \param ele The dom_html_field_set_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_field_set_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_field_set_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_FIELDSET], namespace, prefix); } /** * Finalise a dom_html_field_set_element object * * \param ele The dom_html_field_set_element object */ void _dom_html_field_set_element_finalise(struct dom_html_field_set_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_field_set_element object * * \param ele The dom_html_field_set_element object */ void _dom_html_field_set_element_destroy(struct dom_html_field_set_element *ele) { _dom_html_field_set_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_field_set_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_field_set_element_destroy(dom_node_internal *node) { _dom_html_field_set_element_destroy((struct dom_html_field_set_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_field_set_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /** * Get the dom_html_form_element object * * \param field_set The dom_html_legend_element object * \param form The returned dom_html_form_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_field_set_element_get_form( dom_html_field_set_element *field_set, dom_html_form_element **form) { dom_html_document *doc = (dom_html_document *) ((dom_node_internal *) field_set)->owner; dom_node_internal *form_tmp = ((dom_node_internal *) field_set)->parent; /* Search ancestor chain for FIELDSET element */ while (form_tmp != NULL) { if (form_tmp->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(form_tmp->name, doc->memoised[hds_FORM])) break; form_tmp = form_tmp->parent; } if (form_tmp != NULL) { *form = (dom_html_form_element *) form_tmp; return DOM_NO_ERR; } *form = NULL; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/html/Makefile0000644000175000017500000000250712377676745017301 0ustar vincevince# Sources DIR_SOURCES := \ html_document.c html_collection.c html_options_collection.c \ html_element.c html_html_element.c html_head_element.c \ html_link_element.c html_title_element.c html_meta_element.c \ html_base_element.c html_style_element.c \ html_body_element.c html_form_element.c html_select_element.c \ html_button_element.c html_input_element.c html_text_area_element.c \ html_opt_group_element.c html_option_element.c html_hr_element.c \ html_dlist_element.c html_directory_element.c html_menu_element.c \ html_fieldset_element.c html_legend_element.c html_div_element.c \ html_paragraph_element.c html_heading_element.c html_quote_element.c \ html_pre_element.c html_br_element.c html_label_element.c \ html_ulist_element.c html_olist_element.c html_li_element.c \ html_font_element.c html_mod_element.c html_anchor_element.c \ html_basefont_element.c html_image_element.c html_object_element.c \ html_param_element.c html_applet_element.c html_area_element.c \ html_map_element.c html_script_element.c html_tablecaption_element.c \ html_tablecell_element.c html_tablecol_element.c html_tablesection_element.c \ html_table_element.c html_tablerow_element.c html_frameset_element.c \ html_frame_element.c html_iframe_element.c html_isindex_element.c \ UNINMPLEMENTED_SOURCES := \ include $(NSBUILD)/Makefile.subdir netsurf-all-3.2/libdom/src/html/html_input_element.c0000644000175000017500000003276412377676745021711 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone */ #include #include #include #include "html/html_document.h" #include "html/html_input_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_INPUT_ELEMENT }, DOM_HTML_INPUT_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_input_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_input_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_input_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_input_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_input_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_input_element object * * \param doc The document object * \param ele The dom_html_input_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_input_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_input_element *ele) { ele->form = NULL; ele->default_checked = false; ele->default_checked_set = false; ele->default_value = NULL; ele->default_value_set = false; ele->checked = false; ele->checked_set = false; return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_INPUT], namespace, prefix); } /** * Finalise a dom_html_input_element object * * \param ele The dom_html_input_element object */ void _dom_html_input_element_finalise(struct dom_html_input_element *ele) { if (ele->default_value != NULL) { dom_string_unref(ele->default_value); ele->default_value = NULL; } _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_input_element object * * \param ele The dom_html_input_element object */ void _dom_html_input_element_destroy(struct dom_html_input_element *ele) { _dom_html_input_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the disabled property * * \param ele The dom_html_input_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_get_disabled(dom_html_input_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_input_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_set_disabled(dom_html_input_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Get the readOnly property * * \param ele The dom_html_input_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_get_read_only(dom_html_input_element *ele, bool *read_only) { return dom_html_element_get_bool_property(&ele->base, "readonly", SLEN("readonly"), read_only); } /** * Set the readOnly property * * \param ele The dom_html_input_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_set_read_only(dom_html_input_element *ele, bool read_only) { return dom_html_element_set_bool_property(&ele->base, "readonly", SLEN("readonly"), read_only); } /** * Get the checked property * * \param ele The dom_html_input_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_get_checked(dom_html_input_element *ele, bool *checked) { if(ele->checked_set) { *checked = ele->checked; return DOM_NO_ERR; } return dom_html_element_get_bool_property(&ele->base, "checked", SLEN("checked"), checked); } /** * Set the checked property * * \param ele The dom_html_input_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_set_checked(dom_html_input_element *ele, bool checked) { return dom_html_element_set_bool_property(&ele->base, "checked", SLEN("checked"), checked); } /** * Get the defaultValue property * * \param ele The dom_html_input_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_get_default_value( dom_html_input_element *ele, dom_string **default_value) { *default_value = ele->default_value; if (*default_value != NULL) dom_string_ref(*default_value); return DOM_NO_ERR; } /** * Set the defaultValue property * * \param ele The dom_html_input_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_set_default_value( dom_html_input_element *ele, dom_string *default_value) { if (ele->default_value != NULL) dom_string_unref(ele->default_value); ele->default_value = default_value; ele->default_value_set = true; if (ele->default_value != NULL) dom_string_ref(ele->default_value); return DOM_NO_ERR; } /** * Get the defaultChecked property * * \param ele The dom_html_input_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_get_default_checked( dom_html_input_element *ele, bool *default_checked) { *default_checked = ele->default_checked; return DOM_NO_ERR; } /** * Set the defaultChecked property * * \param ele The dom_html_input_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_set_default_checked( dom_html_input_element *ele, bool default_checked) { ele->default_checked = default_checked; ele->default_checked_set = true; return DOM_NO_ERR; } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_input_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { dom_html_input_element *input = (dom_html_input_element *)ele; dom_html_document *html = (dom_html_document *)(ele->base.owner); /** \todo Find some way to do the equiv for default_checked to be * false instead of true. Some end-tag hook in the binding perhaps? */ if (dom_string_caseless_isequal(name, html->memoised[hds_checked])) { if (input->default_checked_set == false) { input->default_checked = true; input->default_checked_set = true; } } if (dom_string_caseless_isequal(name, html->memoised[hds_value])) { if (input->default_value_set == false) { input->default_value = value; dom_string_ref(value); input->default_value_set = true; } } dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_input_element_destroy(dom_node_internal *node) { _dom_html_input_element_destroy((struct dom_html_input_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_input_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_input_element_get_##attr( \ dom_html_input_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_input_element_set_##attr( \ dom_html_input_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(accept); SIMPLE_GET_SET(access_key); SIMPLE_GET_SET(align); SIMPLE_GET_SET(alt); SIMPLE_GET_SET(name); SIMPLE_GET_SET(src); SIMPLE_GET(type); SIMPLE_GET_SET(use_map); SIMPLE_GET_SET(value); dom_exception dom_html_input_element_get_size( dom_html_input_element *input, int32_t *size) { return dom_html_element_get_int32_t_property(&input->base, "size", SLEN("size"), size); } dom_exception dom_html_input_element_set_size( dom_html_input_element *input, uint32_t size) { return dom_html_element_set_int32_t_property(&input->base, "size", SLEN("size"), size); } dom_exception dom_html_input_element_get_tab_index( dom_html_input_element *input, int32_t *tab_index) { return dom_html_element_get_int32_t_property(&input->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_input_element_set_tab_index( dom_html_input_element *input, uint32_t tab_index) { return dom_html_element_set_int32_t_property(&input->base, "tabindex", SLEN("tabindex"), tab_index); } dom_exception dom_html_input_element_get_max_length( dom_html_input_element *input, int32_t *max_length) { return dom_html_element_get_int32_t_property(&input->base, "maxlength", SLEN("maxlength"), max_length); } dom_exception dom_html_input_element_set_max_length( dom_html_input_element *input, uint32_t max_length) { return dom_html_element_set_int32_t_property(&input->base, "maxlength", SLEN("maxlength"), max_length); } dom_exception dom_html_input_element_get_form( dom_html_input_element *input, dom_html_form_element **form) { *form = input->form; if (*form != NULL) dom_node_ref(*form); return DOM_NO_ERR; } dom_exception _dom_html_input_element_set_form( dom_html_input_element *input, dom_html_form_element *form) { input->form = form; return DOM_NO_ERR; } /** * Blur this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_blur(dom_html_input_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /** \todo Is this event (a) default (b) bubbling and (c) cancelable? */ return _dom_dispatch_generic_event((dom_document *) doc, (dom_event_target *) ele, doc->memoised[hds_blur], true, true, &success); } /** * Focus this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_focus(dom_html_input_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /** \this event doesnt bubble and is non-cancelable src:wikipedia*/ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_focus], false, false, &success); } /** * Select this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_select(dom_html_input_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; assert(doc != NULL); /** \this event bubbles and non-cancelable src:wikipedia*/ return _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_select], true, false, &success); } /** * Click this control * * \param ele The form object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_input_element_click(dom_html_input_element *ele) { struct dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele); bool success = false; dom_exception err; assert(doc != NULL); /** \This event bubbles & is cancelable src:Wikipedia*/ err = _dom_dispatch_generic_event((dom_document *)doc, (dom_event_target *) ele, doc->memoised[hds_click], true, true, &success); if(err != DOM_NO_ERR) return err; ele->checked = true; ele->checked_set = true; return DOM_NO_ERR; } netsurf-all-3.2/libdom/src/html/html_tablecell_element.c0000644000175000017500000002063712377676746022476 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_tablecell_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_TABLE_CELL_ELEMENT }, DOM_HTML_TABLE_CELL_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_table_cell_element table_cell * * \param doc The document table_cell * \param ele The returned element table_cell * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_cell_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_cell_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_table_cell_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_table_cell_element_initialise(doc, tag_name, namespace, prefix, *ele); } /** * Initialise a dom_html_table_cell_element table_cell * * \param doc The document table_cell * \param ele The dom_html_table_cell_element table_cell * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_table_cell_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_cell_element *ele) { return _dom_html_element_initialise(doc, &ele->base, tag_name, namespace, prefix); } /** * Finalise a dom_html_table_cell_element table_cell * * \param ele The dom_html_table_cell_element table_cell */ void _dom_html_table_cell_element_finalise(struct dom_html_table_cell_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_table_cell_element table_cell * * \param ele The dom_html_table_cell_element table_cell */ void _dom_html_table_cell_element_destroy(struct dom_html_table_cell_element *ele) { _dom_html_table_cell_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_table_cell_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_table_cell_element_destroy(dom_node_internal *node) { _dom_html_table_cell_element_destroy((struct dom_html_table_cell_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_table_cell_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_table_cell_element_get_##attr( \ dom_html_table_cell_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_table_cell_element_set_##attr( \ dom_html_table_cell_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(abbr); SIMPLE_GET_SET(align); SIMPLE_GET_SET(axis); SIMPLE_GET_SET(bg_color); SIMPLE_GET_SET(ch); SIMPLE_GET_SET(ch_off); SIMPLE_GET_SET(headers); SIMPLE_GET_SET(height); SIMPLE_GET_SET(scope); SIMPLE_GET_SET(v_align); SIMPLE_GET_SET(width); /** * Get the cell_index property * * \param table_cell The dom_html_table_cell_element object * \param cell_index The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_get_cell_index( dom_html_table_cell_element *table_cell, int32_t *cell_index) { dom_node_internal *n = ((dom_node_internal *)table_cell)->parent; dom_html_document *doc = (dom_html_document *)(n->owner); int32_t cnt = 0; while(n != NULL) { if(dom_string_caseless_isequal(doc->memoised[hds_TR],n->name)) { break; } n = n->parent; } dom_node_internal *root = n; while(n != NULL) { if(n == (dom_node_internal *)table_cell) { break; } else if((n->type == DOM_ELEMENT_NODE) && (dom_string_caseless_isequal(doc->memoised[hds_TD],n->name) || dom_string_caseless_isequal(doc->memoised[hds_TH],n->name))) { cnt += 1; } if(n->first_child != NULL) { n = n->first_child; } else if(n->next != NULL) { n = n->next; } else { /* No children and siblings */ struct dom_node_internal *parent = n->parent; while (n == parent->last_child && n != root) { n = parent; parent = parent->parent; } if(n == root) { n = NULL; } else { n = n->next; } } } *cell_index = cnt; return DOM_NO_ERR; } /** * Get the col_span property * * \param table_cell The dom_html_table_cell_element object * \param no_wrap The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_get_col_span( dom_html_table_cell_element *table_cell, int32_t *col_span) { return dom_html_element_get_int32_t_property(&table_cell->base, "colspan", SLEN("colspan"), col_span); } /** * Set the col_span property * * \param table_cell The dom_html_table_cell_element object * \param no_wrap The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_set_col_span( dom_html_table_cell_element *table_cell, uint32_t col_span) { return dom_html_element_set_int32_t_property(&table_cell->base, "colspan", SLEN("colspan"), col_span); } /** * Get the row_span property * * \param table_cell The dom_html_table_cell_element object * \param no_wrap The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_get_row_span( dom_html_table_cell_element *table_cell, int32_t *row_span) { return dom_html_element_get_int32_t_property(&table_cell->base, "rowspan", SLEN("rowspan"), row_span); } /** * Set the row_span property * * \param table_cell The dom_html_table_cell_element object * \param no_wrap The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_set_row_span( dom_html_table_cell_element *table_cell, uint32_t row_span) { return dom_html_element_set_int32_t_property(&table_cell->base, "rowspan", SLEN("rowspan"), row_span); } /** * Get the no_wrap property * * \param ele The dom_html_table_cell_element object * \param no_wrap The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_get_no_wrap(dom_html_table_cell_element *ele, bool *no_wrap) { return dom_html_element_get_bool_property(&ele->base, "nowrap", SLEN("nowrap"), no_wrap); } /** * Set the no_wrap property * * \param ele The dom_html_table_cell_element object * \param no_wrap The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_table_cell_element_set_no_wrap(dom_html_table_cell_element *ele, bool no_wrap) { return dom_html_element_set_bool_property(&ele->base, "nowrap", SLEN("nowrap"), no_wrap); } netsurf-all-3.2/libdom/src/html/html_br_element.c0000644000175000017500000001025412377676745021143 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_br_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_BR_ELEMENT }, DOM_HTML_BR_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_br_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_br_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_br_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_br_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_br_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_br_element object * * \param doc The document object * \param ele The dom_html_br_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_br_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_br_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_BR], namespace, prefix); } /** * Finalise a dom_html_br_element object * * \param ele The dom_html_br_element object */ void _dom_html_br_element_finalise(struct dom_html_br_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_br_element object * * \param ele The dom_html_br_element object */ void _dom_html_br_element_destroy(struct dom_html_br_element *ele) { _dom_html_br_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_br_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_br_element_destroy(dom_node_internal *node) { _dom_html_br_element_destroy((struct dom_html_br_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_br_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_br_element_get_##attr( \ dom_html_br_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_br_element_set_##attr( \ dom_html_br_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(clear); netsurf-all-3.2/libdom/src/html/html_html_element.h0000644000175000017500000000315312377676745021511 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_html_element_h_ #define dom_internal_html_html_element_h_ #include #include "html/html_element.h" struct dom_html_html_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_html_element object */ dom_exception _dom_html_html_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_html_element **ele); /* Initialise a dom_html_html_element object */ dom_exception _dom_html_html_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_html_element *ele); /* Finalise a dom_html_html_element object */ void _dom_html_html_element_finalise(struct dom_html_html_element *ele); /* Destroy a dom_html_html_element object */ void _dom_html_html_element_destroy(struct dom_html_html_element *ele); /* The protected virtual functions */ dom_exception _dom_html_html_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_html_element_destroy(dom_node_internal *node); dom_exception _dom_html_html_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_HTML_ELEMENT_PROTECT_VTABLE \ _dom_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_HTML_ELEMENT \ _dom_virtual_html_html_element_destroy, \ _dom_html_html_element_copy #endif netsurf-all-3.2/libdom/src/html/html_olist_element.c0000644000175000017500000001306212377676745021672 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang * Copyright 2014 Rupinder Singh Khokhar */ #include #include #include #include "html/html_document.h" #include "html/html_olist_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_O_LIST_ELEMENT }, DOM_HTML_O_LIST_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_o_list_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_o_list_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *o_listfix, struct dom_html_o_list_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_o_list_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_o_list_element_initialise(doc, namespace, o_listfix, *ele); } /** * Initialise a dom_html_o_list_element object * * \param doc The document object * \param ele The dom_html_o_list_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_o_list_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *o_listfix, struct dom_html_o_list_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_OL], namespace, o_listfix); } /** * Finalise a dom_html_o_list_element object * * \param ele The dom_html_o_list_element object */ void _dom_html_o_list_element_finalise(struct dom_html_o_list_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_o_list_element object * * \param ele The dom_html_o_list_element object */ void _dom_html_o_list_element_destroy(struct dom_html_o_list_element *ele) { _dom_html_o_list_element_finalise(ele); free(ele); } /** * Get the compact Property * * \param o_list The dom_html_o_list_element object */ dom_exception dom_html_o_list_element_get_compact( dom_html_o_list_element *o_list, bool *compact) { return dom_html_element_get_bool_property(&o_list->base, "compact", SLEN("compact"), compact); } /** * Set the compact Property * * \param o_list The dom_html_o_list_element object */ dom_exception dom_html_o_list_element_set_compact( dom_html_o_list_element *o_list, bool compact) { return dom_html_element_set_bool_property(&o_list->base, "compact", SLEN("compact"), compact); } /** * Get the start Property * * \param o_list The dom_html_o_list_element object */ dom_exception dom_html_o_list_element_get_start( dom_html_o_list_element *o_list, int32_t *start) { return dom_html_element_get_int32_t_property(&o_list->base, "start", SLEN("start"), start); } /** * Set the start Property * * \param o_list The dom_html_o_list_element object */ dom_exception dom_html_o_list_element_set_start( dom_html_o_list_element *o_list, uint32_t start) { return dom_html_element_set_int32_t_property(&o_list->base, "start", SLEN("start"), start); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_o_list_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_o_list_element_destroy(dom_node_internal *node) { _dom_html_o_list_element_destroy((struct dom_html_o_list_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_o_list_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_o_list_element_get_##attr( \ dom_html_o_list_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_o_list_element_set_##attr( \ dom_html_o_list_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(type); netsurf-all-3.2/libdom/src/html/html_link_element.h0000644000175000017500000000316512377676745021505 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #ifndef dom_internal_html_link_element_h_ #define dom_internal_html_link_element_h_ #include #include "html/html_element.h" struct dom_html_link_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_link_element object */ dom_exception _dom_html_link_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_link_element **ele); /* Initialise a dom_html_link_element object */ dom_exception _dom_html_link_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_link_element *ele); /* Finalise a dom_html_link_element object */ void _dom_html_link_element_finalise(struct dom_html_link_element *ele); /* Destroy a dom_html_link_element object */ void _dom_html_link_element_destroy(struct dom_html_link_element *ele); /* The protected virtual functions */ dom_exception _dom_html_link_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_link_element_destroy(dom_node_internal *node); dom_exception _dom_html_link_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_LINK_ELEMENT_PROTECT_VTABLE \ _dom_html_link_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_LINK_ELEMENT \ _dom_virtual_html_link_element_destroy, \ _dom_html_link_element_copy #endif netsurf-all-3.2/libdom/src/html/html_document.c0000644000175000017500000007411012377676745020646 0ustar vincevince/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang */ #include #include #include "html/html_document.h" #include "html/html_element.h" #include "html/html_collection.h" #include "html/html_html_element.h" #include "html/html_head_element.h" #include "html/html_body_element.h" #include "html/html_link_element.h" #include "html/html_title_element.h" #include "html/html_meta_element.h" #include "html/html_form_element.h" #include "html/html_button_element.h" #include "html/html_input_element.h" #include "html/html_text_area_element.h" #include "html/html_opt_group_element.h" #include "html/html_option_element.h" #include "html/html_select_element.h" #include "html/html_hr_element.h" #include "html/html_dlist_element.h" #include "html/html_directory_element.h" #include "html/html_menu_element.h" #include "html/html_fieldset_element.h" #include "html/html_legend_element.h" #include "html/html_paragraph_element.h" #include "html/html_heading_element.h" #include "html/html_quote_element.h" #include "html/html_pre_element.h" #include "html/html_br_element.h" #include "html/html_label_element.h" #include "html/html_ulist_element.h" #include "html/html_olist_element.h" #include "html/html_li_element.h" #include "html/html_font_element.h" #include "html/html_mod_element.h" #include "html/html_anchor_element.h" #include "html/html_basefont_element.h" #include "html/html_image_element.h" #include "html/html_object_element.h" #include "html/html_param_element.h" #include "html/html_applet_element.h" #include "html/html_map_element.h" #include "html/html_area_element.h" #include "html/html_script_element.h" #include "html/html_tablecaption_element.h" #include "html/html_tablecell_element.h" #include "html/html_tablecol_element.h" #include "html/html_tablesection_element.h" #include "html/html_table_element.h" #include "html/html_tablerow_element.h" #include "html/html_style_element.h" #include "html/html_frameset_element.h" #include "html/html_frame_element.h" #include "html/html_iframe_element.h" #include "html/html_isindex_element.h" #include "core/attr.h" #include "core/string.h" #include "utils/namespace.h" #include "utils/utils.h" static struct dom_html_document_vtable html_document_vtable = { { { { DOM_NODE_EVENT_TARGET_VTABLE }, DOM_NODE_VTABLE, }, DOM_DOCUMENT_VTABLE_HTML }, DOM_HTML_DOCUMENT_VTABLE }; static struct dom_node_protect_vtable html_document_protect_vtable = { DOM_HTML_DOCUMENT_PROTECT_VTABLE }; /* Create a HTMLDocument */ dom_exception _dom_html_document_create( dom_events_default_action_fetcher daf, void *daf_ctx, dom_html_document **doc) { dom_exception error; dom_html_document *result; result = malloc(sizeof(dom_html_document)); if (result == NULL) return DOM_NO_MEM_ERR; result->base.base.base.vtable = &html_document_vtable; result->base.base.vtable = &html_document_protect_vtable; error = _dom_html_document_initialise(result, daf, daf_ctx); if (error != DOM_NO_ERR) { free(result); return error; } *doc = result; return DOM_NO_ERR; } /* Initialise a HTMLDocument */ dom_exception _dom_html_document_initialise(dom_html_document *doc, dom_events_default_action_fetcher daf, void *daf_ctx) { dom_exception error; int sidx; error = _dom_document_initialise(&doc->base, daf, daf_ctx); if (error != DOM_NO_ERR) return error; doc->title = NULL; doc->referrer = NULL; doc->domain = NULL; doc->url = NULL; doc->cookie = NULL; doc->body = NULL; doc->memoised = calloc(sizeof(dom_string *), hds_COUNT); if (doc->memoised == NULL) { error = DOM_NO_MEM_ERR; goto out; } #define HTML_DOCUMENT_STRINGS_ACTION(attr,str) \ error = dom_string_create_interned((const uint8_t *) #str, \ SLEN(#str), &doc->memoised[hds_##attr]); \ if (error != DOM_NO_ERR) { \ goto out; \ } #include "html_document_strings.h" #undef HTML_DOCUMENT_STRINGS_ACTION out: if (doc->memoised != NULL && error != DOM_NO_ERR) { for(sidx = 0; sidx < hds_COUNT; ++sidx) { if (doc->memoised[sidx] != NULL) { dom_string_unref(doc->memoised[sidx]); } } free(doc->memoised); doc->memoised = NULL; } return error; } /* Finalise a HTMLDocument */ bool _dom_html_document_finalise(dom_html_document *doc) { int sidx; if (doc->cookie != NULL) dom_string_unref(doc->cookie); if (doc->url != NULL) dom_string_unref(doc->url); if (doc->domain != NULL) dom_string_unref(doc->domain); if (doc->referrer != NULL) dom_string_unref(doc->referrer); if (doc->title != NULL) dom_string_unref(doc->title); if (doc->memoised != NULL) { for(sidx = 0; sidx < hds_COUNT; ++sidx) { if (doc->memoised[sidx] != NULL) { dom_string_unref(doc->memoised[sidx]); } } free(doc->memoised); doc->memoised = NULL; } return _dom_document_finalise(&doc->base); } /* Destroy a HTMLDocument */ void _dom_html_document_destroy(dom_node_internal *node) { dom_html_document *doc = (dom_html_document *) node; if (_dom_html_document_finalise(doc) == true) free(doc); } dom_exception _dom_html_document_copy(dom_node_internal *old, dom_node_internal **copy) { UNUSED(old); UNUSED(copy); return DOM_NOT_SUPPORTED_ERR; } /* Overloaded methods inherited from super class */ /** Internal method to support both kinds of create method */ static dom_exception _dom_html_document_create_element_internal(dom_html_document *html, dom_string *in_tag_name, dom_string *namespace, dom_string *prefix, dom_html_element **result) { dom_exception exc; dom_string *tag_name; exc = dom_string_toupper(in_tag_name, true, &tag_name); if (exc != DOM_NO_ERR) return exc; if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HTML])) { exc = _dom_html_html_element_create(html, namespace, prefix, (dom_html_html_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HEAD])) { exc = _dom_html_head_element_create(html, namespace, prefix, (dom_html_head_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TITLE])) { exc = _dom_html_title_element_create(html, namespace, prefix, (dom_html_title_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BODY])) { exc = _dom_html_body_element_create(html, namespace, prefix, (dom_html_body_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FORM])) { exc = _dom_html_form_element_create(html, namespace, prefix, (dom_html_form_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LINK])) { exc = _dom_html_link_element_create(html, namespace, prefix, (dom_html_link_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BUTTON])) { exc = _dom_html_button_element_create(html, namespace, prefix, (dom_html_button_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_INPUT])) { exc = _dom_html_input_element_create(html, namespace, prefix, (dom_html_input_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TEXTAREA])) { exc = _dom_html_text_area_element_create(html, namespace, prefix, (dom_html_text_area_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OPTGROUP])) { exc = _dom_html_opt_group_element_create(html, namespace, prefix, (dom_html_opt_group_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OPTION])) { exc = _dom_html_option_element_create(html, namespace, prefix, (dom_html_option_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_SELECT])) { exc = _dom_html_select_element_create(html, namespace, prefix, (dom_html_select_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_HR])) { exc = _dom_html_hr_element_create(html, namespace, prefix, (dom_html_hr_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_DL])) { exc = _dom_html_d_list_element_create(html, namespace, prefix, (dom_html_d_list_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_DIRECTORY])) { exc = _dom_html_directory_element_create(html, namespace, prefix, (dom_html_directory_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_MENU])) { exc = _dom_html_menu_element_create(html, namespace, prefix, (dom_html_menu_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FIELDSET])) { exc = _dom_html_field_set_element_create(html, namespace, prefix, (dom_html_field_set_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LEGEND])) { exc = _dom_html_legend_element_create(html, namespace, prefix, (dom_html_legend_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_P])) { exc = _dom_html_paragraph_element_create(html, namespace, prefix, (dom_html_paragraph_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_H1]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_H2]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_H3]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_H4]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_H5]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_H6]) ) { exc = _dom_html_heading_element_create(html, tag_name, namespace, prefix, (dom_html_heading_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_Q])) { exc = _dom_html_quote_element_create(html, namespace, prefix, (dom_html_quote_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_PRE])) { exc = _dom_html_pre_element_create(html, namespace, prefix, (dom_html_pre_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BR])) { exc = _dom_html_br_element_create(html, namespace, prefix, (dom_html_br_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LABEL])) { exc = _dom_html_label_element_create(html, namespace, prefix, (dom_html_label_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_UL])) { exc = _dom_html_u_list_element_create(html, namespace, prefix, (dom_html_u_list_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OL])) { exc = _dom_html_o_list_element_create(html, namespace, prefix, (dom_html_o_list_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_LI])) { exc = _dom_html_li_element_create(html, namespace, prefix, (dom_html_li_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FONT])) { exc = _dom_html_font_element_create(html, namespace, prefix, (dom_html_font_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_DEL]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_INS])) { exc = _dom_html_mod_element_create(html, tag_name, namespace, prefix, (dom_html_mod_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_A])) { exc = _dom_html_anchor_element_create(html, namespace, prefix, (dom_html_anchor_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_BASEFONT])) { exc = _dom_html_base_font_element_create(html, namespace, prefix, (dom_html_base_font_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_IMG])) { exc = _dom_html_image_element_create(html, namespace, prefix, (dom_html_image_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_OBJECT])) { exc = _dom_html_object_element_create(html, namespace, prefix, (dom_html_object_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_PARAM])) { exc = _dom_html_param_element_create(html, namespace, prefix, (dom_html_param_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_APPLET])) { exc = _dom_html_applet_element_create(html, namespace, prefix, (dom_html_applet_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_MAP])) { exc = _dom_html_map_element_create(html, namespace, prefix, (dom_html_map_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_AREA])) { exc = _dom_html_area_element_create(html, namespace, prefix, (dom_html_area_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_SCRIPT])) { exc = _dom_html_script_element_create(html, namespace, prefix, (dom_html_script_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_CAPTION])) { exc = _dom_html_table_caption_element_create(html, namespace, prefix, (dom_html_table_caption_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TD]) || dom_string_caseless_isequal(tag_name, html->memoised[hds_TH]) ) { exc = _dom_html_table_cell_element_create(html, tag_name, namespace, prefix, (dom_html_table_cell_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_COL])|| dom_string_caseless_isequal(tag_name, html->memoised[hds_COLGROUP]) ) { exc = _dom_html_table_col_element_create(html, tag_name, namespace, prefix, (dom_html_table_col_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_THEAD])|| dom_string_caseless_isequal(tag_name, html->memoised[hds_TBODY])|| dom_string_caseless_isequal(tag_name, html->memoised[hds_TFOOT])) { exc = _dom_html_table_section_element_create(html, tag_name, namespace, prefix, (dom_html_table_section_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TABLE])) { exc = _dom_html_table_element_create(html, namespace, prefix, (dom_html_table_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_TD])) { exc = _dom_html_table_row_element_create(html, namespace, prefix, (dom_html_table_row_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_STYLE])) { exc = _dom_html_style_element_create(html, (dom_html_style_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FRAMESET])) { exc = _dom_html_frame_set_element_create(html, namespace, prefix, (dom_html_frame_set_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_FRAME])) { exc = _dom_html_frame_element_create(html, namespace, prefix, (dom_html_frame_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_IFRAME])) { exc = _dom_html_iframe_element_create(html, namespace, prefix, (dom_html_iframe_element **) result); } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_ISINDEX])) { exc = _dom_html_isindex_element_create(html, namespace, prefix, (dom_html_isindex_element **) result); } else { exc = _dom_html_element_create(html, tag_name, namespace, prefix, result); } dom_string_unref(tag_name); return exc; } dom_exception _dom_html_document_create_element(dom_document *doc, dom_string *tag_name, dom_element **result) { dom_html_document *html = (dom_html_document *) doc; return _dom_html_document_create_element_internal(html, tag_name, NULL, NULL, (dom_html_element **)result); } dom_exception _dom_html_document_create_element_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_element **result) { dom_html_document *html = (dom_html_document *) doc; dom_string *prefix, *localname; dom_exception err; /* Divide QName into prefix/localname pair */ err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) { return err; } /* Attempt to create element */ err = _dom_html_document_create_element_internal(html, localname, namespace, prefix, (dom_html_element **)result); /* Tidy up */ dom_string_unref(localname); if (prefix != NULL) { dom_string_unref(prefix); } return err; } /** * Create an attribute * * \param doc The document owning the attribute * \param name The name of the attribute * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * * The constructed attribute will always be classified as 'specified'. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_html_document_create_attribute(dom_document *doc, dom_string *name, dom_attr **result) { return _dom_attr_create(doc, name, NULL, NULL, true, result); } /** * Create an attribute from the qualified name and namespace URI * * \param doc The document owning the attribute * \param namespace The namespace URI to use * \param qname The qualified name of the attribute * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a * prefix and ::namespace is NULL, or * ::qname has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" and * ::namespace is not * "http://www.w3.org/2000/xmlns", or * ::namespace is * "http://www.w3.org/2000/xmlns" and * ::qname is not (or is not prefixed by) * "xmlns", * DOM_NOT_SUPPORTED_ERR if ::doc does not support the "XML" * feature. * * The returned node will have its reference count increased. It is * the responsibility of the caller to unref the node once it has * finished with it. */ dom_exception _dom_html_document_create_attribute_ns(dom_document *doc, dom_string *namespace, dom_string *qname, dom_attr **result) { dom_string *prefix, *localname; dom_exception err; /* Divide QName into prefix/localname pair */ err = _dom_namespace_split_qname(qname, &prefix, &localname); if (err != DOM_NO_ERR) { return err; } /* Attempt to create attribute */ err = _dom_attr_create(doc, localname, namespace, prefix, true, result); /* Tidy up */ if (localname != NULL) { dom_string_unref(localname); } if (prefix != NULL) { dom_string_unref(prefix); } return err; } /** * Retrieve a list of all elements with a given tag name * * \param doc The document to search in * \param tagname The tag name to search for ("*" for all) * \param result Pointer to location to receive result * \return DOM_NO_ERR. * * The returned list will have its reference count increased. It is * the responsibility of the caller to unref the list once it has * finished with it. */ dom_exception _dom_html_document_get_elements_by_tag_name(dom_document *doc, dom_string *tagname, dom_nodelist **result) { return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAME_CASELESS, (dom_node_internal *) doc, tagname, NULL, NULL, result); } /** * Retrieve a list of all elements with a given local name and namespace URI * * \param doc The document to search in * \param namespace The namespace URI * \param localname The local name * \param result Pointer to location to receive result * \return DOM_NO_ERR on success, appropriate dom_exception on failure. * * The returned list will have its reference count increased. It is * the responsibility of the caller to unref the list once it has * finished with it. */ dom_exception _dom_html_document_get_elements_by_tag_name_ns( dom_document *doc, dom_string *namespace, dom_string *localname, dom_nodelist **result) { return _dom_document_get_nodelist(doc, DOM_NODELIST_BY_NAMESPACE_CASELESS, (dom_node_internal *) doc, NULL, namespace, localname, result); } /*-----------------------------------------------------------------------*/ /* The DOM spec public API */ /** * Get the title of this HTMLDocument * \param doc The document object * \param title The reutrned title string * \return DOM_NO_ERR on success, appropriated dom_exception on failure. * * @note: this method find a title for the document as following: * 1. If there is a title in the document object set by * dom_html_document_set_title, then use it; * 2. If there is no such one, find the element and use its text * as the returned title. */ dom_exception _dom_html_document_get_title(dom_html_document *doc, dom_string **title) { dom_exception exc = DOM_NO_ERR; *title = NULL; if (doc->title != NULL) { *title = dom_string_ref(doc->title); } else { dom_element *node; dom_nodelist *nodes; uint32_t len; exc = dom_document_get_elements_by_tag_name(doc, doc->memoised[hds_TITLE], &nodes); if (exc != DOM_NO_ERR) { return exc; } exc = dom_nodelist_get_length(nodes, &len); if (exc != DOM_NO_ERR) { dom_nodelist_unref(nodes); return exc; } if (len == 0) { dom_nodelist_unref(nodes); return DOM_NO_ERR; } exc = dom_nodelist_item(nodes, 0, (void *) &node); dom_nodelist_unref(nodes); if (exc != DOM_NO_ERR) { return exc; } exc = dom_node_get_text_content(node, title); dom_node_unref(node); } return exc; } dom_exception _dom_html_document_set_title(dom_html_document *doc, dom_string *title) { if (doc->title != NULL) dom_string_unref(doc->title); doc->title = dom_string_ref(title); return DOM_NO_ERR; } dom_exception _dom_html_document_get_referrer(dom_html_document *doc, dom_string **referrer) { *referrer = dom_string_ref(doc->referrer); return DOM_NO_ERR; } dom_exception _dom_html_document_get_domain(dom_html_document *doc, dom_string **domain) { *domain = dom_string_ref(doc->domain); return DOM_NO_ERR; } dom_exception _dom_html_document_get_url(dom_html_document *doc, dom_string **url) { *url = dom_string_ref(doc->url); return DOM_NO_ERR; } dom_exception _dom_html_document_get_body(dom_html_document *doc, struct dom_html_element **body) { dom_exception exc = DOM_NO_ERR; if (doc->body != NULL) { *body = doc->body; } else { dom_element *node; dom_nodelist *nodes; uint32_t len; exc = dom_document_get_elements_by_tag_name(doc, doc->memoised[hds_BODY], &nodes); if (exc != DOM_NO_ERR) { return exc; } exc = dom_nodelist_get_length(nodes, &len); if (exc != DOM_NO_ERR) { dom_nodelist_unref(nodes); return exc; } if (len == 0) { exc = dom_document_get_elements_by_tag_name(doc, doc->memoised[hds_FRAMESET], &nodes); if (exc != DOM_NO_ERR) { return exc; } exc = dom_nodelist_get_length(nodes, &len); if (exc != DOM_NO_ERR) { dom_nodelist_unref(nodes); return exc; } if(len == 0) { dom_nodelist_unref(nodes); return DOM_NO_ERR; } } exc = dom_nodelist_item(nodes, 0, (void *) &node); dom_nodelist_unref(nodes); if (exc != DOM_NO_ERR) { return exc; } *body = (dom_html_element *)node; dom_node_unref(node); } return exc; } dom_exception _dom_html_document_set_body(dom_html_document *doc, struct dom_html_element *body) { doc->body = body; return DOM_NO_ERR; } /** * Callback for creating the images collection * * \param node The dom_node_internal object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool images_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_IMG])) { return true; } return false; } dom_exception _dom_html_document_get_images(dom_html_document *doc, struct dom_html_collection **col) { dom_element *root; dom_exception err; err = dom_document_get_document_element(doc, &root); if (err != DOM_NO_ERR) return err; return _dom_html_collection_create(doc, (dom_node_internal *) root, images_callback, doc, col); } bool applet_callback(struct dom_node_internal * node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_APPLET])) { return true; } return false; } /** * Callback for creating the applets collection * * \param node The dom_node_internal object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool applets_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_OBJECT])) { uint32_t len = 0; dom_html_collection *applets; _dom_html_collection_create(ctx, node, applet_callback, ctx, &applets); dom_html_collection_get_length(applets, &len); if(len != 0) return true; } return false; } dom_exception _dom_html_document_get_applets(dom_html_document *doc, struct dom_html_collection **col) { dom_element *root; dom_exception err; err = dom_document_get_document_element(doc, &root); if (err != DOM_NO_ERR) return err; return _dom_html_collection_create(doc, (dom_node_internal *) root, applets_callback, doc, col); } /** * Callback for creating the links collection * * \param node The dom_node_internal object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool links_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && (dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_A]) || dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_AREA])) ) { bool has_value = false; dom_exception err; err = dom_element_has_attribute(node, ((dom_html_document *)ctx)->memoised[hds_href], &has_value); if(err !=DOM_NO_ERR) return err; if(has_value) return true; } return false; } dom_exception _dom_html_document_get_links(dom_html_document *doc, struct dom_html_collection **col) { dom_element *root; dom_exception err; err = dom_document_get_document_element(doc, &root); if (err != DOM_NO_ERR) return err; return _dom_html_collection_create(doc, (dom_node_internal *) root, links_callback, doc, col); } static bool __dom_html_document_node_is_form(dom_node_internal *node, void *ctx) { dom_html_document *doc = (dom_html_document *)node->owner; UNUSED(ctx); return dom_string_caseless_isequal(node->name, doc->memoised[hds_FORM]); } dom_exception _dom_html_document_get_forms(dom_html_document *doc, struct dom_html_collection **col) { dom_html_collection *result; dom_element *root; dom_exception err; err = dom_document_get_document_element(doc, &root); if (err != DOM_NO_ERR) return err; err = _dom_html_collection_create(doc, (dom_node_internal *) root, __dom_html_document_node_is_form, NULL, &result); if (err != DOM_NO_ERR) { dom_node_unref(root); return err; } dom_node_unref(root); *col = result; return DOM_NO_ERR; } /** * Callback for creating the anchors collection * * \param node The dom_node_internal object * \param ctx The dom_html_document object (void *) * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ bool anchors_callback(struct dom_node_internal *node, void *ctx) { if(node->type == DOM_ELEMENT_NODE && dom_string_caseless_isequal(node->name, ((dom_html_document *)ctx)->memoised[hds_A])) { bool has_value = false; dom_exception err; err = dom_element_has_attribute(node, ((dom_html_document *)ctx)->memoised[hds_name], &has_value); if(err !=DOM_NO_ERR) return err; if(has_value) return true; } return false; } dom_exception _dom_html_document_get_anchors(dom_html_document *doc, struct dom_html_collection **col) { dom_element *root; dom_exception err; err = dom_document_get_document_element(doc, &root); if (err != DOM_NO_ERR) return err; return _dom_html_collection_create(doc, (dom_node_internal *) root, anchors_callback, doc, col); } dom_exception _dom_html_document_get_cookie(dom_html_document *doc, dom_string **cookie) { UNUSED(doc); UNUSED(cookie); /*todo implement this after updating client interface */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_set_cookie(dom_html_document *doc, dom_string *cookie) { UNUSED(doc); UNUSED(cookie); /*todo implement this after updating client interface */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_open(dom_html_document *doc) { UNUSED(doc); /*todo implement this after updating client interface */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_close(dom_html_document *doc) { UNUSED(doc); /*todo implement this after updating client interface */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_write(dom_html_document *doc, dom_string *text) { UNUSED(doc); UNUSED(text); /*todo implement this after updating client interface */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_writeln(dom_html_document *doc, dom_string *text) { UNUSED(doc); UNUSED(text); /*todo implement this after _dom_html_document_write */ return DOM_NOT_SUPPORTED_ERR; } dom_exception _dom_html_document_get_elements_by_name(dom_html_document *doc, dom_string *name, struct dom_nodelist **list) { UNUSED(doc); UNUSED(name); UNUSED(list); /*todo implement after updating core nodelist interface */ return DOM_NOT_SUPPORTED_ERR; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_link_element.c�������������������������������������������������0000644�0001750�0001750�00000012077�12377676745�021502� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku.com> */ #include <assert.h> #include <stdlib.h> #include "html/html_document.h" #include "html/html_link_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_LINK_ELEMENT }, DOM_HTML_LINK_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_link_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_link_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_link_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_link_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_link_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_link_element object * * \param doc The document object * \param ele The dom_html_link_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_link_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_link_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_LINK], namespace, prefix); } /** * Finalise a dom_html_link_element object * * \param ele The dom_html_link_element object */ void _dom_html_link_element_finalise(struct dom_html_link_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_link_element object * * \param ele The dom_html_link_element object */ void _dom_html_link_element_destroy(struct dom_html_link_element *ele) { _dom_html_link_element_finalise(ele); free(ele); } /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the disabled property * * \param ele The dom_html_link_element object * \param disabled The returned status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_link_element_get_disabled(dom_html_link_element *ele, bool *disabled) { return dom_html_element_get_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /** * Set the disabled property * * \param ele The dom_html_link_element object * \param disabled The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_link_element_set_disabled(dom_html_link_element *ele, bool disabled) { return dom_html_element_set_bool_property(&ele->base, "disabled", SLEN("disabled"), disabled); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_link_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_link_element_destroy(dom_node_internal *node) { _dom_html_link_element_destroy((struct dom_html_link_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_link_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET_SET(attr) \ dom_exception dom_html_link_element_get_##attr( \ dom_html_link_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } \ \ dom_exception dom_html_link_element_set_##attr( \ dom_html_link_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } SIMPLE_GET_SET(charset) SIMPLE_GET_SET(href) SIMPLE_GET_SET(hreflang) SIMPLE_GET_SET(media) SIMPLE_GET_SET(rel) SIMPLE_GET_SET(rev) SIMPLE_GET_SET(target) SIMPLE_GET_SET(type) �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_style_element.h������������������������������������������������0000644�0001750�0001750�00000003063�12377676745�021705� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku.com> */ #ifndef dom_internal_html_style_element_h_ #define dom_internal_html_style_element_h_ #include <dom/html/html_style_element.h> #include "html/html_element.h" struct dom_html_style_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_style_element object */ dom_exception _dom_html_style_element_create(struct dom_html_document *doc, struct dom_html_style_element **ele); /* Initialise a dom_html_style_element object */ dom_exception _dom_html_style_element_initialise(struct dom_html_document *doc, struct dom_html_style_element *ele); /* Finalise a dom_html_style_element object */ void _dom_html_style_element_finalise(struct dom_html_style_element *ele); /* Destroy a dom_html_style_element object */ void _dom_html_style_element_destroy(struct dom_html_style_element *ele); /* The protected virtual functions */ dom_exception _dom_html_style_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_style_element_destroy(dom_node_internal *node); dom_exception _dom_html_style_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_STYLE_ELEMENT_PROTECT_VTABLE \ _dom_html_style_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_STYLE_ELEMENT \ _dom_virtual_html_style_element_destroy, \ _dom_html_style_element_copy #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/TODO����������������������������������������������������������������0000644�0001750�0001750�00000004663�12377676745�016336� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������The following is the status of the HTML Element and derived objects, at least as far as the test suite is concerned. HTMLElement html_element DONE HTMLHtmlElement html_html_element DONE HTMLHeadElement html_head_element DONE HTMLLinkElement html_link_element DONE HTMLTitleElement html_title_element DONE HTMLMetaElement html_meta_element DONE HTMLBaseElement html_base_element DONE HTMLIsIndexElement html_isindex_element MISSING HTMLStyleElement html_style_element DONE HTMLBodyElement html_body_element DONE HTMLFormElement html_form_element DONE HTMLSelectElement html_select_element DONE HTMLOptGroupElement html_optgroup_element DONE HTMLOptionElement html_option_element DONE HTMLInputElement html_input_element DONE HTMLTextAreaElement html_textarea_element DONE HTMLButtonElement html_button_element DONE HTMLLabelElement html_label_element DONE HTMLFieldSetElement html_fieldset_element DONE HTMLLegendElement html_legend_element DONE HTMLUListElement html_ulist_element DONE HTMLOListElement html_olist_element DONE HTMLDListElement html_dlist_element DONE HTMLDirectoryElement html_directory_element DONE HTMLMenuElement html_menu_element DONE HTMLLIElement html_li_element DONE HTMLBlockquoteElement html_blockquote_element DONE HTMLDivElement html_div_element DONE HTMLParagraphElement html_paragraph_element DONE HTMLHeadingElement html_heading_element DONE HTMLQuoteElement html_quote_element DONE HTMLPreElement html_pre_element DONE HTMLBRElement html_br_element DONE HTMLBaseFontElement html_basefont_element DONE HTMLFontElement html_font_element DONE HTMLHRElement html_hr_element DONE HTMLModElement html_mod_element DONE HTMLAnchorElement html_anchor_element DONE HTMLImageElement html_image_element DONE HTMLObjectElement html_object_element DONE HTMLParamElement html_param_element DONE HTMLAppletElement html_applet_element DONE HTMLMapElement html_map_element DONE HTMLAreaElement html_area_element DONE HTMLScriptElement html_script_element DONE HTMLTableElement html_table_element DONE HTMLTableCaptionElement html_tablecaption_element DONE HTMLTableColElement html_tablecol_element DONE HTMLTableSectionElement html_tablesection_element DONE HTMLTableRowElement html_tablerow_element DONE HTMLTableCellElement html_tablecell_element DONE HTMLFrameSetElement html_frameset_element MISSING HTMLFrameElement html_frame_element MISSING HTMLIFrameElement html_iframe_element MISSING �����������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_frame_element.c������������������������������������������������0000644�0001750�0001750�00000013111�12377676745�021625� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar<rsk1coder99@gmail.com> */ #include <assert.h> #include <stdlib.h> #include <dom/html/html_frame_element.h> #include "html/html_document.h" #include "html/html_frame_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_FRAME_ELEMENT }, DOM_HTML_FRAME_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_frame_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_frame_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_frame_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_frame_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_frame_element object * * \param doc The document object * \param ele The dom_html_frame_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_frame_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_frame_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_FRAME], namespace, prefix); } /** * Finalise a dom_html_frame_element object * * \param ele The dom_html_frame_element object */ void _dom_html_frame_element_finalise(struct dom_html_frame_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_frame_element object * * \param ele The dom_html_frame_element object */ void _dom_html_frame_element_destroy(struct dom_html_frame_element *ele) { _dom_html_frame_element_finalise(ele); free(ele); } /** * Get the no_resize property * * \param ele The dom_html_frame_element object * \param no_resize The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_frame_element_get_no_resize(dom_html_frame_element *ele, bool *no_resize) { return dom_html_element_get_bool_property(&ele->base, "noresize", SLEN("noresize"), no_resize); } /** * Set the no_resize property * * \param ele The dom_html_frame_element object * \param no_resize The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_frame_element_set_no_resize(dom_html_frame_element *ele, bool no_resize) { return dom_html_element_set_bool_property(&ele->base, "noresize", SLEN("noresize"), no_resize); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_frame_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_frame_element_destroy(dom_node_internal *node) { _dom_html_frame_element_destroy((struct dom_html_frame_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_frame_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_frame_element_get_##attr( \ dom_html_frame_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_frame_element_set_##attr( \ dom_html_frame_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(long_desc); SIMPLE_GET_SET(name); SIMPLE_GET_SET(src); SIMPLE_GET_SET(frame_border); SIMPLE_GET_SET(margin_width); SIMPLE_GET_SET(margin_height); SIMPLE_GET_SET(scrolling); dom_exception dom_html_frame_element_get_content_document( dom_html_frame_element *ele, dom_document **content_document) { /* We don't support creating documents from within here */ UNUSED(ele); UNUSED(content_document); return DOM_NOT_SUPPORTED_ERR; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_text_area_element.h��������������������������������������������0000644�0001750�0001750�00000004315�12377676746�022523� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> */ #ifndef dom_internal_html_text_area_element_h_ #define dom_internal_html_text_area_element_h_ #include <dom/html/html_text_area_element.h> #include "html/html_element.h" struct dom_html_text_area_element { struct dom_html_element base; /**< The base class */ struct dom_html_form_element *form; /**< The form associated with the text_area */ dom_string *default_value; /**< Initial value */ bool default_value_set; /**< Whether default_value has been set */ dom_string *value; /**< Current value */ bool value_set; /**< Whether value has been set */ }; /* Create a dom_html_text_area_element object */ dom_exception _dom_html_text_area_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_text_area_element **ele); /* Initialise a dom_html_text_area_element object */ dom_exception _dom_html_text_area_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_text_area_element *ele); /* Finalise a dom_html_text_area_element object */ void _dom_html_text_area_element_finalise(struct dom_html_text_area_element *ele); /* Destroy a dom_html_text_area_element object */ void _dom_html_text_area_element_destroy(struct dom_html_text_area_element *ele); /* The protected virtual functions */ dom_exception _dom_html_text_area_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_text_area_element_destroy(dom_node_internal *node); dom_exception _dom_html_text_area_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TEXT_AREA_ELEMENT_PROTECT_VTABLE \ _dom_html_text_area_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TEXT_AREA_ELEMENT \ _dom_virtual_html_text_area_element_destroy, \ _dom_html_text_area_element_copy /* Internal function for bindings */ dom_exception _dom_html_text_area_element_set_form( dom_html_text_area_element *text_area, dom_html_form_element *form); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_quote_element.h������������������������������������������������0000644�0001750�0001750�00000003343�12377676745�021703� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com> */ #ifndef dom_internal_html_quote_element_h_ #define dom_internal_html_quote_element_h_ #include <dom/html/html_quote_element.h> #include "html/html_element.h" struct dom_html_quote_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_quote_element object */ dom_exception _dom_html_quote_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_quote_element **ele); /* Initialise a dom_html_quote_element object */ dom_exception _dom_html_quote_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_quote_element *ele); /* Finalise a dom_html_quote_element object */ void _dom_html_quote_element_finalise(struct dom_html_quote_element *ele); /* Destroy a dom_html_quote_element object */ void _dom_html_quote_element_destroy(struct dom_html_quote_element *ele); /* The protected virtual functions */ dom_exception _dom_html_quote_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_quote_element_destroy(dom_node_internal *node); dom_exception _dom_html_quote_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_QUOTE_ELEMENT_PROTECT_VTABLE \ _dom_html_quote_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_QUOTE_ELEMENT \ _dom_virtual_html_quote_element_destroy, \ _dom_html_quote_element_copy #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_tablecaption_element.h�����������������������������������������0000644�0001750�0001750�00000003642�12377676746�023216� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com> */ #ifndef dom_internal_html_table_caption_element_h_ #define dom_internal_html_table_caption_element_h_ #include <dom/html/html_tablecaption_element.h> #include "html/html_element.h" struct dom_html_table_caption_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_caption_element object */ dom_exception _dom_html_table_caption_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_caption_element **ele); /* Initialise a dom_html_table_caption_element object */ dom_exception _dom_html_table_caption_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_caption_element *ele); /* Finalise a dom_html_table_caption_element object */ void _dom_html_table_caption_element_finalise(struct dom_html_table_caption_element *ele); /* Destroy a dom_html_table_caption_element object */ void _dom_html_table_caption_element_destroy(struct dom_html_table_caption_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_caption_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_caption_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_caption_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_CAPTION_ELEMENT_PROTECT_VTABLE \ _dom_html_table_caption_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_CAPTION_ELEMENT \ _dom_virtual_html_table_caption_element_destroy, \ _dom_html_table_caption_element_copy #endif ����������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_tablesection_element.h�����������������������������������������0000644�0001750�0001750�00000004027�12377676746�023223� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com> */ #ifndef dom_internal_html_table_section_element_h_ #define dom_internal_html_table_section_element_h_ #include <dom/html/html_tablesection_element.h> #include "html/html_element.h" struct dom_html_table_section_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_section_element object */ dom_exception _dom_html_table_section_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_section_element **ele); /* Initialise a dom_html_table_section_element object */ dom_exception _dom_html_table_section_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_table_section_element *ele); /* Finalise a dom_html_table_section_element object */ void _dom_html_table_section_element_finalise(struct dom_html_table_section_element *ele); /* Destroy a dom_html_table_section_element object */ void _dom_html_table_section_element_destroy(struct dom_html_table_section_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_section_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_section_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_SECTION_ELEMENT_PROTECT_VTABLE \ _dom_html_table_section_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_SECTION_ELEMENT \ _dom_virtual_html_table_section_element_destroy, \ _dom_html_table_section_element_copy #endif bool table_section_callback(struct dom_node_internal *node, void *ctx); ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_isindex_element.c����������������������������������������������0000644�0001750�0001750�00000011245�12377676745�022204� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku.com> */ #include <stdlib.h> #include <dom/html/html_isindex_element.h> #include "html/html_document.h" #include "html/html_isindex_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_ISINDEX_ELEMENT }, DOM_HTML_ISINDEX_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_isindex_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_isindex_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_isindex_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_isindex_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_isindex_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_isindex_element object * * \param doc The document object * \param ele The dom_html_isindex_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_isindex_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_isindex_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_ISINDEX], namespace, prefix); } /** * Finalise a dom_html_isindex_element object * * \param ele The dom_html_isindex_element object */ void _dom_html_isindex_element_finalise(struct dom_html_isindex_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_isindex_element object * * \param ele The dom_html_isindex_element object */ void _dom_html_isindex_element_destroy(struct dom_html_isindex_element *ele) { _dom_html_isindex_element_finalise(ele); free(ele); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_isindex_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_isindex_element_destroy(dom_node_internal *node) { _dom_html_isindex_element_destroy((struct dom_html_isindex_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_isindex_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } /*-----------------------------------------------------------------------*/ /* API functions */ #define SIMPLE_GET(attr) \ dom_exception dom_html_isindex_element_get_##attr( \ dom_html_isindex_element *element, \ dom_string **attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_SET(attr) \ dom_exception dom_html_isindex_element_set_##attr( \ dom_html_isindex_element *element, \ dom_string *attr) \ { \ dom_exception ret; \ dom_string *_memo_##attr; \ \ _memo_##attr = \ ((struct dom_html_document *) \ ((struct dom_node_internal *)element)->owner)->\ memoised[hds_##attr]; \ \ ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ return ret; \ } #define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr) SIMPLE_GET_SET(prompt); /*-----------------------------------------------------------------------*/ /* Public APIs */ /** * Get the form element which contains this element * * \param ele The dom_html_isindex_element * \param form The form element * \return DOM_NO_ERR on success. */ dom_exception dom_html_isindex_element_get_form(dom_html_isindex_element *ele, struct dom_html_form_element **form) { UNUSED(ele); UNUSED(form); return DOM_NOT_SUPPORTED_ERR; } �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_mod_element.h��������������������������������������������������0000644�0001750�0001750�00000003340�12377676745�021322� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com> */ #ifndef dom_internal_html_mod_element_h_ #define dom_internal_html_mod_element_h_ #include <dom/html/html_mod_element.h> #include "html/html_element.h" struct dom_html_mod_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_mod_element object */ dom_exception _dom_html_mod_element_create(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_mod_element **ele); /* Initialise a dom_html_mod_element object */ dom_exception _dom_html_mod_element_initialise(struct dom_html_document *doc, dom_string *tag_name, dom_string *namespace, dom_string *prefix, struct dom_html_mod_element *ele); /* Finalise a dom_html_mod_element object */ void _dom_html_mod_element_finalise(struct dom_html_mod_element *ele); /* Destroy a dom_html_mod_element object */ void _dom_html_mod_element_destroy(struct dom_html_mod_element *ele); /* The protected virtual functions */ dom_exception _dom_html_mod_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_mod_element_destroy(dom_node_internal *node); dom_exception _dom_html_mod_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_MOD_ELEMENT_PROTECT_VTABLE \ _dom_html_mod_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_MOD_ELEMENT \ _dom_virtual_html_mod_element_destroy, \ _dom_html_mod_element_copy #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_tablerow_element.h���������������������������������������������0000644�0001750�0001750�00000003610�12377676746�022363� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar <rsk1coder99@gmail.com> */ #ifndef dom_internal_html_table_row_element_h_ #define dom_internal_html_table_row_element_h_ #include <dom/html/html_tablerow_element.h> #include "html/html_element.h" struct dom_html_table_row_element { struct dom_html_element base; /**< The base class */ }; /* Create a dom_html_table_row_element object */ dom_exception _dom_html_table_row_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_row_element **ele); /* Initialise a dom_html_table_row_element object */ dom_exception _dom_html_table_row_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_table_row_element *ele); /* Finalise a dom_html_table_row_element object */ void _dom_html_table_row_element_finalise(struct dom_html_table_row_element *ele); /* Destroy a dom_html_table_row_element object */ void _dom_html_table_row_element_destroy(struct dom_html_table_row_element *ele); /* The protected virtual functions */ dom_exception _dom_html_table_row_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed); void _dom_virtual_html_table_row_element_destroy(dom_node_internal *node); dom_exception _dom_html_table_row_element_copy(dom_node_internal *old, dom_node_internal **copy); #define DOM_HTML_TABLE_ROW_ELEMENT_PROTECT_VTABLE \ _dom_html_table_row_element_parse_attribute #define DOM_NODE_PROTECT_VTABLE_HTML_TABLE_ROW_ELEMENT \ _dom_virtual_html_table_row_element_destroy, \ _dom_html_table_row_element_copy #endif bool table_cells_callback(struct dom_node_internal *node, void *ctx); ������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/html/html_menu_element.c�������������������������������������������������0000644�0001750�0001750�00000007725�12377676745�021515� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2014 Rupinder Singh Khokhar<rsk1coder99@gmail.com> */ #include <assert.h> #include <stdlib.h> #include <dom/html/html_menu_element.h> #include "html/html_document.h" #include "html/html_menu_element.h" #include "core/node.h" #include "core/attr.h" #include "utils/utils.h" static struct dom_element_protected_vtable _protect_vtable = { { DOM_NODE_PROTECT_VTABLE_HTML_MENU_ELEMENT }, DOM_HTML_MENU_ELEMENT_PROTECT_VTABLE }; /** * Create a dom_html_menu_element object * * \param doc The document object * \param ele The returned element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_menu_element_create(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_menu_element **ele) { struct dom_node_internal *node; *ele = malloc(sizeof(dom_html_menu_element)); if (*ele == NULL) return DOM_NO_MEM_ERR; /* Set up vtables */ node = (struct dom_node_internal *) *ele; node->base.vtable = &_dom_html_element_vtable; node->vtable = &_protect_vtable; return _dom_html_menu_element_initialise(doc, namespace, prefix, *ele); } /** * Initialise a dom_html_menu_element object * * \param doc The document object * \param ele The dom_html_menu_element object * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_menu_element_initialise(struct dom_html_document *doc, dom_string *namespace, dom_string *prefix, struct dom_html_menu_element *ele) { return _dom_html_element_initialise(doc, &ele->base, doc->memoised[hds_MENU], namespace, prefix); } /** * Finalise a dom_html_menu_element object * * \param ele The dom_html_menu_element object */ void _dom_html_menu_element_finalise(struct dom_html_menu_element *ele) { _dom_html_element_finalise(&ele->base); } /** * Destroy a dom_html_menu_element object * * \param ele The dom_html_menu_element object */ void _dom_html_menu_element_destroy(struct dom_html_menu_element *ele) { _dom_html_menu_element_finalise(ele); free(ele); } /** * Get the compact property * * \param ele The dom_html_menu_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_menu_element_get_compact(dom_html_menu_element *ele, bool *compact) { return dom_html_element_get_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /** * Set the compact property * * \param ele The dom_html_menu_element object * \param compact The status * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception dom_html_menu_element_set_compact(dom_html_menu_element *ele, bool compact) { return dom_html_element_set_bool_property(&ele->base, "compact", SLEN("compact"), compact); } /*------------------------------------------------------------------------*/ /* The protected virtual functions */ /* The virtual function used to parse attribute value, see src/core/element.c * for detail */ dom_exception _dom_html_menu_element_parse_attribute(dom_element *ele, dom_string *name, dom_string *value, dom_string **parsed) { UNUSED(ele); UNUSED(name); dom_string_ref(value); *parsed = value; return DOM_NO_ERR; } /* The virtual destroy function, see src/core/node.c for detail */ void _dom_virtual_html_menu_element_destroy(dom_node_internal *node) { _dom_html_menu_element_destroy((struct dom_html_menu_element *) node); } /* The virtual copy function, see src/core/node.c for detail */ dom_exception _dom_html_menu_element_copy(dom_node_internal *old, dom_node_internal **copy) { return _dom_html_element_copy(old, copy); } �������������������������������������������netsurf-all-3.2/libdom/src/utils/�������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�016017� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/validate.h���������������������������������������������������������0000644�0001750�0001750�00000001145�12377676746�017775� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * * This file contains the API used to validate whether certain element's * name/namespace are legal according the XML 1.0 standard. See * * http://www.w3.org/TR/2004/REC-xml-20040204/ * * for detail. */ #ifndef dom_utils_valid_h_ #define dom_utils_valid_h_ #include <stdbool.h> #include <dom/core/string.h> bool _dom_validate_name(dom_string *name); bool _dom_validate_ncname(dom_string *name); #endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/namespace.c��������������������������������������������������������0000644�0001750�0001750�00000017620�12377676746�020140� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> */ #include <string.h> #include <dom/dom.h> #include "utils/namespace.h" #include "utils/validate.h" #include "utils/utils.h" /** XML prefix */ static dom_string *xml; /** XMLNS prefix */ static dom_string *xmlns; /* The namespace strings */ static const char *namespaces[DOM_NAMESPACE_COUNT] = { NULL, "http://www.w3.org/1999/xhtml", "http://www.w3.org/1998/Math/MathML", "http://www.w3.org/2000/svg", "http://www.w3.org/1999/xlink", "http://www.w3.org/XML/1998/namespace", "http://www.w3.org/2000/xmlns/" }; dom_string *dom_namespaces[DOM_NAMESPACE_COUNT] = { NULL, }; /** * Initialise the namespace component * * \return DOM_NO_ERR on success. */ static dom_exception _dom_namespace_initialise(void) { int i; dom_exception err; err = dom_string_create((const uint8_t *) "xml", SLEN("xml"), &xml); if (err != DOM_NO_ERR) { return err; } err = dom_string_create((const uint8_t *) "xmlns", SLEN("xmlns"), &xmlns); if (err != DOM_NO_ERR) { dom_string_unref(xml); xml = NULL; return err; } for (i = 1; i < DOM_NAMESPACE_COUNT; i++) { err = dom_string_create( (const uint8_t *) namespaces[i], strlen(namespaces[i]), &dom_namespaces[i]); if (err != DOM_NO_ERR) { dom_string_unref(xmlns); xmlns = NULL; dom_string_unref(xml); xml = NULL; return err; } } return DOM_NO_ERR; } #ifdef FINALISE_NAMESPACE /** * Finalise the namespace component * * \return DOM_NO_ERR on success. */ dom_exception _dom_namespace_finalise(void) { int i; if (xmlns != NULL) { dom_string_unref(xmlns); xmlns = NULL; } if (xml != NULL) { dom_string_unref(xml); xml = NULL; } for (i = 1; i < DOM_NAMESPACE_COUNT; i++) { if (dom_namespaces[i] != NULL) { dom_string_unref(dom_namespaces[i]); dom_namespaces[i] = NULL; } } return DOM_NO_ERR; } #endif /** * Ensure a QName is valid * * \param qname The qname to validate * \param namespace The namespace URI associated with the QName, or NULL * \return DOM_NO_ERR if valid, * DOM_INVALID_CHARACTER_ERR if ::qname contains an invalid character, * DOM_NAMESPACE_ERR if ::qname is malformed, or it has a * prefix and ::namespace is NULL, or * ::qname has a prefix "xml" and * ::namespace is not * "http://www.w3.org/XML/1998/namespace", * or ::qname has a prefix "xmlns" and * ::namespace is not * "http://www.w3.org/2000/xmlns", or * ::namespace is * "http://www.w3.org/2000/xmlns" and * ::qname is not (or is not prefixed by) * "xmlns". */ dom_exception _dom_namespace_validate_qname(dom_string *qname, dom_string *namespace) { uint32_t colon, len; if (xml == NULL) { dom_exception err = _dom_namespace_initialise(); if (err != DOM_NO_ERR) return err; } if (qname == NULL) { if (namespace != NULL) return DOM_NAMESPACE_ERR; if (namespace == NULL) return DOM_NO_ERR; } if (_dom_validate_name(qname) == false) return DOM_NAMESPACE_ERR; len = dom_string_length(qname); /* Find colon */ colon = dom_string_index(qname, ':'); if (colon == (uint32_t) -1) { /* No prefix */ /* If namespace URI is for xmlns, ensure qname == "xmlns" */ if (namespace != NULL && dom_string_isequal(namespace, dom_namespaces[DOM_NAMESPACE_XMLNS]) && dom_string_isequal(qname, xmlns) == false) { return DOM_NAMESPACE_ERR; } /* If qname == "xmlns", ensure namespace URI is for xmlns */ if (namespace != NULL && dom_string_isequal(qname, xmlns) && dom_string_isequal(namespace, dom_namespaces[DOM_NAMESPACE_XMLNS]) == false) { return DOM_NAMESPACE_ERR; } } else if (colon == 0) { /* Some name like ":name" */ if (namespace != NULL) return DOM_NAMESPACE_ERR; } else { /* Prefix */ dom_string *prefix; dom_string *lname; dom_exception err; /* Ensure there is a namespace URI */ if (namespace == NULL) { return DOM_NAMESPACE_ERR; } err = dom_string_substr(qname, 0, colon, &prefix); if (err != DOM_NO_ERR) { return err; } err = dom_string_substr(qname, colon + 1, len, &lname); if (err != DOM_NO_ERR) { dom_string_unref(prefix); return err; } if ((_dom_validate_ncname(prefix) == false) || (_dom_validate_ncname(lname) == false)) { dom_string_unref(prefix); dom_string_unref(lname); return DOM_NAMESPACE_ERR; } dom_string_unref(lname); /* Test for invalid XML namespace */ if (dom_string_isequal(prefix, xml) && dom_string_isequal(namespace, dom_namespaces[DOM_NAMESPACE_XML]) == false) { dom_string_unref(prefix); return DOM_NAMESPACE_ERR; } /* Test for invalid xmlns namespace */ if (dom_string_isequal(prefix, xmlns) && dom_string_isequal(namespace, dom_namespaces[DOM_NAMESPACE_XMLNS]) == false) { dom_string_unref(prefix); return DOM_NAMESPACE_ERR; } /* Test for presence of xmlns namespace with non xmlns prefix */ if (dom_string_isequal(namespace, dom_namespaces[DOM_NAMESPACE_XMLNS]) && dom_string_isequal(prefix, xmlns) == false) { dom_string_unref(prefix); return DOM_NAMESPACE_ERR; } dom_string_unref(prefix); } return DOM_NO_ERR; } /** * Split a QName into a namespace prefix and localname string * * \param qname The qname to split * \param prefix Pointer to location to receive prefix * \param localname Pointer to location to receive localname * \return DOM_NO_ERR on success. * * If there is no prefix present in ::qname, then ::prefix will be NULL. * * ::prefix and ::localname will be referenced. The caller should unreference * them once finished. */ dom_exception _dom_namespace_split_qname(dom_string *qname, dom_string **prefix, dom_string **localname) { uint32_t colon; dom_exception err; if (xml == NULL) { err = _dom_namespace_initialise(); if (err != DOM_NO_ERR) return err; } /* Find colon, if any */ colon = dom_string_index(qname, ':'); if (colon == (uint32_t) -1) { /* None found => no prefix */ *prefix = NULL; *localname = dom_string_ref(qname); } else { /* Found one => prefix */ err = dom_string_substr(qname, 0, colon, prefix); if (err != DOM_NO_ERR) { return err; } err = dom_string_substr(qname, colon + 1, dom_string_length(qname), localname); if (err != DOM_NO_ERR) { dom_string_unref(*prefix); *prefix = NULL; return err; } } return DOM_NO_ERR; } /** * Get the XML prefix dom_string * * \return the xml prefix dom_string. * * Note: The client of this function may or may not call the dom_string_ref * on the returned dom_string, because this string will only be destroyed when * the dom_finalise is called. But if the client call dom_string_ref, it must * call dom_string_unref to maintain a correct ref count of the dom_string. */ dom_string *_dom_namespace_get_xml_prefix(void) { if (xml == NULL) { if (_dom_namespace_initialise() != DOM_NO_ERR) return NULL; } return xml; } /** * Get the XMLNS prefix dom_string. * * \return the xmlns prefix dom_string * * Note: The client of this function may or may not call the dom_string_ref * on the returned dom_string, because this string will only be destroyed when * the dom_finalise is called. But if the client call dom_string_ref, it must * call dom_string_unref to maintain a correct ref count of the dom_string. */ dom_string *_dom_namespace_get_xmlns_prefix(void) { if (xml == NULL) { if (_dom_namespace_initialise() != DOM_NO_ERR) return NULL; } return xmlns; } ����������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/validate.c���������������������������������������������������������0000644�0001750�0001750�00000010721�12377676746�017770� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> */ #include <inttypes.h> #include <stddef.h> #include "utils/validate.h" #include <dom/core/string.h> #include "utils/character_valid.h" #include "utils/namespace.h" #include "utils/utils.h" #include <parserutils/charset/utf8.h> /* An combination of various tests */ static bool is_first_char(uint32_t ch); static bool is_name_char(uint32_t ch); /* Test whether the character can be the first character of * a NCName. */ static bool is_first_char(uint32_t ch) { /* Refer http://www.w3.org/TR/REC-xml/ for detail */ if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || (ch == '_') || (ch == ':') || ((ch >= 0xC0) && (ch <= 0xD6)) || ((ch >= 0xD8) && (ch <= 0xF6)) || ((ch >= 0xF8) && (ch <= 0x2FF)) || ((ch >= 0x370) && (ch <= 0x37D)) || ((ch >= 0x37F) && (ch <= 0x1FFF)) || ((ch >= 0x200C) && (ch <= 0x200D)) || ((ch >= 0x2070) && (ch <= 0x218F)) || ((ch >= 0x2C00) && (ch <= 0x2FEF)) || ((ch >= 0x3001) && (ch <= 0xD7FF)) || ((ch >= 0xF900) && (ch <= 0xFDCF)) || ((ch >= 0xFDF0) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0xEFFFF))) return true; if (is_letter(ch) || ch == (uint32_t) '_' || ch == (uint32_t) ':') { return true; } return false; } /* Test whether the character can be a part of a NCName */ static bool is_name_char(uint32_t ch) { /* Refer http://www.w3.org/TR/REC-xml/ for detail */ if (((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || /* !start */ (ch == '_') || (ch == ':') || (ch == '-') || (ch == '.') || (ch == 0xB7) || /* !start */ ((ch >= 0xC0) && (ch <= 0xD6)) || ((ch >= 0xD8) && (ch <= 0xF6)) || ((ch >= 0xF8) && (ch <= 0x2FF)) || ((ch >= 0x300) && (ch <= 0x36F)) || /* !start */ ((ch >= 0x370) && (ch <= 0x37D)) || ((ch >= 0x37F) && (ch <= 0x1FFF)) || ((ch >= 0x200C) && (ch <= 0x200D)) || ((ch >= 0x203F) && (ch <= 0x2040)) || /* !start */ ((ch >= 0x2070) && (ch <= 0x218F)) || ((ch >= 0x2C00) && (ch <= 0x2FEF)) || ((ch >= 0x3001) && (ch <= 0xD7FF)) || ((ch >= 0xF900) && (ch <= 0xFDCF)) || ((ch >= 0xFDF0) && (ch <= 0xFFFD)) || ((ch >= 0x10000) && (ch <= 0xEFFFF))) return true; if (is_letter(ch) == true) return true; if (is_digit(ch) == true) return true; if (is_combining_char(ch) == true) return true; if (is_extender(ch) == true) return true; return false; } /** * Test whether the name is a valid one according XML 1.0 standard. * For the standard please refer: * * http://www.w3.org/TR/2004/REC-xml-20040204/ * * \param name The name need to be tested * \return true if ::name is valid, false otherwise. */ bool _dom_validate_name(dom_string *name) { uint32_t ch; size_t clen, slen; parserutils_error err; const uint8_t *s; if (name == NULL) return false; slen = dom_string_length(name); if (slen == 0) return false; s = (const uint8_t *) dom_string_data(name); slen = dom_string_byte_length(name); err = parserutils_charset_utf8_to_ucs4(s, slen, &ch, &clen); if (err != PARSERUTILS_OK) { return false; } if (is_first_char(ch) == false) return false; s += clen; slen -= clen; while (slen > 0) { err = parserutils_charset_utf8_to_ucs4(s, slen, &ch, &clen); if (err != PARSERUTILS_OK) { return false; } if (is_name_char(ch) == false) return false; s += clen; slen -= clen; } return true; } /** * Validate whether the string is a legal NCName. * Refer http://www.w3.org/TR/REC-xml-names/ for detail. * * \param str The name to validate * \return true if ::name is valid, false otherwise. */ bool _dom_validate_ncname(dom_string *name) { uint32_t ch; size_t clen, slen; parserutils_error err; const uint8_t *s; if (name == NULL) return false; slen = dom_string_length(name); if (slen == 0) return false; s = (const uint8_t *) dom_string_data(name); slen = dom_string_byte_length(name); err = parserutils_charset_utf8_to_ucs4(s, slen, &ch, &clen); if (err != PARSERUTILS_OK) { return false; } if (is_letter(ch) == false && ch != (uint32_t) '_') return false; s += clen; slen -= clen; while (slen > 0) { err = parserutils_charset_utf8_to_ucs4(s, slen, &ch, &clen); if (err != PARSERUTILS_OK) { return false; } if (is_name_char(ch) == false) return false; if (ch == (uint32_t) ':') return false; s += clen; slen -= clen; } return true; } �����������������������������������������������netsurf-all-3.2/libdom/src/utils/hashtable.h��������������������������������������������������������0000644�0001750�0001750�00000002336�12377676746�020142� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2006 Rob Kendrick <rjek@rjek.com> * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> */ #ifndef dom_utils_hashtable_h_ #define dom_utils_hashtable_h_ #include <stdbool.h> #include <dom/functypes.h> typedef struct dom_hash_table dom_hash_table; typedef struct dom_hash_vtable { uint32_t (*hash)(void *key, void *pw); void *(*clone_key)(void *key, void *pw); void (*destroy_key)(void *key, void *pw); void *(*clone_value)(void *value, void *pw); void (*destroy_value)(void *value, void *pw); bool (*key_isequal)(void *key1, void *key2, void *pw); } dom_hash_vtable; dom_hash_table *_dom_hash_create(unsigned int chains, const dom_hash_vtable *vtable, void *pw); dom_hash_table *_dom_hash_clone(dom_hash_table *ht); void _dom_hash_destroy(dom_hash_table *ht); bool _dom_hash_add(dom_hash_table *ht, void *key, void *value, bool replace); void *_dom_hash_get(dom_hash_table *ht, void *key); void *_dom_hash_del(dom_hash_table *ht, void *key); void *_dom_hash_iterate(dom_hash_table *ht, uintptr_t *c1, uintptr_t **c2); uint32_t _dom_hash_get_length(dom_hash_table *ht); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/namespace.h��������������������������������������������������������0000644�0001750�0001750�00000001530�12377676746�020136� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef dom_utils_namespace_h_ #define dom_utils_namespace_h_ #include <dom/functypes.h> #include <dom/core/exceptions.h> #include <dom/core/string.h> struct dom_document; /* Ensure a QName is valid */ dom_exception _dom_namespace_validate_qname(dom_string *qname, dom_string *namespace); /* Split a QName into a namespace prefix and localname string */ dom_exception _dom_namespace_split_qname(dom_string *qname, dom_string **prefix, dom_string **localname); /* Get the XML prefix dom_string */ dom_string *_dom_namespace_get_xml_prefix(void); /* Get the XMLNS prefix dom_string */ dom_string *_dom_namespace_get_xmlns_prefix(void); #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/hashtable.c��������������������������������������������������������0000644�0001750�0001750�00000024024�12377676746�020133� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2006 Rob Kendrick <rjek@rjek.com> * Copyright 2006 Richard Wilson <info@tinct.net> * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> */ #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <assert.h> #ifdef TEST_RIG #include <stdio.h> #endif #include "utils/hashtable.h" #include <libwapcaplet/libwapcaplet.h> /* The hash table entry */ struct _dom_hash_entry { void *key; /**< The key pointer */ void *value; /**< The value pointer */ struct _dom_hash_entry *next; /**< Next entry */ }; /* The hash table */ struct dom_hash_table { const dom_hash_vtable *vtable; /**< Vtable */ void *pw; /**< Client data */ unsigned int nchains; /**< Number of chains */ struct _dom_hash_entry **chain; /**< The chain head */ uint32_t nentries; /**< The entries in this table */ }; /** * Create a new hash table, and return a context for it. The memory consumption * of a hash table is approximately 8 + (nchains * 12) bytes if it is empty. * * \param chains Number of chains/buckets this hash table will have. This * should be a prime number, and ideally a prime number just * over a power of two, for best performance and distribution * \param vtable Client vtable * \param pw Client private data * \return struct dom_hash_table containing the context of this hash table or * NULL if there is insufficent memory to create it and its chains. */ dom_hash_table *_dom_hash_create(unsigned int chains, const dom_hash_vtable *vtable, void *pw) { dom_hash_table *r = malloc(sizeof(struct dom_hash_table)); if (r == NULL) { return NULL; } r->vtable = vtable; r->pw = pw; r->nentries = 0; r->nchains = chains; r->chain = calloc(chains, sizeof(struct _dom_hash_entry *)); if (r->chain == NULL) { free(r); return NULL; } return r; } /** * Clone a hash table. * * \param ht Hash table to clone. * * \return The cloned hash table. */ dom_hash_table *_dom_hash_clone(dom_hash_table *ht) { void *key = NULL, *nkey = NULL; void *value = NULL, *nvalue = NULL; uintptr_t c1, *c2 = NULL; struct dom_hash_table *ret; ret = _dom_hash_create(ht->nchains, ht->vtable, ht->pw); if (ret == NULL) return NULL; while ( (key = _dom_hash_iterate(ht, &c1, &c2)) != NULL) { nkey = ht->vtable->clone_key(key, ht->pw); if (nkey == NULL) { _dom_hash_destroy(ret); return NULL; } value = _dom_hash_get(ht, key); nvalue = ht->vtable->clone_value(value, ht->pw); if (nvalue == NULL) { ht->vtable->destroy_key(nkey, ht->pw); _dom_hash_destroy(ret); return NULL; } if (_dom_hash_add(ret, nkey, nvalue, false) == false) { _dom_hash_destroy(ret); return NULL; } } return ret; } /** * Destroys a hash table, freeing all memory associated with it. * * \param ht Hash table to destroy. After the function returns, this * will nolonger be valid */ void _dom_hash_destroy(dom_hash_table *ht) { unsigned int i; if (ht == NULL) return; for (i = 0; i < ht->nchains; i++) { if (ht->chain[i] != NULL) { struct _dom_hash_entry *e = ht->chain[i]; while (e) { struct _dom_hash_entry *n = e->next; ht->vtable->destroy_key(e->key, ht->pw); ht->vtable->destroy_value(e->value, ht->pw); free(e); e = n; } } } free(ht->chain); free(ht); } /** * Adds a key/value pair to a hash table * * \param ht The hash table context to add the key/value pair to. * \param key The key to associate the value with. * \param value The value to associate the key with. * \return true if the add succeeded, false otherwise. (Failure most likely * indicates insufficent memory to make copies of the key and value. */ bool _dom_hash_add(dom_hash_table *ht, void *key, void *value, bool replace) { unsigned int h, c; struct _dom_hash_entry *e; if (ht == NULL || key == NULL || value == NULL) return false; h = ht->vtable->hash(key, ht->pw); c = h % ht->nchains; for (e = ht->chain[c]; e; e = e->next) { if (ht->vtable->key_isequal(key, e->key, ht->pw)) { if (replace == true) { e->value = value; return true; } else { return false; } } } e = malloc(sizeof(struct _dom_hash_entry)); if (e == NULL) { return false; } e->key = key; e->value = value; e->next = ht->chain[c]; ht->chain[c] = e; ht->nentries++; return true; } /** * Looks up a the value associated with with a key from a specific hash table. * * \param ht The hash table context to look up * \param key The key to search for * \return The value associated with the key, or NULL if it was not found. */ void *_dom_hash_get(struct dom_hash_table *ht, void *key) { unsigned int h, c; struct _dom_hash_entry *e; if (ht == NULL || key == NULL) return NULL; h = ht->vtable->hash(key, ht->pw); c = h % ht->nchains; for (e = ht->chain[c]; e; e = e->next) { if (ht->vtable->key_isequal(key, e->key, ht->pw)) return e->value; } return NULL; } /** * Delete the key from the hashtable. * * \param ht The hashtable object * \param key The key to delete * \return The deleted value */ void *_dom_hash_del(struct dom_hash_table *ht, void *key) { unsigned int h, c; struct _dom_hash_entry *e, *p; void *ret; if (ht == NULL || key == NULL) return NULL; h = ht->vtable->hash(key, ht->pw); c = h % ht->nchains; p = ht->chain[c]; for (e = p; e; p = e, e = e->next) { if (ht->vtable->key_isequal(key, e->key, ht->pw)) { if (p != e) { p->next = e->next; } else { /* The first item in this chain is target*/ ht->chain[c] = e->next; } ret = e->value; free(e); ht->nentries--; return ret; } } return NULL; } /** * Iterate through all available hash keys. * * \param ht The hash table context to iterate. * \param c1 Pointer to first context * \param c2 Pointer to second context (set to 0 on first call) * \return The next hash key, or NULL for no more keys */ void *_dom_hash_iterate(struct dom_hash_table *ht, uintptr_t *c1, uintptr_t **c2) { struct _dom_hash_entry **he = (struct _dom_hash_entry **) c2; if (ht == NULL) return NULL; if (!*he) *c1 = -1; else *he = (*he)->next; if (*he) return (*he)->key; while (!*he) { (*c1)++; if (*c1 >= ht->nchains) return NULL; *he = ht->chain[*c1]; } return (*he)->key; } /** * Get the number of elements in this hash table * * \param ht The hash table * * \return the number of elements */ uint32_t _dom_hash_get_length(struct dom_hash_table *ht) { return ht->nentries; } /*-----------------------------------------------------------------------*/ /* A simple test rig. To compile, use: * gcc -g -o hashtest -I../ -I../../include -DTEST_RIG hashtable.c * * If you make changes to this hash table implementation, please rerun this * test, and if possible, through valgrind to make sure there are no memory * leaks or invalid memory accesses. If you add new functionality, please * include a test for it that has good coverage along side the other tests. */ #ifdef TEST_RIG /** * Hash a pointer, returning a 32bit value. * * \param ptr The pointer to hash. * \return the calculated hash value for the pointer. */ static inline unsigned int _dom_hash_pointer_fnv(void *ptr) { return (unsigned int) ptr; } static void *test_alloc(void *p, size_t size, void *ptr) { if (p != NULL) { free(p); return NULL; } if (p == NULL) { return malloc(size); } } int main(int argc, char *argv[]) { struct dom_hash_table *a, *b; FILE *dict; char keybuf[BUFSIZ], valbuf[BUFSIZ]; int i; char *cow="cow", *moo="moo", *pig="pig", *oink="oink", *chicken="chikcken", *cluck="cluck", *dog="dog", *woof="woof", *cat="cat", *meow="meow"; void *ret; a = _dom_hash_create(79, _dom_hash_pointer_fnv, test_alloc, NULL); assert(a != NULL); b = _dom_hash_create(103, _dom_hash_pointer_fnv, test_alloc, NULL); assert(b != NULL); _dom_hash_add(a, cow, moo ,true); _dom_hash_add(b, moo, cow ,true); _dom_hash_add(a, pig, oink ,true); _dom_hash_add(b, oink, pig ,true); _dom_hash_add(a, chicken, cluck ,true); _dom_hash_add(b, cluck, chicken ,true); _dom_hash_add(a, dog, woof ,true); _dom_hash_add(b, woof, dog ,true); _dom_hash_add(a, cat, meow ,true); _dom_hash_add(b, meow, cat ,true); #define MATCH(x,y) assert(!strcmp((char *)hash_get(a, x), (char *)y)); \ assert(!strcmp((char *)hash_get(b, y), (char *)x)) MATCH(cow, moo); MATCH(pig, oink); MATCH(chicken, cluck); MATCH(dog, woof); MATCH(cat, meow); assert(hash_get_length(a) == 5); assert(hash_get_length(b) == 5); _dom_hash_del(a, cat); _dom_hash_del(b, meow); assert(hash_get(a, cat) == NULL); assert(hash_get(b, meow) == NULL); assert(hash_get_length(a) == 4); assert(hash_get_length(b) == 4); _dom_hash_destroy(a, NULL, NULL); _dom_hash_destroy(b, NULL, NULL); /* This test requires /usr/share/dict/words - a large list of English * words. We load the entire file - odd lines are used as keys, and * even lines are used as the values for the previous line. we then * work through it again making sure everything matches. * * We do this twice - once in a hash table with many chains, and once * with a hash table with fewer chains. */ a = _dom_hash_create(1031, _dom_hash_pointer_fnv, test_alloc, NULL); b = _dom_hash_create(7919, _dom_hash_pointer_fnv, test_alloc, NULL); dict = fopen("/usr/share/dict/words", "r"); if (dict == NULL) { fprintf(stderr, "Unable to open /usr/share/dict/words - \ extensive testing skipped.\n"); exit(0); } while (!feof(dict)) { fscanf(dict, "%s", keybuf); fscanf(dict, "%s", valbuf); _dom_hash_add(a, keybuf, valbuf, true); _dom_hash_add(b, keybuf, valbuf, true); } for (i = 0; i < 5; i++) { fseek(dict, 0, SEEK_SET); while (!feof(dict)) { fscanf(dict, "%s", keybuf); fscanf(dict, "%s", valbuf); assert(strcmp(hash_get(a, keybuf), valbuf) == 0); assert(strcmp(hash_get(b, keybuf), valbuf) == 0); } } _dom_hash_destroy(a, NULL, NULL); _dom_hash_destroy(b, NULL, NULL); fclose(dict); return 0; } #endif ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/character_valid.h��������������������������������������������������0000644�0001750�0001750�00000003152�12377676746�021317� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * * This file contains the API used to validate whether certain character in * name/value is legal according the XML 1.0 standard. See * * http://www.w3.org/TR/2004/REC-xml-20040204/ * http://www.w3.org/TR/REC-xml/ * * for detail. */ #ifndef dom_utils_character_valid_h_ #define dom_utils_character_valid_h_ #include <stdbool.h> #include <stdlib.h> struct xml_char_range { unsigned int start; unsigned int end; }; struct xml_char_group { size_t len; const struct xml_char_range *range; }; /* The groups */ extern const struct xml_char_group base_char_group; extern const struct xml_char_group char_group; extern const struct xml_char_group combining_char_group; extern const struct xml_char_group digit_char_group; extern const struct xml_char_group extender_group; extern const struct xml_char_group ideographic_group; bool _dom_is_character_in_group(unsigned int ch, const struct xml_char_group *group); #define is_base_char(ch) _dom_is_character_in_group((ch), &base_char_group) #define is_char(ch) _dom_is_character_in_group((ch), &char_group) #define is_combining_char(ch) _dom_is_character_in_group((ch), \ &combining_char_group) #define is_digit(ch) _dom_is_character_in_group((ch), &digit_char_group) #define is_extender(ch) _dom_is_character_in_group((ch), &extender_group) #define is_ideographic(ch) _dom_is_character_in_group((ch), &ideographic_group) #define is_letter(ch) (is_base_char(ch) || is_ideographic(ch)) #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/character_valid.c��������������������������������������������������0000644�0001750�0001750�00000021372�12377676746�021316� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> */ #include "utils/character_valid.h" #include <assert.h> static const struct xml_char_range base_char_range[] = { {0x41, 0x5a}, {0x61, 0x7a}, {0xc0, 0xd6}, {0xd8, 0xf6}, {0x00f8, 0x00ff}, {0x100, 0x131}, {0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3}, {0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8}, {0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da}, {0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3}, {0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481}, {0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb}, {0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559}, {0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a}, {0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce}, {0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939}, {0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, {0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5}, {0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e}, {0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82}, {0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d}, {0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5}, {0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47}, {0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100}, {0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c}, {0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140}, {0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155}, {0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165}, {0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173}, {0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab}, {0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2}, {0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b}, {0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182}, {0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3} }; const struct xml_char_group base_char_group = { sizeof(base_char_range) / sizeof(base_char_range[0]), base_char_range}; static const struct xml_char_range char_range[] = { {0x100, 0xd7ff}, {0xe000, 0xfffd}, {0x10000, 0x10ffff} }; const struct xml_char_group char_group = { sizeof(char_range) / sizeof(char_range[0]), char_range}; static const struct xml_char_range combining_char_range[] = { {0x300, 0x345}, {0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9}, {0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4}, {0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df}, {0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903}, {0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954}, {0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be}, {0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd}, {0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c}, {0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48}, {0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc}, {0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03}, {0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d}, {0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8}, {0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44}, {0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83}, {0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6}, {0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d}, {0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e}, {0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd}, {0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39}, {0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b}, {0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7}, {0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f}, {0x3099, 0x3099}, {0x309a, 0x309a} }; const struct xml_char_group combining_char_group = { sizeof(combining_char_range) / sizeof(combining_char_range[0]), combining_char_range }; static const struct xml_char_range digit_char_range[] = { {0x30, 0x39}, {0x660, 0x669}, {0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f}, {0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f}, {0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9}, {0xf20, 0xf29} }; const struct xml_char_group digit_char_group = { sizeof(digit_char_range) / sizeof(digit_char_range[0]), digit_char_range }; static const struct xml_char_range extender_range[] = { {0xb7, 0xb7}, {0x2d0, 0x2d0}, {0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46}, {0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e}, {0x30fc, 0x30fe} }; const struct xml_char_group extender_group = { sizeof(extender_range) / sizeof(extender_range[0]), extender_range }; static const struct xml_char_range ideographic_range[] = { {0x3007, 0x3007}, {0x3021, 0x3029}, {0x4e00, 0x9fa5} }; const struct xml_char_group ideographic_group = { sizeof(ideographic_range) / sizeof(ideographic_range[0]), ideographic_range }; /* The binary search helper function */ static bool binary_search(unsigned int ch, int left, int right, const struct xml_char_range *range); /* Search for ch in range[left, right] */ bool binary_search(unsigned int ch, int left, int right, const struct xml_char_range *range) { int mid; if (left > right) return false; mid = (left + right) / 2; if (ch >= range[mid].start && ch <= range[mid].end) return true; if (ch < range[mid].start) return binary_search(ch, left, mid - 1, range); if (ch > range[mid].end) return binary_search(ch, mid + 1, right, range); return false; } /** * Test whether certain character beint32_ts to some XML character group * * \param ch The character being tested * \param group The character group * \return true if the character beint32_ts to the group, false otherwise. * * Generally, we use an algorithm like binary search to find the desired * character in the group. The time complexity is about lg(n) and here n is * at most 180, so, I think the algorithm is fast enough for name validation. */ bool _dom_is_character_in_group(unsigned int ch, const struct xml_char_group *group) { int len = group->len; const struct xml_char_range *range = group->range; if (ch < range[0].start || ch > range[len-1].end) return false; return binary_search(ch, 0, len - 1, range); } #ifdef CHVALID_DEBUG /* The following is the testcases for this file. * Compile this file : * * gcc -o test -DCHVALID_DEBUG character_valid.c * */ #include <stdio.h> int main(int argc, char **argv) { unsigned int ch = 0x666; assert(is_digit(ch) == true); assert(is_base_char(ch) == false); assert(is_char(ch) == true); assert(is_extender(ch) == false); assert(is_combining_char(ch) == false); assert(is_ideographic(ch) == false); ch = 0xf40; assert(is_digit(ch) == false); assert(is_base_char(ch) == true); assert(is_char(ch) == true); assert(is_extender(ch) == false); assert(is_combining_char(ch) == false); assert(is_ideographic(ch) == false); printf("The test pass.\n"); return 0; } #endif ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/list.h�������������������������������������������������������������0000644�0001750�0001750�00000002307�12377676746�017160� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * * This file contains the list structure used to compose lists. * * Note: This is a implementation of a doubld-linked cyclar list. */ #ifndef dom_utils_list_h_ #define dom_utils_list_h_ #include <stddef.h> struct list_entry { struct list_entry *prev; struct list_entry *next; }; /** * Initialise a list_entry structure * * \param ent The entry to initialise */ static inline void list_init(struct list_entry *ent) { ent->prev = ent; ent->next = ent; } /** * Append a new list_entry after the list * * \param head The list header * \param new The new entry */ static inline void list_append(struct list_entry *head, struct list_entry *new) { new->next = head; new->prev = head->prev; head->prev->next = new; head->prev = new; } /** * Delete a list_entry from the list * * \param entry The entry need to be deleted from the list */ static inline void list_del(struct list_entry *ent) { ent->prev->next = ent->next; ent->next->prev = ent->prev; ent->prev = ent; ent->next = ent; } #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/utils.h������������������������������������������������������������0000644�0001750�0001750�00000001037�12377676746�017344� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef dom_utils_utils_h_ #define dom_utils_utils_h_ #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef SLEN /* Calculate length of a string constant */ #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ #endif #ifndef UNUSED #define UNUSED(x) ((x)=(x)) #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/utils/Makefile�����������������������������������������������������������0000644�0001750�0001750�00000000162�12377676746�017471� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sources DIR_SOURCES := namespace.c hashtable.c character_valid.c validate.c include $(NSBUILD)/Makefile.subdir ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/src/Makefile�����������������������������������������������������������������0000644�0001750�0001750�00000000053�12377676745�016327� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Src include $(NSBUILD)/Makefile.subdir �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�015665� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�016465� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/libxml_xmlparser.c����������������������������������������������0000644�0001750�0001750�00000110624�12377676745�022233� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #include <stdbool.h> #include <string.h> #include <assert.h> #include <libxml/parser.h> #include <libxml/SAX2.h> #include <libxml/xmlerror.h> #include <dom/dom.h> #include <libwapcaplet/libwapcaplet.h> #include "xmlerror.h" #include "xmlparser.h" #include "utils.h" #include "core/document.h" static void xml_parser_start_document(void *ctx); static void xml_parser_end_document(void *ctx); static void xml_parser_start_element_ns(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes); static void xml_parser_end_element_ns(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI); static dom_exception xml_parser_link_nodes(dom_xml_parser *parser, struct dom_node *dom, xmlNodePtr xml); static void xml_parser_add_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_element_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_text_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_cdata_section(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_entity_reference(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_entity(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_comment(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_add_document_type(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child); static void xml_parser_internal_subset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); static int xml_parser_is_standalone(void *ctx); static int xml_parser_has_internal_subset(void *ctx); static int xml_parser_has_external_subset(void *ctx); static xmlParserInputPtr xml_parser_resolve_entity(void *ctx, const xmlChar *publicId, const xmlChar *systemId); static xmlEntityPtr xml_parser_get_entity(void *ctx, const xmlChar *name); static void xml_parser_entity_decl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content); static void xml_parser_notation_decl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId); static void xml_parser_attribute_decl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree); static void xml_parser_element_decl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content); static void xml_parser_unparsed_entity_decl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName); static void xml_parser_set_document_locator(void *ctx, xmlSAXLocatorPtr loc); static void xml_parser_reference(void *ctx, const xmlChar *name); static void xml_parser_characters(void *ctx, const xmlChar *ch, int len); static void xml_parser_comment(void *ctx, const xmlChar *value); static xmlEntityPtr xml_parser_get_parameter_entity(void *ctx, const xmlChar *name); static void xml_parser_cdata_block(void *ctx, const xmlChar *value, int len); static void xml_parser_external_subset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID); /** * libdom XML parser object */ struct dom_xml_parser { xmlParserCtxtPtr xml_ctx; /**< libxml parser context */ struct dom_document *doc; /**< DOM Document we're building */ dom_string *udkey; /**< Key for DOM node user data */ dom_msg msg; /**< Informational message function */ void *mctx; /**< Pointer to client data */ }; /** * SAX callback dispatch table */ static xmlSAXHandler sax_handler = { .internalSubset = xml_parser_internal_subset, .isStandalone = xml_parser_is_standalone, .hasInternalSubset = xml_parser_has_internal_subset, .hasExternalSubset = xml_parser_has_external_subset, .resolveEntity = xml_parser_resolve_entity, .getEntity = xml_parser_get_entity, .entityDecl = xml_parser_entity_decl, .notationDecl = xml_parser_notation_decl, .attributeDecl = xml_parser_attribute_decl, .elementDecl = xml_parser_element_decl, .unparsedEntityDecl = xml_parser_unparsed_entity_decl, .setDocumentLocator = xml_parser_set_document_locator, .startDocument = xml_parser_start_document, .endDocument = xml_parser_end_document, .startElement = NULL, .endElement = NULL, .reference = xml_parser_reference, .characters = xml_parser_characters, .ignorableWhitespace = xml_parser_characters, .processingInstruction = NULL, .comment = xml_parser_comment, .warning = NULL, .error = NULL, .fatalError = NULL, .getParameterEntity = xml_parser_get_parameter_entity, .cdataBlock = xml_parser_cdata_block, .externalSubset = xml_parser_external_subset, .initialized = XML_SAX2_MAGIC, ._private = NULL, .startElementNs = xml_parser_start_element_ns, .endElementNs = xml_parser_end_element_ns, .serror = NULL }; static void *dom_xml_alloc(void *ptr, size_t len, void *pw) { UNUSED(pw); if (ptr == NULL) return len > 0 ? malloc(len) : NULL; if (len == 0) { free(ptr); return NULL; } return realloc(ptr, len); } /** * Create an XML parser instance * * \param enc Source charset, or NULL * \param int_enc Desired charset of document buffer (UTF-8 or UTF-16) * \param msg Informational message function * \param mctx Pointer to client-specific private data * \return Pointer to instance, or NULL on memory exhaustion * * Neither ::enc nor ::int_enc are used here. * libxml only supports a UTF-8 document buffer and forcibly setting the * parser encoding is not yet implemented */ dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, dom_msg msg, void *mctx, dom_document **document) { dom_xml_parser *parser; dom_exception err; int ret; UNUSED(enc); UNUSED(int_enc); parser = dom_xml_alloc(NULL, sizeof(dom_xml_parser), NULL); if (parser == NULL) { msg(DOM_MSG_CRITICAL, mctx, "No memory for parser"); return NULL; } parser->xml_ctx = xmlCreatePushParserCtxt(&sax_handler, parser, "", 0, NULL); if (parser->xml_ctx == NULL) { dom_xml_alloc(parser, 0, NULL); msg(DOM_MSG_CRITICAL, mctx, "Failed to create XML parser"); return NULL; } /* Set options of parsing context */ ret = xmlCtxtUseOptions(parser->xml_ctx, XML_PARSE_DTDATTR | XML_PARSE_DTDLOAD); if (ret != 0) { xmlFreeParserCtxt(parser->xml_ctx); dom_xml_alloc(parser, 0, NULL); msg(DOM_MSG_CRITICAL, mctx, "Failed setting parser options"); return NULL; } /* Create key for user data registration */ err = dom_string_create((const uint8_t *) "__xmlnode", SLEN("__xmlnode"), &parser->udkey); if (err != DOM_NO_ERR) { xmlFreeParserCtxt(parser->xml_ctx); dom_xml_alloc(parser, 0, NULL); msg(DOM_MSG_CRITICAL, mctx, "No memory for userdata key"); return NULL; } err = dom_implementation_create_document( DOM_IMPLEMENTATION_XML, /* namespace */ NULL, /* qname */ NULL, /* doctype */ NULL, NULL, NULL, document); if (err != DOM_NO_ERR) { xmlFreeParserCtxt(parser->xml_ctx); dom_string_unref(parser->udkey); dom_xml_alloc(parser, 0, NULL); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating document"); return NULL; } parser->doc = (dom_document *) dom_node_ref(*document); parser->msg = msg; parser->mctx = mctx; return parser; } /** * Destroy an XML parser instance * * \param parser The parser instance to destroy */ void dom_xml_parser_destroy(dom_xml_parser *parser) { dom_string_unref(parser->udkey); dom_node_unref(parser->doc); xmlFreeDoc(parser->xml_ctx->myDoc); xmlFreeParserCtxt(parser->xml_ctx); dom_xml_alloc(parser, 0, NULL); } /** * Parse a chunk of data * * \param parser The XML parser instance to use for parsing * \param data Pointer to data chunk * \param len Byte length of data chunk * \return DOM_XML_OK on success, DOM_XML_EXTERNAL_ERR | <libxml error> on failure */ dom_xml_error dom_xml_parser_parse_chunk(dom_xml_parser *parser, uint8_t *data, size_t len) { xmlParserErrors err; err = xmlParseChunk(parser->xml_ctx, (char *) data, len, 0); if (err != XML_ERR_OK) { parser->msg(DOM_MSG_ERROR, parser->mctx, "xmlParseChunk failed: %d", err); return DOM_XML_EXTERNAL_ERR | err; } return DOM_XML_OK; } /** * Notify parser that datastream is empty * * \param parser The XML parser instance to notify * \return DOM_XML_OK on success, DOM_XML_EXTERNAL_ERR | <libxml error> on failure * * This will force any remaining data through the parser */ dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser) { xmlParserErrors err; err = xmlParseChunk(parser->xml_ctx, "", 0, 1); if (err != XML_ERR_OK) { parser->msg(DOM_MSG_ERROR, parser->mctx, "xmlParseChunk failed: %d", err); return DOM_XML_EXTERNAL_ERR | err; } return DOM_XML_OK; } /** * Handle a document start SAX event * * \param ctx The callback context */ void xml_parser_start_document(void *ctx) { dom_xml_parser *parser = (dom_xml_parser *) ctx; dom_exception err; /* Invoke libxml2's default behaviour */ xmlSAX2StartDocument(parser->xml_ctx); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) parser->doc, (xmlNodePtr) parser->xml_ctx->myDoc); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_WARNING, parser->mctx, "Not able to link document nodes"); } } /** * Handle a document end SAX event * * \param ctx The callback context */ void xml_parser_end_document(void *ctx) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr node; xmlNodePtr n; dom_exception err; /* Invoke libxml2's default behaviour */ xmlSAX2EndDocument(parser->xml_ctx); /* If there is no document, we can't do anything */ if (parser->doc == NULL) { parser->msg(DOM_MSG_WARNING, parser->mctx, "No document in end_document"); return; } /* We need to mirror any child nodes at the end of the list of * children which occur after the last Element node in the list */ /* Get XML node */ err = dom_node_get_user_data((struct dom_node *) parser->doc, parser->udkey, (void **) (void *) &node); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_WARNING, parser->mctx, "Failed finding XML node"); return; } /* Find last Element node, if any */ for (n = node->last; n != NULL; n = n->prev) { if (n->type == XML_ELEMENT_NODE) break; } if (n == NULL) { /* No Element node found; entire list needs mirroring */ n = node->children; } else { /* Found last Element; skip over it */ n = n->next; } /* Now, mirror nodes in the DOM */ for (; n != NULL; n = n->next) { xml_parser_add_node(parser, (struct dom_node *) node->_private, n); } } /** * Handle an element open SAX event * * \param ctx The callback context * \param localname The local name of the element * \param prefix The element namespace prefix * \param URI The element namespace URI * \param nb_namespaces The number of namespace definitions * \param namespaces Array of nb_namespaces prefix/URI pairs * \param nb_attributes The total number of attributes * \param nb_defaulted The number of defaulted attributes * \param attributes Array of nb_attributes attribute values * * The number of non-defaulted attributes is ::nb_attributes - ::nb_defaulted * The defaulted attributes are at the end of the array ::attributes. */ void xml_parser_start_element_ns(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr parent = parser->xml_ctx->node; /* Invoke libxml2's default behaviour */ xmlSAX2StartElementNs(parser->xml_ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes); /* If there is no document, we can't do anything */ if (parser->doc == NULL) { parser->msg(DOM_MSG_WARNING, parser->mctx, "No document in start_element_ns"); return; } if (parent == NULL) { /* No parent; use document */ parent = (xmlNodePtr) parser->xml_ctx->myDoc; } if (parent->type == XML_DOCUMENT_NODE || parent->type == XML_ELEMENT_NODE) { /* Mirror in the DOM all children of the parent node * between the previous Element child (or the start, * whichever is encountered first) and the Element * just created */ xmlNodePtr n; /* Find previous element node, if any */ for (n = parser->xml_ctx->node->prev; n != NULL; n = n->prev) { if (n->type == XML_ELEMENT_NODE) break; } if (n == NULL) { /* No previous Element; use parent's children */ n = parent->children; } else { /* Previous Element; skip over it */ n = n->next; } /* Now, mirror nodes in the DOM */ for (; n != parser->xml_ctx->node; n = n->next) { xml_parser_add_node(parser, (struct dom_node *) parent->_private, n); } } /* Mirror the created node and its attributes in the DOM */ xml_parser_add_node(parser, (struct dom_node *) parent->_private, parser->xml_ctx->node); } /** * Handle an element close SAX event * * \param ctx The callback context * \param localname The local name of the element * \param prefix The element namespace prefix * \param URI The element namespace URI */ void xml_parser_end_element_ns(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlNodePtr node = parser->xml_ctx->node; xmlNodePtr n; /* Invoke libxml2's default behaviour */ xmlSAX2EndElementNs(parser->xml_ctx, localname, prefix, URI); /* If there is no document, we can't do anything */ if (parser->doc == NULL) { parser->msg(DOM_MSG_WARNING, parser->mctx, "No document in end_element_ns"); return; } /* If node wasn't linked, we can't do anything */ if (node->_private == NULL) { parser->msg(DOM_MSG_WARNING, parser->mctx, "Node '%s' not linked", node->name); return; } /* We need to mirror any child nodes at the end of the list of * children which occur after the last Element node in the list */ /* Find last Element node, if any */ for (n = node->last; n != NULL; n = n->prev) { if (n->type == XML_ELEMENT_NODE) break; } if (n == NULL) { /* No Element node found; entire list needs mirroring */ n = node->children; } else { /* Found last Element; skip over it */ n = n->next; } /* Now, mirror nodes in the DOM */ for (; n != NULL; n = n->next) { xml_parser_add_node(parser, (struct dom_node *) node->_private, n); } } /** * Link a DOM and XML node together * * \param parser The parser context * \param dom The DOM node * \param xml The XML node * \return DOM_NO_ERR on success, appropriate error otherwise */ dom_exception xml_parser_link_nodes(dom_xml_parser *parser, struct dom_node *dom, xmlNodePtr xml) { void *prev_data; dom_exception err; /* Register XML node as user data for DOM node */ err = dom_node_set_user_data(dom, parser->udkey, xml, NULL, &prev_data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed setting user data: %d", err); return err; } /* Register DOM node with the XML node */ xml->_private = dom; return DOM_NO_ERR; } /** * Add a node to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { static const char *node_types[] = { "THIS_IS_NOT_A_NODE", "XML_ELEMENT_NODE", "XML_ATTRIBUTE_NODE", "XML_TEXT_NODE", "XML_CDATA_SECTION_NODE", "XML_ENTITY_REF_NODE", "XML_ENTITY_NODE", "XML_PI_NODE", "XML_COMMENT_NODE", "XML_DOCUMENT_NODE", "XML_DOCUMENT_TYPE_NODE", "XML_DOCUMENT_FRAG_NODE", "XML_NOTATION_NODE", "XML_HTML_DOCUMENT_NODE", "XML_DTD_NODE", "XML_ELEMENT_DECL", "XML_ATTRIBUTE_DECL", "XML_ENTITY_DECL", "XML_NAMESPACE_DECL", "XML_XINCLUDE_START", "XML_XINCLUDE_END", "XML_DOCB_DOCUMENT_NODE" }; switch (child->type) { case XML_ELEMENT_NODE: xml_parser_add_element_node(parser, parent, child); break; case XML_TEXT_NODE: xml_parser_add_text_node(parser, parent, child); break; case XML_CDATA_SECTION_NODE: xml_parser_add_cdata_section(parser, parent, child); break; case XML_ENTITY_REF_NODE: xml_parser_add_entity_reference(parser, parent, child); break; case XML_COMMENT_NODE: xml_parser_add_comment(parser, parent, child); break; case XML_DTD_NODE: xml_parser_add_document_type(parser, parent, child); break; case XML_ENTITY_DECL: xml_parser_add_entity(parser, parent, child); break; default: parser->msg(DOM_MSG_NOTICE, parser->mctx, "Unsupported node type: %s", node_types[child->type]); } } /** * Add an element node to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_element_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { struct dom_element *el, *ins_el = NULL; xmlAttrPtr a; dom_exception err; /* Create the element node */ if (child->ns == NULL) { /* No namespace */ dom_string *tag_name; /* Create tag name DOM string */ err = dom_string_create(child->name, strlen((const char *) child->name), &tag_name); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for tag name"); return; } /* Create element node */ err = dom_document_create_element(parser->doc, tag_name, &el); if (err != DOM_NO_ERR) { dom_string_unref(tag_name); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating element '%s'", child->name); return; } /* No longer need tag name */ dom_string_unref(tag_name); } else { /* Namespace */ dom_string *namespace; dom_string *qname; size_t qnamelen = (child->ns->prefix != NULL ? strlen((const char *) child->ns->prefix) : 0) + (child->ns->prefix != NULL ? 1 : 0) /* ':' */ + strlen((const char *) child->name); uint8_t qnamebuf[qnamelen + 1 /* '\0' */]; /* Create namespace DOM string */ err = dom_string_create( child->ns->href, strlen((const char *) child->ns->href), &namespace); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for namespace"); return; } /* QName is "prefix:localname", * or "localname" if there is no prefix */ sprintf((char *) qnamebuf, "%s%s%s", child->ns->prefix != NULL ? (const char *) child->ns->prefix : "", child->ns->prefix != NULL ? ":" : "", (const char *) child->name); /* Create qname DOM string */ err = dom_string_create( qnamebuf, qnamelen, &qname); if (err != DOM_NO_ERR) { dom_string_unref(namespace); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for qname"); return; } /* Create element node */ err = dom_document_create_element_ns(parser->doc, namespace, qname, &el); if (err != DOM_NO_ERR) { dom_string_unref(namespace); dom_string_unref(qname); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating element '%s'", qnamebuf); return; } /* No longer need namespace / qname */ dom_string_unref(namespace); dom_string_unref(qname); } /* Add attributes to created element */ for (a = child->properties; a != NULL; a = a->next) { struct dom_attr *attr, *prev_attr; xmlNodePtr c; /* Create attribute node */ if (a->ns == NULL) { /* Attribute has no namespace */ dom_string *name; /* Create attribute name DOM string */ err = dom_string_create( a->name, strlen((const char *) a->name), &name); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for attribute name"); goto cleanup; } /* Create attribute */ err = dom_document_create_attribute(parser->doc, name, &attr); if (err != DOM_NO_ERR) { dom_string_unref(name); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating attribute \ '%s'", a->name); goto cleanup; } /* No longer need attribute name */ dom_string_unref(name); } else { /* Attribute has namespace */ dom_string *namespace; dom_string *qname; size_t qnamelen = (a->ns->prefix != NULL ? strlen((const char *) a->ns->prefix) : 0) + (a->ns->prefix != NULL ? 1 : 0) /* ':' */ + strlen((const char *) a->name); uint8_t qnamebuf[qnamelen + 1 /* '\0' */]; /* Create namespace DOM string */ err = dom_string_create( a->ns->href, strlen((const char *) a->ns->href), &namespace); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for namespace"); return; } /* QName is "prefix:localname", * or "localname" if there is no prefix */ sprintf((char *) qnamebuf, "%s%s%s", a->ns->prefix != NULL ? (const char *) a->ns->prefix : "", a->ns->prefix != NULL ? ":" : "", (const char *) a->name); /* Create qname DOM string */ err = dom_string_create( qnamebuf, qnamelen, &qname); if (err != DOM_NO_ERR) { dom_string_unref(namespace); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for qname"); return; } /* Create attribute */ err = dom_document_create_attribute_ns(parser->doc, namespace, qname, &attr); if (err != DOM_NO_ERR) { dom_string_unref(namespace); dom_string_unref(qname); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating attribute \ '%s'", qnamebuf); return; } /* No longer need namespace / qname */ dom_string_unref(namespace); dom_string_unref(qname); } /* Clone subtree (attribute value) */ for (c = a->children; c != NULL; c = c->next) { xml_parser_add_node(parser, (struct dom_node *) attr, c); } /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) attr, (xmlNodePtr) a); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) attr); goto cleanup; } if (a->ns == NULL) { /* And add attribute to the element */ err = dom_element_set_attribute_node(el, attr, &prev_attr); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) attr); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching attribute \ '%s'", a->name); goto cleanup; } } else { err = dom_element_set_attribute_node_ns(el, attr, &prev_attr); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) attr); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching attribute \ '%s'", a->name); goto cleanup; } } /* We're not interested in the previous attribute (if any) */ if (prev_attr != NULL && prev_attr != attr) dom_node_unref((struct dom_node *) prev_attr); /* We're no longer interested in the attribute node */ dom_node_unref((struct dom_node *) attr); } /* Append element to parent */ err = dom_node_append_child(parent, (struct dom_node *) el, (struct dom_node **) (void *) &ins_el); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching element '%s'", child->name); goto cleanup; } /* We're not interested in the inserted element */ if (ins_el != NULL) dom_node_unref((struct dom_node *) ins_el); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) el, child); if (err != DOM_NO_ERR) { goto cleanup; } /* No longer interested in element node */ dom_node_unref((struct dom_node *) el); return; cleanup: /* No longer want node (any attributes attached to it * will be cleaned up with it) */ dom_node_unref((struct dom_node *) el); return; } /** * Add a text node to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_text_node(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { struct dom_text *text, *ins_text = NULL; dom_string *data; dom_exception err; /* Create DOM string data for text node */ err = dom_string_create(child->content, strlen((const char *) child->content), &data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for text node contents "); return; } /* Create text node */ err = dom_document_create_text_node(parser->doc, data, &text); if (err != DOM_NO_ERR) { dom_string_unref(data); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for text node"); return; } /* No longer need data */ dom_string_unref(data); /* Append text node to parent */ err = dom_node_append_child(parent, (struct dom_node *) text, (struct dom_node **) (void *) &ins_text); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) text); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching text node"); return; } /* We're not interested in the inserted text node */ if (ins_text != NULL) dom_node_unref((struct dom_node *) ins_text); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) text, child); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) text); return; } /* No longer interested in text node */ dom_node_unref((struct dom_node *) text); } /** * Add a cdata section to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_cdata_section(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { struct dom_cdata_section *cdata, *ins_cdata = NULL; dom_string *data; dom_exception err; /* Create DOM string data for cdata section */ err = dom_string_create(child->content, strlen((const char *) child->content), &data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section contents"); return; } /* Create cdata section */ err = dom_document_create_cdata_section(parser->doc, data, &cdata); if (err != DOM_NO_ERR) { dom_string_unref(data); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section"); return; } /* No longer need data */ dom_string_unref(data); /* Append cdata section to parent */ err = dom_node_append_child(parent, (struct dom_node *) cdata, (struct dom_node **) (void *) &ins_cdata); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) cdata); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching cdata section"); return; } /* We're not interested in the inserted cdata section */ if (ins_cdata != NULL) dom_node_unref((struct dom_node *) ins_cdata); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) cdata, child); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) cdata); return; } /* No longer interested in cdata section */ dom_node_unref((struct dom_node *) cdata); } /** * Add an entity reference to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_entity_reference(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { struct dom_entity_reference *entity, *ins_entity = NULL; dom_string *name; xmlNodePtr c; dom_exception err; /* Create name of entity reference */ err = dom_string_create(child->name, strlen((const char *) child->name), &name); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for entity reference name"); return; } /* Create text node */ err = dom_document_create_entity_reference(parser->doc, name, &entity); if (err != DOM_NO_ERR) { dom_string_unref(name); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for entity reference"); return; } /* No longer need name */ dom_string_unref(name); /* Mirror subtree (reference value) */ for (c = child->children; c != NULL; c = c->next) { xml_parser_add_node(parser, (struct dom_node *) entity, c); } /* Append entity reference to parent */ err = dom_node_append_child(parent, (struct dom_node *) entity, (struct dom_node **) (void *) &ins_entity); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) entity); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching entity reference"); return; } /* We're not interested in the inserted entity reference */ if (ins_entity != NULL) dom_node_unref((struct dom_node *) ins_entity); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) entity, child); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) entity); return; } /* No longer interested in entity reference */ dom_node_unref((struct dom_node *) entity); } static void xml_parser_add_entity(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { UNUSED(parser); UNUSED(parent); UNUSED(child); } /** * Add a comment to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_comment(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { struct dom_comment *comment, *ins_comment = NULL; dom_string *data; dom_exception err; /* Create DOM string data for comment */ err = dom_string_create(child->content, strlen((const char *) child->content), &data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for comment data"); return; } /* Create comment */ err = dom_document_create_comment(parser->doc, data, &comment); if (err != DOM_NO_ERR) { dom_string_unref(data); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for comment node"); return; } /* No longer need data */ dom_string_unref(data); /* Append comment to parent */ err = dom_node_append_child(parent, (struct dom_node *) comment, (struct dom_node **) (void *) &ins_comment); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) comment); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed attaching comment node"); return; } /* We're not interested in the inserted comment */ if (ins_comment != NULL) dom_node_unref((struct dom_node *) ins_comment); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) comment, child); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) comment); return; } /* No longer interested in comment */ dom_node_unref((struct dom_node *) comment); } /** * Add a document type to the DOM * * \param parser The parser context * \param parent The parent DOM node * \param child The xmlNode to mirror in the DOM as a child of parent */ void xml_parser_add_document_type(dom_xml_parser *parser, struct dom_node *parent, xmlNodePtr child) { xmlDtdPtr dtd = (xmlDtdPtr) child; struct dom_document_type *doctype, *ins_doctype = NULL; const char *qname, *public_id, *system_id; dom_exception err; /* Create qname for doctype */ qname = (const char *) dtd->name; /* Create public ID for doctype */ public_id = dtd->ExternalID != NULL ? (const char *) dtd->ExternalID : ""; /* Create system ID for doctype */ system_id = dtd->SystemID != NULL ? (const char *) dtd->SystemID : ""; /* Create doctype */ err = dom_implementation_create_document_type( qname, public_id, system_id, &doctype); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed to create document type"); return; } /* Add doctype to document */ err = dom_node_append_child(parent, (struct dom_node *) doctype, (struct dom_node **) (void *) &ins_doctype); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) doctype); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed attaching doctype"); return; } /* Not interested in inserted node */ if (ins_doctype != NULL) dom_node_unref((struct dom_node *) ins_doctype); /* Link nodes together */ err = xml_parser_link_nodes(parser, (struct dom_node *) doctype, child); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) doctype); return; } /* No longer interested in doctype */ dom_node_unref((struct dom_node *) doctype); } /* ------------------------------------------------------------------------*/ void xml_parser_internal_subset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2InternalSubset(parser->xml_ctx, name, ExternalID, SystemID); } int xml_parser_is_standalone(void *ctx) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2IsStandalone(parser->xml_ctx); } int xml_parser_has_internal_subset(void *ctx) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2HasInternalSubset(parser->xml_ctx); } int xml_parser_has_external_subset(void *ctx) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2HasExternalSubset(parser->xml_ctx); } xmlParserInputPtr xml_parser_resolve_entity(void *ctx, const xmlChar *publicId, const xmlChar *systemId) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2ResolveEntity(parser->xml_ctx, publicId, systemId); } xmlEntityPtr xml_parser_get_entity(void *ctx, const xmlChar *name) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2GetEntity(parser->xml_ctx, name); } void xml_parser_entity_decl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2EntityDecl(parser->xml_ctx, name, type, publicId, systemId, content); } void xml_parser_notation_decl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2NotationDecl(parser->xml_ctx, name, publicId, systemId); } void xml_parser_attribute_decl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2AttributeDecl(parser->xml_ctx, elem, fullname, type, def, defaultValue, tree); } void xml_parser_element_decl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2ElementDecl(parser->xml_ctx, name, type, content); } void xml_parser_unparsed_entity_decl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2UnparsedEntityDecl(parser->xml_ctx, name, publicId, systemId, notationName); } void xml_parser_set_document_locator(void *ctx, xmlSAXLocatorPtr loc) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2SetDocumentLocator(parser->xml_ctx, loc); } void xml_parser_reference(void *ctx, const xmlChar *name) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2Reference(parser->xml_ctx, name); } void xml_parser_characters(void *ctx, const xmlChar *ch, int len) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2Characters(parser->xml_ctx, ch, len); } void xml_parser_comment(void *ctx, const xmlChar *value) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2Comment(parser->xml_ctx, value); } xmlEntityPtr xml_parser_get_parameter_entity(void *ctx, const xmlChar *name) { dom_xml_parser *parser = (dom_xml_parser *) ctx; return xmlSAX2GetParameterEntity(parser->xml_ctx, name); } void xml_parser_cdata_block(void *ctx, const xmlChar *value, int len) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2CDataBlock(parser->xml_ctx, value, len); } void xml_parser_external_subset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) { dom_xml_parser *parser = (dom_xml_parser *) ctx; xmlSAX2ExternalSubset(parser->xml_ctx, name, ExternalID, SystemID); } ������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/xmlparser.h�����������������������������������������������������0000644�0001750�0001750�00000001567�12377676745�020676� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef xml_xmlparser_h_ #define xml_xmlparser_h_ #include <stddef.h> #include <inttypes.h> #include <dom/dom.h> #include "xmlerror.h" typedef struct dom_xml_parser dom_xml_parser; /* Create an XML parser instance */ dom_xml_parser *dom_xml_parser_create(const char *enc, const char *int_enc, dom_msg msg, void *mctx, dom_document **document); /* Destroy an XML parser instance */ void dom_xml_parser_destroy(dom_xml_parser *parser); /* Parse a chunk of data */ dom_xml_error dom_xml_parser_parse_chunk(dom_xml_parser *parser, uint8_t *data, size_t len); /* Notify parser that datastream is empty */ dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser); #endif �����������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/xmlerror.h������������������������������������������������������0000644�0001750�0001750�00000000610�12377676745�020517� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef xml_xmlerror_h_ #define xml_xmlerror_h_ typedef enum { DOM_XML_OK = 0, DOM_XML_NOMEM = 1, DOM_XML_EXTERNAL_ERR = (1<<16), } dom_xml_error; #endif ������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/README����������������������������������������������������������0000644�0001750�0001750�00000001122�12377676745�017353� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������LibXML binding for libdom ========================= This is a wrapper around libxml's push parser API, to facilitate construction of a libdom DOM tree. The basic premise is that the wrapper intercepts the SAX events emitted by libxml's tokeniser then invokes libxml's own SAX handlers, wrapping the results up in libdom-specific data structures. The tree created is thus a tree of libdom nodes, each of which is linked to the libxml node that backs it. This allows the binding to process the DOM tree using libxml api, should it need to (e.g. for normalization purposes). ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/expat_xmlparser.c�����������������������������������������������0000644�0001750�0001750�00000034454�12377676745�022073� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> */ #include <stdbool.h> #include <string.h> #include <assert.h> #include <stdlib.h> #include <stdio.h> #include <dom/dom.h> #include "xmlparser.h" #include "utils.h" #include <expat.h> /** * expat XML parser object */ struct dom_xml_parser { dom_msg msg; /**< Informational message function */ void *mctx; /**< Pointer to client data */ XML_Parser parser; /**< expat parser context */ struct dom_document *doc; /**< DOM Document we're building */ struct dom_node *current; /**< DOM node we're currently building */ bool is_cdata; /**< If the character data is cdata or text */ }; /* Binding functions */ static void expat_xmlparser_start_element_handler(void *_parser, const XML_Char *name, const XML_Char **atts) { dom_xml_parser *parser = _parser; dom_exception err; dom_element *elem, *ins_elem; dom_string *tag_name; dom_string *namespace = NULL; const XML_Char *ns_sep = strchr(name, '\n'); if (ns_sep != NULL) { err = dom_string_create_interned((const uint8_t *)name, ns_sep - name, &namespace); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for namespace name"); return; } name = ns_sep + 1; } err = dom_string_create_interned((const uint8_t *)name, strlen(name), &tag_name); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for tag name"); if (namespace != NULL) dom_string_unref(namespace); return; } if (namespace == NULL) err = dom_document_create_element(parser->doc, tag_name, &elem); else err = dom_document_create_element_ns(parser->doc, namespace, tag_name, &elem); if (err != DOM_NO_ERR) { if (namespace != NULL) dom_string_unref(namespace); dom_string_unref(tag_name); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed to create element '%s'", name); return; } dom_string_unref(tag_name); if (namespace != NULL) dom_string_unref(namespace); /* Add attributes to the element */ while (*atts) { dom_string *key, *value; ns_sep = strchr(*atts, '\n'); if (ns_sep != NULL) { err = dom_string_create_interned((const uint8_t *)(*atts), ns_sep - (*atts), &namespace); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for attr namespace"); dom_node_unref(elem); return; } } else namespace = NULL; if (ns_sep == NULL) err = dom_string_create_interned((const uint8_t *)(*atts), strlen(*atts), &key); else err = dom_string_create_interned((const uint8_t *)(ns_sep + 1), strlen(ns_sep + 1), &key); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for attribute name"); if (namespace != NULL) dom_string_unref(namespace); dom_node_unref(elem); return; } atts++; err = dom_string_create((const uint8_t *)(*atts), strlen(*atts), &value); if (err != DOM_NO_ERR) { dom_node_unref(elem); if (namespace != NULL) dom_string_unref(namespace); dom_string_unref(key); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for attribute value"); return; } atts++; if (namespace == NULL) err = dom_element_set_attribute(elem, key, value); else err = dom_element_set_attribute_ns(elem, namespace, key, value); if (namespace != NULL) dom_string_unref(namespace); dom_string_unref(key); dom_string_unref(value); if (err != DOM_NO_ERR) { dom_node_unref(elem); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for setting attribute"); return; } } err = dom_node_append_child(parser->current, (struct dom_node *) elem, (struct dom_node **) (void *) &ins_elem); if (err != DOM_NO_ERR) { dom_node_unref(elem); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for appending child node"); return; } dom_node_unref(ins_elem); dom_node_unref(parser->current); parser->current = (struct dom_node *)elem; /* Steal initial ref */ } static void expat_xmlparser_end_element_handler(void *_parser, const XML_Char *name) { dom_xml_parser *parser = _parser; dom_exception err; dom_node *parent; UNUSED(name); err = dom_node_get_parent_node(parser->current, &parent); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Unable to find a parent while closing element."); return; } dom_node_unref(parser->current); parser->current = parent; /* Takes the ref given by get_parent_node */ } static void expat_xmlparser_start_cdata_handler(void *_parser) { dom_xml_parser *parser = _parser; parser->is_cdata = true; } static void expat_xmlparser_end_cdata_handler(void *_parser) { dom_xml_parser *parser = _parser; parser->is_cdata = false; } static void expat_xmlparser_cdata_handler(void *_parser, const XML_Char *s, int len) { dom_xml_parser *parser = _parser; dom_string *data; dom_exception err; struct dom_node *cdata, *ins_cdata, *lastchild = NULL; dom_node_type ntype = 0; err = dom_string_create((const uint8_t *)s, len, &data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section contents"); return; } err = dom_node_get_last_child(parser->current, &lastchild); if (err == DOM_NO_ERR && lastchild != NULL) { err = dom_node_get_node_type(lastchild, &ntype); } if (err != DOM_NO_ERR) { dom_string_unref(data); if (lastchild != NULL) dom_node_unref(lastchild); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section"); return; } if (ntype == DOM_TEXT_NODE && parser->is_cdata == false) { /* We can append this text instead */ err = dom_characterdata_append_data( (dom_characterdata *)lastchild, data); dom_string_unref(data); if (lastchild != NULL) dom_node_unref(lastchild); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section"); } return; } if (lastchild != NULL) dom_node_unref(lastchild); /* We can't append directly, so make a new node */ err = parser->is_cdata ? dom_document_create_cdata_section(parser->doc, data, (dom_cdata_section **) (void *) &cdata) : dom_document_create_text_node(parser->doc, data, (dom_text **) (void *) &cdata); if (err != DOM_NO_ERR) { dom_string_unref(data); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for cdata section"); return; } /* No longer need data */ dom_string_unref(data); /* Append cdata section to parent */ err = dom_node_append_child(parser->current, cdata, &ins_cdata); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) cdata); parser->msg(DOM_MSG_ERROR, parser->mctx, "Failed attaching cdata section"); return; } /* We're not interested in the inserted cdata section */ if (ins_cdata != NULL) dom_node_unref(ins_cdata); /* No longer interested in cdata section */ dom_node_unref(cdata); } static int expat_xmlparser_external_entity_ref_handler(XML_Parser parser, const XML_Char *context, const XML_Char *base, const XML_Char *system_id, const XML_Char *public_id) { FILE *fh; XML_Parser subparser; unsigned char data[1024]; size_t len; enum XML_Status status; UNUSED(base); UNUSED(public_id); if (system_id == NULL) return XML_STATUS_OK; fh = fopen(system_id, "r"); if (fh == NULL) return XML_STATUS_OK; subparser = XML_ExternalEntityParserCreate(parser, context, NULL); if (subparser == NULL) { fclose(fh); return XML_STATUS_OK; } /* Parse the file bit by bit */ while ((len = fread(data, 1, 1024, fh)) > 0) { status = XML_Parse(subparser, (const char *)data, len, 0); if (status != XML_STATUS_OK) { XML_ParserFree(subparser); fclose(fh); return XML_STATUS_OK; } } XML_Parse(subparser, "", 0, 1); XML_ParserFree(subparser); fclose(fh); return XML_STATUS_OK; } static void expat_xmlparser_comment_handler(void *_parser, const XML_Char *_comment) { dom_xml_parser *parser = _parser; struct dom_comment *comment, *ins_comment = NULL; dom_string *data; dom_exception err; /* Create DOM string data for comment */ err = dom_string_create((const uint8_t *)_comment, strlen((const char *) _comment), &data); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for comment data"); return; } /* Create comment */ err = dom_document_create_comment(parser->doc, data, &comment); if (err != DOM_NO_ERR) { dom_string_unref(data); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "No memory for comment node"); return; } /* No longer need data */ dom_string_unref(data); /* Append comment to parent */ err = dom_node_append_child(parser->current, (struct dom_node *) comment, (struct dom_node **) (void *) &ins_comment); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) comment); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed attaching comment node"); return; } /* We're not interested in the inserted comment */ if (ins_comment != NULL) dom_node_unref((struct dom_node *) ins_comment); /* No longer interested in comment */ dom_node_unref((struct dom_node *) comment); } static void expat_xmlparser_start_doctype_decl_handler(void *_parser, const XML_Char *doctype_name, const XML_Char *system_id, const XML_Char *public_id, int has_internal_subset) { dom_xml_parser *parser = _parser; struct dom_document_type *doctype, *ins_doctype = NULL; dom_exception err; UNUSED(has_internal_subset); err = dom_implementation_create_document_type( doctype_name, system_id ? system_id : "", public_id ? public_id : "", &doctype); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed to create document type"); return; } /* Add doctype to document */ err = dom_node_append_child(parser->doc, (struct dom_node *) doctype, (struct dom_node **) (void *) &ins_doctype); if (err != DOM_NO_ERR) { dom_node_unref((struct dom_node *) doctype); parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed attaching doctype"); return; } /* Not interested in inserted node */ if (ins_doctype != NULL) dom_node_unref((struct dom_node *) ins_doctype); /* No longer interested in doctype */ dom_node_unref((struct dom_node *) doctype); } static void expat_xmlparser_unknown_data_handler(void *_parser, const XML_Char *s, int len) { UNUSED(_parser); UNUSED(s); UNUSED(len); } /** * Create an XML parser instance * * \param enc Source charset, or NULL * \param int_enc Desired charset of document buffer (UTF-8 or UTF-16) * \param msg Informational message function * \param mctx Pointer to client-specific private data * \return Pointer to instance, or NULL on memory exhaustion * * int_enc is ignored due to it being made of bees. */ dom_xml_parser * dom_xml_parser_create(const char *enc, const char *int_enc, dom_msg msg, void *mctx, dom_document **document) { dom_xml_parser *parser; dom_exception err; UNUSED(int_enc); parser = calloc(sizeof(*parser), 1); if (parser == NULL) { msg(DOM_MSG_CRITICAL, mctx, "No memory for parser"); return NULL; } parser->msg = msg; parser->mctx = mctx; parser->parser = XML_ParserCreateNS(enc, '\n'); if (parser->parser == NULL) { free(parser); msg(DOM_MSG_CRITICAL, mctx, "No memory for parser"); return NULL; } parser->doc = NULL; err = dom_implementation_create_document( DOM_IMPLEMENTATION_XML, /* namespace */ NULL, /* qname */ NULL, /* doctype */ NULL, NULL, NULL, document); if (err != DOM_NO_ERR) { parser->msg(DOM_MSG_CRITICAL, parser->mctx, "Failed creating document"); XML_ParserFree(parser->parser); free(parser); return NULL; } parser->doc = (dom_document *) dom_node_ref(*document); XML_SetUserData(parser->parser, parser); XML_SetElementHandler(parser->parser, expat_xmlparser_start_element_handler, expat_xmlparser_end_element_handler); XML_SetCdataSectionHandler(parser->parser, expat_xmlparser_start_cdata_handler, expat_xmlparser_end_cdata_handler); XML_SetCharacterDataHandler(parser->parser, expat_xmlparser_cdata_handler); XML_SetParamEntityParsing(parser->parser, XML_PARAM_ENTITY_PARSING_ALWAYS); XML_SetExternalEntityRefHandler(parser->parser, expat_xmlparser_external_entity_ref_handler); XML_SetCommentHandler(parser->parser, expat_xmlparser_comment_handler); XML_SetStartDoctypeDeclHandler(parser->parser, expat_xmlparser_start_doctype_decl_handler); XML_SetDefaultHandlerExpand(parser->parser, expat_xmlparser_unknown_data_handler); parser->current = dom_node_ref(parser->doc); parser->is_cdata = false; return parser; } /** * Destroy an XML parser instance * * \param parser The parser instance to destroy */ void dom_xml_parser_destroy(dom_xml_parser *parser) { XML_ParserFree(parser->parser); if (parser->current != NULL) dom_node_unref(parser->current); dom_node_unref(parser->doc); free(parser); } /** * Parse a chunk of data * * \param parser The XML parser instance to use for parsing * \param data Pointer to data chunk * \param len Byte length of data chunk * \return DOM_XML_OK on success, DOM_XML_EXTERNAL_ERR | <expat error> on failure */ dom_xml_error dom_xml_parser_parse_chunk(dom_xml_parser *parser, uint8_t *data, size_t len) { enum XML_Status status; status = XML_Parse(parser->parser, (const char *)data, len, 0); if (status != XML_STATUS_OK) { parser->msg(DOM_MSG_ERROR, parser->mctx, "XML_Parse failed: %d", status); return DOM_XML_EXTERNAL_ERR | status; } return DOM_XML_OK; } /** * Notify parser that datastream is empty * * \param parser The XML parser instance to notify * \return DOM_XML_OK on success, DOM_XML_EXTERNAL_ERR | <expat error> on failure * * This will force any remaining data through the parser */ dom_xml_error dom_xml_parser_completed(dom_xml_parser *parser) { enum XML_Status status; status = XML_Parse(parser->parser, "", 0, 1); if (status != XML_STATUS_OK) { parser->msg(DOM_MSG_ERROR, parser->mctx, "XML_Parse failed: %d", status); return DOM_XML_EXTERNAL_ERR | status; } return DOM_XML_OK; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/utils.h���������������������������������������������������������0000644�0001750�0001750�00000001023�12377676745�020004� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef xml_utils_h_ #define xml_utils_h_ #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef SLEN /* Calculate length of a string constant */ #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ #endif #ifndef UNUSED #define UNUSED(x) ((x)=(x)) #endif #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/xml/Makefile��������������������������������������������������������0000644�0001750�0001750�00000001473�12377676745�020144� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ifeq ($(WITH_LIBXML_BINDING),yes) DIR_SOURCES := libxml_xmlparser.c # LibXML2 ifneq ($(PKGCONFIG),) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libxml-2.0 --cflags) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libxml-2.0 --libs) else CFLAGS := $(CFLAGS) -I$(PREFIX)/include/libxml2 LDFLAGS := $(LDFLAGS) -lxml2 endif # LibXML 2.6.26 has a bug in its headers that expects _POSIX_C_SOURCE to be # defined. Define it here, even though we don't need it. CFLAGS := $(CFLAGS) -D_POSIX_C_SOURCE DO_XML_INSTALL := yes endif ifeq ($(WITH_EXPAT_BINDING),yes) DIR_SOURCES := expat_xmlparser.c LDFLAGS := $(LDFLAGS) -lexpat DO_XML_INSTALL := yes endif ifeq ($(DO_XML_INSTALL),yes) DIR_INSTALL_ITEMS := /include/dom/bindings/xml:xmlerror.h;xmlparser.h endif include $(NSBUILD)/Makefile.subdir �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/�������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�017134� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/parser.h�����������������������������������������������������0000644�0001750�0001750�00000005751�12377676745�020623� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef dom_hubbub_parser_h_ #define dom_hubbub_parser_h_ #include <stddef.h> #include <inttypes.h> #include <hubbub/errors.h> #include <dom/dom.h> #include "errors.h" /** * Type of script completion function */ typedef dom_hubbub_error (*dom_script)(void *ctx, struct dom_node *node); typedef struct dom_hubbub_parser dom_hubbub_parser; /* The encoding source of the document */ typedef enum dom_hubbub_encoding_source { DOM_HUBBUB_ENCODING_SOURCE_HEADER, DOM_HUBBUB_ENCODING_SOURCE_DETECTED, DOM_HUBBUB_ENCODING_SOURCE_META } dom_hubbub_encoding_source; /* The recommended way to use the parser is: * * dom_hubbub_parser_create(...); * dom_hubbub_parser_parse_chunk(...); * call _parse_chunk for all chunks of data * * After you have parsed the data, * * dom_hubbub_parser_completed(...); * dom_hubbub_parser_destroy(...); * * Clients must ensure that these function calls above are called in * the order shown. dom_hubbub_parser_create() will pass the ownership * of the document to the client. After that, the parser should be destroyed. * The client must not call any method of this parser after destruction. */ /** * Parameter block for dom_hubbub_parser_create */ typedef struct dom_hubbub_parser_params { const char *enc; /**< Source charset, or NULL */ bool fix_enc; /**< Whether fix the encoding */ bool enable_script; /**< Whether scripting should be enabled. */ dom_script script; /**< Script callback function */ dom_msg msg; /**< Informational message function */ void *ctx; /**< Pointer to client-specific private data */ /** default action fetcher function */ dom_events_default_action_fetcher daf; } dom_hubbub_parser_params; /* Create a Hubbub parser instance */ dom_hubbub_error dom_hubbub_parser_create(dom_hubbub_parser_params *params, dom_hubbub_parser **parser, dom_document **document); /* Destroy a Hubbub parser instance */ void dom_hubbub_parser_destroy(dom_hubbub_parser *parser); /* Parse a chunk of data */ dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser, const uint8_t *data, size_t len); /* insert data into the parse stream but do not parse it */ dom_hubbub_error dom_hubbub_parser_insert_chunk(dom_hubbub_parser *parser, const uint8_t *data, size_t length); /* Notify parser that datastream is empty */ dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser); /* Retrieve the document's encoding */ const char *dom_hubbub_parser_get_encoding(dom_hubbub_parser *parser, dom_hubbub_encoding_source *source); /** * Set the Parse pause state. * * \param parser The parser object * \param pause The pause state to set. * \return DOM_HUBBUB_OK on success, * DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on failure */ dom_hubbub_error dom_hubbub_parser_pause(dom_hubbub_parser *parser, bool pause); #endif �����������������������netsurf-all-3.2/libdom/bindings/hubbub/parser.c�����������������������������������������������������0000644�0001750�0001750�00000055136�12377676745�020620� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com> * Copyright 2012 Daniel Silverstone <dsilvers@netsurf-browser.org> */ #include <stdio.h> #include <string.h> #include <hubbub/errors.h> #include <hubbub/hubbub.h> #include <hubbub/parser.h> #include <dom/dom.h> #include "parser.h" #include "utils.h" #include "core/document.h" #include "core/string.h" #include "core/node.h" #include "html/html_document.h" #include "html/html_button_element.h" #include "html/html_input_element.h" #include "html/html_select_element.h" #include "html/html_text_area_element.h" #include <libwapcaplet/libwapcaplet.h> /** * libdom Hubbub parser context */ struct dom_hubbub_parser { hubbub_parser *parser; /**< Hubbub parser instance */ hubbub_tree_handler tree_handler; /**< Hubbub parser tree handler */ struct dom_document *doc; /**< DOM Document we're building */ dom_hubbub_encoding_source encoding_source; /**< The document's encoding source */ const char *encoding; /**< The document's encoding */ bool complete; /**< Indicate stream completion */ dom_msg msg; /**< Informational messaging function */ dom_script script; /**< Script callback function */ void *mctx; /**< Pointer to client data */ }; /* Forward declaration to break reference loop */ static hubbub_error add_attributes(void *parser, void *node, const hubbub_attribute *attributes, uint32_t n_attributes); /*--------------------- The callbacks definitions --------------------*/ static hubbub_error create_comment(void *parser, const hubbub_string *data, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; dom_string *str; struct dom_comment *comment; *result = NULL; err = dom_string_create(data->ptr, data->len, &str); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create comment node text"); return HUBBUB_UNKNOWN; } err = dom_document_create_comment(dom_parser->doc, str, &comment); if (err != DOM_NO_ERR) { dom_string_unref(str); dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create comment node with text '%.*s'", data->len, data->ptr); return HUBBUB_UNKNOWN; } *result = comment; dom_string_unref(str); return HUBBUB_OK; } static char *parser_strndup(const char *s, size_t n) { size_t len; char *s2; for (len = 0; len != n && s[len] != '\0'; len++) continue; s2 = malloc(len + 1); if (s2 == NULL) return NULL; memcpy(s2, s, len); s2[len] = '\0'; return s2; } static hubbub_error create_doctype(void *parser, const hubbub_doctype *doctype, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; char *qname, *public_id = NULL, *system_id = NULL; struct dom_document_type *dtype; *result = NULL; qname = parser_strndup((const char *) doctype->name.ptr, (size_t) doctype->name.len); if (qname == NULL) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create doctype name"); goto fail; } if (doctype->public_missing == false) { public_id = parser_strndup( (const char *) doctype->public_id.ptr, (size_t) doctype->public_id.len); } else { public_id = strdup(""); } if (public_id == NULL) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create doctype public id"); goto clean1; } if (doctype->system_missing == false) { system_id = parser_strndup( (const char *) doctype->system_id.ptr, (size_t) doctype->system_id.len); } else { system_id = strdup(""); } if (system_id == NULL) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create doctype system id"); goto clean2; } err = dom_implementation_create_document_type(qname, public_id, system_id, &dtype); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create the document type"); goto clean3; } *result = dtype; clean3: free(system_id); clean2: free(public_id); clean1: free(qname); fail: if (*result == NULL) return HUBBUB_UNKNOWN; else return HUBBUB_OK; } static hubbub_error create_element(void *parser, const hubbub_tag *tag, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; dom_string *name; struct dom_element *element = NULL; hubbub_error herr; *result = NULL; err = dom_string_create_interned(tag->name.ptr, tag->name.len, &name); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create element name"); goto fail; } if (tag->ns == HUBBUB_NS_NULL) { err = dom_document_create_element(dom_parser->doc, name, &element); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create the DOM element"); goto clean1; } } else { err = dom_document_create_element_ns(dom_parser->doc, dom_namespaces[tag->ns], name, &element); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create the DOM element"); goto clean1; } } if (element != NULL && tag->n_attributes > 0) { herr = add_attributes(parser, element, tag->attributes, tag->n_attributes); if (herr != HUBBUB_OK) goto clean1; } *result = element; clean1: dom_string_unref(name); fail: if (*result == NULL) return HUBBUB_UNKNOWN; else return HUBBUB_OK; } static hubbub_error create_text(void *parser, const hubbub_string *data, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; dom_string *str; struct dom_text *text = NULL; *result = NULL; err = dom_string_create(data->ptr, data->len, &str); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create text '%.*s'", data->len, data->ptr); goto fail; } err = dom_document_create_text_node(dom_parser->doc, str, &text); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create the DOM text node"); goto clean1; } *result = text; clean1: dom_string_unref(str); fail: if (*result == NULL) return HUBBUB_UNKNOWN; else return HUBBUB_OK; } static hubbub_error ref_node(void *parser, void *node) { struct dom_node *dnode = (struct dom_node *) node; UNUSED(parser); dom_node_ref(dnode); return HUBBUB_OK; } static hubbub_error unref_node(void *parser, void *node) { struct dom_node *dnode = (struct dom_node *) node; UNUSED(parser); dom_node_unref(dnode); return HUBBUB_OK; } static hubbub_error append_child(void *parser, void *parent, void *child, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; err = dom_node_append_child((struct dom_node *) parent, (struct dom_node *) child, (struct dom_node **) result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't append child '%p' for parent '%p'", child, parent); return HUBBUB_UNKNOWN; } return HUBBUB_OK; } static hubbub_error insert_before(void *parser, void *parent, void *child, void *ref_child, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; err = dom_node_insert_before((struct dom_node *) parent, (struct dom_node *) child, (struct dom_node *) ref_child, (struct dom_node **) result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't insert node '%p' before node '%p'", child, ref_child); return HUBBUB_UNKNOWN; } return HUBBUB_OK; } static hubbub_error remove_child(void *parser, void *parent, void *child, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; err = dom_node_remove_child((struct dom_node *) parent, (struct dom_node *) child, (struct dom_node **) result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't remove child '%p'", child); return HUBBUB_UNKNOWN; } return HUBBUB_OK; } static hubbub_error clone_node(void *parser, void *node, bool deep, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; err = dom_node_clone_node((struct dom_node *) node, deep, (struct dom_node **) result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't clone node '%p'", node); return HUBBUB_UNKNOWN; } return HUBBUB_OK; } static hubbub_error reparent_children(void *parser, void *node, void *new_parent) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; struct dom_node *child, *result; while(true) { err = dom_node_get_first_child((struct dom_node *) node, &child); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_note_get_first_child"); return HUBBUB_UNKNOWN; } if (child == NULL) break; err = dom_node_remove_child(node, (struct dom_node *) child, &result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_node_remove_child"); goto fail; } dom_node_unref(result); err = dom_node_append_child((struct dom_node *) new_parent, (struct dom_node *) child, &result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_node_append_child"); goto fail; } dom_node_unref(result); dom_node_unref(child); } return HUBBUB_OK; fail: dom_node_unref(child); return HUBBUB_UNKNOWN; } static hubbub_error get_parent(void *parser, void *node, bool element_only, void **result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; struct dom_node *parent; dom_node_type type = DOM_NODE_TYPE_COUNT; err = dom_node_get_parent_node((struct dom_node *) node, &parent); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_node_get_parent"); return HUBBUB_UNKNOWN; } if (element_only == false) { *result = parent; return HUBBUB_OK; } err = dom_node_get_node_type(parent, &type); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_node_get_type"); goto fail; } if (type == DOM_ELEMENT_NODE) { *result = parent; return HUBBUB_OK; } else { *result = NULL; dom_node_unref(parent); return HUBBUB_OK; } return HUBBUB_OK; fail: dom_node_unref(parent); return HUBBUB_UNKNOWN; } static hubbub_error has_children(void *parser, void *node, bool *result) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; err = dom_node_has_child_nodes((struct dom_node *) node, result); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in dom_node_has_child_nodes"); return HUBBUB_UNKNOWN; } return HUBBUB_OK; } static hubbub_error form_associate(void *parser, void *form, void *node) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_html_form_element *form_ele = form; dom_node_internal *ele = node; dom_html_document *doc = (dom_html_document *)ele->owner; dom_exception err = DOM_NO_ERR; /* Determine the kind of the node we have here. */ if (dom_string_caseless_isequal(ele->name, doc->memoised[hds_BUTTON])) { err = _dom_html_button_element_set_form( (dom_html_button_element *)node, form_ele); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in form_associate"); return HUBBUB_UNKNOWN; } } else if (dom_string_caseless_isequal(ele->name, doc->memoised[hds_INPUT])) { err = _dom_html_input_element_set_form( (dom_html_input_element *)node, form_ele); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in form_associate"); return HUBBUB_UNKNOWN; } } else if (dom_string_caseless_isequal(ele->name, doc->memoised[hds_SELECT])) { err = _dom_html_select_element_set_form( (dom_html_select_element *)node, form_ele); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in form_associate"); return HUBBUB_UNKNOWN; } } else if (dom_string_caseless_isequal(ele->name, doc->memoised[hds_TEXTAREA])) { err = _dom_html_text_area_element_set_form( (dom_html_text_area_element *)node, form_ele); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Error in form_associate"); return HUBBUB_UNKNOWN; } } return HUBBUB_OK; } static hubbub_error add_attributes(void *parser, void *node, const hubbub_attribute *attributes, uint32_t n_attributes) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_exception err; uint32_t i; for (i = 0; i < n_attributes; i++) { dom_string *name, *value; err = dom_string_create_interned(attributes[i].name.ptr, attributes[i].name.len, &name); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create attribute name"); goto fail; } err = dom_string_create(attributes[i].value.ptr, attributes[i].value.len, &value); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't create attribute value"); dom_string_unref(name); goto fail; } if (attributes[i].ns == HUBBUB_NS_NULL) { err = dom_element_set_attribute( (struct dom_element *) node, name, value); dom_string_unref(name); dom_string_unref(value); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't add attribute"); } } else { err = dom_element_set_attribute_ns( (struct dom_element *) node, dom_namespaces[attributes[i].ns], name, value); dom_string_unref(name); dom_string_unref(value); if (err != DOM_NO_ERR) { dom_parser->msg(DOM_MSG_CRITICAL, dom_parser->mctx, "Can't add attribute ns"); } } } return HUBBUB_OK; fail: return HUBBUB_UNKNOWN; } static hubbub_error set_quirks_mode(void *parser, hubbub_quirks_mode mode) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; switch (mode) { case HUBBUB_QUIRKS_MODE_NONE: dom_document_set_quirks_mode(dom_parser->doc, DOM_DOCUMENT_QUIRKS_MODE_NONE); break; case HUBBUB_QUIRKS_MODE_LIMITED: dom_document_set_quirks_mode(dom_parser->doc, DOM_DOCUMENT_QUIRKS_MODE_LIMITED); break; case HUBBUB_QUIRKS_MODE_FULL: dom_document_set_quirks_mode(dom_parser->doc, DOM_DOCUMENT_QUIRKS_MODE_FULL); break; } return HUBBUB_OK; } static hubbub_error change_encoding(void *parser, const char *charset) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; uint32_t source; const char *name; /* If we have an encoding here, it means we are *certain* */ if (dom_parser->encoding != NULL) { return HUBBUB_OK; } /* Find the confidence otherwise (can only be from a BOM) */ name = hubbub_parser_read_charset(dom_parser->parser, &source); if (source == HUBBUB_CHARSET_CONFIDENT) { dom_parser->encoding_source = DOM_HUBBUB_ENCODING_SOURCE_DETECTED; dom_parser->encoding = charset; return HUBBUB_OK; } /* So here we have something of confidence tentative... */ /* http://www.whatwg.org/specs/web-apps/current-work/#change */ /* 2. "If the new encoding is identical or equivalent to the encoding * that is already being used to interpret the input stream, then set * the confidence to confident and abort these steps." */ /* Whatever happens, the encoding should be set here; either for * reprocessing with a different charset, or for confirming that the * charset is in fact correct */ dom_parser->encoding = charset; dom_parser->encoding_source = DOM_HUBBUB_ENCODING_SOURCE_META; /* Equal encodings will have the same string pointers */ return (charset == name) ? HUBBUB_OK : HUBBUB_ENCODINGCHANGE; } static hubbub_error complete_script(void *parser, void *script) { dom_hubbub_parser *dom_parser = (dom_hubbub_parser *) parser; dom_hubbub_error err; err = dom_parser->script(dom_parser->mctx, (struct dom_node *)script); if (err == DOM_HUBBUB_OK) { return HUBBUB_OK; } if ((err & DOM_HUBBUB_HUBBUB_ERR) != 0) { return err & (~DOM_HUBBUB_HUBBUB_ERR); } return HUBBUB_UNKNOWN; } static hubbub_tree_handler tree_handler = { create_comment, create_doctype, create_element, create_text, ref_node, unref_node, append_child, insert_before, remove_child, clone_node, reparent_children, get_parent, has_children, form_associate, add_attributes, set_quirks_mode, change_encoding, complete_script, NULL }; /** * Default message callback */ static void dom_hubbub_parser_default_msg(uint32_t severity, void *ctx, const char *msg, ...) { UNUSED(severity); UNUSED(ctx); UNUSED(msg); } /** * Default script callback. */ static dom_hubbub_error dom_hubbub_parser_default_script(void *ctx, struct dom_node *node) { UNUSED(ctx); UNUSED(node); return DOM_HUBBUB_OK; } /** * Create a Hubbub parser instance * * \param params The binding creation parameters * \param parser Pointer to location to recive instance. * \param document Pointer to location to receive document. * \return Error code */ dom_hubbub_error dom_hubbub_parser_create(dom_hubbub_parser_params *params, dom_hubbub_parser **parser, dom_document **document) { dom_hubbub_parser *binding; hubbub_parser_optparams optparams; hubbub_error error; dom_exception err; dom_string *idname = NULL; /* check result parameters */ if (document == NULL) { return DOM_HUBBUB_BADPARM; } if (parser == NULL) { return DOM_HUBBUB_BADPARM; } /* setup binding parser context */ binding = malloc(sizeof(dom_hubbub_parser)); if (binding == NULL) { return DOM_HUBBUB_NOMEM; } binding->parser = NULL; binding->doc = NULL; binding->encoding = params->enc; if (params->enc != NULL) { binding->encoding_source = DOM_HUBBUB_ENCODING_SOURCE_HEADER; } else { binding->encoding_source = DOM_HUBBUB_ENCODING_SOURCE_DETECTED; } binding->complete = false; if (params->msg == NULL) { binding->msg = dom_hubbub_parser_default_msg; } else { binding->msg = params->msg; } binding->mctx = params->ctx; /* ensure script function is valid or use the default */ if (params->script == NULL) { binding->script = dom_hubbub_parser_default_script; } else { binding->script = params->script; } /* create hubbub parser */ error = hubbub_parser_create(binding->encoding, params->fix_enc, &binding->parser); if (error != HUBBUB_OK) { free(binding); return (DOM_HUBBUB_HUBBUB_ERR | error); } /* create DOM document */ err = dom_implementation_create_document(DOM_IMPLEMENTATION_HTML, NULL, NULL, NULL, params->daf, params->ctx, &binding->doc); if (err != DOM_NO_ERR) { hubbub_parser_destroy(binding->parser); free(binding); return DOM_HUBBUB_DOM; } binding->tree_handler = tree_handler; binding->tree_handler.ctx = (void *)binding; /* set tree handler on parser */ optparams.tree_handler = &binding->tree_handler; hubbub_parser_setopt(binding->parser, HUBBUB_PARSER_TREE_HANDLER, &optparams); /* set document node*/ optparams.document_node = dom_node_ref((struct dom_node *)binding->doc); hubbub_parser_setopt(binding->parser, HUBBUB_PARSER_DOCUMENT_NODE, &optparams); /* set scripting state */ optparams.enable_scripting = params->enable_script; hubbub_parser_setopt(binding->parser, HUBBUB_PARSER_ENABLE_SCRIPTING, &optparams); /* set the document id parameter before the parse so searches * based on id succeed. */ err = dom_string_create_interned((const uint8_t *) "id", SLEN("id"), &idname); if (err != DOM_NO_ERR) { binding->msg(DOM_MSG_ERROR, binding->mctx, "Can't set DOM document id name"); hubbub_parser_destroy(binding->parser); free(binding); return DOM_HUBBUB_DOM; } _dom_document_set_id_name(binding->doc, idname); dom_string_unref(idname); /* set return parameters */ *document = (dom_document *)dom_node_ref(binding->doc); *parser = binding; return DOM_HUBBUB_OK; } dom_hubbub_error dom_hubbub_parser_insert_chunk(dom_hubbub_parser *parser, const uint8_t *data, size_t length) { hubbub_parser_insert_chunk(parser->parser, data, length); return DOM_HUBBUB_OK; } /** * Destroy a Hubbub parser instance * * \param parser The Hubbub parser object */ void dom_hubbub_parser_destroy(dom_hubbub_parser *parser) { hubbub_parser_destroy(parser->parser); parser->parser = NULL; if (parser->doc != NULL) { dom_node_unref((struct dom_node *) parser->doc); parser->doc = NULL; } free(parser); } /** * Parse data with Hubbub parser * * \param parser The parser object * \param data The data to be parsed * \param len The length of the data to be parsed * \return DOM_HUBBUB_OK on success, * DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on failure */ dom_hubbub_error dom_hubbub_parser_parse_chunk(dom_hubbub_parser *parser, const uint8_t *data, size_t len) { hubbub_error err; err = hubbub_parser_parse_chunk(parser->parser, data, len); if (err != HUBBUB_OK) return DOM_HUBBUB_HUBBUB_ERR | err; return DOM_HUBBUB_OK; } /** * Notify the parser to complete parsing * * \param parser The parser object * \return DOM_HUBBUB_OK on success, * DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on underlaying parser failure * DOMHUBBUB_UNKNOWN | <lwc_error> on libwapcaplet failure */ dom_hubbub_error dom_hubbub_parser_completed(dom_hubbub_parser *parser) { hubbub_error err; err = hubbub_parser_completed(parser->parser); if (err != HUBBUB_OK) { parser->msg(DOM_MSG_ERROR, parser->mctx, "hubbub_parser_completed failed: %d", err); return DOM_HUBBUB_HUBBUB_ERR | err; } parser->complete = true; return DOM_HUBBUB_OK; } /** * Retrieve the encoding * * \param parser The parser object * \param source The encoding_source * \return the encoding name */ const char *dom_hubbub_parser_get_encoding(dom_hubbub_parser *parser, dom_hubbub_encoding_source *source) { *source = parser->encoding_source; return parser->encoding != NULL ? parser->encoding : "Windows-1252"; } /** * Set the Parse pause state. * * \param parser The parser object * \param pause The pause state to set. * \return DOM_HUBBUB_OK on success, * DOM_HUBBUB_HUBBUB_ERR | <hubbub_error> on failure */ dom_hubbub_error dom_hubbub_parser_pause(dom_hubbub_parser *parser, bool pause) { hubbub_error err; hubbub_parser_optparams params; params.pause_parse = pause; err = hubbub_parser_setopt(parser->parser, HUBBUB_PARSER_PAUSE, ¶ms); if (err != HUBBUB_OK) return DOM_HUBBUB_HUBBUB_ERR | err; return DOM_HUBBUB_OK; } ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/errors.h�����������������������������������������������������0000644�0001750�0001750�00000002323�12377676745�020633� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef dom_hubbub_errors_h_ #define dom_hubbub_errors_h_ typedef enum { DOM_HUBBUB_OK = 0, DOM_HUBBUB_NOMEM = 1, DOM_HUBBUB_BADPARM = 2, /**< Bad input parameter */ DOM_HUBBUB_DOM = 3, /**< DOM operation failed */ DOM_HUBBUB_HUBBUB_ERR = (1<<16), DOM_HUBBUB_HUBBUB_ERR_PAUSED = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_PAUSED), DOM_HUBBUB_HUBBUB_ERR_ENCODINGCHANGE = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_ENCODINGCHANGE), DOM_HUBBUB_HUBBUB_ERR_NOMEM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NOMEM), DOM_HUBBUB_HUBBUB_ERR_BADPARM = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADPARM), DOM_HUBBUB_HUBBUB_ERR_INVALID = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_INVALID), DOM_HUBBUB_HUBBUB_ERR_FILENOTFOUND = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_FILENOTFOUND), DOM_HUBBUB_HUBBUB_ERR_NEEDDATA = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_NEEDDATA), DOM_HUBBUB_HUBBUB_ERR_BADENCODING = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_BADENCODING), DOM_HUBBUB_HUBBUB_ERR_UNKNOWN = (DOM_HUBBUB_HUBBUB_ERR | HUBBUB_UNKNOWN), } dom_hubbub_error; #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/README�������������������������������������������������������0000644�0001750�0001750�00000000451�12377676745�020026� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Hubbub binding for libdom ========================= This is a wrapper around hubbub's parser API, to facilitate construction of a libdom DOM tree. The basic premise is that the wrapper intercepts the SAX-like events emitted by hubbub's tokeniser then builds a libdom DOM tree from them. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/utils.h������������������������������������������������������0000644�0001750�0001750�00000001041�12377676745�020453� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of libdom. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org> */ #ifndef dom_hubbub_utils_h_ #define dom_hubbub_utils_h_ #ifndef max #define max(a,b) ((a)>(b)?(a):(b)) #endif #ifndef min #define min(a,b) ((a)<(b)?(a):(b)) #endif #ifndef SLEN /* Calculate length of a string constant */ #define SLEN(s) (sizeof((s)) - 1) /* -1 for '\0' */ #endif #ifndef UNUSED #define UNUSED(x) ((x)=(x)) #endif #endif �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/bindings/hubbub/Makefile�����������������������������������������������������0000644�0001750�0001750�00000000700�12377676745�020603� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ifeq ($(WITH_HUBBUB_BINDING),yes) DIR_SOURCES := parser.c DIR_INSTALL_ITEMS := /include/dom/bindings/hubbub:errors.h;parser.h # Hubbub ifneq ($(PKGCONFIG),) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libhubbub --cflags) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libhubbub --libs) else CFLAGS := $(CFLAGS) -I$(PREFIX)/include LDFLAGS := $(LDFLAGS) -lhubbub -lparserutils endif endif include $(NSBUILD)/Makefile.subdir ����������������������������������������������������������������netsurf-all-3.2/libdom/bindings/Makefile������������������������������������������������������������0000644�0001750�0001750�00000000057�12377676745�017341� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Bindings include $(NSBUILD)/Makefile.subdir ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/libdom/Makefile���������������������������������������������������������������������0000644�0001750�0001750�00000016107�12377676745�015547� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Component settings COMPONENT := dom COMPONENT_VERSION := 0.1.1 # Default to a static library COMPONENT_TYPE ?= lib-static # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools TESTRUNNER := $(PERL) $(NSTESTTOOLS)/testrunner.pl # Toolchain flags WARNFLAGS := -Wall -W -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations -Wnested-externs # BeOS/Haiku standard library headers generate warnings ifneq ($(TARGET),beos) WARNFLAGS := $(WARNFLAGS) -Werror endif # AmigaOS needs this to avoid warnings ifeq ($(TARGET),amiga) CFLAGS := -U__STRICT_ANSI__ $(CFLAGS) endif CFLAGS := -D_BSD_SOURCE -I$(CURDIR)/include/ \ -I$(CURDIR)/src -I$(CURDIR)/binding $(WARNFLAGS) $(CFLAGS) # Some gcc2 versions choke on -std=c99, and it doesn't know about it anyway ifneq ($(GCCVER),2) CFLAGS := -std=c99 $(CFLAGS) endif # Parserutils & wapcaplet ifneq ($(findstring clean,$(MAKECMDGOALS)),clean) ifneq ($(PKGCONFIG),) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libparserutils --cflags) CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libwapcaplet --cflags) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils --libs) LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libwapcaplet --libs) else CFLAGS := $(CFLAGS) -I$(PREFIX)/include LDFLAGS := $(LDFLAGS) -lparserutils -lwapcaplet endif endif include $(NSBUILD)/Makefile.top # Extra installation rules Is := include/dom I := /include/dom INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/dom.h;$(Is)/functypes.h Is := include/dom/core I := /include/dom/core INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/attr.h;$(Is)/characterdata.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/cdatasection.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/comment.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/doc_fragment.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/document.h;$(Is)/document_type.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/entity_ref.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/element.h;$(Is)/exceptions.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/implementation.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/namednodemap.h;$(Is)/node.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/nodelist.h;$(Is)/string.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/pi.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/text.h;$(Is)/typeinfo.h Is := include/dom/events I := /include/dom/events INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/event.h;$(Is)/ui_event.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/custom_event.h;$(Is)/mouse_event.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/keyboard_event.h;$(Is)/text_event.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/mouse_wheel_event.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/mouse_multi_wheel_event.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/mutation_event.h;$(Is)/event_target.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/mutation_name_event.h;$(Is)/events.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/event_listener.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/document_event.h Is := include/dom/html I := /include/dom/html INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_document.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_collection.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_html_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_head_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_link_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_title_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_body_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_meta_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_form_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_button_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_input_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_select_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_text_area_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_option_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_opt_group_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_options_collection.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_hr_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_dlist_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_directory_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_menu_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_fieldset_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_legend_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_div_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_paragraph_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_heading_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_quote_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_pre_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_br_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_label_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_ulist_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_olist_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_li_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_font_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_mod_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_anchor_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_basefont_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_image_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_object_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_param_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_applet_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_area_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_map_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_script_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecaption_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecell_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablecol_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablesection_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_table_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_tablerow_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_base_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_style_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_frameset_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_frame_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_iframe_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_isindex_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) ifeq ($(WITH_LIBXML_BINDING),yes) REQUIRED_PKGS := $(REQUIRED_PKGS) libxml-2.0 endif ifeq ($(WITH_HUBBUB_BINDING),yes) REQUIRED_PKGS := $(REQUIRED_PKGS) libhubbub endif ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�015152� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/test-data/��������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�017040� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/test-data/small���������������������������������������������������������0000644�0001750�0001750�00000000340�12377676763�020110� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������\���3x3_32bpp����������������,���P���0������������������������D���2x2_32bpp����������������,���<���0�����������4���1x1_32bpp������������������,���0���0��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/test-data/primary-color-16bpp�������������������������������������������0000644�0001750�0001750�00000537660�12377676763�022551� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������歓���red���������c�������������,���,���(��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������blue��������c�������������,���,���(�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|�|��green�������c�������������,���,���(��������������������������������������������������������������������������������netsurf-all-3.2/librosprite/test-data/32bpp-alpha-test����������������������������������������������0000644�0001750�0001750�00000073224�12377676763�022001� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������v��v��test4������2d���J����������,���,���0������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/librosprite.pc.in�������������������������������������������������������0000644�0001750�0001750�00000000337�12377676763�020464� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������prefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/LIBDIR includedir=${prefix}/include Name: librosprite Description: Loads RISC OS sprite files Version: VERSION Libs: -L${libdir} -lrosprite Cflags: -I${includedir} �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/palettes/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�016773� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/palettes/256mono��������������������������������������������������������0000644�0001750�0001750�00000003000�12377676763�020134� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������            !!!!""""####$$$$%%%%&&&&''''(((())))****++++,,,,----....////0000111122223333444455556666777788889999::::;;;;<<<<====>>>>????@@@@AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMMMMNNNNOOOOPPPPQQQQRRRRSSSSTTTTUUUUVVVVWWWWXXXXYYYYZZZZ[[[[\\\\]]]]^^^^____````aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmmnnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyyzzzz{{{{||||}}}}~~~~ □いゥΖЁ┬旭臼臆崖幹亀橋祁幻更査算室十松真誓疏詑鍛陳電篤杷犯鰭癖頬面様領蕨佩冪厰嗷墺孚嶽忻慓捶旙栩樛毫湎烝玻瘁矜窿粐繞聿艸蓙蜑裴諡跛迯銕闖韶髑鴪齠netsurf-all-3.2/librosprite/palettes/16colour�������������������������������������������������������0000644�0001750�0001750�00000000170�12377676763�020406� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������毫算wwwUUU333����D 銕� �� �� 銕 U��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/palettes/4mono����������������������������������������������������������0000644�0001750�0001750�00000000030�12377676763�017763� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince�������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������算www�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/palettes/16mono���������������������������������������������������������0000644�0001750�0001750�00000000170�12377676763�020053� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������"""333DDDUUUfffwww   算 面 毫銕�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/palettes/256colour������������������������������������������������������0000644�0001750�0001750�00000003000�12377676763�020467� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������"""333D��Uf""w33��D U ""f 33w D�D UUf"fw3w��""33��""33�DU"f3w�DU"f3w �D�!U""f"#3w3$DD�%UU&ff"'ww3(�DD)UU*"ff+3ww,DDD-UUU.fff/www0D�1U2f"3w34D�5U6f"7w38DD9UU:ff;ww<DD=UU>ff?ww@��AB""C33DD�EUFf"Gw3H�DIUJ"fK3wLDDMUUNffOwwP�QR"S算3T�UV遞"W3XDYUZf[算w\D]U^遞f_w`��ab""c33dD�eUff"gw3h�DiUj"fk3wlDDmUUnffowwp�qr"s3t面�u毫v銕"w3xDyUzf{w|面D}毫U~銕fw��""33D�Uf"w3��""33D�Uf"w3�"3�"3�"3�"3�DU"f3wDDUUffww�DU"f3wDDUUffwwDUfwDUfwDUfwDUfw�"3算DUfw算�"3DUfw算遞算算遞�"遞3DUf遞w�面毫"銕3D面U毫f銕w遞面毫銕面毫銕面毫銕netsurf-all-3.2/librosprite/palettes/2mono����������������������������������������������������������0000644�0001750�0001750�00000000014�12377676763�017763� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/include/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�016575� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/include/librosprite.h���������������������������������������������������0000644�0001750�0001750�00000013044�12377676763�021326� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of librosprite. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 James Shaw <js102@zepler.net> */ /** * \mainpage * * librosprite is a library for reading RISC OS sprite and palette files. The following subformats are supported: * <ul> * <li>1-bit and 8-bit transparency masks</li> * <li>Sprites with custom palettes</li> * <li>Standard RISC OS 1-bit, 2-bit palettes, and 4-bit and 8-bit colour palettes</li> * <li>Old-style sprites with most screen modes from 0-49 supported</li> * <li>32bpp CMYK</li> * <li>Inline alpha channel, as used by Photodesk and Tinct</li> * </ul> * */ /** * \file librosprite.h * * Sprite file reading is performed by rosprite_load(), and palette file reading by rosprite_load_palette(). * * Retrieving sprite or palette data is performed by a reader. * librosprite implements file and memory readers. * To use a reader, create a context by calling the * rosprite_create_file_context() or rosprite_create_mem_context(). * Pass the reader function, and the context you have created, to the load function, * typically rosprite_load(). */ #ifndef ROSPRITE_H #define ROSPRITE_H #include <stdint.h> #include <stdio.h> #include <stdbool.h> typedef enum { ROSPRITE_OK, ROSPRITE_NOMEM, ROSPRITE_EOF, ROSPRITE_BADMODE } rosprite_error; typedef enum { ROSPRITE_RGB, ROSPRITE_CMYK } rosprite_color_model; /** * A reader interface used to load sprite files. */ typedef int (*reader)(uint8_t* buf, size_t count, void* ctx); struct rosprite_file_context; /** * A sprite area comprises zero or more rosprites. Optionally, it may also have an extension_words block. */ struct rosprite_area { uint32_t extension_size; /* size of extension_words in bytes */ uint8_t* extension_words; uint32_t sprite_count; struct rosprite** sprites; /* array of length sprite_count */ }; /** * A sprite mode defines the colour depth, colour model and bitmap resolution of a sprite. */ struct rosprite_mode { /** * The bits per colour channel. Legal values are 1, 2, 4, 8, 16, 24 and 32. */ uint32_t colorbpp; /* maskbpp denotes the amount of alpha bpp used * while mask_width is the bits used to store the mask. * Old modes have the same mask_width as their colorbpp, but the value * is always all-zeroes or all-ones. * New modes can have 1bpp or 8bpp masks */ uint32_t maskbpp; uint32_t mask_width; /* in pixels */ /** * Horizontal dots per inch. Typical values are 22, 45, 90 and 180. */ uint32_t xdpi; /** * Vertical dots per inch. Typical values are 22, 45, 90 and 180. */ uint32_t ydpi; rosprite_color_model color_model; }; struct rosprite_palette { uint32_t size; /* in number of entries (each entry is a word) */ uint32_t* palette; }; /** * A sprite is a bitmap image which has a mode, width and height. */ struct rosprite { /** * The sprite name. This may be up to 12 characters long, and must be zero terminated. */ unsigned char name[13]; struct rosprite_mode mode; bool has_mask; bool has_palette; uint32_t palettesize; /* in number of entries (each entry is a word) */ uint32_t* palette; /** * Width in pixels */ uint32_t width; /** * Height in pixels */ uint32_t height; /** * Image data is a series of words, appearing on screen left-to-right, top-to-bottom. * Each word takes the form 0xRRGGBBAA. A is the alpha channel, where 0 is transparent, and 255 is opaque. */ uint32_t* image; /* image data in 0xRRGGBBAA words */ }; struct rosprite_file_context; /** * Create a file reader context using the specified file handle. * Clients must call rosprite_destroy_file_context() to dispose of the context. * * \param[out] result */ rosprite_error rosprite_create_file_context(FILE* f, struct rosprite_file_context** result); void rosprite_destroy_file_context(struct rosprite_file_context* ctx); int rosprite_file_reader(uint8_t* buf, size_t count, void* ctx); struct rosprite_mem_context; /** * Create a memory reader context using the specified memory pointer. * Clients must call rosprite_destroy_mem_context() to dispose of the context. * * \param[in] p pointer to the start of the memory block * \param[in] total_size the size of the block pointed to by p, in bytes * \param[out] result */ rosprite_error rosprite_create_mem_context(uint8_t* p, unsigned long total_size, struct rosprite_mem_context** result); void rosprite_destroy_mem_context(struct rosprite_mem_context* ctx); int rosprite_mem_reader(uint8_t* buf, size_t count, void* ctx); /** * Load a rosprite_area using the reader provided. * Clients must call rosprite_destroy_sprite_area() to dispose of the rosprite_area. * * \param[out] result The pointer to be populated by this function. */ rosprite_error rosprite_load(reader reader, void* ctx, struct rosprite_area** result); /** * Dispose of a rosprite_area and its children. */ void rosprite_destroy_sprite_area(struct rosprite_area *); /** * Load a RISC OS palette file. A palette file has RISC OS filetype 0xFED, * and is a series of VDU 19 Set Palette commands, each command being 6 bytes long. * * Clients must call rosprite_destroy_palette() to dispose of the rosprite_palette. * * \param[out] result The pointer to be populated by this function. * \see http://www.drobe.co.uk/show_manual.php?manual=/sh-cgi?manual=Vdu%26page=19 */ rosprite_error rosprite_load_palette(reader reader, void* ctx, struct rosprite_palette** result); /** * Dispose of a rosprite_palette and its children. */ void rosprite_destroy_palette(struct rosprite_palette *); #endif ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/COPYING�����������������������������������������������������������������0000644�0001750�0001750�00000002060�12377676763�016223� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Copyright (c) 2008 James Shaw <js102@zepler.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/examples/���������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�016770� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/examples/example.c������������������������������������������������������0000644�0001750�0001750�00000011514�12377676763�020611� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of librosprite. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 James Shaw <js102@zepler.net> */ /** * \file * A test harness using SDL to display all sprites in a sprite file. * * Usage: example \<spritefile\> */ #include <stdio.h> #include <stdlib.h> #include <SDL/SDL.h> #include "librosprite.h" void sdl_draw_pixel(SDL_Surface* surface, uint32_t x, uint32_t y, uint32_t color); void sdl_blank(SDL_Surface* surface); int load_file_to_memory(const char *filename, uint8_t **result); int create_file_context(char* filename, void** result); int create_mem_context(char* filename, void** result); int main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "Usage: example spritefile\n"); exit(EXIT_FAILURE); } if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); exit(EXIT_FAILURE); } atexit(SDL_Quit); char* filename = argv[1]; void* ctx; if (create_file_context(filename, &ctx) < 0) { fprintf(stderr, "Unable to create file reader context\n"); exit(EXIT_FAILURE); } printf("Loading %s\n", filename); struct rosprite_area* sprite_area; if (rosprite_load(rosprite_file_reader, ctx, &sprite_area) != ROSPRITE_OK) { fprintf(stderr, "Error loading spritefile\n"); exit(EXIT_FAILURE); }; printf("sprite_count %u\n", sprite_area->sprite_count); printf("extension_size %u\n", sprite_area->extension_size); SDL_Surface *screen; screen = SDL_SetVideoMode(800, 600, 32, SDL_ANYFORMAT); SDL_SetAlpha(screen, SDL_SRCALPHA, 0); for (unsigned int i = 0; i < sprite_area->sprite_count; i++) { struct rosprite* sprite = sprite_area->sprites[i]; printf("\nname %s\n", sprite->name); printf("color_model %s\n", sprite->mode.color_model == ROSPRITE_RGB ? "RGB" : "CMYK"); printf("colorbpp %u\n", sprite->mode.colorbpp); printf("xdpi %u\n", sprite->mode.xdpi); printf("ydpi %u\n", sprite->mode.ydpi); printf("width %u px\n", sprite->width); printf("height %u px\n", sprite->height); printf("hasPalette %s\n", sprite->has_palette ? "YES" : "NO"); if (sprite->has_palette) printf("paletteSize %u\n", sprite->palettesize); printf("hasMask %s\n", sprite->has_mask ? "YES" : "NO"); if (sprite->has_mask) printf("mask_width %u\n", sprite->mode.mask_width); if (sprite->has_mask) printf("maskbpp %u\n", sprite->mode.maskbpp); sdl_blank(screen); for (uint32_t y = 0; y < sprite->height; y++) { for (uint32_t x = 0; x < sprite->width; x++) { sdl_draw_pixel(screen, x, y, sprite->image[y*sprite->width + x]); } } SDL_UpdateRect(screen, 0, 0, 0, 0); fgetc(stdin); } rosprite_destroy_mem_context(ctx); rosprite_destroy_sprite_area(sprite_area); return EXIT_SUCCESS; } int create_file_context(char* filename, void** result) { FILE *f = fopen(filename, "rb"); if (!f) { *result = NULL; return -1; } struct rosprite_file_context* ctx; if (rosprite_create_file_context(f, &ctx) != ROSPRITE_OK) { return -1; } *result = ctx; return 0; } int create_mem_context(char* filename, void** result) { uint8_t* content; int size = load_file_to_memory(filename, &content); if (size < 0) return -1; struct rosprite_mem_context* ctx; if (rosprite_create_mem_context(content, size, &ctx) != ROSPRITE_OK) { return -1; } *result = ctx; return 0; } int load_file_to_memory(const char *filename, uint8_t **result) { int size = 0; FILE *f = fopen(filename, "rb"); if (f == NULL) { *result = NULL; return -1; // -1 means file opening fail } fseek(f, 0, SEEK_END); size = ftell(f); fseek(f, 0, SEEK_SET); *result = (uint8_t *)malloc(size+1); if ((unsigned int) size != fread(*result, sizeof(char), size, f)) { free(*result); return -2; // -2 means file reading fail } fclose(f); (*result)[size] = 0; return size; } /* color is 0xrrggbbaa */ void sdl_draw_pixel(SDL_Surface* surface, uint32_t x, uint32_t y, uint32_t color) { uint32_t* pixel = ((uint32_t*) (surface->pixels)) + (y * surface->pitch/4) + x; /* pretty sure SDL can do this, but can't figure out how */ uint32_t bg_color = ((int) (x / 4.0) + ((int)(y / 4.0) % 2)) % 2 ? 0x99 : 0x66; uint32_t alpha = color & 0x000000ff; uint32_t r = (color & 0xff000000) >> 24; uint32_t g = (color & 0x00ff0000) >> 16; uint32_t b = (color & 0x0000ff00) >> 8; r = ((alpha / 255.0) * r) + (((255-alpha) / 255.0) * bg_color); g = ((alpha / 255.0) * g) + (((255-alpha) / 255.0) * bg_color); b = ((alpha / 255.0) * b) + (((255-alpha) / 255.0) * bg_color); uint32_t mapped_color = SDL_MapRGB(surface->format, r, g, b); *pixel = mapped_color; } void sdl_blank(SDL_Surface* surface) { for (uint32_t y = 0; y < (uint32_t) surface->h; y++) { for (uint32_t x = 0; x < (uint32_t) surface->w; x++) { sdl_draw_pixel(surface, x, y, (uint32_t) ((int) (x / 4.0) + ((int)(y / 4.0) % 2)) % 2 ? 0x999999ff : 0x666666ff); } } } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/src/��������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713350�015741� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/src/librosprite.c�������������������������������������������������������0000644�0001750�0001750�00000073170�12377676763�020473� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of librosprite. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 James Shaw <js102@zepler.net> */ /** * \file */ #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include "librosprite.h" /** * Reads four bytes, 00, 11, 22 and 33, of a byte array b to give 0x33221100. */ #define BTUINT(b) (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24)) /** * Reverse the byte order of a word such that 0xAABBCCDD becomes 0xDDCCBBAA. */ #define BSWAP(word) (((word & (0x000000ff)) << 24) | ((word & 0x0000ff00) << 8) | ((word & 0x00ff0000) >> 8) | ((word & 0xff000000) >> 24)) #define ERRCHK(x) do { \ rosprite_error err = x; \ if (err != ROSPRITE_OK) return err; \ } while(0) struct rosprite_header { uint32_t width_words; /* width in words */ /* height defined in sprite struct */ uint32_t first_used_bit; /* old format only (spriteType = 0) */ uint32_t last_used_bit; /** * Image size in bytes */ uint32_t image_size; /** * Mask size in bytes */ uint32_t mask_size; }; struct rosprite_mask_state { uint32_t x; uint32_t y; uint32_t first_used_bit; uint32_t row_max_bit; uint32_t height; uint32_t current_byte_index; uint32_t current_word; uint32_t bpp; }; struct rosprite_file_context { FILE* f; }; struct rosprite_mem_context { uint8_t* base; unsigned long offset; bool known_size; unsigned long size; }; static const struct rosprite_mode oldmodes[] = { /*0*/{ .colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*1*/{ .colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 45, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*2*/{ .colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 22, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*3*/{ .colorbpp = 0, .maskbpp = 0, .mask_width = 0, .xdpi = 0, .ydpi = 0, .color_model = ROSPRITE_RGB }, /*4*/{ .colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 45, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*5*/{ .colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 22, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*6*/{ .colorbpp = 0, .maskbpp = 0, .mask_width = 0, .xdpi = 0, .ydpi = 0, .color_model = ROSPRITE_RGB }, /*7*/{ .colorbpp = 0, .maskbpp = 0, .mask_width = 0, .xdpi = 0, .ydpi = 0, .color_model = ROSPRITE_RGB }, /*8*/{ .colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*9*/{ .colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 45, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*10*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 22, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*11*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*12*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*13*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 45, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*14*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*15*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*16*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*17*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*18*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*19*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*20*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*21*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*22*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi =180, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*23*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*24*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*25*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*26*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*27*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*28*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*29*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*30*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*31*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*32*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*33*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*34*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*35*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*36*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*37*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*38*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*39*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*40*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*41*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*42*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*43*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*44*/{.colorbpp = 1, .maskbpp = 1, .mask_width = 1, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*45*/{.colorbpp = 2, .maskbpp = 1, .mask_width = 2, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*46*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 90, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*47*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 45, .ydpi = 45, .color_model = ROSPRITE_RGB }, /*48*/{.colorbpp = 4, .maskbpp = 1, .mask_width = 4, .xdpi = 45, .ydpi = 90, .color_model = ROSPRITE_RGB }, /*49*/{.colorbpp = 8, .maskbpp = 1, .mask_width = 8, .xdpi = 45, .ydpi = 90, .color_model = ROSPRITE_RGB } }; /* table for converting a 5bit channel into an 8bit channel (used for 16bpp to 32bpp conversion) */ static const uint8_t sprite_16bpp_translate[] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x29, 0x31, 0x39, 0x41, 0x4a, 0x52, 0x5a, 0x62, 0x6a, 0x73, 0x7b, 0x83, 0x8b, 0x94, 0x9c, 0xa4, 0xac, 0xb4, 0xbd, 0xc5, 0xcd, 0xd5, 0xde, 0xe6, 0xee, 0xf6, 0xff }; /* palettes generated with palette2c.c * which in turn requires rosprite_load_palette(FILE* f) * defined in this file */ static const uint32_t sprite_1bpp_palette[] = { 0xffffffff, 0xff }; static const uint32_t sprite_2bpp_palette[] = { 0xffffffff, 0xbbbbbbff, 0x777777ff, 0xff }; static const uint32_t sprite_4bpp_palette[] = { 0xffffffff, 0xddddddff, 0xbbbbbbff, 0x999999ff, 0x777777ff, 0x555555ff, 0x333333ff, 0xff, 0x4499ff, 0xeeee00ff, 0xcc00ff, 0xdd0000ff, 0xeeeebbff, 0x558800ff, 0xffbb00ff, 0xbbffff }; static const uint32_t sprite_8bpp_palette[] = { 0xff, 0x111111ff, 0x222222ff, 0x333333ff, 0x440000ff, 0x551111ff, 0x662222ff, 0x773333ff, 0x44ff, 0x111155ff, 0x222266ff, 0x333377ff, 0x440044ff, 0x551155ff, 0x662266ff, 0x773377ff, 0x880000ff, 0x991111ff, 0xaa2222ff, 0xbb3333ff, 0xcc0000ff, 0xdd1111ff, 0xee2222ff, 0xff3333ff, 0x880044ff, 0x991155ff, 0xaa2266ff, 0xbb3377ff, 0xcc0044ff, 0xdd1155ff, 0xee2266ff, 0xff3377ff, 0x4400ff, 0x115511ff, 0x226622ff, 0x337733ff, 0x444400ff, 0x555511ff, 0x666622ff, 0x777733ff, 0x4444ff, 0x115555ff, 0x226666ff, 0x337777ff, 0x444444ff, 0x555555ff, 0x666666ff, 0x777777ff, 0x884400ff, 0x995511ff, 0xaa6622ff, 0xbb7733ff, 0xcc4400ff, 0xdd5511ff, 0xee6622ff, 0xff7733ff, 0x884444ff, 0x995555ff, 0xaa6666ff, 0xbb7777ff, 0xcc4444ff, 0xdd5555ff, 0xee6666ff, 0xff7777ff, 0x8800ff, 0x119911ff, 0x22aa22ff, 0x33bb33ff, 0x448800ff, 0x559911ff, 0x66aa22ff, 0x77bb33ff, 0x8844ff, 0x119955ff, 0x22aa66ff, 0x33bb77ff, 0x448844ff, 0x559955ff, 0x66aa66ff, 0x77bb77ff, 0x888800ff, 0x999911ff, 0xaaaa22ff, 0xbbbb33ff, 0xcc8800ff, 0xdd9911ff, 0xeeaa22ff, 0xffbb33ff, 0x888844ff, 0x999955ff, 0xaaaa66ff, 0xbbbb77ff, 0xcc8844ff, 0xdd9955ff, 0xeeaa66ff, 0xffbb77ff, 0xcc00ff, 0x11dd11ff, 0x22ee22ff, 0x33ff33ff, 0x44cc00ff, 0x55dd11ff, 0x66ee22ff, 0x77ff33ff, 0xcc44ff, 0x11dd55ff, 0x22ee66ff, 0x33ff77ff, 0x44cc44ff, 0x55dd55ff, 0x66ee66ff, 0x77ff77ff, 0x88cc00ff, 0x99dd11ff, 0xaaee22ff, 0xbbff33ff, 0xcccc00ff, 0xdddd11ff, 0xeeee22ff, 0xffff33ff, 0x88cc44ff, 0x99dd55ff, 0xaaee66ff, 0xbbff77ff, 0xcccc44ff, 0xdddd55ff, 0xeeee66ff, 0xffff77ff, 0x88ff, 0x111199ff, 0x2222aaff, 0x3333bbff, 0x440088ff, 0x551199ff, 0x6622aaff, 0x7733bbff, 0xccff, 0x1111ddff, 0x2222eeff, 0x3333ffff, 0x4400ccff, 0x5511ddff, 0x6622eeff, 0x7733ffff, 0x880088ff, 0x991199ff, 0xaa22aaff, 0xbb33bbff, 0xcc0088ff, 0xdd1199ff, 0xee22aaff, 0xff33bbff, 0x8800ccff, 0x9911ddff, 0xaa22eeff, 0xbb33ffff, 0xcc00ccff, 0xdd11ddff, 0xee22eeff, 0xff33ffff, 0x4488ff, 0x115599ff, 0x2266aaff, 0x3377bbff, 0x444488ff, 0x555599ff, 0x6666aaff, 0x7777bbff, 0x44ccff, 0x1155ddff, 0x2266eeff, 0x3377ffff, 0x4444ccff, 0x5555ddff, 0x6666eeff, 0x7777ffff, 0x884488ff, 0x995599ff, 0xaa66aaff, 0xbb77bbff, 0xcc4488ff, 0xdd5599ff, 0xee66aaff, 0xff77bbff, 0x8844ccff, 0x9955ddff, 0xaa66eeff, 0xbb77ffff, 0xcc44ccff, 0xdd55ddff, 0xee66eeff, 0xff77ffff, 0x8888ff, 0x119999ff, 0x22aaaaff, 0x33bbbbff, 0x448888ff, 0x559999ff, 0x66aaaaff, 0x77bbbbff, 0x88ccff, 0x1199ddff, 0x22aaeeff, 0x33bbffff, 0x4488ccff, 0x5599ddff, 0x66aaeeff, 0x77bbffff, 0x888888ff, 0x999999ff, 0xaaaaaaff, 0xbbbbbbff, 0xcc8888ff, 0xdd9999ff, 0xeeaaaaff, 0xffbbbbff, 0x8888ccff, 0x9999ddff, 0xaaaaeeff, 0xbbbbffff, 0xcc88ccff, 0xdd99ddff, 0xeeaaeeff, 0xffbbffff, 0xcc88ff, 0x11dd99ff, 0x22eeaaff, 0x33ffbbff, 0x44cc88ff, 0x55dd99ff, 0x66eeaaff, 0x77ffbbff, 0xccccff, 0x11ddddff, 0x22eeeeff, 0x33ffffff, 0x44ccccff, 0x55ddddff, 0x66eeeeff, 0x77ffffff, 0x88cc88ff, 0x99dd99ff, 0xaaeeaaff, 0xbbffbbff, 0xcccc88ff, 0xdddd99ff, 0xeeeeaaff, 0xffffbbff, 0x88ccccff, 0x99ddddff, 0xaaeeeeff, 0xbbffffff, 0xccccccff, 0xddddddff, 0xeeeeeeff, 0xffffffff }; static inline rosprite_error rosprite_read_word(reader reader, void* ctx, uint32_t* result); static rosprite_error rosprite_get_mode(uint32_t spriteMode, struct rosprite_mode* result); static uint32_t rosprite_palette_lookup(struct rosprite* sprite, uint32_t pixel); static inline uint32_t rosprite_cmyk_to_rgb(uint32_t cmyk); static uint32_t rosprite_next_mask_pixel(uint8_t* mask, struct rosprite_mask_state* mask_state); static rosprite_error rosprite_load_high_color(uint8_t* image_in, uint8_t* mask, struct rosprite* sprite, struct rosprite_header* header); static rosprite_error rosprite_load_low_color(uint8_t* image_in, uint8_t* mask, struct rosprite* sprite, struct rosprite_header* header); rosprite_error rosprite_load_sprite(reader reader, void* ctx, struct rosprite** result); static rosprite_error rosprite_init_mask_state(struct rosprite* sprite, struct rosprite_header* header, uint8_t* mask, struct rosprite_mask_state** result); static uint32_t rosprite_upscale_color(uint32_t pixel, struct rosprite_mode* mode, bool* has_alpha_pixel_data); static inline void rosprite_fix_alpha(uint32_t* image, unsigned long pixels); rosprite_error rosprite_load(reader reader, void* ctx, struct rosprite_area** result) { uint32_t firstSpriteOffset, firstFreeWordOffset; int bytes_read; uint32_t i; struct rosprite_area* sprite_area = malloc(sizeof(struct rosprite_area)); ERRCHK(rosprite_read_word(reader, ctx, &(sprite_area->sprite_count))); ERRCHK(rosprite_read_word(reader, ctx, &firstSpriteOffset)); ERRCHK(rosprite_read_word(reader, ctx, &firstFreeWordOffset)); /* TODO: use this for some sanity checking? */ sprite_area->extension_size = 16 - firstSpriteOffset; sprite_area->extension_words = NULL; if (sprite_area->extension_size > 0) { sprite_area->extension_words = malloc(sprite_area->extension_size); bytes_read = reader(sprite_area->extension_words, (size_t) (sprite_area->extension_size), ctx); if (bytes_read < (signed long) sprite_area->extension_size) { return ROSPRITE_EOF; } } sprite_area->sprites = malloc(sizeof(struct rosprite*) * sprite_area->sprite_count); /* allocate array of pointers */ for (i = 0; i < sprite_area->sprite_count; i++) { struct rosprite* sprite; ERRCHK(rosprite_load_sprite(reader, ctx, &sprite)); sprite_area->sprites[i] = sprite; } *result = sprite_area; return ROSPRITE_OK; } void rosprite_destroy_sprite_area(struct rosprite_area* sprite_area) { uint32_t i; for (i = 0; i < sprite_area->sprite_count; i++) { struct rosprite* sprite = sprite_area->sprites[i]; if (sprite->has_palette) free(sprite->palette); free(sprite->image); free(sprite); } free(sprite_area->sprites); if (sprite_area->extension_size > 0) free(sprite_area->extension_words); free(sprite_area); } rosprite_error rosprite_load_palette(reader reader, void* ctx, struct rosprite_palette** result) { uint32_t c; uint8_t b[6]; unsigned int bytesRead; /* TODO: currently assume palette has linear entries (2nd byte in is 00, 01, 02 etc) */ struct rosprite_palette* palette = malloc(sizeof(struct rosprite_palette)); palette->palette = malloc(sizeof(uint32_t) * 256); /* allocate 256 whether we need them all or not */ c = 0; bytesRead = reader(b, 6, ctx); assert(bytesRead % 6 == 0); while (bytesRead == 6) { assert(b[0] == 19); /* VDU 19 */ /* only process logical colours */ if (b[2] == 16) { /*assert(c == b[1]);*/ uint32_t entry = (b[3] << 24) | (b[4] << 16) | (b[5] << 8) | 0xff; /* last byte is alpha */ palette->palette[c] = entry; c++; assert(c <= 256); } bytesRead = reader(b, 6, ctx); assert(bytesRead % 6 == 0); } palette->size = c; *result = palette; return ROSPRITE_OK; } void rosprite_destroy_palette(struct rosprite_palette* palette) { free(palette->palette); free(palette); } rosprite_error rosprite_create_file_context(FILE* f, struct rosprite_file_context** result) { struct rosprite_file_context* ctx = malloc(sizeof(struct rosprite_file_context)); if (!ctx) return ROSPRITE_NOMEM; ctx->f = f; *result = ctx; return ROSPRITE_OK; } void rosprite_destroy_file_context(struct rosprite_file_context* ctx) { free(ctx); } int rosprite_file_reader(uint8_t* buf, size_t count, void* ctx) { return fread(buf, 1 /*size*/, count, ((struct rosprite_file_context*) ctx)->f); } rosprite_error rosprite_create_mem_context(uint8_t* p, unsigned long total_size, struct rosprite_mem_context** result) { struct rosprite_mem_context* ctx = malloc(sizeof(struct rosprite_mem_context)); if (!ctx) return ROSPRITE_NOMEM; ctx->base = p; ctx->offset = 0; ctx->size = total_size; *result = ctx; return ROSPRITE_OK; } void rosprite_destroy_mem_context(struct rosprite_mem_context* ctx) { free(ctx); } int rosprite_mem_reader(uint8_t* buf, size_t count, void* ctx) { size_t copy_size; struct rosprite_mem_context* memctx = ctx; /* if we're asked for more memory than the block contains, * only copy as much as we can */ if ((memctx->offset + count) > memctx->size) { copy_size = memctx->size - memctx->offset; } else { copy_size = count; } memcpy(buf, memctx->base + memctx->offset, copy_size); memctx->offset += copy_size; return copy_size; } /** * Load a single sprite. * * \param[out] result */ rosprite_error rosprite_load_sprite(reader reader, void* ctx, struct rosprite** result) { uint32_t nextSpriteOffset; uint32_t imageOffset; uint32_t maskOffset, spriteModeWord; uint32_t paletteEntries; uint8_t* image; uint8_t* mask = NULL; struct rosprite* sprite = malloc(sizeof(struct rosprite)); struct rosprite_header* header = malloc(sizeof(struct rosprite_header)); ERRCHK(rosprite_read_word(reader, ctx, &nextSpriteOffset)); reader(sprite->name, 12, ctx); sprite->name[12] = '\0'; ERRCHK(rosprite_read_word(reader, ctx, &header->width_words)); /* file has width - 1 and height - 1 */ header->width_words += 1; ERRCHK(rosprite_read_word(reader, ctx, &(sprite->height))); sprite->height += 1; ERRCHK(rosprite_read_word(reader, ctx, &(header->first_used_bit))); /* old format only (spriteType = 0) */ ERRCHK(rosprite_read_word(reader, ctx, &(header->last_used_bit))); ERRCHK(rosprite_read_word(reader, ctx, &imageOffset)); assert(imageOffset >= 44); /* should never be smaller than the size of the header) */ ERRCHK(rosprite_read_word(reader, ctx, &maskOffset)); ERRCHK(rosprite_read_word(reader, ctx, &spriteModeWord)); ERRCHK(rosprite_get_mode(spriteModeWord, &(sprite->mode))); /* TODO left-hand wastage */ assert((header->last_used_bit + 1) % sprite->mode.colorbpp == 0); /*assert(header->width_words % sprite->mode->colorbpp == 0);*/ sprite->width = (header->width_words * 32 - header->first_used_bit - (31 - header->last_used_bit)) / sprite->mode.colorbpp; sprite->palettesize = imageOffset - 44; sprite->has_palette = (sprite->palettesize > 0); /* sprite has no mask if imageOffset == maskOffset */ if (imageOffset == maskOffset) { sprite->has_mask = false; header->image_size = nextSpriteOffset - 44 - sprite->palettesize; header->mask_size = 0; } else { sprite->has_mask = true; header->image_size = maskOffset - imageOffset; header->mask_size = nextSpriteOffset - 44 - sprite->palettesize - header->image_size; } if (sprite->has_palette) { uint32_t j, word1, word2, entry; assert(sprite->palettesize % 8 == 0); sprite->palette = malloc(sizeof(uint32_t) * sprite->palettesize); paletteEntries = sprite->palettesize / 8; /* Each palette entry is two words big * The second word is a duplicate of the first * I think this is in case you ever wanted flashing colours * PRM1-730 */ for (j = 0; j < paletteEntries; j++) { ERRCHK(rosprite_read_word(reader, ctx, &word1)); ERRCHK(rosprite_read_word(reader, ctx, &word2)); assert(word1 == word2); /* if they aren't equal, flashing colours are desired, which we don't support */ /* swap rr and bb parts -- PRM1-731 */ entry = ((word1 & 0xff000000) >> 16) | (word1 & 0x00ff0000) | ((word1 & 0x0000ff00) << 16) | 0xff; sprite->palette[j] = entry; } } image = malloc(header->image_size); reader(image, header->image_size, ctx); if (sprite->has_mask) { mask = malloc(header->mask_size); reader(mask, header->mask_size, ctx); } /* sanity check image_size */ assert((header->width_words) * 4 * (sprite->height) == header->image_size); /* TODO: sanity check mask_size */ if (sprite->mode.colorbpp > 8) { ERRCHK(rosprite_load_high_color(image, mask, sprite, header)); } else { ERRCHK(rosprite_load_low_color(image, mask, sprite, header)); } free(image); free(mask); free(header); *result = sprite; return ROSPRITE_OK; } /** * Determine the sprite_mode for the specified sprite_mode_word. * * \param[out] result */ static rosprite_error rosprite_get_mode(uint32_t sprite_mode_word, struct rosprite_mode* result) { struct rosprite_mode mode; uint32_t spriteType = (sprite_mode_word & (15 << 27)) >> 27; /* preserve bits 27-30 only */ if (spriteType != 0) { bool hasEightBitAlpha = sprite_mode_word >> 31; /* bit 31 */ /* new modes have 1bpp masks (PRM5a-111) * unless bit 31 is set (http://select.riscos.com/prm/graphics/sprites/alphachannel.html) */ mode.maskbpp = (hasEightBitAlpha ? 8 : 1); mode.mask_width = mode.maskbpp; mode.xdpi = (sprite_mode_word & (8191 << 14)) >> 14; /* preserve bits 14-26 only */ mode.ydpi = (sprite_mode_word & (8191 << 1)) >> 1; /* preserve bits 1-13 only */ mode.color_model = ROSPRITE_RGB; switch (spriteType) { case 1: mode.colorbpp = 1; break; case 2: mode.colorbpp = 2; break; case 3: mode.colorbpp = 4; break; case 4: mode.colorbpp = 8; break; case 5: mode.colorbpp = 16; break; case 6: mode.colorbpp = 32; break; case 7: mode.colorbpp = 32; mode.color_model = ROSPRITE_CMYK; break; case 8: mode.colorbpp = 24; break; default: return ROSPRITE_BADMODE; } } else { assert(sprite_mode_word < 256); /* don't think you can have modes over 255? */ mode = oldmodes[sprite_mode_word]; } /* illegal mode check */ if ((mode.colorbpp == 0) || (mode.xdpi == 0) || (mode.ydpi == 0)) { return ROSPRITE_BADMODE; } memcpy(result, &mode, sizeof(struct rosprite_mode)); return ROSPRITE_OK; } /** * Load a sprite image with 16 or more bpp. * * \param[out] sprite On exit, sprite.image will be populated */ static rosprite_error rosprite_load_high_color(uint8_t* image_in, uint8_t* mask, struct rosprite* sprite, struct rosprite_header* header) { struct rosprite_mask_state* mask_state = NULL; uint32_t currentByteIndex = 0; uint32_t j, x, y, x_pixels, pixel; bool has_alpha_pixel_data = false; uint8_t b; bool old_has_alpha; if (sprite->has_mask) { ERRCHK(rosprite_init_mask_state(sprite, header, mask, &mask_state)); } sprite->image = malloc(sprite->width * sprite->height * 4); /* all image data is 32bpp going out */ /* Spec says that there must be no left-hand wastage */ assert(header->first_used_bit == 0); { const uint32_t bpp = sprite->mode.colorbpp; const uint32_t bytesPerPixel = bpp / 8; const uint32_t row_max_bit = header->width_words * 32 - (31 - header->last_used_bit); /* Last used bit in row */ for (y = 0; y < sprite->height; y++) { x_pixels = 0; for (x = 0; x < row_max_bit; x += bpp) { pixel = 0; for (j = 0; j < bytesPerPixel; j++) { b = image_in[currentByteIndex++]; pixel = pixel | (b << (j * 8)); } old_has_alpha = has_alpha_pixel_data; pixel = rosprite_upscale_color(pixel, &(sprite->mode), &has_alpha_pixel_data); if (old_has_alpha != has_alpha_pixel_data && (y > 0 || x_pixels > 0)) { rosprite_fix_alpha(sprite->image, (y * sprite->width) + x_pixels - 1); } if (sprite->has_mask) { uint8_t mask_pixel = rosprite_next_mask_pixel(mask, mask_state); pixel = (pixel & 0xffffff00) | mask_pixel; } sprite->image[y*sprite->width + x_pixels] = pixel; x_pixels++; } /* Ensure byte index is pointing at start of next row */ if (y + 1 < sprite->height) { currentByteIndex = (currentByteIndex + 3) & ~3; /* Round up to next multiple of 4 */ } } } if (sprite->has_mask) free(mask_state); return ROSPRITE_OK; } /** * Iterate over the specified number of pixels, starting at the image pointer, * and set the alpha channel to 0x00. */ static inline void rosprite_fix_alpha(uint32_t* image, unsigned long pixels) { uint32_t i; for (i = 0; i <= pixels; i++) { image[i] = image[i] & 0xffffff00; } } /** * Load a sprite image with 8 or fewer bpp. * * \param[out] sprite On exit, sprite.image will be populated */ static rosprite_error rosprite_load_low_color(uint8_t* image_in, uint8_t* mask, struct rosprite* sprite, struct rosprite_header* header) { uint32_t current_byte_index, currentword; uint32_t x, y, x_pixels, pixel; uint8_t mask_pixel; struct rosprite_mask_state* mask_state = NULL; if (sprite->has_mask) { ERRCHK(rosprite_init_mask_state(sprite, header, mask, &mask_state)); } sprite->image = malloc(sprite->width * sprite->height * 4); /* all image data is 32bpp going out */ { const uint32_t bpp = sprite->mode.colorbpp; const uint32_t row_max_bit = header->width_words * 32 - (31 - header->last_used_bit); /* Last used bit in row */ const uint32_t bitmask = (1 << bpp) - 1; /* creates a mask of 1s that is bpp bits wide */ current_byte_index = 0; currentword = BTUINT((image_in + current_byte_index)); current_byte_index += 4; for (y = 0; y < sprite->height; y++) { x_pixels = 0; for (x = header->first_used_bit; x < row_max_bit ; x += bpp) { const uint32_t offset_into_word = x % 32; pixel = (currentword & (bitmask << offset_into_word)) >> offset_into_word; pixel = rosprite_palette_lookup(sprite, pixel); /* lookup returns 32bpp */ if (sprite->has_mask) { mask_pixel = rosprite_next_mask_pixel(mask, mask_state); pixel = (pixel & 0xffffff00) | mask_pixel; } sprite->image[y*sprite->width + x_pixels] = pixel; x_pixels++; /* If we're not at the end of the row and we've processed all of this word, fetch the next one */ if (x + bpp < row_max_bit && offset_into_word + bpp == 32) { currentword = BTUINT((image_in + current_byte_index)); current_byte_index += 4; } } /* Advance to first word of next row */ if (y + 1 < sprite->height) { currentword = BTUINT((image_in + current_byte_index)); current_byte_index += 4; } } } if (sprite->has_mask) free(mask_state); return ROSPRITE_OK; } static uint32_t rosprite_palette_lookup(struct rosprite* sprite, uint32_t pixel) { uint32_t translated_pixel; /* because we're dealing with 8bpp or less */ if (sprite->has_palette) { if(pixel < (sprite->palettesize / 8)) { translated_pixel = sprite->palette[pixel]; } else { translated_pixel = sprite_8bpp_palette[pixel]; } } else { switch (sprite->mode.colorbpp) { case 8: assert(pixel < 256); translated_pixel = sprite_8bpp_palette[pixel]; break; case 4: assert(pixel < 16); translated_pixel = sprite_4bpp_palette[pixel]; break; case 2: assert(pixel < 4); translated_pixel = sprite_2bpp_palette[pixel]; break; case 1: assert(pixel < 2); translated_pixel = sprite_1bpp_palette[pixel]; break; default: translated_pixel = 0; assert(false); } } return translated_pixel; } static rosprite_error rosprite_init_mask_state(struct rosprite* sprite, struct rosprite_header* header, uint8_t* mask, struct rosprite_mask_state** result) { struct rosprite_mask_state* mask_state = malloc(sizeof(struct rosprite_mask_state)); if (!mask_state) return ROSPRITE_NOMEM; mask_state->x = header->first_used_bit; mask_state->y = 0; mask_state->first_used_bit = header->first_used_bit; mask_state->row_max_bit = sprite->width * sprite->mode.mask_width; mask_state->height = sprite->height; mask_state->bpp = sprite->mode.mask_width; mask_state->current_word = BTUINT(mask); mask_state->current_byte_index = 4; *result = mask_state; return ROSPRITE_OK; } /** * Get the next mask byte. * A mask of 0xff denotes 100% opaque, 0x00 denotes 100% transparent. * * \param[in,out] mask_state */ static uint32_t rosprite_next_mask_pixel(uint8_t* mask, struct rosprite_mask_state* mask_state) { /* a 1bpp mask (for new mode sprites), each row is word aligned (therefore potential righthand wastage */ const uint32_t bitmask = (1 << mask_state->bpp) - 1; const uint32_t offset_into_word = mask_state->x % 32; uint32_t pixel = (mask_state->current_word & (bitmask << offset_into_word)) >> offset_into_word; if (mask_state->x + mask_state->bpp < mask_state->row_max_bit && offset_into_word + mask_state->bpp == 32) { mask_state->current_word = BTUINT((mask + mask_state->current_byte_index)); mask_state->current_byte_index += 4; } mask_state->x += mask_state->bpp; if (mask_state->x >= mask_state->row_max_bit) { mask_state->x = mask_state->first_used_bit; if (mask_state->y + 1 < mask_state->height) { mask_state->current_word = BTUINT((mask + mask_state->current_byte_index)); mask_state->current_byte_index += 4; } mask_state->y++; } /* * if the mask is 1bpp, make sure the whole byte is 0x00 or 0xff */ if (mask_state->bpp < 8) { pixel = (pixel & 1) ? 0xff : 0x00; } return pixel; } /** * Upscale a 16, 24 or 32bpp sprite to the 0xRRGGBBAA representation. * Do not call this function with a sprite with less than 16bpp, * but use a palette lookup instead. */ static uint32_t rosprite_upscale_color(uint32_t pixel, struct rosprite_mode* mode, bool* has_alpha_pixel_data) { uint8_t alpha; switch (mode->colorbpp) { case 32: if (mode->color_model == ROSPRITE_RGB) { /* swap from 0xAABBGGRR to 0xRRGGBBAA */ pixel = BSWAP(pixel); } else { pixel = rosprite_cmyk_to_rgb(pixel); } break; case 24: /* reverse byte order */ pixel = BSWAP(pixel); break; case 16: /* incoming format is b_00000000000000000bbbbbgggggrrrrr */ { uint8_t red = pixel & 31; uint8_t green = (pixel & (31 << 5)) >> 5; uint8_t blue = (pixel & (31 << 10)) >> 10; /* sanity check */ assert(red < 32); assert(green < 32); assert(blue < 32); pixel = (sprite_16bpp_translate[red] << 24) | (sprite_16bpp_translate[green] << 16) | (sprite_16bpp_translate[blue] << 8); } break; case 8: case 4: case 2: case 1: assert(false); /* shouldn't need to call for <= 8bpp, since a palette lookup will return 32bpp */ default: assert(false); /* unknown bpp */ } alpha = pixel & 0xff; if (alpha == 0x00) { if (!(*has_alpha_pixel_data)) { pixel = pixel | 0xff; } } else { *has_alpha_pixel_data = true; } return pixel; } static inline uint32_t rosprite_cmyk_to_rgb(uint32_t cmyk) { uint8_t c = cmyk & 0xff; uint8_t m = (cmyk & 0xff00) >> 8; uint8_t y = (cmyk & 0xff0000) >> 16; uint8_t k = cmyk >> 24; /* Convert to CMY colourspace */ uint8_t C = c + k; uint8_t M = m + k; uint8_t Y = y + k; /* And to RGB */ uint8_t r = 255 - C; uint8_t g = 255 - M; uint8_t b = 255 - Y; return r << 24 | g << 16 | b << 8; } static inline rosprite_error rosprite_read_word(reader reader, void* ctx, uint32_t* result) { unsigned char b[4]; if (reader(b, 4, ctx) < 4) { return ROSPRITE_EOF; } *result = BTUINT(b); return ROSPRITE_OK; } ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/src/palette2c.c���������������������������������������������������������0000644�0001750�0001750�00000001766�12377676763�020022� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������/* * This file is part of librosprite. * Licensed under the MIT License, * http://www.opensource.org/licenses/mit-license.php * Copyright 2008 James Shaw <js102@zepler.net> */ #include <stdio.h> #include <stdlib.h> #include "librosprite.h" int main(int argc, char *argv[]) { if (argc < 2) { printf("Usage: palette2c palettefile\n"); exit(EXIT_FAILURE); } char* filename = argv[1]; FILE* f = fopen(filename, "rb"); if (f == NULL) { printf("Can't load palettefile %s\n", filename); exit(EXIT_FAILURE); } struct rosprite_file_context* ctx; if (rosprite_create_file_context(f, &ctx) != ROSPRITE_OK) { exit(EXIT_FAILURE); } struct rosprite_palette* palette; if (rosprite_load_palette(rosprite_file_reader, ctx, &palette) != ROSPRITE_OK) { exit(EXIT_FAILURE); } for (uint32_t i = 0; i < palette->size; i++) { printf("0x%x, ", palette->palette[i]); } fclose(f); rosprite_destroy_file_context(ctx); rosprite_destroy_palette(palette); return EXIT_SUCCESS; } ����������netsurf-all-3.2/librosprite/src/Makefile������������������������������������������������������������0000644�0001750�0001750�00000000113�12377676763�017414� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sources DIR_SOURCES := librosprite.c include $(NSBUILD)/Makefile.subdir �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/Makefile����������������������������������������������������������������0000644�0001750�0001750�00000002452�12377676763�016635� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Component settings COMPONENT := rosprite COMPONENT_VERSION := 0.1.1 # Default to a static library COMPONENT_TYPE ?= lib-static # FIXME # palette2c tool needs building and installing as binary target # examples/example.c needs a build target # Setup the tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools # Toolchain flags WARNFLAGS := -Wall -Wextra -Wundef -Wpointer-arith -Wcast-align \ -Wwrite-strings -Wstrict-prototypes \ -Wnested-externs -pedantic -std=c99 \ -Wno-format-zero-length -Wformat-security -Wstrict-aliasing=2 \ -Wmissing-format-attribute -Wunused \ -Wformat=2 -Werror-implicit-function-declaration \ -Wmissing-declarations -Wmissing-prototypes # BeOS/Haiku standard library headers create warnings ifneq ($(TARGET),beos) WARNFLAGS := $(WARNFLAGS) -Werror endif CFLAGS := -I$(CURDIR)/include/ $(WARNFLAGS) $(CFLAGS) ifneq ($(GCCVER),2) CFLAGS := $(CFLAGS) -std=c99 else # __inline__ is a GCCism CFLAGS := $(CFLAGS) -Dinline="__inline__" endif include $(NSBUILD)/Makefile.top # Extra installation rules I := /include INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/librosprite.h INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT) ����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/librosprite/Doxyfile����������������������������������������������������������������0000644�0001750�0001750�00000145175�12377676763�016715� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Doxyfile 1.5.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. PROJECT_NAME = librosprite # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or # if some version control system is used. PROJECT_NUMBER = # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. # If a relative path is entered, it will be relative to the location # where doxygen was started. If left blank the current directory will be used. OUTPUT_DIRECTORY = # If the CREATE_SUBDIRS tag is set to YES, then doxygen will create # 4096 sub-directories (in 2 levels) under the output directory of each output # format and will distribute the generated files over these directories. # Enabling this option can be useful when feeding doxygen a huge amount of # source files, where putting all generated files in the same directory would # otherwise cause performance problems for the file system. CREATE_SUBDIRS = NO # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. # The default language is English, other supported languages are: # Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, # Croatian, Czech, Danish, Dutch, Finnish, French, German, Greek, Hungarian, # Italian, Japanese, Japanese-en (Japanese with English messages), Korean, # Korean-en, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, # Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. OUTPUT_LANGUAGE = English # This tag can be used to specify the encoding used in the generated output. # The encoding is not always determined by the language that is chosen, # but also whether or not the output is meant for Windows or non-Windows users. # In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES # forces the Windows encoding (this is the default for the Windows binary), # whereas setting the tag to NO uses a Unix-style encoding (the default for # all platforms other than Windows). USE_WINDOWS_ENCODING = NO # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will # include brief member descriptions after the members that are listed in # the file and class documentation (similar to JavaDoc). # Set to NO to disable this. BRIEF_MEMBER_DESC = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # This tag implements a quasi-intelligent brief description abbreviator # that is used to form the text in various listings. Each string # in this list, if found as the leading text of the brief description, will be # stripped from the text and the result after processing the whole list, is # used as the annotated text. Otherwise, the brief description is used as-is. # If left blank, the following values are used ("$name" is automatically # replaced with the name of the entity): "The $name class" "The $name widget" # "The $name file" "is" "provides" "specifies" "contains" # "represents" "a" "an" "the" ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then # Doxygen will generate a detailed section even if there is only a brief # description. ALWAYS_DETAILED_SEC = NO # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. INLINE_INHERITED_MEMB = NO # If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full # path before files name in the file list and in the header files. If set # to NO the shortest path that makes the file name unique will be used. FULL_PATH_NAMES = YES # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # can be used to strip a user-defined part of the path. Stripping is # only done if one of the specified strings matches the left-hand part of # the path. The tag can be used to show relative paths in the file list. # If left blank the directory from which doxygen is run is used as the # path to strip. STRIP_FROM_PATH = # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # the path mentioned in the documentation of a class, which tells # the reader which header file to include in order to use a class. # If left blank only the name of the header file containing the class # definition is used. Otherwise one should specify the include paths that # are normally passed to the compiler using the -I flag. STRIP_FROM_INC_PATH = # If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter # (but less readable) file names. This can be useful is your file systems # doesn't support long names like on DOS, Mac, or CD-ROM. SHORT_NAMES = NO # If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen # will interpret the first line (until the first dot) of a JavaDoc-style # comment as the brief description. If set to NO, the JavaDoc # comments will behave just like the Qt-style comments (thus requiring an # explicit @brief command for a brief description. JAVADOC_AUTOBRIEF = YES # The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen # treat a multi-line C++ special comment block (i.e. a block of //! or /// # comments) as a brief description. This used to be the default behaviour. # The new default is to treat a multi-line C++ comment block as a detailed # description. Set this tag to YES if you prefer the old behaviour instead. MULTILINE_CPP_IS_BRIEF = NO # If the DETAILS_AT_TOP tag is set to YES then Doxygen # will output the detailed description near the top, like JavaDoc. # If set to NO, the detailed description appears after the member # documentation. DETAILS_AT_TOP = NO # If the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # re-implements. INHERIT_DOCS = YES # If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce # a new page for each member. If set to NO, the documentation of a member will # be part of the file/class/namespace that contains it. SEPARATE_MEMBER_PAGES = NO # The TAB_SIZE tag can be used to set the number of spaces in a tab. # Doxygen uses this value to replace tabs by spaces in code fragments. TAB_SIZE = 8 # This tag can be used to specify a number of aliases that acts # as commands in the documentation. An alias has the form "name=value". # For example adding "sideeffect=\par Side Effects:\n" will allow you to # put the command \sideeffect (or @sideeffect) in the documentation, which # will result in a user-defined paragraph with heading "Side Effects:". # You can put \n's in the value part of an alias to insert newlines. ALIASES = # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C # sources only. Doxygen will then generate output that is more tailored for C. # For instance, some of the names that are used will be different. The list # of all members will be omitted, etc. OPTIMIZE_OUTPUT_FOR_C = NO # Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java # sources only. Doxygen will then generate output that is more tailored for Java. # For instance, namespaces will be presented as packages, qualified scopes # will look different, etc. OPTIMIZE_OUTPUT_JAVA = NO # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to # include (a tag file for) the STL sources as input, then you should # set this tag to YES in order to let doxygen match functions declarations and # definitions whose arguments contain STL classes (e.g. func(std::string); v.s. # func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. BUILTIN_STL_SUPPORT = NO # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC # tag is set to YES, then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. DISTRIBUTE_GROUP_DOC = NO # Set the SUBGROUPING tag to YES (the default) to allow class member groups of # the same type (for instance a group of public functions) to be put as a # subgroup of that type (e.g. under the Public Functions section). Set it to # NO to prevent subgrouping. Alternatively, this can be done per class using # the \nosubgrouping command. SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- # If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in # documentation are documented, even if no documentation was available. # Private class members and static file members will be hidden unless # the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES EXTRACT_ALL = NO # If the EXTRACT_PRIVATE tag is set to YES all private members of a class # will be included in the documentation. EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. # If set to NO only classes defined in header files are included. EXTRACT_LOCAL_CLASSES = YES # This flag is only useful for Objective-C code. When set to YES local # methods, which are defined in the implementation section but not in # the interface are included in the documentation. # If set to NO (the default) only methods in the interface are included. EXTRACT_LOCAL_METHODS = NO # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all # undocumented members of documented classes, files or namespaces. # If set to NO (the default) these members will be included in the # various overviews, but no documentation section is generated. # This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_MEMBERS = NO # If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all # undocumented classes that are normally visible in the class hierarchy. # If set to NO (the default) these classes will be included in the various # overviews. This option has no effect if EXTRACT_ALL is enabled. HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all # friend (class|struct|union) declarations. # If set to NO (the default) these declarations will be included in the # documentation. HIDE_FRIEND_COMPOUNDS = NO # If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any # documentation blocks found inside the body of a function. # If set to NO (the default) these blocks will be appended to the # function's detailed documentation block. HIDE_IN_BODY_DOCS = NO # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate # file names in lower-case letters. If set to YES upper-case letters are also # allowed. This is useful if you have classes or files whose names only differ # in case and if your file system supports case sensitive file names. Windows # and Mac users are advised to set this option to NO. CASE_SENSE_NAMES = YES # If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen # will show members with their full class and namespace scopes in the # documentation. If set to YES the scope will be hidden. HIDE_SCOPE_NAMES = NO # If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen # will put a list of the files that are included by a file in the documentation # of that file. SHOW_INCLUDE_FILES = YES # If the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen # will sort the (detailed) documentation of file and class members # alphabetically by member name. If set to NO the members will appear in # declaration order. SORT_MEMBER_DOCS = YES # If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the # brief documentation of file, namespace and class members alphabetically # by member name. If set to NO (the default) the members will appear in # declaration order. SORT_BRIEF_DOCS = NO # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to # NO (the default), the class list will be sorted only by class name, # not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. # Note: This option applies only to the class list, not to the # alphabetical list. SORT_BY_SCOPE_NAME = NO # The GENERATE_TODOLIST tag can be used to enable (YES) or # disable (NO) the todo list. This list is created by putting \todo # commands in the documentation. GENERATE_TODOLIST = YES # The GENERATE_TESTLIST tag can be used to enable (YES) or # disable (NO) the test list. This list is created by putting \test # commands in the documentation. GENERATE_TESTLIST = YES # The GENERATE_BUGLIST tag can be used to enable (YES) or # disable (NO) the bug list. This list is created by putting \bug # commands in the documentation. GENERATE_BUGLIST = YES # The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or # disable (NO) the deprecated list. This list is created by putting # \deprecated commands in the documentation. GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. ENABLED_SECTIONS = # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in # the documentation. If the initializer consists of more lines than specified # here it will be hidden. Use a value of 0 to hide initializers completely. # The appearance of the initializer of individual variables and defines in the # documentation can be controlled using \showinitializer or \hideinitializer # command in the documentation regardless of this setting. MAX_INITIALIZER_LINES = 30 # Set the SHOW_USED_FILES tag to NO to disable the list of files generated # at the bottom of the documentation of classes and structs. If set to YES the # list will mention the files that were used to generate the documentation. SHOW_USED_FILES = YES # If the sources in your project are distributed over multiple directories # then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy # in the documentation. The default is NO. SHOW_DIRECTORIES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from the # version control system). Doxygen will invoke the program by executing (via # popen()) the command <command> <input-file>, where <command> is the value of # the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file # provided by doxygen. Whatever the program writes to standard output # is used as the file version. See the manual for examples. FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- # The QUIET tag can be used to turn on/off the messages that are generated # by doxygen. Possible values are YES and NO. If left blank NO is used. QUIET = NO # The WARNINGS tag can be used to turn on/off the warning messages that are # generated by doxygen. Possible values are YES and NO. If left blank # NO is used. WARNINGS = YES # If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings # for undocumented members. If EXTRACT_ALL is set to YES then this flag will # automatically be disabled. WARN_IF_UNDOCUMENTED = YES # If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for # potential errors in the documentation, such as not documenting some # parameters in a documented function, or documenting parameters that # don't exist or using markup commands wrongly. WARN_IF_DOC_ERROR = YES # This WARN_NO_PARAMDOC option can be abled to get warnings for # functions that are documented, but have no documentation for their parameters # or return value. If set to NO (the default) doxygen will only warn about # wrong or incomplete parameter documentation, but not about the absence of # documentation. WARN_NO_PARAMDOC = NO # The WARN_FORMAT tag determines the format of the warning messages that # doxygen can produce. The string should contain the $file, $line, and $text # tags, which will be replaced by the file and line number from which the # warning originated and the warning text. Optionally the format may contain # $version, which will be replaced by the version of the file (if it could # be obtained via FILE_VERSION_FILTER) WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning # and error messages should be written. If left blank the output is written # to stderr. WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- # The INPUT tag can be used to specify the files and/or directories that contain # documented source files. You may enter file names like "myfile.cpp" or # directories like "/usr/src/myproject". Separate the files or directories # with spaces. INPUT = # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank the following patterns are tested: # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py FILE_PATTERNS = # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. # If left blank NO is used. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded # from the input. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude # certain files from those directories. Note that the wildcards are matched # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* EXCLUDE_PATTERNS = # The EXAMPLE_PATH tag can be used to specify one or more files or # directories that contain example code fragments that are included (see # the \include command). EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude # commands irrespective of the value of the RECURSIVE tag. # Possible values are YES and NO. If left blank NO is used. EXAMPLE_RECURSIVE = NO # The IMAGE_PATH tag can be used to specify one or more files or # directories that contain image that are included in the documentation (see # the \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program # by executing (via popen()) the command <filter> <input-file>, where <filter> # is the value of the INPUT_FILTER tag, and <input-file> is the name of an # input file. Doxygen will then use the output that the filter program writes # to standard output. If FILTER_PATTERNS is specified, this tag will be # ignored. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # basis. Doxygen will compare the file name with each pattern and apply the # filter if there is a match. The filters are a list of the form: # pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further # info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER # is applied to all files. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using # INPUT_FILTER) will be used to filter the input files when producing source # files to browse (i.e. when SOURCE_BROWSER is set to YES). FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- # If the SOURCE_BROWSER tag is set to YES then a list of source files will # be generated. Documented entities will be cross-referenced with these sources. # Note: To get rid of all source code in the generated output, make sure also # VERBATIM_HEADERS is set to NO. SOURCE_BROWSER = NO # Setting the INLINE_SOURCES tag to YES will include the body # of functions and classes directly in the documentation. INLINE_SOURCES = NO # Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES (the default) # then for each documented function all documented # functions referencing it will be listed. REFERENCED_BY_RELATION = YES # If the REFERENCES_RELATION tag is set to YES (the default) # then for each documented function all documented entities # called/used by that function will be listed. REFERENCES_RELATION = YES # If the REFERENCES_LINK_SOURCE tag is set to YES (the default) # and SOURCE_BROWSER tag is set to YES, then the hyperlinks from # functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will # link to the source code. Otherwise they will link to the documentstion. REFERENCES_LINK_SOURCE = YES # If the USE_HTAGS tag is set to YES then the references to source code # will point to the HTML generated by the htags(1) tool instead of doxygen # built-in source browser. The htags tool is part of GNU's global source # tagging system (see http://www.gnu.org/software/global/global.html). You # will need version 4.8.6 or higher. USE_HTAGS = NO # If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen # will generate a verbatim copy of the header file for each class for # which an include is specified. Set to NO to disable this. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- # If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index # of all compounds will be generated. Enable this if the project # contains a lot of classes, structs, unions or interfaces. ALPHABETICAL_INDEX = NO # If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then # the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns # in which this list will be split (can be a number in the range [1..20]) COLS_IN_ALPHA_INDEX = 5 # In case all classes in a project start with a common prefix, all # classes will be put under the same header in the alphabetical index. # The IGNORE_PREFIX tag can be used to specify one or more prefixes that # should be ignored while generating the index headers. IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- # If the GENERATE_HTML tag is set to YES (the default) Doxygen will # generate HTML output. GENERATE_HTML = YES # The HTML_OUTPUT tag is used to specify where the HTML docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `html' will be used as the default path. HTML_OUTPUT = doc # The HTML_FILE_EXTENSION tag can be used to specify the file extension for # each generated HTML page (for example: .htm,.php,.asp). If it is left blank # doxygen will generate files with .html extension. HTML_FILE_EXTENSION = .html # The HTML_HEADER tag can be used to specify a personal HTML header for # each generated HTML page. If it is left blank doxygen will generate a # standard header. HTML_HEADER = # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a # standard footer. HTML_FOOTER = # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to # fine-tune the look of the HTML output. If the tag is left blank doxygen # will generate a default style sheet. Note that doxygen will try to copy # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! HTML_STYLESHEET = # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to # NO a bullet list will be used. HTML_ALIGN_MEMBERS = YES # If the GENERATE_HTMLHELP tag is set to YES, additional index files # will be generated that can be used as input for tools like the # Microsoft HTML help workshop to generate a compressed HTML help file (.chm) # of the generated HTML documentation. GENERATE_HTMLHELP = NO # If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can # be used to specify the file name of the resulting .chm file. You # can add a path in front of the file if the result should not be # written to the html output directory. CHM_FILE = # If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can # be used to specify the location (absolute path including file name) of # the HTML help compiler (hhc.exe). If non-empty doxygen will try to run # the HTML help compiler on the generated index.hhp. HHC_LOCATION = # If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag # controls if a separate .chi index file is generated (YES) or that # it should be included in the master .chm file (NO). GENERATE_CHI = NO # If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag # controls whether a binary table of contents is generated (YES) or a # normal table of contents (NO) in the .chm file. BINARY_TOC = NO # The TOC_EXPAND flag can be set to YES to add extra items for group members # to the contents of the HTML help documentation and to the tree view. TOC_EXPAND = NO # The DISABLE_INDEX tag can be used to turn on/off the condensed index at # top of each HTML page. The value NO (the default) enables the index and # the value YES disables it. DISABLE_INDEX = NO # This tag can be used to set the number of enum values (range [1..20]) # that doxygen will group on one line in the generated HTML documentation. ENUM_VALUES_PER_LINE = 4 # If the GENERATE_TREEVIEW tag is set to YES, a side panel will be # generated containing a tree-like index structure (just like the one that # is generated for HTML Help). For this to work a browser that supports # JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, # Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are # probably better off using the HTML help feature. GENERATE_TREEVIEW = NO # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be # used to set the initial width (in pixels) of the frame in which the tree # is shown. TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will # generate Latex output. GENERATE_LATEX = NO # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `latex' will be used as the default path. LATEX_OUTPUT = latex # The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be # invoked. If left blank `latex' will be used as the default command name. LATEX_CMD_NAME = latex # The MAKEINDEX_CMD_NAME tag can be used to specify the command name to # generate index for LaTeX. If left blank `makeindex' will be used as the # default command name. MAKEINDEX_CMD_NAME = makeindex # If the COMPACT_LATEX tag is set to YES Doxygen generates more compact # LaTeX documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_LATEX = NO # The PAPER_TYPE tag can be used to set the paper type that is used # by the printer. Possible values are: a4, a4wide, letter, legal and # executive. If left blank a4wide will be used. PAPER_TYPE = a4wide # The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX # packages that should be included in the LaTeX output. EXTRA_PACKAGES = # The LATEX_HEADER tag can be used to specify a personal LaTeX header for # the generated latex document. The header should contain everything until # the first chapter. If it is left blank doxygen will generate a # standard header. Notice: only use this tag if you know what you are doing! LATEX_HEADER = # If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated # is prepared for conversion to pdf (using ps2pdf). The pdf file will # contain links (just like the HTML output) instead of page references # This makes the output suitable for online browsing using a pdf viewer. PDF_HYPERLINKS = NO # If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of # plain latex in the generated Makefile. Set this option to YES to get a # higher quality PDF documentation. USE_PDFLATEX = NO # If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. # command to the generated LaTeX files. This will instruct LaTeX to keep # running if errors occur, instead of asking the user for help. # This option is also used when generating formulas in HTML. LATEX_BATCHMODE = NO # If LATEX_HIDE_INDICES is set to YES then doxygen will not # include the index chapters (such as File Index, Compound Index, etc.) # in the output. LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- # If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output # The RTF output is optimized for Word 97 and may not look very pretty with # other RTF readers or editors. GENERATE_RTF = NO # The RTF_OUTPUT tag is used to specify where the RTF docs will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `rtf' will be used as the default path. RTF_OUTPUT = rtf # If the COMPACT_RTF tag is set to YES Doxygen generates more compact # RTF documents. This may be useful for small projects and may help to # save some trees in general. COMPACT_RTF = NO # If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated # will contain hyperlink fields. The RTF file will # contain links (just like the HTML output) instead of page references. # This makes the output suitable for online browsing using WORD or other # programs which support those fields. # Note: wordpad (write) and others do not support links. RTF_HYPERLINKS = NO # Load stylesheet definitions from file. Syntax is similar to doxygen's # config file, i.e. a series of assignments. You only have to provide # replacements, missing definitions are set to their default value. RTF_STYLESHEET_FILE = # Set optional variables used in the generation of an rtf document. # Syntax is similar to doxygen's config file. RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- # If the GENERATE_MAN tag is set to YES (the default) Doxygen will # generate man pages GENERATE_MAN = NO # The MAN_OUTPUT tag is used to specify where the man pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `man' will be used as the default path. MAN_OUTPUT = man # The MAN_EXTENSION tag determines the extension that is added to # the generated man pages (default is the subroutine's section .3) MAN_EXTENSION = .3 # If the MAN_LINKS tag is set to YES and Doxygen generates man output, # then it will generate one additional man file for each entity # documented in the real man page(s). These additional files # only source the real man page, but without them the man command # would be unable to find the correct page. The default is NO. MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- # If the GENERATE_XML tag is set to YES Doxygen will # generate an XML file that captures the structure of # the code including all documentation. GENERATE_XML = NO # The XML_OUTPUT tag is used to specify where the XML pages will be put. # If a relative path is entered the value of OUTPUT_DIRECTORY will be # put in front of it. If left blank `xml' will be used as the default path. XML_OUTPUT = xml # The XML_SCHEMA tag can be used to specify an XML schema, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_SCHEMA = # The XML_DTD tag can be used to specify an XML DTD, # which can be used by a validating XML parser to check the # syntax of the XML files. XML_DTD = # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that # enabling this will significantly increase the size of the XML output. XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will # generate an AutoGen Definitions (see autogen.sf.net) file # that captures the structure of the code including all # documentation. Note that this feature is still experimental # and incomplete at the moment. GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- # If the GENERATE_PERLMOD tag is set to YES Doxygen will # generate a Perl module file that captures the structure of # the code including all documentation. Note that this # feature is still experimental and incomplete at the # moment. GENERATE_PERLMOD = NO # If the PERLMOD_LATEX tag is set to YES Doxygen will generate # the necessary Makefile rules, Perl scripts and LaTeX code to be able # to generate PDF and DVI output from the Perl module output. PERLMOD_LATEX = NO # If the PERLMOD_PRETTY tag is set to YES the Perl module output will be # nicely formatted so it can be parsed by a human reader. This is useful # if you want to understand what is going on. On the other hand, if this # tag is set to NO the size of the Perl module output will be much smaller # and Perl will parse it just the same. PERLMOD_PRETTY = YES # The names of the make variables in the generated doxyrules.make file # are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. # This is useful so different doxyrules.make files included by the same # Makefile don't overwrite each other's variables. PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. Macro expansion can be done in a controlled # way by setting EXPAND_ONLY_PREDEF to YES. MACRO_EXPANSION = NO # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED and EXPAND_AS_DEFINED tags. EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the # directories. If left blank, the patterns specified with FILE_PATTERNS will # be used. INCLUDE_FILE_PATTERNS = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. To prevent a macro definition from being # undefined via #undef or recursively expanded use the := operator # instead of the = operator. PREDEFINED = # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then # this tag can be used to specify a list of macro names that should be expanded. # The macro definition that is found in the sources will be used. # Use the PREDEFINED tag if you want to use a different macro definition. EXPAND_AS_DEFINED = # If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then # doxygen's preprocessor will remove all function-like macros that are alone # on a line, have an all uppercase name, and do not end with a semicolon. Such # function macros are typically used for boiler-plate code, and will confuse # the parser if not removed. SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- # The TAGFILES option can be used to specify one or more tagfiles. # Optionally an initial location of the external documentation # can be added for each tagfile. The format of a tag file without # this location is as follows: # TAGFILES = file1 file2 ... # Adding location for the tag files is done as follows: # TAGFILES = file1=loc1 "file2 = loc2" ... # where "loc1" and "loc2" can be relative or absolute paths or # URLs. If a location is present for each tag, the installdox tool # does not have to be run to correct the links. # Note that each tag file must have a unique name # (where the name does NOT include the path) # If a tag file is not located in the directory in which doxygen # is run, you must also specify the path to the tagfile here. TAGFILES = # When a file name is specified after GENERATE_TAGFILE, doxygen will create # a tag file that is based on the input files it reads. GENERATE_TAGFILE = # If the ALLEXTERNALS tag is set to YES all external classes will be listed # in the class index. If set to NO only the inherited external classes # will be listed. ALLEXTERNALS = NO # If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed # in the modules index. If set to NO, only the current project's groups will # be listed. EXTERNAL_GROUPS = YES # The PERL_PATH should be the absolute path and name of the perl script # interpreter (i.e. the result of `which perl'). PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- # If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will # generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base # or super classes. Setting the tag to NO turns the diagrams off. Note that # this option is superseded by the HAVE_DOT option below. This is only a # fallback. It is recommended to install and use dot, since it yields more # powerful graphs. CLASS_DIAGRAMS = YES # If set to YES, the inheritance and collaboration graphs will hide # inheritance and usage relations if the target is undocumented # or is not a class. HIDE_UNDOC_RELATIONS = YES # If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is # available from the path. This tool is part of Graphviz, a graph visualization # toolkit from AT&T and Lucent Bell Labs. The other options in this section # have no effect if this option is set to NO (the default) HAVE_DOT = NO # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect inheritance relations. Setting this tag to YES will force the # the CLASS_DIAGRAMS tag to NO. CLASS_GRAPH = YES # If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen # will generate a graph for each documented class showing the direct and # indirect implementation dependencies (inheritance, containment, and # class references variables) of the class with other documented classes. COLLABORATION_GRAPH = YES # If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen # will generate a graph for groups, showing the direct groups dependencies GROUP_GRAPHS = YES # If the UML_LOOK tag is set to YES doxygen will generate inheritance and # collaboration diagrams in a style similar to the OMG's Unified Modeling # Language. UML_LOOK = NO # If set to YES, the inheritance and collaboration graphs will show the # relations between templates and their instances. TEMPLATE_RELATIONS = NO # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT # tags are set to YES then doxygen will generate a graph for each documented # file showing the direct and indirect include dependencies of the file with # other documented files. INCLUDE_GRAPH = YES # If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and # HAVE_DOT tags are set to YES then doxygen will generate a graph for each # documented header file showing the documented files that directly or # indirectly include this file. INCLUDED_BY_GRAPH = YES # If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a call dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable call graphs for selected # functions only using the \callgraph command. CALL_GRAPH = NO # If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will # generate a caller dependency graph for every global function or class method. # Note that enabling this option will significantly increase the time of a run. # So in most cases it will be better to enable caller graphs for selected # functions only using the \callergraph command. CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen # will graphical hierarchy of all classes instead of a textual one. GRAPHICAL_HIERARCHY = YES # If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES # then doxygen will show the dependencies a directory has on other directories # in a graphical way. The dependency relations are determined by the #include # relations between the files in the directories. DIRECTORY_GRAPH = YES # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. Possible values are png, jpg, or gif # If left blank png will be used. DOT_IMAGE_FORMAT = png # The tag DOT_PATH can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. DOT_PATH = # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the # \dotfile command). DOTFILE_DIRS = # The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_WIDTH = 1024 # The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height # (in pixels) of the graphs generated by dot. If a graph becomes larger than # this value, doxygen will try to truncate the graph, so that it fits within # the specified constraint. Beware that most browsers cannot cope with very # large images. MAX_DOT_GRAPH_HEIGHT = 1024 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable # from the root by following a path via at most 3 edges will be shown. Nodes # that lay further from the root node will be omitted. Note that setting this # option to 1 or 2 may greatly reduce the computation time needed for large # code bases. Also note that a graph may be further truncated if the graph's # image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH # and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), # the graph is not depth-constrained. MAX_DOT_GRAPH_DEPTH = 0 # Set the DOT_TRANSPARENT tag to YES to generate images with a transparent # background. This is disabled by default, which results in a white background. # Warning: Depending on the platform used, enabling this option may lead to # badly anti-aliased labels on the edges of a graph (i.e. they become hard to # read). DOT_TRANSPARENT = NO # Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output # files in one run (i.e. multiple -o and -T options on the command line). This # makes dot run faster, but since only newer versions of dot (>1.8.10) # support this, this feature is disabled by default. DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/������������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�015166� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/����������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�016621� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�017600� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test/foo.c������������������������������������������������������0000644�0001750�0001750�00000000141�12377676731�020530� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #include "foo.h" int main(void) { foo(); printf("PASS\n"); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test/Makefile���������������������������������������������������0000644�0001750�0001750�00000000137�12377676731�021246� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Test sources in this directory DIR_TEST_SOURCES := foo.c include $(NSBUILD)/Makefile.subdir ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test2/����������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�017662� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test2/foo.c�����������������������������������������������������0000644�0001750�0001750�00000000141�12377676731�020612� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include <stdio.h> #include "foo.h" int main(void) { foo(); printf("PASS\n"); return 0; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/test2/Makefile��������������������������������������������������0000644�0001750�0001750�00000000137�12377676731�021330� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Test sources in this directory DIR_TEST_SOURCES := foo.c include $(NSBUILD)/Makefile.subdir ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/Makefile.config�������������������������������������������������0000644�0001750�0001750�00000000143�12377676731�021530� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Configuration makefile fragment # Local configuration changes -include Makefile.config.override �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/libfoo.pc.in����������������������������������������������������0000644�0001750�0001750�00000000311�12377676731�021024� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������prefix=PREFIX exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include Name: libfoo Description: Pointless example library Version: 0.0.1 Libs: -L${libdir} Cflags: -I${includedir} �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src1/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�017471� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src1/foo.h������������������������������������������������������0000644�0001750�0001750�00000000075�12377676731�020434� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#ifndef foo_h_ #define foo_h_ extern int foo(void); #endif �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src1/foo.c������������������������������������������������������0000644�0001750�0001750�00000000061�12377676731�020422� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#include "foo.h" int foo(void) { return -1; } �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src1/Makefile���������������������������������������������������0000644�0001750�0001750�00000000271�12377676731�021136� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sources in this directory DIR_SOURCES := foo.c # Items to install from this directory DIR_INSTALL_ITEMS := /include:foo.h # Grab the core makefile include $(NSBUILD)/Makefile.subdir ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src2/�����������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�017472� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src2/bar.c������������������������������������������������������0000644�0001750�0001750�00000000046�12377676731�020407� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������extern int bar(void) { return -1; } ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/src2/Makefile���������������������������������������������������0000644�0001750�0001750�00000000125�12377676731�021135� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Sources in this directory DIR_SOURCES := bar.c include $(NSBUILD)/Makefile.subdir �������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/example/Makefile��������������������������������������������������������0000644�0001750�0001750�00000001060�12377676731�020263� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������# Define the component name COMPONENT := foo # And the component type COMPONENT_TYPE := lib-static # Component version COMPONENT_VERSION := 0.0.1 # Tooling PREFIX ?= /opt/netsurf NSSHARED ?= $(PREFIX)/share/netsurf-buildsystem include $(NSSHARED)/makefiles/Makefile.tools # Grab the core makefile include $(NSBUILD)/Makefile.top # Add extra install rules for our pkg-config control file and the library itself INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in INSTALL_ITEMS := $(INSTALL_ITEMS) /lib:$(BUILDDIR)/lib$(COMPONENT)$(LIBEXT) ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/README������������������������������������������������������������������0000644�0001750�0001750�00000001256�12377676731�016057� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������NetSurf shared build system =========================== To install ---------- make install [PREFIX=/somewhere] By default, PREFIX will be /opt/netsurf and this will be true for all makefiles which use the shared build infrastructure. To use ------ See the example in example/ Note that PREFIX must be the same for when you compile/test/install anything using this build system as it was when you installed it in the first place. If it is not (or if packaging is getting in the way or similar) then simply set NSSHARED to the path to the shared build system (up to an including simply pointing at the directory containing this README) and the makefiles will work the rest out. ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/COPYING�����������������������������������������������������������������0000644�0001750�0001750�00000002071�12377676731�016226� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Copyright 2009-2013 The NetSurf Browser Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. �����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/llvm/�������������������������������������������������������������������0000755�0001750�0001750�00000000000�12377713347�016140� 5����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������netsurf-all-3.2/buildsystem/llvm/scan-build���������������������������������������������������������0000755�0001750�0001750�00000105674�12377676731�020131� 0����������������������������������������������������������������������������������������������������ustar �vince���������������������������vince������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������#!/usr/bin/env perl # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## # # A script designed to wrap a build so that all calls to gcc are intercepted # and piped to the static analyzer. # ##===----------------------------------------------------------------------===## use strict; use warnings; use FindBin qw($RealBin); use Digest::MD5; use File::Basename; use File::Spec; use Term::ANSIColor; use Term::ANSIColor qw(:constants); use Cwd qw/ getcwd abs_path /; use Sys::Hostname; my $Verbose = 0; # Verbose output from this script. my $Prog = "scan-build"; my $BuildName; my $BuildDate; my $CXX; # Leave undefined initially. my $TERM = $ENV{'TERM'}; my $UseColor = (defined $TERM and $TERM eq 'xterm-color' and -t STDOUT and defined $ENV{'SCAN_BUILD_COLOR'}); my $UserName = HtmlEscape(getpwuid($<) || 'unknown'); my $HostName = HtmlEscape(hostname() || 'unknown'); my $CurrentDir = HtmlEscape(getcwd()); my $CurrentDirSuffix = basename($CurrentDir); my $CmdArgs; my $HtmlTitle; my $Date = localtime(); ##----------------------------------------------------------------------------## # Diagnostics ##----------------------------------------------------------------------------## sub Diag { if ($UseColor) { print BOLD, MAGENTA "$Prog: @_"; print RESET; } else { print "$Prog: @_"; } } sub DiagCrashes { my $Dir = shift; Diag ("The analyzer encountered problems on some source files.\n"); Diag ("Preprocessed versions of these sources were deposited in '$Dir/failures'.\n"); Diag ("Please consider submitting a bug report using these files:\n"); Diag (" http://clang.llvm.org/StaticAnalysisUsage.html#filingbugs\n") } sub DieDiag { if ($UseColor) { print BOLD, RED "$Prog: "; print RESET, RED @_; print RESET; } else { print "$Prog: ", @_; } exit(0); } ##----------------------------------------------------------------------------## # Some initial preprocessing of Clang options. ##----------------------------------------------------------------------------## my $ClangPath = undef; sub Which { my $bin = shift; my @paths = File::Spec->path(); foreach my $p (@paths) { my $candidate = File::Spec->catfile($p, $bin); if (-x $candidate) { $ClangPath = $p; return $candidate; } } return undef; } # First, look for 'clang' in bin. my $ClangSB = Cwd::realpath("$RealBin/bin/clang"); # Second, look for 'clang' in same directory as scan-build if (!defined $ClangSB || ! -x $ClangSB) { $ClangSB = Cwd::realpath("$RealBin/clang"); } # Third, look for 'clang' in ../bin if (!defined $ClangSB || ! -x $ClangSB) { $ClangSB = Cwd::realpath("$RealBin/../bin/clang"); } # Finally, default to looking for 'clang' in the path. if (!defined $ClangSB || ! -x $ClangSB) { $ClangSB = Which("clang"); } my $Clang = $ClangSB; # First, look for 'clang-cc' in libexec. my $ClangCCSB = Cwd::realpath("$RealBin/libexec/clang-cc"); # Second, look for 'clang-cc' in the same directory as scan-build. if (!defined $ClangCCSB || ! -x $ClangCCSB) { $ClangCCSB = Cwd::realpath("$RealBin/clang-cc"); } # Third, look for 'clang-cc' in ../libexec if (!defined $ClangCCSB || ! -x $ClangCCSB) { $ClangCCSB = Cwd::realpath("$RealBin/../libexec/clang-cc"); } # Finally, default to looking for 'clang-cc' in the path. if (!defined $ClangCCSB || ! -x $ClangCCSB) { if (defined $ClangPath) { my @dirs = ( $ClangPath, "..", "libexec" ); my $candidate = File::Spec->catfile(@dirs, "clang-cc"); if (-x $candidate) { $ClangCCSB = $candidate; } else { $ClangCCSB = "clang-cc"; } } else { $ClangCCSB = "clang-cc"; } } my $ClangCC = $ClangCCSB; my %AvailableAnalyses; # Query clang for analysis options. open(PIPE, "-|", $ClangCC, "--help") or DieDiag("Cannot execute '$ClangCC'\n"); my $FoundAnalysis = 0; while(<PIPE>) { if ($FoundAnalysis == 0) { if (/Checks and Analyses/) { $FoundAnalysis = 1; } next; } if (/^\s\s\s\s([^\s]+)\s(.+)$/) { next if ($1 =~ /-dump/ or $1 =~ /-view/ or $1 =~ /-checker-simple/ or $1 =~ /-warn-uninit/); $AvailableAnalyses{$1} = $2; next; } last; } close (PIPE); my %AnalysesDefaultEnabled = ( '-warn-dead-stores' => 1, '-checker-cfref' => 1, '-warn-objc-methodsigs' => 1, # Do not enable the missing -dealloc check by default. # '-warn-objc-missing-dealloc' => 1, '-warn-objc-unused-ivars' => 1, ); ##----------------------------------------------------------------------------## # GetHTMLRunDir - Construct an HTML directory name for the current sub-run. ##----------------------------------------------------------------------------## sub GetHTMLRunDir { die "Not enough arguments." if (@_ == 0); my $Dir = shift @_; my $TmpMode = 0; if (!defined $Dir) { if (`uname` =~ /Darwin/) { $Dir = $ENV{'TMPDIR'}; if (!defined $Dir) { $Dir = "/tmp"; } } else { $Dir = "/tmp"; } $TmpMode = 1; } # Chop off any trailing '/' characters. while ($Dir =~ /\/$/) { chop $Dir; } # Get current date and time. my @CurrentTime = localtime(); my $year = $CurrentTime[5] + 1900; my $day = $CurrentTime[3]; my $month = $CurrentTime[4] + 1; my $DateString = sprintf("%d-%02d-%02d", $year, $month, $day); # Determine the run number. my $RunNumber; if (-d $Dir) { if (! -r $Dir) { DieDiag("directory '$Dir' exists but is not readable.\n"); } # Iterate over all files in the specified directory. my $max = 0; opendir(DIR, $Dir); my @FILES = grep { -d "$Dir/$_" } readdir(DIR); closedir(DIR); foreach my $f (@FILES) { # Strip the prefix '$Prog-' if we are dumping files to /tmp. if ($TmpMode) { next if (!($f =~ /^$Prog-(.+)/)); $f = $1; } my @x = split/-/, $f; next if (scalar(@x) != 4); next if ($x[0] != $year); next if ($x[1] != $month); next if ($x[2] != $day); if ($x[3] > $max) { $max = $x[3]; } } $RunNumber = $max + 1; } else { if (-x $Dir) { DieDiag("'$Dir' exists but is not a directory.\n"); } if ($TmpMode) { DieDiag("The directory '/tmp' does not exist or cannot be accessed.\n"); } # $Dir does not exist. It will be automatically created by the # clang driver. Set the run number to 1. $RunNumber = 1; } die "RunNumber must be defined!" if (!defined $RunNumber); # Append the run number. my $NewDir; if ($TmpMode) { $NewDir = "$Dir/$Prog-$DateString-$RunNumber"; } else { $NewDir = "$Dir/$DateString-$RunNumber"; } system 'mkdir','-p',$NewDir; return $NewDir; } sub SetHtmlEnv { die "Wrong number of arguments." if (scalar(@_) != 2); my $Args = shift; my $Dir = shift; die "No build command." if (scalar(@$Args) == 0); my $Cmd = $$Args[0]; if ($Cmd =~ /configure/) { return; } if ($Verbose) { Diag("Emitting reports for this run to '$Dir'.\n"); } $ENV{'CCC_ANALYZER_HTML'} = $Dir; } ##----------------------------------------------------------------------------## # ComputeDigest - Compute a digest of the specified file. ##----------------------------------------------------------------------------## sub ComputeDigest { my $FName = shift; DieDiag("Cannot read $FName to compute Digest.\n") if (! -r $FName); # Use Digest::MD5. We don't have to be cryptographically secure. We're # just looking for duplicate files that come from a non-malicious source. # We use Digest::MD5 because it is a standard Perl module that should # come bundled on most systems. open(FILE, $FName) or DieDiag("Cannot open $FName when computing Digest.\n"); binmode FILE; my $Result = Digest::MD5->new->addfile(*FILE)->hexdigest; close(FILE); # Return the digest. return $Result; } ##----------------------------------------------------------------------------## # UpdatePrefix - Compute the common prefix of files. ##----------------------------------------------------------------------------## my $Prefix; sub UpdatePrefix { my $x = shift; my $y = basename($x); $x =~ s/\Q$y\E$//; if (!defined $Prefix) { $Prefix = $x; return; } chop $Prefix while (!($x =~ /^\Q$Prefix/)); } sub GetPrefix { return $Prefix; } ##----------------------------------------------------------------------------## # UpdateInFilePath - Update the path in the report file. ##----------------------------------------------------------------------------## sub UpdateInFilePath { my $fname = shift; my $regex = shift; my $newtext = shift; open (RIN, $fname) or die "cannot open $fname"; open (ROUT, ">", "$fname.tmp") or die "cannot open $fname.tmp"; while (<RIN>) { s/$regex/$newtext/; print ROUT $_; } close (ROUT); close (RIN); system("mv", "$fname.tmp", $fname); } ##----------------------------------------------------------------------------## # ScanFile - Scan a report file for various identifying attributes. ##----------------------------------------------------------------------------## # Sometimes a source file is scanned more than once, and thus produces # multiple error reports. We use a cache to solve this problem. my %AlreadyScanned; sub ScanFile { my $Index = shift; my $Dir = shift; my $FName = shift; # Compute a digest for the report file. Determine if we have already # scanned a file that looks just like it. my $digest = ComputeDigest("$Dir/$FName"); if (defined $AlreadyScanned{$digest}) { # Redundant file. Remove it. system ("rm", "-f", "$Dir/$FName"); return; } $AlreadyScanned{$digest} = 1; # At this point the report file is not world readable. Make it happen. system ("chmod", "644", "$Dir/$FName"); # Scan the report file for tags. open(IN, "$Dir/$FName") or DieDiag("Cannot open '$Dir/$FName'\n"); my $BugType = ""; my $BugFile = ""; my $BugCategory; my $BugPathLength = 1; my $BugLine = 0; my $found = 0; while (<IN>) { last if ($found == 5); if (/<!-- BUGTYPE (.*) -->$/) { $BugType = $1; ++$found; } elsif (/<!-- BUGFILE (.*) -->$/) { $BugFile = abs_path($1); UpdatePrefix($BugFile); ++$found; } elsif (/<!-- BUGPATHLENGTH (.*) -->$/) { $BugPathLength = $1; ++$found; } elsif (/<!-- BUGLINE (.*) -->$/) { $BugLine = $1; ++$found; } elsif (/<!-- BUGCATEGORY (.*) -->$/) { $BugCategory = $1; ++$found; } } close(IN); if (!defined $BugCategory) { $BugCategory = "Other"; } push @$Index,[ $FName, $BugCategory, $BugType, $BugFile, $BugLine, $BugPathLength ]; } ##----------------------------------------------------------------------------## # CopyFiles - Copy resource files to target directory. ##----------------------------------------------------------------------------## sub CopyFiles { my $Dir = shift; my $JS = Cwd::realpath("$RealBin/sorttable.js"); DieDiag("Cannot find 'sorttable.js'.\n") if (! -r $JS); system ("cp", $JS, "$Dir"); DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") if (! -r "$Dir/sorttable.js"); my $CSS = Cwd::realpath("$RealBin/scanview.css"); DieDiag("Cannot find 'scanview.css'.\n") if (! -r $CSS); system ("cp", $CSS, "$Dir"); DieDiag("Could not copy 'scanview.css' to '$Dir'.\n") if (! -r $CSS); } ##----------------------------------------------------------------------------## # Postprocess - Postprocess the results of an analysis scan. ##----------------------------------------------------------------------------## sub Postprocess { my $Dir = shift; my $BaseDir = shift; die "No directory specified." if (!defined $Dir); if (! -d $Dir) { Diag("No bugs found.\n"); return 0; } opendir(DIR, $Dir); my @files = grep { /^report-.*\.html$/ } readdir(DIR); closedir(DIR); if (scalar(@files) == 0 and ! -e "$Dir/failures") { Diag("Removing directory '$Dir' because it contains no reports.\n"); system ("rm", "-fR", $Dir); return 0; } # Scan each report file and build an index. my @Index; foreach my $file (@files) { ScanFile(\@Index, $Dir, $file); } # Scan the failures directory and use the information in the .info files # to update the common prefix directory. my @failures; my @attributes_ignored; if (-d "$Dir/failures") { opendir(DIR, "$Dir/failures"); @failures = grep { /[.]info.txt$/ && !/attribute_ignored/; } readdir(DIR); closedir(DIR); opendir(DIR, "$Dir/failures"); @attributes_ignored = grep { /^attribute_ignored/; } readdir(DIR); closedir(DIR); foreach my $file (@failures) { open IN, "$Dir/failures/$file" or DieDiag("cannot open $file\n"); my $Path = <IN>; if (defined $Path) { UpdatePrefix($Path); } close IN; } } # Generate an index.html file. my $FName = "$Dir/index.html"; open(OUT, ">", $FName) or DieDiag("Cannot create file '$FName'\n"); # Print out the header. print OUT <<ENDTEXT; <html> <head> <title>${HtmlTitle}

    ${HtmlTitle}

    ENDTEXT print OUT "\n" if (defined($BuildName) && defined($BuildDate)); print OUT < ENDTEXT if (scalar(@files)) { # Print out the summary table. my %Totals; for my $row ( @Index ) { my $bug_type = ($row->[2]); my $bug_category = ($row->[1]); my $key = "$bug_category:$bug_type"; if (!defined $Totals{$key}) { $Totals{$key} = [1,$bug_category,$bug_type]; } else { $Totals{$key}->[0]++; } } print OUT "

    Bug Summary

    "; if (defined $BuildName) { print OUT "\n

    Results in this analysis run are based on analyzer build $BuildName.

    \n" } my $TotalBugs = scalar(@Index); print OUT <
    ENDTEXT my $last_category; for my $key ( sort { my $x = $Totals{$a}; my $y = $Totals{$b}; my $res = $x->[1] cmp $y->[1]; $res = $x->[2] cmp $y->[2] if ($res == 0); $res } keys %Totals ) { my $val = $Totals{$key}; my $category = $val->[1]; if (!defined $last_category or $last_category ne $category) { $last_category = $category; print OUT "\n"; } my $x = lc $key; $x =~ s/[ ,'":\/()]+/_/g; print OUT "\n"; } # Print out the table of errors. print OUT <

    Reports

    User:${UserName}\@${HostName}
    Working Directory:${CurrentDir}
    Command Line:${CmdArgs}
    Date:${Date}
    Version:${BuildName} (${BuildDate})
    Bug TypeQuantityDisplay?
    All Bugs$TotalBugs
    $category
    "; print OUT $val->[2]; print OUT ""; print OUT $val->[0]; print OUT "
    ENDTEXT my $prefix = GetPrefix(); my $regex; my $InFileRegex; my $InFilePrefix = "File:"; print OUT ""; print OUT ""; # Update the file prefix. my $fname = $row->[3]; if (defined $regex) { $fname =~ s/$regex//; UpdateInFilePath("$Dir/$ReportFile", $InFileRegex, $InFilePrefix) } print OUT ""; # Print out the quantities. for my $j ( 4 .. 5 ) { print OUT ""; } # Print the rest of the columns. for (my $j = 6; $j <= $#{$row}; ++$j) { print OUT "" } # Emit the "View" link. print OUT ""; # Emit REPORTBUG markers. print OUT "\n\n"; # End the row. print OUT "\n"; } print OUT "\n
    Bug Group Bug Type ▾ File Line Path Length
    "; if (defined $prefix) { $regex = qr/^\Q$prefix\E/is; $InFileRegex = qr/\Q$InFilePrefix$prefix\E/is; } for my $row ( sort { $a->[2] cmp $b->[2] } @Index ) { my $x = "$row->[1]:$row->[2]"; $x = lc $x; $x =~ s/[ ,'":\/()]+/_/g; my $ReportFile = $row->[0]; print OUT "
    "; print OUT $row->[1]; print OUT ""; print OUT $row->[2]; print OUT ""; my @fname = split /\//,$fname; if ($#fname > 0) { while ($#fname >= 0) { my $x = shift @fname; print OUT $x; if ($#fname >= 0) { print OUT " /"; } } } else { print OUT $fname; } print OUT "$row->[$j]$row->[$j]View Report
    \n\n"; } if (scalar (@failures) || scalar(@attributes_ignored)) { print OUT "

    Analyzer Failures

    \n"; if (scalar @attributes_ignored) { print OUT "The analyzer's parser ignored the following attributes:

    \n"; print OUT "\n"; print OUT "\n"; foreach my $file (sort @attributes_ignored) { die "cannot demangle attribute name\n" if (! ($file =~ /^attribute_ignored_(.+).txt/)); my $attribute = $1; # Open the attribute file to get the first file that failed. next if (!open (ATTR, "$Dir/failures/$file")); my $ppfile = ; chomp $ppfile; close ATTR; next if (! -e "$Dir/failures/$ppfile"); # Open the info file and get the name of the source file. open (INFO, "$Dir/failures/$ppfile.info.txt") or die "Cannot open $Dir/failures/$ppfile.info.txt\n"; my $srcfile = ; chomp $srcfile; close (INFO); # Print the information in the table. my $prefix = GetPrefix(); if (defined $prefix) { $srcfile =~ s/^\Q$prefix//; } print OUT "\n"; my $ppfile_clang = $ppfile; $ppfile_clang =~ s/[.](.+)$/.clang.$1/; print OUT " \n"; } print OUT "
    AttributeSource FilePreprocessed FileSTDERR Output
    $attribute$srcfile$ppfile$ppfile.stderr.txt
    \n"; } if (scalar @failures) { print OUT "

    The analyzer had problems processing the following files:

    \n"; print OUT "\n"; print OUT "\n"; foreach my $file (sort @failures) { $file =~ /(.+).info.txt$/; # Get the preprocessed file. my $ppfile = $1; # Open the info file and get the name of the source file. open (INFO, "$Dir/failures/$file") or die "Cannot open $Dir/failures/$file\n"; my $srcfile = ; chomp $srcfile; my $problem = ; chomp $problem; close (INFO); # Print the information in the table. my $prefix = GetPrefix(); if (defined $prefix) { $srcfile =~ s/^\Q$prefix//; } print OUT "\n"; my $ppfile_clang = $ppfile; $ppfile_clang =~ s/[.](.+)$/.clang.$1/; print OUT " \n"; } print OUT "
    ProblemSource FilePreprocessed FileSTDERR Output
    $problem$srcfile$ppfile$ppfile.stderr.txt
    \n"; } print OUT "

    Please consider submitting preprocessed files as bug reports.

    \n"; } print OUT "\n"; close(OUT); CopyFiles($Dir); # Make sure $Dir and $BaseDir are world readable/executable. system("chmod", "755", $Dir); if (defined $BaseDir) { system("chmod", "755", $BaseDir); } my $Num = scalar(@Index); Diag("$Num bugs found.\n"); if ($Num > 0 && -r "$Dir/index.html") { Diag("Run 'scan-view $Dir' to examine bug reports.\n"); } DiagCrashes($Dir) if (scalar @failures || scalar @attributes_ignored); return $Num; } ##----------------------------------------------------------------------------## # RunBuildCommand - Run the build command. ##----------------------------------------------------------------------------## sub AddIfNotPresent { my $Args = shift; my $Arg = shift; my $found = 0; foreach my $k (@$Args) { if ($k eq $Arg) { $found = 1; last; } } if ($found == 0) { push @$Args, $Arg; } } sub RunBuildCommand { my $Args = shift; my $IgnoreErrors = shift; my $Cmd = $Args->[0]; my $CCAnalyzer = shift; # Get only the part of the command after the last '/'. if ($Cmd =~ /\/([^\/]+)$/) { $Cmd = $1; } if ($Cmd =~ /(.*\/?gcc[^\/]*$)/ or $Cmd =~ /(.*\/?cc[^\/]*$)/ or $Cmd =~ /(.*\/?llvm-gcc[^\/]*$)/ or $Cmd =~ /(.*\/?ccc-analyzer[^\/]*$)/) { if (!($Cmd =~ /ccc-analyzer/) and !defined $ENV{"CCC_CC"}) { $ENV{"CCC_CC"} = $1; } shift @$Args; unshift @$Args, $CCAnalyzer; } elsif ($IgnoreErrors) { if ($Cmd eq "make" or $Cmd eq "gmake") { AddIfNotPresent($Args,"-k"); AddIfNotPresent($Args,"-i"); } elsif ($Cmd eq "xcodebuild") { AddIfNotPresent($Args,"-PBXBuildsContinueAfterErrors=YES"); } } if ($Cmd eq "xcodebuild") { # Check if using iPhone SDK 3.0 (simulator). If so the compiler being # used should be gcc-4.2. if (!defined $ENV{"CCC_CC"}) { for (my $i = 0 ; $i < scalar(@$Args); ++$i) { if ($Args->[$i] eq "-sdk" && $i + 1 < scalar(@$Args)) { if (@$Args[$i+1] =~ /^iphonesimulator3/) { $ENV{"CCC_CC"} = "gcc-4.2"; } } } } # Disable distributed builds for xcodebuild. AddIfNotPresent($Args,"-nodistribute"); # Disable PCH files until clang supports them. AddIfNotPresent($Args,"GCC_PRECOMPILE_PREFIX_HEADER=NO"); # When 'CC' is set, xcodebuild uses it to do all linking, even if we are # linking C++ object files. Set 'LDPLUSPLUS' so that xcodebuild uses 'g++' # when linking such files. die if (!defined $CXX); my $LDPLUSPLUS = `which $CXX`; $LDPLUSPLUS =~ s/\015?\012//; # strip newlines $ENV{'LDPLUSPLUS'} = $LDPLUSPLUS; } return (system(@$Args) >> 8); } ##----------------------------------------------------------------------------## # DisplayHelp - Utility function to display all help options. ##----------------------------------------------------------------------------## sub DisplayHelp { print < [build options] ENDTEXT if (defined $BuildName) { print "ANALYZER BUILD: $BuildName ($BuildDate)\n\n"; } print </>/g; return $tmp; } ##----------------------------------------------------------------------------## # ShellEscape - backslash escape characters that are special to the shell ##----------------------------------------------------------------------------## sub ShellEscape { # copy argument to new variable so we don't clobber the original my $arg = shift || ''; if ($arg =~ /["\s]/) { return "'" . $arg . "'"; } return $arg; } ##----------------------------------------------------------------------------## # Process command-line arguments. ##----------------------------------------------------------------------------## my $AnalyzeHeaders = 0; my $HtmlDir; # Parent directory to store HTML files. my $IgnoreErrors = 0; # Ignore build errors. my $ViewResults = 0; # View results when the build terminates. my $ExitStatusFoundBugs = 0; # Exit status reflects whether bugs were found my @AnalysesToRun; my $StoreModel; my $ConstraintsModel; my $OutputFormat; if (!@ARGV) { DisplayHelp(); exit 1; } while (@ARGV) { # Scan for options we recognize. my $arg = $ARGV[0]; if ($arg eq "-h" or $arg eq "--help") { DisplayHelp(); exit 0; } if ($arg eq '-analyze-headers') { shift @ARGV; $AnalyzeHeaders = 1; next; } if (defined $AvailableAnalyses{$arg}) { shift @ARGV; push @AnalysesToRun, $arg; next; } if ($arg eq "-o") { shift @ARGV; if (!@ARGV) { DieDiag("'-o' option requires a target directory name.\n"); } # Construct an absolute path. Uses the current working directory # as a base if the original path was not absolute. $HtmlDir = abs_path(shift @ARGV); next; } if ($arg =~ /^--html-title(=(.+))?$/) { shift @ARGV; if (!defined $2 || $2 eq '') { if (!@ARGV) { DieDiag("'--html-title' option requires a string.\n"); } $HtmlTitle = shift @ARGV; } else { $HtmlTitle = $2; } next; } if ($arg eq "-k" or $arg eq "--keep-going") { shift @ARGV; $IgnoreErrors = 1; next; } if ($arg =~ /^--use-cc(=(.+))?$/) { shift @ARGV; my $cc; if (!defined $2 || $2 eq "") { if (!@ARGV) { DieDiag("'--use-cc' option requires a compiler executable name.\n"); } $cc = shift @ARGV; } else { $cc = $2; } $ENV{"CCC_CC"} = $cc; next; } if ($arg =~ /^--use-c\+\+(=(.+))?$/) { shift @ARGV; if (!defined $2 || $2 eq "") { if (!@ARGV) { DieDiag("'--use-c++' option requires a compiler executable name.\n"); } $CXX = shift @ARGV; } else { $CXX = $2; } next; } if ($arg eq "-v") { shift @ARGV; $Verbose++; next; } if ($arg eq "-V" or $arg eq "--view") { shift @ARGV; $ViewResults = 1; next; } if ($arg eq "--status-bugs") { shift @ARGV; $ExitStatusFoundBugs = 1; next; } if ($arg eq "-store") { shift @ARGV; $StoreModel = shift @ARGV; next; } if ($arg eq "-constraints") { shift @ARGV; $ConstraintsModel = shift @ARGV; next; } if ($arg eq "-plist") { shift @ARGV; $OutputFormat = "plist"; next; } DieDiag("unrecognized option '$arg'\n") if ($arg =~ /^-/); last; } if (!@ARGV) { Diag("No build command specified.\n\n"); DisplayHelp(); exit 1; } $CmdArgs = HtmlEscape(join(' ', map(ShellEscape($_), @ARGV))); $HtmlTitle = "${CurrentDirSuffix} - scan-build results" unless (defined($HtmlTitle)); # Determine the output directory for the HTML reports. my $BaseDir = $HtmlDir; $HtmlDir = GetHTMLRunDir($HtmlDir); # Set the appropriate environment variables. SetHtmlEnv(\@ARGV, $HtmlDir); my $Cmd = Cwd::realpath("$RealBin/libexec/ccc-analyzer"); if (!defined $Cmd || ! -x $Cmd) { $Cmd = Cwd::realpath("$RealBin/ccc-analyzer"); DieDiag("Executable 'ccc-analyzer' does not exist at '$Cmd'\n") if(! -x $Cmd); } if (!defined $ClangCCSB || ! -x $ClangCCSB) { Diag("'clang-cc' executable not found in '$RealBin/libexec'.\n"); Diag("Using 'clang-cc' from path.\n"); } if (!defined $ClangSB || ! -x $ClangSB) { Diag("'clang' executable not found in '$RealBin/bin'.\n"); Diag("Using 'clang' from path.\n"); } if (defined $CXX) { $ENV{'CXX'} = $CXX; } else { $CXX = 'g++'; # This variable is used by other parts of scan-build # that need to know a default C++ compiler to fall back to. } $ENV{'CC'} = $Cmd; $ENV{'CLANG_CC'} = $ClangCC; $ENV{'CLANG'} = $Clang; if ($Verbose >= 2) { $ENV{'CCC_ANALYZER_VERBOSE'} = 1; } if ($Verbose >= 3) { $ENV{'CCC_ANALYZER_LOG'} = 1; } if (scalar(@AnalysesToRun) == 0) { foreach my $key (keys %AnalysesDefaultEnabled) { push @AnalysesToRun,$key; } } if ($AnalyzeHeaders) { push @AnalysesToRun,"-analyzer-opt-analyze-headers"; } $ENV{'CCC_ANALYZER_ANALYSIS'} = join ' ',@AnalysesToRun; if (defined $StoreModel) { $ENV{'CCC_ANALYZER_STORE_MODEL'} = $StoreModel; } if (defined $ConstraintsModel) { $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'} = $ConstraintsModel; } if (defined $OutputFormat) { $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat; } # Run the build. my $ExitStatus = RunBuildCommand(\@ARGV, $IgnoreErrors, $Cmd); if (defined $OutputFormat and $OutputFormat eq "plist") { Diag "Analysis run complete.\n"; Diag "Analysis results (plist files) deposited in '$HtmlDir'\n"; } else { # Postprocess the HTML directory. my $NumBugs = Postprocess($HtmlDir, $BaseDir); if ($ViewResults and -r "$HtmlDir/index.html") { Diag "Analysis run complete.\n"; Diag "Viewing analysis results in '$HtmlDir' using scan-view.\n"; my $ScanView = Cwd::realpath("$RealBin/scan-view"); if (! -x $ScanView) { $ScanView = "scan-view"; } exec $ScanView, "$HtmlDir"; } if ($ExitStatusFoundBugs) { exit 1 if ($NumBugs > 0); exit 0; } } exit $ExitStatus; netsurf-all-3.2/buildsystem/llvm/LICENSE.TXT0000644000175000017500000000614112377676731017632 0ustar vincevince============================================================================== LLVM Release License ============================================================================== University of Illinois/NCSA Open Source License Copyright (c) 2003-2009 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: LLVM Team University of Illinois at Urbana-Champaign http://llvm.org Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution. * Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. ============================================================================== Copyrights and Licenses for Third Party Software Distributed with LLVM: ============================================================================== The LLVM software contains code written by third parties. Such software will have its own individual LICENSE.TXT file in the directory in which it appears. This file will describe the copyrights, license, and restrictions which apply to that code. The disclaimer of warranty in the University of Illinois Open Source License applies to all code in the LLVM Distribution, and nothing in any of the other licenses gives permission to use the names of the LLVM Team or the University of Illinois to endorse or promote products derived from this Software. The following pieces of software have additional or alternate copyrights, licenses, and/or restrictions: Program Directory ------- --------- System Library llvm/lib/System Autoconf llvm/autoconf llvm/projects/ModuleMaker/autoconf llvm/projects/sample/autoconf CellSPU backend llvm/lib/Target/CellSPU/README.txt Google Test llvm/utils/unittest/googletest netsurf-all-3.2/buildsystem/llvm/ccc-analyzer0000755000175000017500000003736712377676731020466 0ustar vincevince#!/usr/bin/env perl # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # ##===----------------------------------------------------------------------===## # # A script designed to interpose between the build system and gcc. It invokes # both gcc and the static analyzer. # ##===----------------------------------------------------------------------===## use strict; use warnings; use Cwd qw/ getcwd abs_path /; use File::Temp qw/ tempfile /; use File::Path qw / mkpath /; use File::Basename; use Text::ParseWords; my $CC = $ENV{'CCC_CC'}; if (!defined $CC) { $CC = "gcc"; } my $CleanupFile; my $ResultFile; # Remove any stale files at exit. END { if (defined $CleanupFile && -z $CleanupFile) { `rm -f $CleanupFile`; } } ##----------------------------------------------------------------------------## # Process Clang Crashes. ##----------------------------------------------------------------------------## sub GetPPExt { my $Lang = shift; if ($Lang =~ /objective-c/) { return ".mi"; } return ".i"; } # Set this to 1 if we want to include 'parser rejects' files. my $IncludeParserRejects = 0; my $ParserRejects = "Parser Rejects"; my $AttributeIgnored = "Attribute Ignored"; sub ProcessClangFailure { my ($ClangCC, $Lang, $file, $Args, $HtmlDir, $ErrorType, $ofile) = @_; my $Dir = "$HtmlDir/failures"; mkpath $Dir; my $prefix = "clang_crash"; if ($ErrorType eq $ParserRejects) { $prefix = "clang_parser_rejects"; } elsif ($ErrorType eq $AttributeIgnored) { $prefix = "clang_attribute_ignored"; } # Generate the preprocessed file with cc (i.e., gcc). my ($PPH, $PPFile) = tempfile( $prefix . "_XXXXXX", SUFFIX => GetPPExt($Lang), DIR => $Dir); system $CC, @$Args, "-E", "-o", $PPFile; close ($PPH); # Generate the preprocessed file with clang. my $PPFile_Clang = $PPFile; $PPFile_Clang =~ s/[.](.+)$/.clang.$1/; system $ClangCC, @$Args, "-E", "-o", "$PPFile_Clang"; # Create the info file. open (OUT, ">", "$PPFile.info.txt") or die "Cannot open $PPFile.info.txt\n"; print OUT abs_path($file), "\n"; print OUT "$ErrorType\n"; print OUT "@$Args\n"; close OUT; `uname -a >> $PPFile.info.txt 2>&1`; `$CC -v >> $PPFile.info.txt 2>&1`; system 'mv',$ofile,"$PPFile.stderr.txt"; return (basename $PPFile); } ##----------------------------------------------------------------------------## # Running the analyzer. ##----------------------------------------------------------------------------## # Determine what clang executable to use. my $Clang = $ENV{'CLANG'}; if (!defined $Clang) { $Clang = 'clang'; } sub GetCCArgs { my $Args = shift; pipe (FROM_CHILD, TO_PARENT); my $pid = fork(); if ($pid == 0) { close FROM_CHILD; open(STDOUT,">&", \*TO_PARENT); open(STDERR,">&", \*TO_PARENT); exec $Clang, "-###", "-fsyntax-only", @$Args; } close(TO_PARENT); my $line; while () { next if (!/clang-cc/); $line = $_; } waitpid($pid,0); close(FROM_CHILD); die "could not find clang-cc line\n" if (!defined $line); # Strip the newline and initial whitspace chomp $line; $line =~ s/^\s+//; my @items = quotewords('\s+', 1, $line); for (my $i = 0 ; $ i < scalar(@items); ++$i) { $items[$i] =~ s/^\"//; $items[$i] =~ s/\"$//; } my $cmd = shift @items; die "cannot find 'clang-cc' in 'clang' command\n" if (!($cmd =~ /clang-cc/)); return \@items; } sub Analyze { my ($ClangCC, $Args, $AnalyzeArgs, $Lang, $Output, $Verbose, $HtmlDir, $file, $Analyses) = @_; $Args = GetCCArgs($Args); # Skip anything related to C++. return if ($Lang =~ /c[+][+]/); my $RunAnalyzer = 0; my $Cmd; my @CmdArgs; my @CmdArgsSansAnalyses; if ($Lang =~ /header/) { exit 0 if (!defined ($Output)); $Cmd = 'cp'; push @CmdArgs,$file; # Remove the PCH extension. $Output =~ s/[.]gch$//; push @CmdArgs,$Output; @CmdArgsSansAnalyses = @CmdArgs; } else { $Cmd = $ClangCC; push @CmdArgs,'-DIBOutlet=__attribute__((iboutlet))'; push @CmdArgs,@$Args; @CmdArgsSansAnalyses = @CmdArgs; push @CmdArgs,'-analyze'; push @CmdArgs,"-analyzer-display-progress"; push @CmdArgs,"-analyzer-eagerly-assume"; push @CmdArgs,(split /\s/,$Analyses); $RunAnalyzer = 1; } # Add the analysis arguments passed down from scan-build. foreach my $Arg (@$AnalyzeArgs) { push @CmdArgs, $Arg; } my @PrintArgs; my $dir; if ($Verbose) { $dir = getcwd(); print STDERR "\n[LOCATION]: $dir\n"; push @PrintArgs,"'$Cmd'"; foreach my $arg (@CmdArgs) { push @PrintArgs,"\'$arg\'"; } } if ($Verbose == 1) { # We MUST print to stderr. Some clients use the stdout output of # gcc for various purposes. print STDERR join(' ',@PrintArgs); print STDERR "\n"; } elsif ($Verbose == 2) { print STDERR "#SHELL (cd '$dir' && @PrintArgs)\n"; } if ($RunAnalyzer) { if (defined $ResultFile) { push @CmdArgs,'-o'; push @CmdArgs, $ResultFile; } elsif (defined $HtmlDir) { push @CmdArgs,'-o'; push @CmdArgs, $HtmlDir; } } if (defined $ENV{'CCC_UBI'}) { push @CmdArgs,"--analyzer-viz-egraph-ubigraph"; } # Capture the STDERR of clang and send it to a temporary file. # Capture the STDOUT of clang and reroute it to ccc-analyzer's STDERR. # We save the output file in the 'crashes' directory if clang encounters # any problems with the file. pipe (FROM_CHILD, TO_PARENT); my $pid = fork(); if ($pid == 0) { close FROM_CHILD; open(STDOUT,">&", \*TO_PARENT); open(STDERR,">&", \*TO_PARENT); exec $Cmd, @CmdArgs; } close TO_PARENT; my ($ofh, $ofile) = tempfile("clang_output_XXXXXX", DIR => $HtmlDir); while () { print $ofh $_; print STDERR $_; } waitpid($pid,0); close(FROM_CHILD); my $Result = $?; # Did the command die because of a signal? if ($Result & 127 and $Cmd eq $ClangCC and defined $HtmlDir) { ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir, "Crash", $ofile); } elsif ($Result) { if ($IncludeParserRejects && !($file =~/conftest/)) { ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir, $ParserRejects, $ofile); } } else { # Check if there were any unhandled attributes. if (open(CHILD, $ofile)) { my %attributes_not_handled; # Don't flag warnings about the following attributes that we # know are currently not supported by Clang. $attributes_not_handled{"cdecl"} = 1; my $ppfile; while () { next if (! /warning: '([^\']+)' attribute ignored/); # Have we already spotted this unhandled attribute? next if (defined $attributes_not_handled{$1}); $attributes_not_handled{$1} = 1; # Get the name of the attribute file. my $dir = "$HtmlDir/failures"; my $afile = "$dir/attribute_ignored_$1.txt"; # Only create another preprocessed file if the attribute file # doesn't exist yet. next if (-e $afile); # Add this file to the list of files that contained this attribute. # Generate a preprocessed file if we haven't already. if (!(defined $ppfile)) { $ppfile = ProcessClangFailure($ClangCC, $Lang, $file, \@CmdArgsSansAnalyses, $HtmlDir, $AttributeIgnored, $ofile); } mkpath $dir; open(AFILE, ">$afile"); print AFILE "$ppfile\n"; close(AFILE); } close CHILD; } } `rm -f $ofile`; } ##----------------------------------------------------------------------------## # Lookup tables. ##----------------------------------------------------------------------------## my %CompileOptionMap = ( '-nostdinc' => 0, '-fblocks' => 0, '-fobjc-gc-only' => 0, '-fobjc-gc' => 0, '-ffreestanding' => 0, '-include' => 1, '-idirafter' => 1, '-iprefix' => 1, '-iquote' => 1, '-isystem' => 1, '-iwithprefix' => 1, '-iwithprefixbefore' => 1 ); my %LinkerOptionMap = ( '-framework' => 1 ); my %CompilerLinkerOptionMap = ( '-isysroot' => 1, '-arch' => 1, '-v' => 0, '-fpascal-strings' => 0, '-mmacosx-version-min' => 0, # This is really a 1 argument, but always has '=' '-miphoneos-version-min' => 0 # This is really a 1 argument, but always has '=' ); my %IgnoredOptionMap = ( '-MT' => 1, # Ignore these preprocessor options. '-MF' => 1, '-fsyntax-only' => 0, '-save-temps' => 0, '-install_name' => 1, '-exported_symbols_list' => 1, '-current_version' => 1, '-compatibility_version' => 1, '-init' => 1, '-e' => 1, '-seg1addr' => 1, '-bundle_loader' => 1, '-multiply_defined' => 1, '-sectorder' => 3, '--param' => 1, '-u' => 1 ); my %LangMap = ( 'c' => 'c', 'cpp' => 'c++', 'cc' => 'c++', 'i' => 'c-cpp-output', 'm' => 'objective-c', 'mi' => 'objective-c-cpp-output' ); my %UniqueOptions = ( '-isysroot' => 0 ); my %LangsAccepted = ( "objective-c" => 1, "c" => 1 ); ##----------------------------------------------------------------------------## # Main Logic. ##----------------------------------------------------------------------------## my $Action = 'link'; my @CompileOpts; my @LinkOpts; my @Files; my $Lang; my $Output; my %Uniqued; # Forward arguments to gcc. my $Status = system($CC,@ARGV); if ($Status) { exit($Status >> 8); } # Get the analysis options. my $Analyses = $ENV{'CCC_ANALYZER_ANALYSIS'}; if (!defined($Analyses)) { $Analyses = '-checker-cfref'; } # Get the store model. my $StoreModel = $ENV{'CCC_ANALYZER_STORE_MODEL'}; if (!defined $StoreModel) { $StoreModel = "basic"; } # Get the constraints engine. my $ConstraintsModel = $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'}; if (!defined $ConstraintsModel) { $ConstraintsModel = "range"; } # Get the output format. my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'}; if (!defined $OutputFormat) { $OutputFormat = "html"; } # Determine the level of verbosity. my $Verbose = 0; if (defined $ENV{CCC_ANALYZER_VERBOSE}) { $Verbose = 1; } if (defined $ENV{CCC_ANALYZER_LOG}) { $Verbose = 2; } # Determine what clang-cc executable to use. my $ClangCC = $ENV{'CLANG_CC'}; if (!defined $ClangCC) { $ClangCC = 'clang-cc'; } # Get the HTML output directory. my $HtmlDir = $ENV{'CCC_ANALYZER_HTML'}; my %DisabledArchs = ('ppc' => 1, 'ppc64' => 1); my %ArchsSeen; my $HadArch = 0; # Process the arguments. foreach (my $i = 0; $i < scalar(@ARGV); ++$i) { my $Arg = $ARGV[$i]; my ($ArgKey) = split /=/,$Arg,2; # Modes ccc-analyzer supports if ($Arg eq '-E') { $Action = 'preprocess'; } elsif ($Arg eq '-c') { $Action = 'compile'; } elsif ($Arg =~ /^-print-prog-name/) { exit 0; } # Specially handle duplicate cases of -arch if ($Arg eq "-arch") { my $arch = $ARGV[$i+1]; # We don't want to process 'ppc' because of Clang's lack of support # for Altivec (also some #defines won't likely be defined correctly, etc.) if (!(defined $DisabledArchs{$arch})) { $ArchsSeen{$arch} = 1; } $HadArch = 1; ++$i; next; } # Options with possible arguments that should pass through to compiler. if (defined $CompileOptionMap{$ArgKey}) { my $Cnt = $CompileOptionMap{$ArgKey}; push @CompileOpts,$Arg; while ($Cnt > 0) { ++$i; --$Cnt; push @CompileOpts, $ARGV[$i]; } next; } # Options with possible arguments that should pass through to linker. if (defined $LinkerOptionMap{$ArgKey}) { my $Cnt = $LinkerOptionMap{$ArgKey}; push @LinkOpts,$Arg; while ($Cnt > 0) { ++$i; --$Cnt; push @LinkOpts, $ARGV[$i]; } next; } # Options with possible arguments that should pass through to both compiler # and the linker. if (defined $CompilerLinkerOptionMap{$ArgKey}) { my $Cnt = $CompilerLinkerOptionMap{$ArgKey}; # Check if this is an option that should have a unique value, and if so # determine if the value was checked before. if ($UniqueOptions{$Arg}) { if (defined $Uniqued{$Arg}) { $i += $Cnt; next; } $Uniqued{$Arg} = 1; } push @CompileOpts,$Arg; push @LinkOpts,$Arg; while ($Cnt > 0) { ++$i; --$Cnt; push @CompileOpts, $ARGV[$i]; push @LinkOpts, $ARGV[$i]; } next; } # Ignored options. if (defined $IgnoredOptionMap{$ArgKey}) { my $Cnt = $IgnoredOptionMap{$ArgKey}; while ($Cnt > 0) { ++$i; --$Cnt; } next; } # Compile mode flags. if ($Arg =~ /^-[D,I,U](.*)$/) { my $Tmp = $Arg; if ($1 eq '') { # FIXME: Check if we are going off the end. ++$i; $Tmp = $Arg . $ARGV[$i]; } push @CompileOpts,$Tmp; next; } # Language. if ($Arg eq '-x') { $Lang = $ARGV[$i+1]; ++$i; next; } # Output file. if ($Arg eq '-o') { ++$i; $Output = $ARGV[$i]; next; } # Get the link mode. if ($Arg =~ /^-[l,L,O]/) { if ($Arg eq '-O') { push @LinkOpts,'-O1'; } elsif ($Arg eq '-Os') { push @LinkOpts,'-O2'; } else { push @LinkOpts,$Arg; } next; } if ($Arg =~ /^-std=/) { push @CompileOpts,$Arg; next; } # if ($Arg =~ /^-f/) { # # FIXME: Not sure if the remaining -fxxxx options have no arguments. # push @CompileOpts,$Arg; # push @LinkOpts,$Arg; # FIXME: Not sure if these are link opts. # } # Get the compiler/link mode. if ($Arg =~ /^-F(.+)$/) { my $Tmp = $Arg; if ($1 eq '') { # FIXME: Check if we are going off the end. ++$i; $Tmp = $Arg . $ARGV[$i]; } push @CompileOpts,$Tmp; push @LinkOpts,$Tmp; next; } # Input files. if ($Arg eq '-filelist') { # FIXME: Make sure we aren't walking off the end. open(IN, $ARGV[$i+1]); while () { s/\015?\012//; push @Files,$_; } close(IN); ++$i; next; } if (!($Arg =~ /^-/)) { push @Files,$Arg; next; } } if ($Action eq 'compile' or $Action eq 'link') { my @Archs = keys %ArchsSeen; # Skip the file if we don't support the architectures specified. exit 0 if ($HadArch && scalar(@Archs) == 0); foreach my $file (@Files) { # Determine the language for the file. my $FileLang = $Lang; if (!defined($FileLang)) { # Infer the language from the extension. if ($file =~ /[.]([^.]+)$/) { $FileLang = $LangMap{$1}; } } next if (!defined $FileLang); next if (!defined $LangsAccepted{$FileLang}); my @CmdArgs; my @AnalyzeArgs; if ($FileLang ne 'unknown') { push @CmdArgs,'-x'; push @CmdArgs,$FileLang; } if (defined $StoreModel) { push @AnalyzeArgs, "-analyzer-store=$StoreModel"; } if (defined $ConstraintsModel) { push @AnalyzeArgs, "-analyzer-constraints=$ConstraintsModel"; } if (defined $OutputFormat) { push @AnalyzeArgs, "-analyzer-output=" . $OutputFormat; if ($OutputFormat eq "plist") { # Change "Output" to be a file. my ($h, $f) = tempfile("report-XXXXXX", SUFFIX => ".plist", DIR => $HtmlDir); $ResultFile = $f; $CleanupFile = $f; } } push @CmdArgs,@CompileOpts; push @CmdArgs,$file; if (scalar @Archs) { foreach my $arch (@Archs) { my @NewArgs; push @NewArgs, '-arch'; push @NewArgs, $arch; push @NewArgs, @CmdArgs; Analyze($ClangCC, \@NewArgs, \@AnalyzeArgs, $FileLang, $Output, $Verbose, $HtmlDir, $file, $Analyses); } } else { Analyze($ClangCC, \@CmdArgs, \@AnalyzeArgs, $FileLang, $Output, $Verbose, $HtmlDir, $file, $Analyses); } } } exit($Status >> 8); netsurf-all-3.2/buildsystem/llvm/scanview.css0000644000175000017500000000240712377676731020501 0ustar vincevincebody { color:#000000; background-color:#ffffff } body { font-family: Helvetica, sans-serif; font-size:9pt } h1 { font-size: 14pt; } h2 { font-size: 12pt; } table { font-size:9pt } table { border-spacing: 0px; border: 1px solid black } th, table thead { background-color:#eee; color:#666666; font-weight: bold; cursor: default; text-align:center; font-weight: bold; font-family: Verdana; white-space:nowrap; } .W { font-size:0px } th, td { padding:5px; padding-left:8px; text-align:left } td.SUMM_DESC { padding-left:12px } td.DESC { white-space:pre } td.Q { text-align:right } td { text-align:left } tbody.scrollContent { overflow:auto } table.form_group { background-color: #ccc; border: 1px solid #333; padding: 2px; } table.form_inner_group { background-color: #ccc; border: 1px solid #333; padding: 0px; } table.form { background-color: #999; border: 1px solid #333; padding: 2px; } td.form_label { text-align: right; vertical-align: top; } /* For one line entires */ td.form_clabel { text-align: right; vertical-align: center; } td.form_value { text-align: left; vertical-align: top; } td.form_submit { text-align: right; vertical-align: top; } h1.SubmitFail { color: #f00; } h1.SubmitOk { } netsurf-all-3.2/buildsystem/llvm/sorttable.js0000644000175000017500000004102512377676731020504 0ustar vincevince/* SortTable version 2 7th April 2007 Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ Instructions: Download this file Add to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i5' : ' ▴'; this.appendChild(sortrevind); return; } if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { // if we're already sorted by this column in reverse, just // re-reverse the table, which is quicker sorttable.reverse(this.sorttable_tbody); this.className = this.className.replace('sorttable_sorted_reverse', 'sorttable_sorted'); this.removeChild(document.getElementById('sorttable_sortrevind')); sortfwdind = document.createElement('span'); sortfwdind.id = "sorttable_sortfwdind"; sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; this.appendChild(sortfwdind); return; } // remove sorttable_sorted classes theadrow = this.parentNode; forEach(theadrow.childNodes, function(cell) { if (cell.nodeType == 1) { // an element cell.className = cell.className.replace('sorttable_sorted_reverse',''); cell.className = cell.className.replace('sorttable_sorted',''); } }); sortfwdind = document.getElementById('sorttable_sortfwdind'); if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } sortrevind = document.getElementById('sorttable_sortrevind'); if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } this.className += ' sorttable_sorted'; sortfwdind = document.createElement('span'); sortfwdind.id = "sorttable_sortfwdind"; sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; this.appendChild(sortfwdind); // build an array to sort. This is a Schwartzian transform thing, // i.e., we "decorate" each row with the actual sort key, // sort based on the sort keys, and then put the rows back in order // which is a lot faster because you only do getInnerText once per row row_array = []; col = this.sorttable_columnindex; rows = this.sorttable_tbody.rows; for (var j=0; j 12) { // definitely dd/mm return sorttable.sort_ddmm; } else if (second > 12) { return sorttable.sort_mmdd; } else { // looks like a date, but we can't tell which, so assume // that it's dd/mm (English imperialism!) and keep looking sortfn = sorttable.sort_ddmm; } } } } return sortfn; }, getInnerText: function(node) { // gets the text we want to use for sorting for a cell. // strips leading and trailing whitespace. // this is *not* a generic getInnerText function; it's special to sorttable. // for example, you can override the cell text with a customkey attribute. // it also gets .value for fields. hasInputs = (typeof node.getElementsByTagName == 'function') && node.getElementsByTagName('input').length; if (node.getAttribute("sorttable_customkey") != null) { return node.getAttribute("sorttable_customkey"); } else if (typeof node.textContent != 'undefined' && !hasInputs) { return node.textContent.replace(/^\s+|\s+$/g, ''); } else if (typeof node.innerText != 'undefined' && !hasInputs) { return node.innerText.replace(/^\s+|\s+$/g, ''); } else if (typeof node.text != 'undefined' && !hasInputs) { return node.text.replace(/^\s+|\s+$/g, ''); } else { switch (node.nodeType) { case 3: if (node.nodeName.toLowerCase() == 'input') { return node.value.replace(/^\s+|\s+$/g, ''); } case 4: return node.nodeValue.replace(/^\s+|\s+$/g, ''); break; case 1: case 11: var innerText = ''; for (var i = 0; i < node.childNodes.length; i++) { innerText += sorttable.getInnerText(node.childNodes[i]); } return innerText.replace(/^\s+|\s+$/g, ''); break; default: return ''; } } }, reverse: function(tbody) { // reverse the rows in a tbody newrows = []; for (var i=0; i=0; i--) { tbody.appendChild(newrows[i]); } delete newrows; }, /* sort functions each sort function takes two parameters, a and b you are comparing a[0] and b[0] */ sort_numeric: function(a,b) { aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); if (isNaN(aa)) aa = 0; bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); if (isNaN(bb)) bb = 0; return aa-bb; }, sort_alpha: function(a,b) { if (a[0]==b[0]) return 0; if (a[0] 0 ) { var q = list[i]; list[i] = list[i+1]; list[i+1] = q; swap = true; } } // for t--; if (!swap) break; for(var i = t; i > b; --i) { if ( comp_func(list[i], list[i-1]) < 0 ) { var q = list[i]; list[i] = list[i-1]; list[i-1] = q; swap = true; } } // for b++; } // while(swap) } } /* ****************************************************************** Supporting functions: bundled here to avoid depending on a library ****************************************************************** */ // Dean Edwards/Matthias Miller/John Resig /* for Mozilla/Opera9 */ if (document.addEventListener) { document.addEventListener("DOMContentLoaded", sorttable.init, false); } /* for Internet Explorer */ /*@cc_on @*/ /*@if (@_win32) document.write("